diff options
author | mark.j.leonard <mark.j.leonard@gmail.com> | 2019-01-15 10:34:53 +0000 |
---|---|---|
committer | mark.j.leonard <mark.j.leonard@gmail.com> | 2019-01-16 13:38:29 +0000 |
commit | 715e009fa1b0b148fc64f8cf1bc2f536e4e2cb23 (patch) | |
tree | d0e126ba6052557a49f7e9a11f820b7946a5266a /src/test/java/org/onap | |
parent | c7e9ff11f28009c4fbc13f7ed1a3ffbb765d358b (diff) |
Update to aai-schema-ingest version 1.4.1
Using SNAPSHOT version (as 1.4.1 is not released)
Change-Id: I3b5959cb2d43840556a628db8fe17701d36aa6f9
Issue-ID: AAI-2077
Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
Diffstat (limited to 'src/test/java/org/onap')
10 files changed, 98 insertions, 204 deletions
diff --git a/src/test/java/org/onap/aai/validation/modeldriven/validator/TestInstanceReader.java b/src/test/java/org/onap/aai/validation/modeldriven/validator/TestInstanceReader.java index 60588bb..38c790b 100644 --- a/src/test/java/org/onap/aai/validation/modeldriven/validator/TestInstanceReader.java +++ b/src/test/java/org/onap/aai/validation/modeldriven/validator/TestInstanceReader.java @@ -1,6 +1,6 @@ /* * ============LICENSE_START=================================================== - * Copyright (c) 2018 Amdocs + * Copyright (c) 2018-2019 Amdocs * ============================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,7 +35,6 @@ import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.onap.aai.validation.exception.ValidationServiceException; import org.onap.aai.validation.modeldriven.configuration.mapping.ModelInstanceMapper; -import org.onap.aai.validation.modeldriven.validator.InstanceReader; import org.onap.aai.validation.test.util.TestUtil; import org.onap.aai.validation.util.JsonUtil; import org.springframework.test.context.ContextConfiguration; @@ -43,7 +42,7 @@ import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) -@TestPropertySource(properties = {"schemaIngestPropLoc = src/test/resources/oxm-reader/schemaIngest.properties"}) +@TestPropertySource(locations = { "classpath:oxm-reader/schemaIngest.properties" }) @ContextConfiguration(locations = {"classpath:model-validation/instance-reader/test-validation-service-beans.xml"}) public class TestInstanceReader { @@ -84,22 +83,26 @@ public class TestInstanceReader { enum TestData { // @formatter:off - MAPPING ("model-validation/instance-reader/model-instance-mapping.json_conf"), - MAPPING_ROOT_UNKNOWN ("model-validation/instance-reader/model-instance-mapping-root-unknown.json_conf"), - MAPPING_ROOT_MISSING ("model-validation/instance-reader/model-instance-mapping-root-missing.json_conf"), - CONNECTOR ("model-validation/instance-reader/connector.json"), - CONNECTOR_MODEL_NAME ("model-validation/instance-reader/connector-model-name.json"), - CONNECTOR_SIBLING ("model-validation/instance-reader/connector-sibling-inventory-items.json"), - EXPECTED_VDC ("model-validation/instance-reader/expected-virtual-data-center.json"), - EXPECTED_VDC_MODEL_NAME ("model-validation/instance-reader/expected-virtual-data-center-model-name.json"), - EXPECTED_LOGICAL_LINK ("model-validation/instance-reader/expected-logical-link.json"), - EXPECTED_GENERIC_VNF ("model-validation/instance-reader/expected-generic-vnf.json"), - EXPECTED_PSERVER ("model-validation/instance-reader/expected-pserver.json"); + MAPPING ("model-validation/instance-reader/model-instance-mapping.json_conf"), + MAPPING_ROOT_UNKNOWN ("model-validation/instance-reader/model-instance-mapping-root-unknown.json_conf"), + MAPPING_ROOT_MISSING ("model-validation/instance-reader/model-instance-mapping-root-missing.json_conf"), + CONNECTOR ("model-validation/instance-reader/connector.json"), + CONNECTOR_MODEL_NAME ("model-validation/instance-reader/connector-model-name.json"), + CONNECTOR_SIBLING ("model-validation/instance-reader/connector-sibling-inventory-items.json"), + EXPECTED_VDC ("model-validation/instance-reader/expected-virtual-data-center.json"), + EXPECTED_VDC_MODEL_NAME ("model-validation/instance-reader/expected-virtual-data-center-model-name.json"), + EXPECTED_LOGICAL_LINK ("model-validation/instance-reader/expected-logical-link.json"), + EXPECTED_GENERIC_VNF ("model-validation/instance-reader/expected-generic-vnf.json"), + EXPECTED_PSERVER ("model-validation/instance-reader/expected-pserver.json"); + // @formatter:on private String filename; - TestData(String filename) {this.filename = filename;} - public String getFilename() {return this.filename;} - // @formatter:on + TestData(String filename) { + this.filename = filename; + } + public String getFilename() { + return this.filename; + } } @Rule @@ -161,8 +164,6 @@ public class TestInstanceReader { JsonElement genericVnfJsonElement = jsonParser.parse(expectedGenericVnf); String expectedGenericVnf = genericVnfJsonElement.toString(); - JsonElement pserverJsonElement = jsonParser.parse(expectedPserver); - String expectedPserver = pserverJsonElement.toString(); // Method under test Multimap<String, String> values = instanceReader.getValues(connectorSibling, mapping); @@ -178,7 +179,7 @@ public class TestInstanceReader { values = instanceReader.getValues(logicalLinkInstance, mapping); assertThat(values.get("generic-vnf").iterator().next(), is(equalTo(expectedGenericVnf))); - assertThat(values.get("pserver").iterator().next(), is(equalTo(expectedPserver))); + assertThat(values.get("pserver").iterator().next(), is(equalTo(jsonParser.parse(expectedPserver).toString()))); } @Test diff --git a/src/test/java/org/onap/aai/validation/modeldriven/validator/TestModelDrivenValidator.java b/src/test/java/org/onap/aai/validation/modeldriven/validator/TestModelDrivenValidator.java index cb9de43..de06357 100644 --- a/src/test/java/org/onap/aai/validation/modeldriven/validator/TestModelDrivenValidator.java +++ b/src/test/java/org/onap/aai/validation/modeldriven/validator/TestModelDrivenValidator.java @@ -1,12 +1,12 @@ -/* +/** * ============LICENSE_START=================================================== - * Copyright (c) 2018 Amdocs + * Copyright (c) 2018-2019 Amdocs * ============================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -43,7 +43,6 @@ import org.onap.aai.validation.controller.ValidationController; import org.onap.aai.validation.modeldriven.ModelCacheManager; import org.onap.aai.validation.modeldriven.ModelId; import org.onap.aai.validation.modeldriven.parser.XMLModelParser; -import org.onap.aai.validation.modeldriven.validator.ModelDrivenValidator; import org.onap.aai.validation.result.ValidationResult; import org.onap.aai.validation.result.Violation; import org.onap.aai.validation.test.util.TestUtil; @@ -52,7 +51,7 @@ import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) -@TestPropertySource(properties = {"schemaIngestPropLoc = src/test/resources/oxm-reader/schemaIngest.properties"}) +@TestPropertySource(locations = {"classpath:oxm-reader/schemaIngest.properties"}) @ContextConfiguration(locations = {"classpath:model-validation/instance-validator/test-validation-service-beans.xml"}) public class TestModelDrivenValidator { @@ -74,21 +73,21 @@ public class TestModelDrivenValidator { private String objectInstance; private String connectorModel; - enum INSTANCE_VALIDATION_FILE { + static enum InstanceValidationFile { // @formatter:off - CONNECTOR_MODEL ("model-validation/instance-validator/connector-widget-id.xml"), - NO_MODEL_ID ("model-validation/instance-validator/connector-instance-no-model-id.json"), - UNKNOWN_MODEL_ID ("model-validation/instance-validator/connector-instance-unknown-model-id.json"), - ERRORS ("model-validation/instance-validator/connector-instance-errors.json"), - MULTIPLE_MISSING_ATTRS ("model-validation/instance-validator/connector-instance-multiple-missing-attrs.json"), - MULTIPLE_UNEXPECTED_ATTRS ("model-validation/instance-validator/connector-instance-multiple-unexpected-attrs.json"), - SUCCESS ("model-validation/instance-validator/connector-instance-success.json"); - // @formatter:on + CONNECTOR_MODEL ("connector-widget-id.xml"), + NO_MODEL_ID ("connector-instance-no-model-id.json"), + UNKNOWN_MODEL_ID ("connector-instance-unknown-model-id.json"), + ERRORS ("connector-instance-errors.json"), + MULTIPLE_MISSING_ATTRS ("connector-instance-multiple-missing-attrs.json"), + MULTIPLE_UNEXPECTED_ATTRS ("connector-instance-multiple-unexpected-attrs.json"), + SUCCESS ("connector-instance-success.json"); + // @formatter:on private String filename; - INSTANCE_VALIDATION_FILE(String filename) { - this.filename = filename; + InstanceValidationFile(String filename) { + this.filename = "model-validation/instance-validator/" + filename; } public String getFilename() { @@ -103,12 +102,12 @@ public class TestModelDrivenValidator { @Before public void setUp() throws Exception { - connectorModel = TestUtil.getFileAsString(INSTANCE_VALIDATION_FILE.CONNECTOR_MODEL.getFilename()); + connectorModel = TestUtil.getFileAsString(InstanceValidationFile.CONNECTOR_MODEL.getFilename()); } @Test public void testValidateInstanceWithoutModelId() throws Exception { - objectInstance = TestUtil.getFileAsString(INSTANCE_VALIDATION_FILE.NO_MODEL_ID.getFilename()); + objectInstance = TestUtil.getFileAsString(InstanceValidationFile.NO_MODEL_ID.getFilename()); ValidationResult validationResult = modelDrivenValidator.validate(objectInstance).get(0); assertThatValidationResultIsValid(validationResult, "c7611ebe-c324-48f1-8085-94aef0c12fd", "connector", @@ -123,7 +122,7 @@ public class TestModelDrivenValidator { @Test public void testValidateInstanceWithUnknownModelId() throws Exception { - objectInstance = TestUtil.getFileAsString(INSTANCE_VALIDATION_FILE.UNKNOWN_MODEL_ID.getFilename()); + objectInstance = TestUtil.getFileAsString(InstanceValidationFile.UNKNOWN_MODEL_ID.getFilename()); Mockito.when(mockModelCacheManager.get(new ModelId(MODEL_ID_ATTRIBUTE_MID, "UNKNOWN-MODEL"))).thenReturn(null); @@ -140,7 +139,7 @@ public class TestModelDrivenValidator { @Test public void testValidate() throws Exception { - objectInstance = TestUtil.getFileAsString(INSTANCE_VALIDATION_FILE.ERRORS.getFilename()); + objectInstance = TestUtil.getFileAsString(InstanceValidationFile.ERRORS.getFilename()); Element modelElement = XMLModelParser.parse(connectorModel, true); @@ -186,7 +185,7 @@ public class TestModelDrivenValidator { @Test public void testValidateMultipleMissingAttrs() throws Exception { - objectInstance = TestUtil.getFileAsString(INSTANCE_VALIDATION_FILE.MULTIPLE_MISSING_ATTRS.getFilename()); + objectInstance = TestUtil.getFileAsString(InstanceValidationFile.MULTIPLE_MISSING_ATTRS.getFilename()); Element modelElement = XMLModelParser.parse(connectorModel, true); @@ -209,7 +208,7 @@ public class TestModelDrivenValidator { @Test public void testValidateMultipleUnexpectedAttrs() throws Exception { - objectInstance = TestUtil.getFileAsString(INSTANCE_VALIDATION_FILE.MULTIPLE_UNEXPECTED_ATTRS.getFilename()); + objectInstance = TestUtil.getFileAsString(InstanceValidationFile.MULTIPLE_UNEXPECTED_ATTRS.getFilename()); Element modelElement = XMLModelParser.parse(connectorModel, true); @@ -232,7 +231,7 @@ public class TestModelDrivenValidator { @Test public void testValidateSuccess() throws Exception { - objectInstance = TestUtil.getFileAsString(INSTANCE_VALIDATION_FILE.SUCCESS.getFilename()); + objectInstance = TestUtil.getFileAsString(InstanceValidationFile.SUCCESS.getFilename()); Element modelElement = XMLModelParser.parse(connectorModel, true); diff --git a/src/test/java/org/onap/aai/validation/reader/TestEventReader.java b/src/test/java/org/onap/aai/validation/reader/TestEventReader.java index a41eb76..b7aba5e 100644 --- a/src/test/java/org/onap/aai/validation/reader/TestEventReader.java +++ b/src/test/java/org/onap/aai/validation/reader/TestEventReader.java @@ -1,6 +1,6 @@ /* * ============LICENSE_START=================================================== - * Copyright (c) 2018 Amdocs + * Copyright (c) 2018-2019 Amdocs * ============================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,7 +34,6 @@ import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import org.onap.aai.validation.exception.ValidationServiceException; -import org.onap.aai.validation.reader.EventReader; import org.onap.aai.validation.reader.data.Entity; import org.onap.aai.validation.reader.data.EntityId; import org.onap.aai.validation.test.util.TestUtil; @@ -43,7 +42,7 @@ import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) -@TestPropertySource(properties = {"schemaIngestPropLoc = src/test/resources/oxm-reader/schemaIngest.properties"}) +@TestPropertySource(locations = { "classpath:oxm-reader/schemaIngest.properties" }) @ContextConfiguration(locations = {"classpath:event-reader/test-validation-service-beans.xml"}) public class TestEventReader { @@ -77,16 +76,20 @@ public class TestEventReader { // @formatter:off VSERVER ("event-reader/vserver-create-event.json"), GENERIC_VNF ("event-reader/generic-vnf-create-event.json"), - INVALID_1 ("event-reader/invalid-event-1.json"), - INVALID_2 ("event-reader/invalid-event-2.json"), - INVALID_3 ("event-reader/invalid-event-3.json"), - INVALID_4 ("event-reader/invalid-event-4.json"), - INVALID_5 ("event-reader/invalid-event-5.json"); + INVALID_1 ("event-reader/invalid-event-1.json"), + INVALID_2 ("event-reader/invalid-event-2.json"), + INVALID_3 ("event-reader/invalid-event-3.json"), + INVALID_4 ("event-reader/invalid-event-4.json"), + INVALID_5 ("event-reader/invalid-event-5.json"); + // @formatter:on private String filename; - TestData(String filename) {this.filename = filename;} - public String getFilename() {return this.filename;} - // @formatter:on + TestData(String filename) { + this.filename = filename; + } + public String getFilename() { + return this.filename; + } } @Test diff --git a/src/test/java/org/onap/aai/validation/reader/TestJsonReader.java b/src/test/java/org/onap/aai/validation/reader/TestJsonReader.java index e7a906a..116534b 100644 --- a/src/test/java/org/onap/aai/validation/reader/TestJsonReader.java +++ b/src/test/java/org/onap/aai/validation/reader/TestJsonReader.java @@ -1,12 +1,12 @@ -/* +/** * ============LICENSE_START=================================================== - * Copyright (c) 2018 Amdocs + * Copyright (c) 2018-2019 Amdocs * ============================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -24,7 +24,6 @@ import static org.junit.Assert.assertThat; import java.util.Arrays; import java.util.List; import org.junit.Test; -import org.onap.aai.validation.reader.JsonReader; import org.onap.aai.validation.test.util.TestUtil; public class TestJsonReader { @@ -34,13 +33,19 @@ public class TestJsonReader { } enum TestData { - // @formatter:off - SAMPLE_JSON ("json-reader/sample.json"); + SAMPLE_JSON( + "json-reader/sample.json" + ); - private String filename; - TestData(String filename) {this.filename = filename;} - public String getFilename() {return this.filename;} - // @formatter:on + private String filename; + + TestData(String filename) { + this.filename = filename; + } + + public String getFilename() { + return this.filename; + } } @Test diff --git a/src/test/java/org/onap/aai/validation/reader/TestOxmConfigTranslator.java b/src/test/java/org/onap/aai/validation/reader/TestOxmConfigTranslator.java deleted file mode 100644 index 73e76db..0000000 --- a/src/test/java/org/onap/aai/validation/reader/TestOxmConfigTranslator.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * ============LICENSE_START=================================================== - * Copyright (c) 2018 Amdocs - * ============================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END===================================================== - */ -package org.onap.aai.validation.reader; - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.Matchers.isEmptyString; -import static org.hamcrest.Matchers.not; -import static org.junit.Assert.assertThat; - -import java.nio.file.InvalidPathException; -import java.util.List; -import java.util.Map; -import java.util.ServiceConfigurationError; -import org.junit.Test; -import org.onap.aai.setup.SchemaLocationsBean; -import org.onap.aai.setup.Version; -import org.onap.aai.validation.reader.OxmConfigTranslator; -import org.springframework.test.util.ReflectionTestUtils; - -public class TestOxmConfigTranslator { - - static { - System.setProperty("APP_HOME", "."); - } - - @Test - public void testOxmFiles() { - OxmConfigTranslator translator = buildConfigTranslator("src/test/resources/oxm-reader/single/"); - Map<Version, List<String>> latestVersion = translator.getNodeFiles(); - assertThat(latestVersion.size(), is(3)); - assertThat(latestVersion.values().iterator().next().size(), is(1)); - assertThat(latestVersion.values().iterator().next().get(0), not(isEmptyString())); - Map<Version, List<String>> latestVersion1 = translator.getEdgeFiles(); - assertThat(latestVersion1.size(), is(1)); - assertThat(latestVersion1.values().iterator().next().size(), is(1)); - assertThat(latestVersion1.values().iterator().next().get(0), not(isEmptyString())); - } - - @Test - public void testMultipleOxmFilesPerVersion() { - OxmConfigTranslator translator = buildConfigTranslator("src/test/resources/oxm-reader/multiple"); - Map<Version, List<String>> latestVersion = translator.getNodeFiles(); - assertThat(latestVersion.size(), is(2)); - assertThat(latestVersion.values().iterator().next().size(), is(2)); - assertThat(latestVersion.values().iterator().next().get(0), not(isEmptyString())); - Map<Version, List<String>> latestVersion1 = translator.getEdgeFiles(); - assertThat(latestVersion1.size(), is(0)); - } - - @Test - public void testZeroMatchingFiles() { - OxmConfigTranslator translator = buildConfigTranslator("src/test/resources/oxm-reader/"); - Map<Version, List<String>> versionsMap = translator.getNodeFiles(); - assertThat(versionsMap.size(), is(0)); - } - - @Test(expected = ServiceConfigurationError.class) - public void testNullNodesPath() { - buildConfigTranslator(null).getNodeFiles(); - } - - @Test(expected = ServiceConfigurationError.class) - public void testNullEdgesPath() { - buildConfigTranslator(null).getEdgeFiles(); - } - - @Test(expected = ServiceConfigurationError.class) - public void testNonExistentNodesPath() { - buildConfigTranslator("no-such-folder-exists/").getNodeFiles(); - } - - @Test(expected = ServiceConfigurationError.class) - public void testNonExistentEdgesPath() { - SchemaLocationsBean bean = new SchemaLocationsBean(); - ReflectionTestUtils.setField(bean, "nodeDirectory", "src/test/resources/oxm-reader/"); - ReflectionTestUtils.setField(bean, "edgeDirectory", "no-such-folder-exists/"); - new OxmConfigTranslator(bean).getEdgeFiles(); - } - - @Test(expected = InvalidPathException.class) - public void testInvalidPath() { - buildConfigTranslator("\0").getEdgeFiles(); - } - - private OxmConfigTranslator buildConfigTranslator(String path) { - return new OxmConfigTranslator(createSchemaLocationsBean(path)); - } - - private SchemaLocationsBean createSchemaLocationsBean(String path) { - SchemaLocationsBean bean = new SchemaLocationsBean(); - ReflectionTestUtils.setField(bean, "nodeDirectory", path); - ReflectionTestUtils.setField(bean, "edgeDirectory", path); - return bean; - } - -} diff --git a/src/test/java/org/onap/aai/validation/reader/TestOxmReader.java b/src/test/java/org/onap/aai/validation/reader/TestOxmReader.java index f7f2643..bbceae5 100644 --- a/src/test/java/org/onap/aai/validation/reader/TestOxmReader.java +++ b/src/test/java/org/onap/aai/validation/reader/TestOxmReader.java @@ -1,6 +1,6 @@ /* * ============LICENSE_START=================================================== - * Copyright (c) 2018 Amdocs + * Copyright (c) 2018-2019 Amdocs * ============================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,13 +26,12 @@ import java.util.List; import javax.inject.Inject; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.aai.validation.reader.OxmReader; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) -@TestPropertySource(properties = {"schemaIngestPropLoc = src/test/resources/oxm-reader/schemaIngest.properties"}) +@TestPropertySource(locations = {"classpath:oxm-reader/schemaIngest.properties"}) @ContextConfiguration(locations = {"classpath:oxm-reader/oxm-reader-beans.xml"}) public class TestOxmReader { diff --git a/src/test/java/org/onap/aai/validation/result/TestValidationResult.java b/src/test/java/org/onap/aai/validation/result/TestValidationResult.java index 5d02101..32f85fe 100644 --- a/src/test/java/org/onap/aai/validation/result/TestValidationResult.java +++ b/src/test/java/org/onap/aai/validation/result/TestValidationResult.java @@ -1,6 +1,6 @@ /* * ============LICENSE_START=================================================== - * Copyright (c) 2018 Amdocs + * Copyright (c) 2018-2019 Amdocs * ============================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,8 +42,6 @@ import org.junit.runner.RunWith; import org.onap.aai.validation.exception.ValidationServiceException; import org.onap.aai.validation.reader.EventReader; import org.onap.aai.validation.reader.data.Entity; -import org.onap.aai.validation.result.ValidationResult; -import org.onap.aai.validation.result.Violation; import org.onap.aai.validation.result.Violation.Builder; import org.onap.aai.validation.result.Violation.ViolationType; import org.onap.aai.validation.test.util.TestUtil; @@ -53,7 +51,7 @@ import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) -@TestPropertySource(properties = {"schemaIngestPropLoc = src/test/resources/oxm-reader/schemaIngest.properties"}) +@TestPropertySource(locations = { "classpath:oxm-reader/schemaIngest.properties" }) @ContextConfiguration(locations = {"classpath:validation-result/test-validation-service-beans.xml"}) public class TestValidationResult { diff --git a/src/test/java/org/onap/aai/validation/ruledriven/rule/RuleTester.java b/src/test/java/org/onap/aai/validation/ruledriven/rule/RuleTester.java index 8593f93..6545120 100644 --- a/src/test/java/org/onap/aai/validation/ruledriven/rule/RuleTester.java +++ b/src/test/java/org/onap/aai/validation/ruledriven/rule/RuleTester.java @@ -1,6 +1,6 @@ /* * ============LICENSE_START=================================================== - * Copyright (c) 2018 Amdocs + * Copyright (c) 2018-2019 Amdocs * ============================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,6 @@ package org.onap.aai.validation.ruledriven.rule; import org.onap.aai.validation.reader.data.AttributeValues; -import org.onap.aai.validation.ruledriven.rule.Rule; /** * Helper class for testing rules diff --git a/src/test/java/org/onap/aai/validation/ruledriven/validator/TestRuleDrivenValidator.java b/src/test/java/org/onap/aai/validation/ruledriven/validator/TestRuleDrivenValidator.java index cf1e874..643e2e3 100644 --- a/src/test/java/org/onap/aai/validation/ruledriven/validator/TestRuleDrivenValidator.java +++ b/src/test/java/org/onap/aai/validation/ruledriven/validator/TestRuleDrivenValidator.java @@ -1,6 +1,6 @@ /* * ============LICENSE_START=================================================== - * Copyright (c) 2018 Amdocs + * Copyright (c) 2018-2019 Amdocs * ============================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,9 +45,9 @@ import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) -@TestPropertySource(properties = {"schemaIngestPropLoc = src/test/resources/oxm-reader/schemaIngest.properties"}) -@ContextConfiguration( - locations = {"classpath:" + TestRuleDrivenValidator.UNIT_TEST_FOLDER + "/test-rule-driven-validator-beans.xml"}) +@TestPropertySource(locations = { "classpath:oxm-reader/schemaIngest.properties" }) +@ContextConfiguration(locations = { + "classpath:" + TestRuleDrivenValidator.UNIT_TEST_FOLDER + "/test-rule-driven-validator-beans.xml" }) public class TestRuleDrivenValidator { static { diff --git a/src/test/java/org/onap/aai/validation/services/TestInfoService.java b/src/test/java/org/onap/aai/validation/services/TestInfoService.java index 0bfa8ba..ac9591a 100644 --- a/src/test/java/org/onap/aai/validation/services/TestInfoService.java +++ b/src/test/java/org/onap/aai/validation/services/TestInfoService.java @@ -1,12 +1,12 @@ -/* +/** * ============LICENSE_START=================================================== - * Copyright (c) 2018 Amdocs + * Copyright (c) 2018-2019 Amdocs * ============================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -35,7 +35,6 @@ import org.junit.runner.RunWith; import org.onap.aai.validation.controller.ValidationController; import org.onap.aai.validation.exception.ValidationServiceException; import org.onap.aai.validation.publisher.MockEventPublisher; -import org.onap.aai.validation.services.InfoService; import org.onap.aai.validation.test.util.TestEntity; import org.onap.aai.validation.test.util.TestUtil; import org.springframework.test.context.ContextConfiguration; @@ -43,7 +42,7 @@ import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) -@TestPropertySource(properties = {"schemaIngestPropLoc = src/test/resources/oxm-reader/schemaIngest.properties"}) +@TestPropertySource(locations = {"classpath:oxm-reader/schemaIngest.properties", "classpath:application.properties"}) @ContextConfiguration(locations = {"classpath:/info-service/test-validation-service-beans.xml"}) public class TestInfoService { @@ -53,12 +52,18 @@ public class TestInfoService { enum TestData { // @formatter:off - VSERVER ("rule-driven-validator/test_events/vserver-create-event.json"); + VSERVER("rule-driven-validator/test_events/vserver-create-event.json"); + // @formatter:on private String filename; - TestData(String filename) {this.filename = filename;} - public String getFilename() {return this.filename;} - // @formatter:on + + TestData(String filename) { + this.filename = filename; + } + + public String getFilename() { + return this.filename; + } } private InfoService infoService; @@ -107,13 +112,9 @@ public class TestInfoService { assertThat(info, containsString("errored=1")); } - /** - * @throws ValidationServiceException - * @throws IOException - * @throws URISyntaxException - */ + @Test - public void testVserverEventRecorded() throws ValidationServiceException, URISyntaxException, IOException { + public void testVserverEventRecorded() throws URISyntaxException, IOException { Path vserverTestFile = Paths.get(ClassLoader.getSystemResource(TestData.VSERVER.getFilename()).toURI()); Path root = vserverTestFile.getParent(); assertThat(root, is(not(nullValue()))); @@ -128,7 +129,7 @@ public class TestInfoService { /** * Assert that the info service status string contains the expected standard results and formatting. - * + * * @param info */ private void assertResultsStringFormatted(String info) { |