From d234dc1544375a38437c207db757274081d99a89 Mon Sep 17 00:00:00 2001 From: "mark.j.leonard" Date: Mon, 18 Feb 2019 16:03:02 +0000 Subject: Remove unused test configuration files Also fix some checkstyle warnings regarding Javadoc comments. Issue-ID: AAI-2057 Change-Id: If654c63ec6a5f9888fdf597e51ad0cad9f363a90 Signed-off-by: mark.j.leonard --- .../aai/validation/auth/MicroServiceAuthTest.java | 50 +++++++---- .../aai/validation/config/TestTopicConfig.java | 7 +- .../org/onap/aai/validation/logging/LogReader.java | 20 ++++- .../validation/logging/TestApplicationLogger.java | 23 ++--- .../mapping/TestModelInstanceMapper.java | 19 +++-- .../modeldriven/parser/TestXMLModelParser.java | 96 --------------------- .../modeldriven/parser/TestXmlModelParser.java | 97 ++++++++++++++++++++++ .../modeldriven/validator/TestInstanceReader.java | 19 ++--- .../aai/validation/reader/TestEventReader.java | 21 +++-- .../validation/result/TestValidationResult.java | 49 ++++++----- .../configuration/ConfigFileBuilder.java | 17 ++-- .../ruledriven/rule/TestRuleExecution.java | 30 +++---- .../ruledriven/rule/TestRuleValidation.java | 17 ++-- .../aai/validation/services/TestInfoService.java | 9 +- .../services/TestValidateServiceImpl.java | 29 +++---- .../onap/aai/validation/test/util/TestEntity.java | 23 ++++- .../onap/aai/validation/test/util/TestUtil.java | 17 ++-- .../info-service/test-validation-service-beans.xml | 37 +++++---- .../resources/model-instance-mapping.json_conf | 28 ------- .../model-instance-mapping.json_conf | 28 +++++++ .../topic-config/test-topic-config-beans.xml | 49 ----------- .../topic-config/test-validation-service-beans.xml | 27 ++---- .../topic-aai-data-integrity.properties | 5 +- .../topic-config/topic-aai-event.properties | 5 +- .../test-validation-service-beans.xml | 36 ++++---- 25 files changed, 382 insertions(+), 376 deletions(-) delete mode 100644 src/test/java/org/onap/aai/validation/modeldriven/parser/TestXMLModelParser.java create mode 100644 src/test/java/org/onap/aai/validation/modeldriven/parser/TestXmlModelParser.java delete mode 100644 src/test/resources/model-instance-mapping.json_conf create mode 100644 src/test/resources/model-validation/model-instance-mapping.json_conf delete mode 100644 src/test/resources/topic-config/test-topic-config-beans.xml (limited to 'src/test') diff --git a/src/test/java/org/onap/aai/validation/auth/MicroServiceAuthTest.java b/src/test/java/org/onap/aai/validation/auth/MicroServiceAuthTest.java index 7217224..1b1a5bb 100644 --- a/src/test/java/org/onap/aai/validation/auth/MicroServiceAuthTest.java +++ b/src/test/java/org/onap/aai/validation/auth/MicroServiceAuthTest.java @@ -9,7 +9,7 @@ * 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, @@ -40,10 +40,11 @@ import org.mockito.Mockito; import org.onap.aai.auth.AAIAuthException; import org.onap.aai.auth.AAIMicroServiceAuth; import org.onap.aai.validation.config.ValidationServiceAuthConfig; +import org.onap.aai.validation.test.util.TestUtil; import org.springframework.mock.web.MockHttpServletRequest; /** - * Tests @{link AAIMicroServiceAuth} + * Tests @{link AAIMicroServiceAuth}. */ public class MicroServiceAuthTest { @@ -59,24 +60,25 @@ public class MicroServiceAuthTest { * of a policy file that does not exist. * * @throws AAIAuthException - * @throws IOException + * if the authorization policy file cannot be loaded */ @Test(expected = AAIAuthException.class) - public void missingPolicyFile() throws AAIAuthException, IOException { + public void missingPolicyFile() throws AAIAuthException { ValidationServiceAuthConfig authConfig = new ValidationServiceAuthConfig(); authConfig.setAuthPolicyFile("invalid.file.name"); new AAIMicroServiceAuth(authConfig); } /** - * Test loading of a temporary file created with the specified roles + * Test loading of a temporary file created with the specified roles. * - * @throws AAIAuthException * @throws IOException - * @throws JSONException + * if the policy file could not be written + * @throws AAIAuthException + * if the policy file cannot be loaded */ @Test - public void createLocalAuthFile() throws AAIAuthException, IOException, JSONException { + public void createLocalAuthFile() throws AAIAuthException, IOException { JSONObject roles = createRoleObject("role", createUserObject("user"), createFunctionObject("func")); AAIMicroServiceAuth auth = createAuthService(roles); assertThat(auth.authUser("nosuchuser", "method:func"), is(equalTo("AAI_9101"))); @@ -84,9 +86,10 @@ public class MicroServiceAuthTest { } /** - * Test loading of the policy file relative to CONFIG_HOME + * Test loading of the policy file relative to CONFIG_HOME. * * @throws AAIAuthException + * if the policy file cannot be loaded */ @Test public void createAuth() throws AAIAuthException { @@ -128,7 +131,7 @@ public class MicroServiceAuthTest { servletRequest.setScheme("https"); servletRequest.setServerPort(9501); servletRequest.setServerName("localhost"); - servletRequest.setRequestURI("/services/validation-service/v1/app/validate"); + servletRequest.setRequestURI(TestUtil.VALIDATION_SERVICE_URL); X509Certificate mockCertificate = Mockito.mock(X509Certificate.class); Mockito.when(mockCertificate.getSubjectX500Principal()) @@ -139,6 +142,13 @@ public class MicroServiceAuthTest { return servletRequest; } + /** + * Create a new auth object using the standard policy JSON + * + * @return a new auth object + * @throws AAIAuthException + * if the policy file cannot be loaded + */ private AAIMicroServiceAuth createStandardAuth() throws AAIAuthException { ValidationServiceAuthConfig authConfig = new ValidationServiceAuthConfig(); authConfig.setAuthPolicyFile(authPolicyFile); @@ -146,13 +156,15 @@ public class MicroServiceAuthTest { } /** - * @param rolesJson - * @return + * @param roles + * @return a new auth object (to be tested) * @throws IOException + * if the policy file could not be written * @throws AAIAuthException + * if the policy file cannot be loaded + * */ private AAIMicroServiceAuth createAuthService(JSONObject roles) throws IOException, AAIAuthException { - ValidationServiceAuthConfig authConfig = new ValidationServiceAuthConfig(); File file = File.createTempFile("auth-policy", "json"); file.deleteOnExit(); FileWriter fileWriter = new FileWriter(file); @@ -160,15 +172,18 @@ public class MicroServiceAuthTest { fileWriter.flush(); fileWriter.close(); + ValidationServiceAuthConfig authConfig = new ValidationServiceAuthConfig(); authConfig.setAuthPolicyFile(file.getAbsolutePath()); return new AAIMicroServiceAuth(authConfig); } /** - * Assert authorisation results for an admin user based on the test policy file + * Assert authorisation results for an admin user based on the test policy file. * * @param auth + * the auth object * @param adminUser + * the admin user name * @throws AAIAuthException */ private void assertAdminUserAuthorisation(AAIMicroServiceAuth auth, String adminUser) throws AAIAuthException { @@ -203,10 +218,7 @@ public class MicroServiceAuthTest { return usersArray; } - private JSONObject createRoleObject(String roleName, JSONArray usersArray, JSONArray functionsArray) - throws JSONException { - JSONObject roles = new JSONObject(); - + private JSONObject createRoleObject(String roleName, JSONArray usersArray, JSONArray functionsArray) { JSONObject role = new JSONObject(); role.put("name", roleName); role.put("functions", functionsArray); @@ -214,6 +226,8 @@ public class MicroServiceAuthTest { JSONArray rolesArray = new JSONArray(); rolesArray.put(role); + + JSONObject roles = new JSONObject(); roles.put("roles", rolesArray); return roles; diff --git a/src/test/java/org/onap/aai/validation/config/TestTopicConfig.java b/src/test/java/org/onap/aai/validation/config/TestTopicConfig.java index f323331..256b78a 100644 --- a/src/test/java/org/onap/aai/validation/config/TestTopicConfig.java +++ b/src/test/java/org/onap/aai/validation/config/TestTopicConfig.java @@ -18,7 +18,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.aai.validation.config; import static org.hamcrest.Matchers.containsInAnyOrder; @@ -40,8 +39,8 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @SpringBootTest @RunWith(SpringJUnit4ClassRunner.class) @Import(TopicPropertiesConfig.class) -@TestPropertySource(locations = { "classpath:test-application.properties" }) -@ContextConfiguration(locations = { "classpath:topic-config/test-validation-service-beans.xml" }) +@TestPropertySource(locations = {"classpath:test-application.properties"}) +@ContextConfiguration(locations = {"classpath:topic-config/test-validation-service-beans.xml"}) public class TestTopicConfig { static { @@ -75,6 +74,7 @@ public class TestTopicConfig { eventTopic.setConsumerGroup("event-dummy-consumer-group"); eventTopic.setConsumerId("event-dummy-consumer-id"); eventTopic.setTransportType("event-dummy-transport-type"); + eventTopic.setProtocol("event-dummy-protocol-type"); Topic exportTopic = new TopicConfig("aai-data-export", "aai-data-integrity").new Topic(); exportTopic.setName("aai-data-export"); @@ -99,6 +99,7 @@ public class TestTopicConfig { integrityTopic.setUsername("integrity-dummy-username"); integrityTopic.setPassword("integrity-dummy-password"); integrityTopic.setTransportType("integrity-dummy-transport-type"); + integrityTopic.setProtocol("http"); List publisherTopics = topicConfig.getPublisherTopics(); diff --git a/src/test/java/org/onap/aai/validation/logging/LogReader.java b/src/test/java/org/onap/aai/validation/logging/LogReader.java index 9faf0fb..77188bc 100644 --- a/src/test/java/org/onap/aai/validation/logging/LogReader.java +++ b/src/test/java/org/onap/aai/validation/logging/LogReader.java @@ -42,6 +42,15 @@ public class LogReader { cachedReader = getReader(logDirectory, logFilePrefix); } + /** + * @param logDirectory + * the directory containing all log files + * @param logFilePrefix + * the prefix to match + * @return a new buffered reader + * @throws IOException + * if an I/O error occurs when opening the log directory, or no files were found + */ private BufferedReader getReader(String logDirectory, String logFilePrefix) throws IOException { BufferedReader reader = new BufferedReader(new FileReader(getLogFile(logDirectory, logFilePrefix))); while (reader.readLine() != null) { @@ -51,15 +60,18 @@ public class LogReader { } /** + * Find the log file matching the given prefix. + * * @param logDirectory + * the directory containing all log files * @return the most recently created log file. * @throws IOException + * if an I/O error occurs when opening the log directory, or no files were found */ private File getLogFile(String logDirectory, String filenamePrefix) throws IOException { - Optional latestFilePath = Files.list(Paths.get(logDirectory)) - .filter(f -> Files.isDirectory(f) == false // - && f.getFileName().toString().startsWith(filenamePrefix) - && !f.getFileName().toString().endsWith(".zip")) + Optional latestFilePath = Files.list(Paths.get(logDirectory)).filter(f -> Files.isDirectory(f) == false // + && f.getFileName().toString().startsWith(filenamePrefix) + && !f.getFileName().toString().endsWith(".zip")) .max(Comparator.comparingLong(f -> f.toFile().lastModified())); if (latestFilePath.isPresent()) { cachedLog = latestFilePath.get(); diff --git a/src/test/java/org/onap/aai/validation/logging/TestApplicationLogger.java b/src/test/java/org/onap/aai/validation/logging/TestApplicationLogger.java index 6aa6908..c31fceb 100644 --- a/src/test/java/org/onap/aai/validation/logging/TestApplicationLogger.java +++ b/src/test/java/org/onap/aai/validation/logging/TestApplicationLogger.java @@ -9,7 +9,7 @@ * 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, @@ -42,7 +42,7 @@ import org.springframework.http.HttpHeaders; /** * Simple test to log each of the validation messages in turn. - * + * * This version tests only the error logger at INFO level. * */ @@ -71,8 +71,9 @@ public class TestApplicationLogger { /** * Check that each message can be logged and that (by implication of successful logging) there is a corresponding * resource (message format). - * + * * @throws IOException + * if an I/O error occurs when opening the log directory, or no files were found */ @Test public void logAllMessages() throws IOException { @@ -97,8 +98,8 @@ public class TestApplicationLogger { } if (logger.isDebugEnabled()) { - logger.debug(msg, args); - validateLoggedMessage(msg, debugReader, "DEBUG"); + logger.debug(msg, args); + validateLoggedMessage(msg, debugReader, "DEBUG"); } // The trace level is not enabled @@ -109,7 +110,7 @@ public class TestApplicationLogger { /** * Check that each message can be logged and that (by implication of successful logging) there is a corresponding * resource (message format). - * + * * @throws IOException */ @Test @@ -124,7 +125,7 @@ public class TestApplicationLogger { /** * Check logAudit with HTTP headers - * + * * @throws IOException */ @Test @@ -156,7 +157,7 @@ public class TestApplicationLogger { /** * Check logAudit with no HTTP headers - * + * * @throws IOException */ @Test @@ -173,7 +174,7 @@ public class TestApplicationLogger { /** * Check logMetrics - * + * * @throws IOException */ @Test @@ -228,7 +229,7 @@ public class TestApplicationLogger { /** * Call a logger method which is expected to throw an UnsupportedOperationException - * + * * @param logMethod * @param dummyMsg */ @@ -244,7 +245,7 @@ public class TestApplicationLogger { /** * Assert that a log message was logged to the expected log file at the expected severity - * + * * @param msg * @param reader * @param severity diff --git a/src/test/java/org/onap/aai/validation/modeldriven/configuration/mapping/TestModelInstanceMapper.java b/src/test/java/org/onap/aai/validation/modeldriven/configuration/mapping/TestModelInstanceMapper.java index 7c820bb..d8e2a61 100644 --- a/src/test/java/org/onap/aai/validation/modeldriven/configuration/mapping/TestModelInstanceMapper.java +++ b/src/test/java/org/onap/aai/validation/modeldriven/configuration/mapping/TestModelInstanceMapper.java @@ -1,20 +1,24 @@ -/* - * ============LICENSE_START=================================================== - * Copyright (c) 2018 Amdocs - * ============================================================================ +/** + * ============LICENSE_START======================================================= + * org.onap.aai + * ================================================================================ + * Copyright (c) 2018-2019 AT&T Intellectual Property. All rights reserved. + * Copyright (c) 2018-2019 European Software Marketing Ltd. + * ================================================================================ * 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, * 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===================================================== + * ============LICENSE_END========================================================= */ + package org.onap.aai.validation.modeldriven.configuration.mapping; import static org.hamcrest.Matchers.is; @@ -24,9 +28,6 @@ import static org.junit.Assert.assertTrue; import java.util.ArrayList; import java.util.List; import org.junit.Test; -import org.onap.aai.validation.modeldriven.configuration.mapping.Filter; -import org.onap.aai.validation.modeldriven.configuration.mapping.ModelInstanceMapper; -import org.onap.aai.validation.modeldriven.configuration.mapping.ValueConfiguration; import org.onap.aai.validation.modeldriven.configuration.mapping.ModelInstanceMapper.MappingType; public class TestModelInstanceMapper { diff --git a/src/test/java/org/onap/aai/validation/modeldriven/parser/TestXMLModelParser.java b/src/test/java/org/onap/aai/validation/modeldriven/parser/TestXMLModelParser.java deleted file mode 100644 index 3344193..0000000 --- a/src/test/java/org/onap/aai/validation/modeldriven/parser/TestXMLModelParser.java +++ /dev/null @@ -1,96 +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.modeldriven.parser; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; -import org.dom4j.Element; -import org.dom4j.Node; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.onap.aai.validation.modeldriven.parser.XMLModelParser; - -public class TestXMLModelParser { - - static { - System.setProperty("APP_HOME", "."); - } - - private static final String CONNECTOR_MODEL_ID = "460c6de2-a92b-4e3b-9ba3-538ce782b2fa"; - private static final String MODEL_ID_ATTRIBUTE = "model-name-version-id"; - - private Element modelElement; - - @Rule - public ExpectedException exception = ExpectedException.none(); - - @Before - public void setUp() throws Exception { - File modelFile = new File("src/test/resources/model-validation/model-parser/all-models.xml"); - Element modelsElement = XMLModelParser.parse(modelFile, false); - modelElement = XMLModelParser.getModelElementWithId(modelsElement, MODEL_ID_ATTRIBUTE, CONNECTOR_MODEL_ID); - } - - @Test - public void testParseXMLModelFile() throws Exception { - assertEquals("Invalid model element name.", "model", modelElement.getName()); - } - - @Test - public void testGetAttributes() throws Exception { - String attrsXPath = "metadata/metadatum/metaname"; - List attrNodes = XMLModelParser.getObjectsFromXPath(modelElement, attrsXPath); - assertEquals("Unexpected number of attributes.", 2, attrNodes.size()); - - List validAttrs = new ArrayList<>(); - validAttrs.add("a"); - validAttrs.add("b"); - - List actualAttrs = new ArrayList<>(); - for (Node node : attrNodes) { - actualAttrs.add(node.getText()); - } - - assertTrue("Unexpected attribute names.", validAttrs.containsAll(actualAttrs)); - } - - @Test - public void testGetRelatedObjects() throws Exception { - String relObjsXPath = "model-elements/model-element"; - List relatedNodes = XMLModelParser.getObjectsFromXPath(modelElement, relObjsXPath); - assertEquals("Unexpected number of related objects.", 1, relatedNodes.size()); - - Node relatedObjUUIDNode = relatedNodes.get(0).selectSingleNode("model-element-uuid"); - assertEquals("Unexpected related object UUID.", "71b825be-febf-45f7-b86a-ca0e3de19c90", - relatedObjUUIDNode.getText()); - } - - @Test - public void testModelValidationFailure() throws Exception { - File modelFile = new File("src/test/resources/model-validation/model-parser/all-models.xml"); - - assertNull("Validation failure should result in null being returned.", XMLModelParser.parse(modelFile, true)); - } -} diff --git a/src/test/java/org/onap/aai/validation/modeldriven/parser/TestXmlModelParser.java b/src/test/java/org/onap/aai/validation/modeldriven/parser/TestXmlModelParser.java new file mode 100644 index 0000000..4ba7fe5 --- /dev/null +++ b/src/test/java/org/onap/aai/validation/modeldriven/parser/TestXmlModelParser.java @@ -0,0 +1,97 @@ +/** + * ============LICENSE_START======================================================= + * org.onap.aai + * ================================================================================ + * Copyright (c) 2018-2019 AT&T Intellectual Property. All rights reserved. + * Copyright (c) 2018-2019 European Software Marketing Ltd. + * ================================================================================ + * 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.modeldriven.parser; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; +import org.dom4j.Element; +import org.dom4j.Node; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; + +public class TestXmlModelParser { + + static { + System.setProperty("APP_HOME", "."); + } + + private static final String CONNECTOR_MODEL_ID = "460c6de2-a92b-4e3b-9ba3-538ce782b2fa"; + private static final String MODEL_ID_ATTRIBUTE = "model-name-version-id"; + + private Element modelElement; + + @Rule + public ExpectedException exception = ExpectedException.none(); + + @Before + public void setUp() throws Exception { + File modelFile = new File("src/test/resources/model-validation/model-parser/all-models.xml"); + Element modelsElement = XMLModelParser.parse(modelFile, false); + modelElement = XMLModelParser.getModelElementWithId(modelsElement, MODEL_ID_ATTRIBUTE, CONNECTOR_MODEL_ID); + } + + @Test + public void testParseXmlModelFile() throws Exception { + assertEquals("Invalid model element name.", "model", modelElement.getName()); + } + + @Test + public void testGetAttributes() throws Exception { + String attrsXPath = "metadata/metadatum/metaname"; + List attrNodes = XMLModelParser.getObjectsFromXPath(modelElement, attrsXPath); + assertEquals("Unexpected number of attributes.", 2, attrNodes.size()); + + List validAttrs = new ArrayList<>(); + validAttrs.add("a"); + validAttrs.add("b"); + + List actualAttrs = new ArrayList<>(); + for (Node node : attrNodes) { + actualAttrs.add(node.getText()); + } + + assertTrue("Unexpected attribute names.", validAttrs.containsAll(actualAttrs)); + } + + @Test + public void testGetRelatedObjects() throws Exception { + String relObjsXPath = "model-elements/model-element"; + List relatedNodes = XMLModelParser.getObjectsFromXPath(modelElement, relObjsXPath); + assertEquals("Unexpected number of related objects.", 1, relatedNodes.size()); + + Node relatedNode = relatedNodes.get(0).selectSingleNode("model-element-uuid"); + assertEquals("Unexpected related object UUID.", "71b825be-febf-45f7-b86a-ca0e3de19c90", relatedNode.getText()); + } + + @Test + public void testModelValidationFailure() throws Exception { + File modelFile = new File("src/test/resources/model-validation/model-parser/all-models.xml"); + + assertNull("Validation failure should result in null being returned.", XMLModelParser.parse(modelFile, true)); + } +} 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 c2b66c5..4d076da 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,19 +1,22 @@ -/* - * ============LICENSE_START=================================================== - * Copyright (c) 2018-2019 Amdocs - * ============================================================================ +/** + * ============LICENSE_START======================================================= + * org.onap.aai + * ================================================================================ + * Copyright (c) 2018-2019 AT&T Intellectual Property. All rights reserved. + * Copyright (c) 2018-2019 European Software Marketing Ltd. + * ================================================================================ * 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, * 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===================================================== + * ============LICENSE_END========================================================= */ package org.onap.aai.validation.modeldriven.validator; @@ -166,7 +169,6 @@ public class TestInstanceReader { JsonElement genericVnfJsonElement = jsonParser.parse(expectedGenericVnf); String expectedGenericVnf = genericVnfJsonElement.toString(); - // Method under test Multimap values = instanceReader.getValues(connectorSibling, mapping); @@ -179,7 +181,6 @@ public class TestInstanceReader { // Method under test values = instanceReader.getValues(logicalLinkInstance, mapping); - assertThat(values.get("generic-vnf").iterator().next(), is(equalTo(expectedGenericVnf))); assertThat(values.get("pserver").iterator().next(), is(equalTo(jsonParser.parse(expectedPserver).toString()))); } @@ -226,14 +227,12 @@ public class TestInstanceReader { @Test public void testGetResourceVersion() throws Exception { String resourceVersion = instanceReader.getResourceVersion(connector); - assertThat(resourceVersion, is("1467975776")); } private static ModelInstanceMapper getMapping(String mappingFileName) throws Exception { JSONArray jsonArray = new JSONArray(TestUtil.getFileAsString(mappingFileName)); JSONObject jsonObject = jsonArray.getJSONObject(0); - return JsonUtil.fromJson(jsonObject.toString(), ModelInstanceMapper.class); } } 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 1d3e6d2..844c010 100644 --- a/src/test/java/org/onap/aai/validation/reader/TestEventReader.java +++ b/src/test/java/org/onap/aai/validation/reader/TestEventReader.java @@ -1,19 +1,22 @@ -/* - * ============LICENSE_START=================================================== - * Copyright (c) 2018-2019 Amdocs - * ============================================================================ +/** + * ============LICENSE_START======================================================= + * org.onap.aai + * ================================================================================ + * Copyright (c) 2018-2019 AT&T Intellectual Property. All rights reserved. + * Copyright (c) 2018-2019 European Software Marketing Ltd. + * ================================================================================ * 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, * 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===================================================== + * ============LICENSE_END========================================================= */ package org.onap.aai.validation.reader; @@ -269,7 +272,9 @@ public class TestEventReader { public void testEntityLinkIsStripped() throws Exception { Entity entity = eventReader.getEntity(vserverEvent); String entityLink = entity.getEntityLink(); - assertThat(entityLink, is( - "cloud-infrastructure/cloud-regions/cloud-region/region1/AAIregion1/tenants/tenant/example-tenant-id-val-88551/vservers/vserver/example-vserver-id-val-34666")); + assertThat(entityLink, + is("cloud-infrastructure/cloud-regions/cloud-region/" + + "region1/AAIregion1/tenants/tenant/example-tenant-id-val-88551/" + + "vservers/vserver/example-vserver-id-val-34666")); } } 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 3462418..7ce0b34 100644 --- a/src/test/java/org/onap/aai/validation/result/TestValidationResult.java +++ b/src/test/java/org/onap/aai/validation/result/TestValidationResult.java @@ -1,19 +1,22 @@ /** - * ============LICENSE_START=================================================== + * ============LICENSE_START======================================================= + * org.onap.aai + * ================================================================================ + * Copyright (c) 2018-2019 AT&T Intellectual Property. All rights reserved. * Copyright (c) 2018-2019 European Software Marketing Ltd. - * ============================================================================ + * ================================================================================ * 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, * 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===================================================== + * ============LICENSE_END========================================================= */ package org.onap.aai.validation.result; @@ -198,14 +201,14 @@ public class TestValidationResult { Map violationDetails = new HashMap<>(); //@formatter:off - Violation violation = new Violation.Builder(entity) - .category("category") - .severity("severity") - .violationType("violationType") - .violationDetails(violationDetails) - .errorMessage("errorMessage") - .build(); - //@formatter:on + Violation violation = new Violation.Builder(entity) + .category("category") + .severity("severity") + .violationType("violationType") + .violationDetails(violationDetails) + .errorMessage("errorMessage") + .build(); + //@formatter:on validationResult.addViolation(violation); assertThat(validationResult, is(not(equalTo(other)))); @@ -385,14 +388,14 @@ public class TestValidationResult { ValidationResult validationResult = new ValidationResultBuilder(eventReader, vserverEvent).build(); //@formatter:off - Violation violation = new Violation.Builder(entity) - .category("category") - .severity("severity") - .violationType("violationType") - .violationDetails(violationDetails) - .errorMessage("errorMessage") - .build(); - //@formatter:on + Violation violation = new Violation.Builder(entity) + .category("category") + .severity("severity") + .violationType("violationType") + .violationDetails(violationDetails) + .errorMessage("errorMessage") + .build(); + //@formatter:on validationResult.addViolation(violation); @@ -411,8 +414,10 @@ public class TestValidationResult { assertThat(validationResult.getEntityId(), is(expectedEntityId)); assertThat(validationResult.getEntityType(), is("vserver")); assertThat(validationResult.getResourceVersion(), is("1464193654")); - assertThat(validationResult.getEntityLink(), is("cloud-infrastructure/cloud-regions/cloud-region/region1/" - + "AAIregion1/tenants/tenant/example-tenant-id-val-88551/vservers/vserver/example-vserver-id-val-34666")); + assertThat(validationResult.getEntityLink(), + is("cloud-infrastructure/cloud-regions/cloud-region/region1/" + + "AAIregion1/tenants/tenant/example-tenant-id-val-88551" + + "/vservers/vserver/example-vserver-id-val-34666")); } private Violation assertThatViolationIsValid(ValidationResult validationResult, Violation expectedViolation) { diff --git a/src/test/java/org/onap/aai/validation/ruledriven/configuration/ConfigFileBuilder.java b/src/test/java/org/onap/aai/validation/ruledriven/configuration/ConfigFileBuilder.java index 1f87ca0..0b865c9 100644 --- a/src/test/java/org/onap/aai/validation/ruledriven/configuration/ConfigFileBuilder.java +++ b/src/test/java/org/onap/aai/validation/ruledriven/configuration/ConfigFileBuilder.java @@ -1,19 +1,22 @@ -/* - * ============LICENSE_START=================================================== - * Copyright (c) 2018 Amdocs - * ============================================================================ +/** + * ============LICENSE_START======================================================= + * org.onap.aai + * ================================================================================ + * Copyright (c) 2018-2019 AT&T Intellectual Property. All rights reserved. + * Copyright (c) 2018-2019 European Software Marketing Ltd. + * ================================================================================ * 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, * 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===================================================== + * ============LICENSE_END========================================================= */ package org.onap.aai.validation.ruledriven.configuration; @@ -26,8 +29,6 @@ import java.util.Properties; import org.junit.rules.TemporaryFolder; import org.onap.aai.cl.api.Logger; import org.onap.aai.validation.logging.LogHelper; -import org.onap.aai.validation.ruledriven.configuration.EntitySection; -import org.onap.aai.validation.ruledriven.configuration.RulesConfigurationLoader; import org.onap.aai.validation.ruledriven.configuration.build.ContentBuilder; import org.onap.aai.validation.ruledriven.configuration.build.EntityBuilder; import org.onap.aai.validation.ruledriven.configuration.build.RuleBuilder; diff --git a/src/test/java/org/onap/aai/validation/ruledriven/rule/TestRuleExecution.java b/src/test/java/org/onap/aai/validation/ruledriven/rule/TestRuleExecution.java index 5b0e66b..d0a6dce 100644 --- a/src/test/java/org/onap/aai/validation/ruledriven/rule/TestRuleExecution.java +++ b/src/test/java/org/onap/aai/validation/ruledriven/rule/TestRuleExecution.java @@ -9,7 +9,7 @@ * 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, @@ -135,7 +135,7 @@ public class TestRuleExecution { * Test for "vserver is related to vpe and vserver-name contains me6". * * @throws Exception - * if the rule expression in this test is invalid + * if the rule expression in this test is invalid */ @Test public void testConditionalRegExp() throws Exception { @@ -266,7 +266,7 @@ public class TestRuleExecution { } /** - * location_clli is 8 or 11 characters and must be characters only + * location_clli is 8 or 11 characters and must be characters only. */ @Test public void testStringLengthAndChars() throws Exception { @@ -537,18 +537,6 @@ public class TestRuleExecution { return new GroovyRule(ruleConfig); } - private GroovyRule buildRuleWithErrorMessage(String name, String attribute, String expression, String errorMessage) - throws IOException, InstantiationException, IllegalAccessException, GroovyConfigurationException { - RuleSection ruleConfig = new RuleSection(); - ruleConfig.setName(name); - ruleConfig.setAttributes(Collections.singletonList(attribute)); - ruleConfig.setExpression(expression); - if(errorMessage != null) { - ruleConfig.setErrorMessage(errorMessage); - } - return new GroovyRule(ruleConfig); - } - /** * Build a simple rule (with a default name) using a RuleConfiguration object * @@ -579,6 +567,18 @@ public class TestRuleExecution { return buildRule("testRule", attributes, expression); } + private GroovyRule buildRuleWithErrorMessage(String name, String attribute, String expression, String errorMessage) + throws IOException, InstantiationException, IllegalAccessException, GroovyConfigurationException { + RuleSection ruleConfig = new RuleSection(); + ruleConfig.setName(name); + ruleConfig.setAttributes(Collections.singletonList(attribute)); + ruleConfig.setExpression(expression); + if (errorMessage != null) { + ruleConfig.setErrorMessage(errorMessage); + } + return new GroovyRule(ruleConfig); + } + private GroovyRule buildRuleWithErrorMessage(String attribute, String expression, String errorText) throws InstantiationException, IllegalAccessException, IOException, GroovyConfigurationException { return buildRuleWithErrorMessage("testRule", attribute, expression, errorText); diff --git a/src/test/java/org/onap/aai/validation/ruledriven/rule/TestRuleValidation.java b/src/test/java/org/onap/aai/validation/ruledriven/rule/TestRuleValidation.java index b881804..325dff2 100644 --- a/src/test/java/org/onap/aai/validation/ruledriven/rule/TestRuleValidation.java +++ b/src/test/java/org/onap/aai/validation/ruledriven/rule/TestRuleValidation.java @@ -1,19 +1,22 @@ -/* - * ============LICENSE_START=================================================== - * Copyright (c) 2018 Amdocs - * ============================================================================ +/** + * ============LICENSE_START======================================================= + * org.onap.aai + * ================================================================================ + * Copyright (c) 2018-2019 AT&T Intellectual Property. All rights reserved. + * Copyright (c) 2018-2019 European Software Marketing Ltd. + * ================================================================================ * 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, * 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===================================================== + * ============LICENSE_END========================================================= */ package org.onap.aai.validation.ruledriven.rule; @@ -215,7 +218,7 @@ public class TestRuleValidation { } /** - * Utility to build a rule and test that the attribute is valid + * Utility to build a rule and test that the attribute passed to it is valid. * * @param attribute * attribute (field) identifier 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 f99748a..c975d16 100644 --- a/src/test/java/org/onap/aai/validation/services/TestInfoService.java +++ b/src/test/java/org/onap/aai/validation/services/TestInfoService.java @@ -47,8 +47,8 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @SpringBootTest @RunWith(SpringJUnit4ClassRunner.class) -@TestPropertySource(locations = { "classpath:oxm-reader/schemaIngest.properties", "classpath:application.properties" }) -@ContextConfiguration(locations = { "classpath:/info-service/test-validation-service-beans.xml" }) +@TestPropertySource(locations = {"classpath:oxm-reader/schemaIngest.properties", "classpath:application.properties"}) +@ContextConfiguration(locations = {"classpath:/info-service/test-validation-service-beans.xml"}) public class TestInfoService { static { @@ -56,9 +56,7 @@ public class TestInfoService { } enum TestData { - VSERVER( - "rule-driven-validator/test_events/vserver-create-event.json" - ); + VSERVER("rule-driven-validator/test_events/vserver-create-event.json"); private String filename; @@ -117,7 +115,6 @@ public class TestInfoService { assertThat(info, containsString("errored=1")); } - @Test public void testVserverEventRecorded() throws URISyntaxException, IOException { Path vserverTestFile = Paths.get(ClassLoader.getSystemResource(TestData.VSERVER.getFilename()).toURI()); diff --git a/src/test/java/org/onap/aai/validation/services/TestValidateServiceImpl.java b/src/test/java/org/onap/aai/validation/services/TestValidateServiceImpl.java index f1cdce6..d1e538f 100644 --- a/src/test/java/org/onap/aai/validation/services/TestValidateServiceImpl.java +++ b/src/test/java/org/onap/aai/validation/services/TestValidateServiceImpl.java @@ -1,19 +1,22 @@ -/* - * ============LICENSE_START=================================================== - * Copyright (c) 2018 Amdocs - * ============================================================================ +/** + * ============LICENSE_START======================================================= + * org.onap.aai + * ================================================================================ + * Copyright (c) 2018-2019 AT&T Intellectual Property. All rights reserved. + * Copyright (c) 2018-2019 European Software Marketing Ltd. + * ================================================================================ * 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, * 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===================================================== + * ============LICENSE_END========================================================= */ package org.onap.aai.validation.services; @@ -22,7 +25,6 @@ import static org.hamcrest.CoreMatchers.notNullValue; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertThat; -import java.net.URISyntaxException; import java.security.cert.X509Certificate; import java.util.Collections; import java.util.List; @@ -34,7 +36,7 @@ import org.junit.Test; import org.mockito.Mockito; import org.onap.aai.auth.AAIMicroServiceAuth; import org.onap.aai.validation.controller.ValidationController; -import org.onap.aai.validation.services.ValidateServiceImpl; +import org.onap.aai.validation.test.util.TestUtil; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -72,15 +74,10 @@ public class TestValidateServiceImpl { } /** - * Create a (mocked) HTTPS request and invoke the Babel generate artifacts API - * - * @param request - * for the Babel Service - * @return the Response from the HTTP API - * @throws URISyntaxException + * Create a (mocked) HTTPS request and invoke the Validation Service API. */ @Test - public void testRequestWithHeaders() throws URISyntaxException { + public void testRequestWithHeaders() { // Create mocked request headers map MultivaluedHashMap headersMap = new MultivaluedHashMap<>(); headersMap.put("X-TransactionId", createSingletonList("transaction-id")); @@ -97,7 +94,7 @@ public class TestValidateServiceImpl { servletRequest.setScheme("https"); servletRequest.setServerPort(9501); servletRequest.setServerName("localhost"); - servletRequest.setRequestURI("/services/validation-service/v1/app/validate"); + servletRequest.setRequestURI(TestUtil.VALIDATION_SERVICE_URL); X509Certificate mockCertificate = Mockito.mock(X509Certificate.class); Mockito.when(mockCertificate.getSubjectX500Principal()) diff --git a/src/test/java/org/onap/aai/validation/test/util/TestEntity.java b/src/test/java/org/onap/aai/validation/test/util/TestEntity.java index b94a875..6c35cf4 100644 --- a/src/test/java/org/onap/aai/validation/test/util/TestEntity.java +++ b/src/test/java/org/onap/aai/validation/test/util/TestEntity.java @@ -1,7 +1,10 @@ /** - * ============LICENSE_START=================================================== - * Copyright (c) 2018 Amdocs - * ============================================================================ + * ============LICENSE_START======================================================= + * org.onap.aai + * ================================================================================ + * Copyright (c) 2018-2019 AT&T Intellectual Property. All rights reserved. + * Copyright (c) 2018-2019 European Software Marketing Ltd. + * ================================================================================ * 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 @@ -13,7 +16,7 @@ * 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===================================================== + * ============LICENSE_END========================================================= */ package org.onap.aai.validation.test.util; @@ -32,6 +35,18 @@ public class TestEntity { public File inputFile; public String expectedResultsFile; + /** + * Create a new test entity. + * + * @param root + * the top-level folder for the test suite + * @param inputFilePath + * the path to the input file to be tested + * @param inputEventsPath + * the folder containing the input file(s) + * @param outputEventsPath + * the folder to write the outputs to + */ public TestEntity(Path root, Path inputFilePath, String inputEventsPath, String outputEventsPath) { String rootUri = root.toUri().toString(); String resultsRoot = rootUri.replaceAll(inputEventsPath + "/$", outputEventsPath + "/"); diff --git a/src/test/java/org/onap/aai/validation/test/util/TestUtil.java b/src/test/java/org/onap/aai/validation/test/util/TestUtil.java index 40fa4de..c70e2ab 100644 --- a/src/test/java/org/onap/aai/validation/test/util/TestUtil.java +++ b/src/test/java/org/onap/aai/validation/test/util/TestUtil.java @@ -1,19 +1,22 @@ -/* - * ============LICENSE_START=================================================== - * Copyright (c) 2018 Amdocs - * ============================================================================ +/** + * ============LICENSE_START======================================================= + * org.onap.aai + * ================================================================================ + * Copyright (c) 2018-2019 AT&T Intellectual Property. All rights reserved. + * Copyright (c) 2018-2019 European Software Marketing Ltd. + * ================================================================================ * 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, * 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===================================================== + * ============LICENSE_END========================================================= */ package org.onap.aai.validation.test.util; @@ -31,6 +34,8 @@ import java.nio.file.Paths; */ public class TestUtil { + public static final String VALIDATION_SERVICE_URL = "/services/validation-service/v1/app/validate"; + /** * Gets files, such as test data from the classpath. * diff --git a/src/test/resources/info-service/test-validation-service-beans.xml b/src/test/resources/info-service/test-validation-service-beans.xml index d1c6ace..8b8fcd9 100644 --- a/src/test/resources/info-service/test-validation-service-beans.xml +++ b/src/test/resources/info-service/test-validation-service-beans.xml @@ -1,20 +1,25 @@ - + diff --git a/src/test/resources/model-instance-mapping.json_conf b/src/test/resources/model-instance-mapping.json_conf deleted file mode 100644 index 12d39ea..0000000 --- a/src/test/resources/model-instance-mapping.json_conf +++ /dev/null @@ -1,28 +0,0 @@ -[ - { - "mappingType": "RELATIONSHIP", - "model": { - "root": "model-elements/model-element", - "id": "relationship-list/relationship/relationship-data/relationship-value[../relationship-key/text()='model.model-name-version-id']", - "value": "relationship-list/relationship/related-to-property/property-value[../property-key/text()='model.model-name']", - "filter": { - "path": "relationship-list/relationship/related-to-property/property-value[../property-key/text()='model.model-type']", - "valid": ["widget"] - } - }, - "instance": { - "origin": "$.inventory-response-item[0]", - "root": "$.inventory-response-items.inventory-response-item[*]" - } - }, - { - "mappingType": "ATTRIBUTE", - "model": { - "value": "metadata/metadatum/metaname" - }, - "instance": { - "origin": "$.inventory-response-item[0]", - "value": "$..extra-properties.metadatum[*].metaname" - } - } -] diff --git a/src/test/resources/model-validation/model-instance-mapping.json_conf b/src/test/resources/model-validation/model-instance-mapping.json_conf new file mode 100644 index 0000000..12d39ea --- /dev/null +++ b/src/test/resources/model-validation/model-instance-mapping.json_conf @@ -0,0 +1,28 @@ +[ + { + "mappingType": "RELATIONSHIP", + "model": { + "root": "model-elements/model-element", + "id": "relationship-list/relationship/relationship-data/relationship-value[../relationship-key/text()='model.model-name-version-id']", + "value": "relationship-list/relationship/related-to-property/property-value[../property-key/text()='model.model-name']", + "filter": { + "path": "relationship-list/relationship/related-to-property/property-value[../property-key/text()='model.model-type']", + "valid": ["widget"] + } + }, + "instance": { + "origin": "$.inventory-response-item[0]", + "root": "$.inventory-response-items.inventory-response-item[*]" + } + }, + { + "mappingType": "ATTRIBUTE", + "model": { + "value": "metadata/metadatum/metaname" + }, + "instance": { + "origin": "$.inventory-response-item[0]", + "value": "$..extra-properties.metadatum[*].metaname" + } + } +] diff --git a/src/test/resources/topic-config/test-topic-config-beans.xml b/src/test/resources/topic-config/test-topic-config-beans.xml deleted file mode 100644 index 0466f81..0000000 --- a/src/test/resources/topic-config/test-topic-config-beans.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - aai-event - aai-data-export - - - - - aai-data-integrity - - - - - - - - - classpath:topic-config/topic-aai-event.properties - classpath:topic-config/topic-aai-data-export.properties - classpath:topic-config/topic-aai-data-integrity.properties - - - - \ No newline at end of file diff --git a/src/test/resources/topic-config/test-validation-service-beans.xml b/src/test/resources/topic-config/test-validation-service-beans.xml index 9d880a3..ad7ad1f 100644 --- a/src/test/resources/topic-config/test-validation-service-beans.xml +++ b/src/test/resources/topic-config/test-validation-service-beans.xml @@ -1,25 +1,12 @@ - - - - - + \ No newline at end of file diff --git a/src/test/resources/topic-config/topic-aai-data-integrity.properties b/src/test/resources/topic-config/topic-aai-data-integrity.properties index f5a5839..a8ca1ee 100644 --- a/src/test/resources/topic-config/topic-aai-data-integrity.properties +++ b/src/test/resources/topic-config/topic-aai-data-integrity.properties @@ -1,5 +1,5 @@ # ============LICENSE_START=================================================== -# Copyright (c) 2018 Amdocs +# Copyright (c) 2018-2019 European Software Marketing Ltd. # ============================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -19,4 +19,5 @@ aai-data-integrity.host=integrity-dummy-host aai-data-integrity.publisher.partition=integrity-dummy-partition aai-data-integrity.username=integrity-dummy-username aai-data-integrity.password=integrity-dummy-password -aai-data-integrity.transport.type=integrity-dummy-transport-type \ No newline at end of file +aai-data-integrity.transport.type=integrity-dummy-transport-type +aai-data-integrity.protocol=http diff --git a/src/test/resources/topic-config/topic-aai-event.properties b/src/test/resources/topic-config/topic-aai-event.properties index 2779f13..72af926 100644 --- a/src/test/resources/topic-config/topic-aai-event.properties +++ b/src/test/resources/topic-config/topic-aai-event.properties @@ -1,5 +1,5 @@ # ============LICENSE_START=================================================== -# Copyright (c) 2018 Amdocs +# Copyright (c) 2018-2019 European Software Marketing Ltd. # ============================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -20,4 +20,5 @@ aai-event.username=event-dummy-username aai-event.password=event-dummy-password aai-event.consumer.group=event-dummy-consumer-group aai-event.consumer.id=event-dummy-consumer-id -aai-event.transport.type=event-dummy-transport-type \ No newline at end of file +aai-event.transport.type=event-dummy-transport-type +aai-event.protocol=event-dummy-protocol-type \ No newline at end of file diff --git a/src/test/resources/validation-result/test-validation-service-beans.xml b/src/test/resources/validation-result/test-validation-service-beans.xml index 9a67d0a..9237a22 100644 --- a/src/test/resources/validation-result/test-validation-service-beans.xml +++ b/src/test/resources/validation-result/test-validation-service-beans.xml @@ -1,22 +1,26 @@ + ============LICENSE_START======================================================= + org.onap.aai + ================================================================================ + Copyright (c) 2018-2019 AT&T Intellectual Property. All rights reserved. + Copyright (c) 2018-2019 European Software Marketing Ltd. + ================================================================================ + 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========================================================= + +-->