From 37843cb3c1765bd5263e3c02f5b14ffa53041e1d Mon Sep 17 00:00:00 2001 From: dekstroza Date: Fri, 18 May 2018 14:42:24 +0100 Subject: [PATCH] json/yaml validation for models Introduced yaml-json-validator-maven-plugin a. Runs in validate phase b. For now only validate /import/tosca subfolders c. Validates both yml and json files Change-Id: I53513321c4378485dd821c251de5555050313911 Issue-ID: SDC-1343 Signed-off-by: dekstroza --- asdctool/pom.xml | 29 ++++++++++ asdctool/src/test/resources/graphError.json | 2 +- catalog-be/pom.xml | 61 ++++++++++++++-------- .../src/test/resources/config/mysql-type.yml | 2 +- catalog-dao/pom.xml | 29 ++++++++++ catalog-fe/pom.xml | 29 ++++++++++ catalog-model/pom.xml | 29 ++++++++++ catalog-ui/pom.xml | 29 ++++++++++ common-app-api/pom.xml | 29 ++++++++++ common-be/pom.xml | 33 ++++++++++++ pom.xml | 5 ++ sdc-os-chef/pom.xml | 27 ++++++++++ security-utils/pom.xml | 29 ++++++++++ test-apis-ci/pom.xml | 37 +++++++++++++ test-apis-ci/src/test/resources/config.json | 16 +++--- ui-ci/pom.xml | 29 ++++++++++ utils/webseal-simulator/pom.xml | 31 +++++++++++ 17 files changed, 414 insertions(+), 32 deletions(-) diff --git a/asdctool/pom.xml b/asdctool/pom.xml index 9a6ef22d82..010edceea9 100644 --- a/asdctool/pom.xml +++ b/asdctool/pom.xml @@ -663,6 +663,35 @@ + + com.github.sylvainlaurent.maven + yaml-json-validator-maven-plugin + + + validate + validate + + validate + + + + + + src/main/resources/**/*.y*ml + src/test/resources/**/*.y*ml + + + + + src/main/resources/**/*.json + src/test/resources/**/*.json + + + + + + + diff --git a/asdctool/src/test/resources/graphError.json b/asdctool/src/test/resources/graphError.json index b7ccf92ee6..a5a51d6693 100644 --- a/asdctool/src/test/resources/graphError.json +++ b/asdctool/src/test/resources/graphError.json @@ -1 +1 @@ -(("ERRRRORROROR{{{\"container\":zxcvfxcvxcvxc{\"accessContcxvxcvrolPolicyIDs\":[\"/in-cse/acp-7cxvxcvxcvx1663881\"],\"creationTime\":\"20170630T111742\",\"currentByteSize\":0,\"currentNrOfInstances\":0,\"expirationTime\":\"20180630T111742\",\"lastModifiedTime\":\"20170630T111742\",\"latest\":\"/in-cse/in-name/cnt_900407520/la\",\"maxByteSize\":10000,\"maxInstanceAge\":0,\"maxNrOfInstances\":10,\"oldest\":\"/in-cse/in-name/cnt_900407520/ol\",\"parentID\":\"/in-cse\",\"resourceID\":\"/in-cse/cnt-900407520\",\"resourceName\":((\"cnt_900407520\",\"resourceTypeR\"RXCFV:\"int3\",\"stateTag\":0}}" \ No newline at end of file +"ERRRRORROROR{{{\"container\":zxcvfxcvxcvxc{\"accessContcxvxcvrolPolicyIDs\":[\"/in-cse/acp-7cxvxcvxcvx1663881\"],\"creationTime\":\"20170630T111742\",\"currentByteSize\":0,\"currentNrOfInstances\":0,\"expirationTime\":\"20180630T111742\",\"lastModifiedTime\":\"20170630T111742\",\"latest\":\"/in-cse/in-name/cnt_900407520/la\",\"maxByteSize\":10000,\"maxInstanceAge\":0,\"maxNrOfInstances\":10,\"oldest\":\"/in-cse/in-name/cnt_900407520/ol\",\"parentID\":\"/in-cse\",\"resourceID\":\"/in-cse/cnt-900407520\",\"resourceName\":((\"cnt_900407520\",\"resourceTypeR\"RXCFV:\"int3\",\"stateTag\":0}}" \ No newline at end of file diff --git a/catalog-be/pom.xml b/catalog-be/pom.xml index 068eecf53b..f0113df130 100644 --- a/catalog-be/pom.xml +++ b/catalog-be/pom.xml @@ -1,5 +1,5 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 catalog-be @@ -145,7 +145,6 @@ ${jersey-bom.version} compile - org.glassfish.jersey.ext jersey-spring4 @@ -498,9 +497,6 @@ - - - com.att.aft dme2 @@ -529,12 +525,10 @@ test - org.glassfish.jersey.core jersey-client ${jersey-bom.version} - @@ -594,13 +588,13 @@ cucumber-junit test - - - org.jmockit - jmockit - ${jmockit.version} - test - + + + org.jmockit + jmockit + ${jmockit.version} + test + com.google.code.bean-matchers @@ -608,9 +602,8 @@ 0.11 test - - + ${project.artifactId}-${project.version} @@ -643,6 +636,35 @@ true + + com.github.sylvainlaurent.maven + yaml-json-validator-maven-plugin + + + validate + validate + + validate + + + + + + src/main/resources/**/*.y*ml + src/test/resources/**/*.y*ml + + + + + src/main/resources/**/*.json + src/test/resources/**/*.json + + + + + + + com.jcabi jcabi-maven-plugin @@ -655,7 +677,6 @@ - org.apache.maven.plugins maven-assembly-plugin @@ -742,8 +763,6 @@ - - org.apache.maven.plugins maven-resources-plugin @@ -1003,7 +1022,5 @@ - - - + \ No newline at end of file diff --git a/catalog-be/src/test/resources/config/mysql-type.yml b/catalog-be/src/test/resources/config/mysql-type.yml index f1985a0bdc..c275537094 100644 --- a/catalog-be/src/test/resources/config/mysql-type.yml +++ b/catalog-be/src/test/resources/config/mysql-type.yml @@ -40,7 +40,7 @@ node_types: db_password: type: string default: pass - description: The password associated with the user account provided in the ‘db_user’ property. + description: The password associated with the user account provided in the db_user property. bind_address: type: boolean default: true diff --git a/catalog-dao/pom.xml b/catalog-dao/pom.xml index 596278e4b4..ccb8085cd0 100644 --- a/catalog-dao/pom.xml +++ b/catalog-dao/pom.xml @@ -301,6 +301,35 @@ + + com.github.sylvainlaurent.maven + yaml-json-validator-maven-plugin + + + validate + validate + + validate + + + + + + src/main/resources/**/*.y*ml + src/test/resources/**/*.y*ml + + + + + src/main/resources/**/*.json + src/test/resources/**/*.json + + + + + + + diff --git a/catalog-fe/pom.xml b/catalog-fe/pom.xml index 66f718a111..3322185eab 100644 --- a/catalog-fe/pom.xml +++ b/catalog-fe/pom.xml @@ -371,6 +371,35 @@ + + com.github.sylvainlaurent.maven + yaml-json-validator-maven-plugin + + + validate + validate + + validate + + + + + + src/main/resources/**/*.y*ml + src/test/resources/**/*.y*ml + + + + + src/main/resources/**/*.json + src/test/resources/**/*.json + + + + + + + diff --git a/catalog-model/pom.xml b/catalog-model/pom.xml index e1193980b3..0a6c7cc75d 100644 --- a/catalog-model/pom.xml +++ b/catalog-model/pom.xml @@ -256,6 +256,35 @@ true + + com.github.sylvainlaurent.maven + yaml-json-validator-maven-plugin + + + validate + validate + + validate + + + + + + src/main/resources/**/*.y*ml + src/test/resources/**/*.y*ml + + + + + src/main/resources/**/*.json + src/test/resources/**/*.json + + + + + + + \ No newline at end of file diff --git a/catalog-ui/pom.xml b/catalog-ui/pom.xml index 14b3267209..d9c842e11a 100644 --- a/catalog-ui/pom.xml +++ b/catalog-ui/pom.xml @@ -123,6 +123,35 @@ + + com.github.sylvainlaurent.maven + yaml-json-validator-maven-plugin + + + validate + validate + + validate + + + + + + src/main/resources/**/*.y*ml + src/test/resources/**/*.y*ml + + + + + src/main/resources/**/*.json + src/test/resources/**/*.json + + + + + + + diff --git a/common-app-api/pom.xml b/common-app-api/pom.xml index 7a8077ec7d..5a0824b3b8 100644 --- a/common-app-api/pom.xml +++ b/common-app-api/pom.xml @@ -207,6 +207,35 @@ true + + com.github.sylvainlaurent.maven + yaml-json-validator-maven-plugin + + + validate + validate + + validate + + + + + + src/main/resources/**/*.y*ml + src/test/resources/**/*.y*ml + + + + + src/main/resources/**/*.json + src/test/resources/**/*.json + + + + + + + \ No newline at end of file diff --git a/common-be/pom.xml b/common-be/pom.xml index 1b0dcd05b3..1f5580016b 100644 --- a/common-be/pom.xml +++ b/common-be/pom.xml @@ -62,5 +62,38 @@ + + + + com.github.sylvainlaurent.maven + yaml-json-validator-maven-plugin + + + validate + validate + + validate + + + + + + src/main/resources/**/*.y*ml + src/test/resources/**/*.y*ml + + + + + src/main/resources/**/*.json + src/test/resources/**/*.json + + + + + + + + + diff --git a/pom.xml b/pom.xml index 38c63ec1bc..1fc2789839 100644 --- a/pom.xml +++ b/pom.xml @@ -275,6 +275,11 @@ nexus-staging-maven-plugin 1.6.8 + + com.github.sylvainlaurent.maven + yaml-json-validator-maven-plugin + 1.0.1 + diff --git a/sdc-os-chef/pom.xml b/sdc-os-chef/pom.xml index a5d69f1697..6dc554451a 100644 --- a/sdc-os-chef/pom.xml +++ b/sdc-os-chef/pom.xml @@ -79,6 +79,33 @@ + + com.github.sylvainlaurent.maven + yaml-json-validator-maven-plugin + + + validate + validate + + validate + + + + + + **/*.y*ml + + + + + **/*.json + + + + + + + diff --git a/security-utils/pom.xml b/security-utils/pom.xml index c0361ed867..a0df7039f7 100644 --- a/security-utils/pom.xml +++ b/security-utils/pom.xml @@ -61,6 +61,35 @@ + + com.github.sylvainlaurent.maven + yaml-json-validator-maven-plugin + + + validate + validate + + validate + + + + + + src/main/resources/**/*.y*ml + src/test/resources/**/*.y*ml + + + + + src/main/resources/**/*.json + src/test/resources/**/*.json + + + + + + + diff --git a/test-apis-ci/pom.xml b/test-apis-ci/pom.xml index ac3cdd731d..14d6611fc0 100644 --- a/test-apis-ci/pom.xml +++ b/test-apis-ci/pom.xml @@ -437,6 +437,43 @@ + + com.github.sylvainlaurent.maven + yaml-json-validator-maven-plugin + + + validate + validate + + validate + + + + + + src/main/resources/**/*.y*ml + src/test/resources/**/*.y*ml + + + src/test/resources/CI/tests/importToscaResourceByCreateUrl/occurencyFalure*.y*ml + src/test/resources/CI/tests/importToscaResourceByCreateUrl/noContent*.y*ml + src/test/resources/CI/tests/HeatDeploymentArtifacts/invalid*.y*ml + + + + + src/main/resources/**/*.json + src/test/resources/**/*.json + + + src/test/resources/CI/tests/HeatDeploymentArtifacts/invalid*.json + + + + + + + diff --git a/test-apis-ci/src/test/resources/config.json b/test-apis-ci/src/test/resources/config.json index 71c9d35e59..86905518b6 100644 --- a/test-apis-ci/src/test/resources/config.json +++ b/test-apis-ci/src/test/resources/config.json @@ -1,12 +1,12 @@ { -catalogBeHost: behost, -catalogFeHost: fehost, -esHost: eshost, -catalogFePort: 8080, -catalogBePort: 8080, -esPort: 9200, -resourceConfigDir: "src/test/resources/CI/tests", -componentsConfigDir: "src/test/resources/CI/components" +"catalogBeHost": "behost", +"catalogFeHost": "fehost", +"esHost": "eshost", +"catalogFePort": 8080, +"catalogBePort": 8080, +"esPort": 9200, +"resourceConfigDir": "src/test/resources/CI/tests", +"componentsConfigDir": "src/test/resources/CI/components" } \ No newline at end of file diff --git a/ui-ci/pom.xml b/ui-ci/pom.xml index 3295b3bcea..6745cc9390 100644 --- a/ui-ci/pom.xml +++ b/ui-ci/pom.xml @@ -313,6 +313,35 @@ + + com.github.sylvainlaurent.maven + yaml-json-validator-maven-plugin + + + validate + validate + + validate + + + + + + src/main/resources/**/*.y*ml + src/test/resources/**/*.y*ml + + + + + src/main/resources/**/*.json + src/test/resources/**/*.json + + + + + + + diff --git a/utils/webseal-simulator/pom.xml b/utils/webseal-simulator/pom.xml index dbdd1d9581..b9f541bd5f 100644 --- a/utils/webseal-simulator/pom.xml +++ b/utils/webseal-simulator/pom.xml @@ -87,6 +87,37 @@ WSSimulator-${project.version} + + + com.github.sylvainlaurent.maven + yaml-json-validator-maven-plugin + + + validate + validate + + validate + + + + + + src/main/resources/**/*.y*ml + src/test/resources/**/*.y*ml + + + + + src/main/resources/**/*.json + src/test/resources/**/*.json + + + + + + + + -- 2.16.6