From ea5f0af6c28863b5f8ee220e105b6c3221c68b03 Mon Sep 17 00:00:00 2001 From: emartin Date: Mon, 15 Apr 2019 11:03:19 +0000 Subject: Fix mapping localDn to be optional field Change-Id: I7d1d4b75ac18e42633206dd5870afeb01a3bc504 Issue-ID: DCAEGEN2-1435 Signed-off-by: emartin --- .../onap/dcaegen2/services/pmmapper/AppTest.java | 2 +- .../services/pmmapper/mapping/MapperTest.java | 7 ------ .../invalid_data/no_managed_element.xml | 27 ---------------------- .../test_data/invalid/no_managed_element.xml | 27 ++++++++++++++++++++++ 4 files changed, 28 insertions(+), 35 deletions(-) delete mode 100644 src/test/resources/mapper_test/mapping_data/invalid_data/no_managed_element.xml create mode 100644 src/test/resources/xml_validator_test/test_data/invalid/no_managed_element.xml (limited to 'src/test') diff --git a/src/test/java/org/onap/dcaegen2/services/pmmapper/AppTest.java b/src/test/java/org/onap/dcaegen2/services/pmmapper/AppTest.java index 7c5340a..2db24b4 100644 --- a/src/test/java/org/onap/dcaegen2/services/pmmapper/AppTest.java +++ b/src/test/java/org/onap/dcaegen2/services/pmmapper/AppTest.java @@ -171,7 +171,7 @@ class AppTest { String metadataFileContents = new String(Files.readAllBytes(metadata)); eventMetadata = new Gson().fromJson(metadataFileContents, EventMetadata.class); - Path testFile = Paths.get(dataDirectory + "/invalid_data/no_managed_element.xml"); + Path testFile = Paths.get("src/test/resources/xml_validator_test/test_data/invalid/no_managed_element.xml"); Event mockEvent = EventUtils.makeMockEvent(EventUtils.fileContentsToString(testFile), eventMetadata); boolean result = App.validate(mockValidator, mockEvent, mockConfig); diff --git a/src/test/java/org/onap/dcaegen2/services/pmmapper/mapping/MapperTest.java b/src/test/java/org/onap/dcaegen2/services/pmmapper/mapping/MapperTest.java index 8670bed..7a8602e 100644 --- a/src/test/java/org/onap/dcaegen2/services/pmmapper/mapping/MapperTest.java +++ b/src/test/java/org/onap/dcaegen2/services/pmmapper/mapping/MapperTest.java @@ -98,13 +98,6 @@ class MapperTest { vesSchema.validate(new JSONObject(objUnderTest.map(testEvent))); } - @ParameterizedTest - @MethodSource("getInvalidEvents") - void testInvalidEvent(Event testEvent) { - when(converter.convert(any(MeasCollecFile.class))).thenReturn(testEvent.getBody()); - assertThrows(MappingException.class, () -> objUnderTest.map(testEvent)); - } - @Test void testFailureToProcess() throws IOException, TemplateException { Template mappingTemplateMock = mock(Template.class, RETURNS_DEEP_STUBS); diff --git a/src/test/resources/mapper_test/mapping_data/invalid_data/no_managed_element.xml b/src/test/resources/mapper_test/mapping_data/invalid_data/no_managed_element.xml deleted file mode 100644 index b1b3d68..0000000 --- a/src/test/resources/mapper_test/mapping_data/invalid_data/no_managed_element.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - a - b - c - - 86 - 67 - 14 - false - - - - - - - diff --git a/src/test/resources/xml_validator_test/test_data/invalid/no_managed_element.xml b/src/test/resources/xml_validator_test/test_data/invalid/no_managed_element.xml new file mode 100644 index 0000000..b1b3d68 --- /dev/null +++ b/src/test/resources/xml_validator_test/test_data/invalid/no_managed_element.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + a + b + c + + 86 + 67 + 14 + false + + + + + + + -- cgit 1.2.3-korg