diff options
Diffstat (limited to 'src/test')
13 files changed, 524 insertions, 5 deletions
diff --git a/src/test/java/org/onap/dcaegen2/services/pmmapper/filtering/MeasFilterHandlerTest.java b/src/test/java/org/onap/dcaegen2/services/pmmapper/filtering/MeasFilterHandlerTest.java new file mode 100644 index 0000000..8b1f8aa --- /dev/null +++ b/src/test/java/org/onap/dcaegen2/services/pmmapper/filtering/MeasFilterHandlerTest.java @@ -0,0 +1,171 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.dcaegen2.services.pmmapper.filtering; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; + +import java.io.IOException; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.stream.Collectors; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import org.onap.dcaegen2.services.pmmapper.model.Event; +import org.onap.dcaegen2.services.pmmapper.model.EventMetadata; +import org.onap.dcaegen2.services.pmmapper.model.MeasCollecFile; +import org.onap.dcaegen2.services.pmmapper.model.MeasFilterConfig; +import org.onap.dcaegen2.services.pmmapper.model.MeasFilterConfig.Filter; +import org.onap.dcaegen2.services.pmmapper.utils.MeasConverter; + +import io.undertow.server.HttpServerExchange; +import utils.EventUtils; + +@ExtendWith(MockitoExtension.class) +class MeasFilterHandlerTest { + + private static MeasFilterConfig filterConfig; + private static final String baseDir = "src/test/resources/filter_test/"; + private static final Path dataDirectory = Paths.get("src/test/resources/mapper_test/mapping_data/"); + private static List<String> counters = Arrays.asList("a", "b"); + private static MeasConverter converter = new MeasConverter(); + private MeasFilterHandler objUnderTest; + @Mock + private HttpServerExchange exchange; + @Mock + private EventMetadata metaData; + + @BeforeEach + void setup() { + filterConfig = new MeasFilterConfig(); + Filter filter = filterConfig.new Filter(); + filter.setDictionaryVersion(""); + filter.setMeasTypes(counters); + filterConfig.setFilters(Arrays.asList(filter)); + objUnderTest = new MeasFilterHandler(new MeasConverter()); + objUnderTest.setFilter(filterConfig.getFilters() + .get(0)); + } + + @Test + void measTypes_byCommaSeparation() throws IOException { + String inputPath = baseDir + "meas_results"; + String inputXml = EventUtils.fileContentsToString(Paths.get(inputPath + ".xml")); + String expected = EventUtils.fileContentsToString(Paths.get(inputPath + "_filtered.xml")); + Event event = new Event(exchange, inputXml, metaData, new HashMap<String, String>(), ""); + event.setMeasCollecFile(converter.convert(inputXml)); + + objUnderTest.filterByMeasType(event); + + String actual = converter.convert(event.getMeasCollecFile()); + assertEquals(expected, actual); + } + + @Test + void measType_byID() throws IOException { + String inputPath = baseDir + "meas_type_and_r"; + String inputXml = EventUtils.fileContentsToString(Paths.get(inputPath + ".xml")); + String filteredString = EventUtils.fileContentsToString(Paths.get(inputPath + "_filtered.xml")); + Event event = new Event(exchange, inputXml, metaData, new HashMap<String, String>(), ""); + event.setMeasCollecFile(converter.convert(inputXml)); + MeasCollecFile f = converter.convert(filteredString); + String expected = converter.convert(f); + objUnderTest.filterByMeasType(event); + + String actual = converter.convert(event.getMeasCollecFile()); + assertEquals(expected, actual); + } + + @Test + void no_Filters_match() { + String inputPath = baseDir + "meas_results"; + String inputXml = EventUtils.fileContentsToString(Paths.get(inputPath + ".xml")); + + Filter noMatchFilter = filterConfig.new Filter(); + noMatchFilter.setMeasTypes(Arrays.asList("nomatch1", "nomatch2")); + objUnderTest.setFilter(noMatchFilter); + + Event event = new Event(exchange, inputXml, metaData, new HashMap<String, String>(), ""); + event.setMeasCollecFile(converter.convert(inputXml)); + assertFalse(objUnderTest.filterByMeasType(event)); + } + + @Test + void multiple_measInfos_measResults() { + String inputPath = baseDir + "meas_results_manyInfo"; + String inputXml = EventUtils.fileContentsToString(Paths.get(inputPath + ".xml")); + String filteredString = EventUtils.fileContentsToString(Paths.get(inputPath + "_filtered.xml")); + Event event = new Event(exchange, inputXml, metaData, new HashMap<String, String>(), ""); + event.setMeasCollecFile(converter.convert(inputXml)); + MeasCollecFile f = converter.convert(filteredString); + String expected = converter.convert(f); + objUnderTest.filterByMeasType(event); + + String actual = converter.convert(event.getMeasCollecFile()); + assertEquals(expected, actual); + } + + @Test + void multiple_measInfos_measTypeAndR() { + String inputPath = baseDir + "meas_type_and_r_manyInfo"; + String inputXml = EventUtils.fileContentsToString(Paths.get(inputPath + ".xml")); + String filteredString = EventUtils.fileContentsToString(Paths.get(inputPath + "_filtered.xml")); + Event event = new Event(exchange, inputXml, metaData, new HashMap<String, String>(), ""); + event.setMeasCollecFile(converter.convert(inputXml)); + MeasCollecFile f = converter.convert(filteredString); + String expected = converter.convert(f); + objUnderTest.filterByMeasType(event); + + String actual = converter.convert(event.getMeasCollecFile()); + assertEquals(expected, actual); + } + + @ParameterizedTest + @MethodSource("getValidMeas") + void applyFilterToValidMeasurements(Event testEvent) { + objUnderTest.filterByMeasType(testEvent); + } + + static List<Event> getValidMeas() throws IOException { + final Path metadata = Paths.get("src/test/resources/valid_metadata.json"); + List<Event> events = EventUtils + .eventsFromDirectory(Paths.get(dataDirectory.toString() + "/valid_data/"), metadata) + .stream() + .map(e -> { + System.out.println(e.getBody()); + MeasCollecFile m = converter.convert(e.getBody()); + System.out.println(m.getMeasData()); + e.setMeasCollecFile(m); + return e; + }) + .collect(Collectors.toList()); + return events; + } +} diff --git a/src/test/java/org/onap/dcaegen2/services/pmmapper/utils/MeasConverterTest.java b/src/test/java/org/onap/dcaegen2/services/pmmapper/utils/MeasConverterTest.java new file mode 100644 index 0000000..f51ec5c --- /dev/null +++ b/src/test/java/org/onap/dcaegen2/services/pmmapper/utils/MeasConverterTest.java @@ -0,0 +1,83 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.dcaegen2.services.pmmapper.utils;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mockito;
+import org.onap.dcaegen2.services.pmmapper.exceptions.MappingException;
+import org.onap.dcaegen2.services.pmmapper.model.MeasCollecFile;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({JAXBContext.class})
+public class MeasConverterTest {
+
+ private MeasConverter objUnderTest;
+
+ @Before
+ public void setup() {
+ objUnderTest = new MeasConverter();
+ }
+ @Test
+ public void convertToString_throws_mappingException() throws Exception {
+ MeasCollecFile file = new MeasCollecFile();
+ PowerMockito.mockStatic(JAXBContext.class);
+ Marshaller marshallerMock = PowerMockito.mock(Marshaller.class);
+ JAXBContext jaxbContext = PowerMockito.mock(JAXBContext.class);
+ StringWriter w = Mockito.mock(StringWriter.class);
+ PowerMockito.whenNew(StringWriter.class).withNoArguments().thenReturn(w);
+ PowerMockito.when(JAXBContext.newInstance(MeasCollecFile.class)).thenReturn(jaxbContext);
+ PowerMockito.when(jaxbContext.createMarshaller()).thenReturn(marshallerMock);
+ PowerMockito.doThrow(new JAXBException("",""))
+ .when(marshallerMock).marshal( Mockito.any(MeasCollecFile.class)
+ ,Mockito.any(StringWriter.class));
+
+ assertThrows(MappingException.class, () -> {
+ objUnderTest.convert(file);
+ });
+ }
+
+ @Test
+ public void convertToMeasCollec_throws_mappingException() throws JAXBException {
+ PowerMockito.mockStatic(JAXBContext.class);
+ Unmarshaller unmarshallerMock = PowerMockito.mock(Unmarshaller.class);
+ JAXBContext jaxbContext = PowerMockito.mock(JAXBContext.class);
+ PowerMockito.when(JAXBContext.newInstance(MeasCollecFile.class)).thenReturn(jaxbContext);
+ PowerMockito.when(jaxbContext.createUnmarshaller()).thenReturn(unmarshallerMock);
+ PowerMockito.when(unmarshallerMock.unmarshal(Mockito.any(StringReader.class))).thenThrow(JAXBException.class);
+
+ assertThrows(MappingException.class, () -> {
+ objUnderTest.convert("xmlString");
+ });
+ }
+}
diff --git a/src/test/resources/filter_test/meas_results.xml b/src/test/resources/filter_test/meas_results.xml new file mode 100644 index 0000000..5825e7b --- /dev/null +++ b/src/test/resources/filter_test/meas_results.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<measCollecFile xmlns="http://www.3gpp.org/ftp/specs/archive/32_series/32.435#measCollec"> + <fileHeader dnPrefix="some dnPrefix" vendorName="FooBar Ltd" + fileFormatVersion="32.435 V10.0"> + <fileSender localDn="Dublin"/> + <measCollec beginTime="2018-10-02T12:00:00+01:00"/> + </fileHeader> + <measData> + <managedElement swVersion="r0.1" localDn="Dublin"/> + <measInfo measInfoId="some measInfoId"> + <job jobId="jobId"/> + <granPeriod endTime="2018-10-02T12:15:00Z" duration="PT900S"/> + <repPeriod duration="PT900S"/> + <measTypes>z a zz b</measTypes> + <measValue measObjLdn="objLdn"> + <measResults>99 1 27 2</measResults> + <suspect>false</suspect> + </measValue> + </measInfo> + </measData> + <fileFooter> + <measCollec endTime="2018-10-02T12:15:00+01:00"/> + </fileFooter> +</measCollecFile> diff --git a/src/test/resources/filter_test/meas_results_filtered.xml b/src/test/resources/filter_test/meas_results_filtered.xml new file mode 100644 index 0000000..af45364 --- /dev/null +++ b/src/test/resources/filter_test/meas_results_filtered.xml @@ -0,0 +1,22 @@ +<measCollecFile xmlns="http://www.3gpp.org/ftp/specs/archive/32_series/32.435#measCollec"> + <fileHeader fileFormatVersion="32.435 V10.0" vendorName="FooBar Ltd" dnPrefix="some dnPrefix"> + <fileSender localDn="Dublin"/> + <measCollec beginTime="2018-10-02T12:00:00+01:00"/> + </fileHeader> + <measData> + <managedElement localDn="Dublin" swVersion="r0.1"/> + <measInfo measInfoId="some measInfoId"> + <job jobId="jobId"/> + <granPeriod duration="PT900S" endTime="2018-10-02T12:15:00Z"/> + <repPeriod duration="PT900S"/> + <measTypes>a b</measTypes> + <measValue measObjLdn="objLdn"> + <measResults>1 2</measResults> + <suspect>false</suspect> + </measValue> + </measInfo> + </measData> + <fileFooter> + <measCollec endTime="2018-10-02T12:15:00+01:00"/> + </fileFooter> +</measCollecFile>
\ No newline at end of file diff --git a/src/test/resources/filter_test/meas_results_manyInfo.xml b/src/test/resources/filter_test/meas_results_manyInfo.xml new file mode 100644 index 0000000..2b87912 --- /dev/null +++ b/src/test/resources/filter_test/meas_results_manyInfo.xml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8"?> +<measCollecFile xmlns="http://www.3gpp.org/ftp/specs/archive/32_series/32.435#measCollec"> + <fileHeader dnPrefix="some dnPrefix" vendorName="FooBar Ltd" + fileFormatVersion="32.435 V10.0"> + <fileSender localDn="Dublin"/> + <measCollec beginTime="2018-10-02T12:00:00+01:00"/> + </fileHeader> + <measData> + <managedElement swVersion="r0.1" localDn="Dublin"/> + <measInfo measInfoId="this will be filtered out"> + <job jobId="jobId"/> + <granPeriod endTime="2018-10-02T12:15:00Z" duration="PT900S"/> + <repPeriod duration="PT900S"/> + <measTypes>z aa zz bb</measTypes> + <measValue measObjLdn="objLdn"> + <measResults>99 1 27 2</measResults> + <suspect>false</suspect> + </measValue> + </measInfo> + <measInfo measInfoId="some measInfoId"> + <job jobId="jobId"/> + <granPeriod endTime="2018-10-02T12:15:00Z" duration="PT900S"/> + <repPeriod duration="PT900S"/> + <measTypes>z a zz b</measTypes> + <measValue measObjLdn="objLdn"> + <measResults>99 1 27 2</measResults> + <suspect>false</suspect> + </measValue> + </measInfo> + <measInfo measInfoId="some measInfoId2"> + <job jobId="jobId"/> + <granPeriod endTime="2018-10-02T12:15:00Z" duration="PT900S"/> + <repPeriod duration="PT900S"/> + <measTypes>z a zz b</measTypes> + <measValue measObjLdn="objLdn"> + <measResults>99 1 27 2</measResults> + <suspect>false</suspect> + </measValue> + </measInfo> + </measData> + <fileFooter> + <measCollec endTime="2018-10-02T12:15:00+01:00"/> + </fileFooter> +</measCollecFile> diff --git a/src/test/resources/filter_test/meas_results_manyInfo_filtered.xml b/src/test/resources/filter_test/meas_results_manyInfo_filtered.xml new file mode 100644 index 0000000..4a887d5 --- /dev/null +++ b/src/test/resources/filter_test/meas_results_manyInfo_filtered.xml @@ -0,0 +1,32 @@ +<measCollecFile xmlns="http://www.3gpp.org/ftp/specs/archive/32_series/32.435#measCollec"> + <fileHeader fileFormatVersion="32.435 V10.0" vendorName="FooBar Ltd" dnPrefix="some dnPrefix"> + <fileSender localDn="Dublin"/> + <measCollec beginTime="2018-10-02T12:00:00+01:00"/> + </fileHeader> + <measData> + <managedElement localDn="Dublin" swVersion="r0.1"/> + <measInfo measInfoId="some measInfoId"> + <job jobId="jobId"/> + <granPeriod duration="PT900S" endTime="2018-10-02T12:15:00Z"/> + <repPeriod duration="PT900S"/> + <measTypes>a b</measTypes> + <measValue measObjLdn="objLdn"> + <measResults>1 2</measResults> + <suspect>false</suspect> + </measValue> + </measInfo> + <measInfo measInfoId="some measInfoId2"> + <job jobId="jobId"/> + <granPeriod duration="PT900S" endTime="2018-10-02T12:15:00Z"/> + <repPeriod duration="PT900S"/> + <measTypes>a b</measTypes> + <measValue measObjLdn="objLdn"> + <measResults>1 2</measResults> + <suspect>false</suspect> + </measValue> + </measInfo> + </measData> + <fileFooter> + <measCollec endTime="2018-10-02T12:15:00+01:00"/> + </fileFooter> +</measCollecFile>
\ No newline at end of file diff --git a/src/test/resources/filter_test/meas_type_and_r.xml b/src/test/resources/filter_test/meas_type_and_r.xml new file mode 100644 index 0000000..0d99e39 --- /dev/null +++ b/src/test/resources/filter_test/meas_type_and_r.xml @@ -0,0 +1,26 @@ +<measCollecFile xmlns="http://www.3gpp.org/ftp/specs/archive/32_series/32.435#measCollec">
+ <fileHeader fileFormatVersion="32.435 V10.0" vendorName="FooBar Ltd" dnPrefix="some dnPrefix">
+ <fileSender localDn="Dublin"/>
+ <measCollec beginTime="2018-10-02T12:00:00+01:00"/>
+ </fileHeader>
+ <measData>
+ <managedElement localDn="Dublin" swVersion="r0.1"/>
+ <measInfo measInfoId="some measInfoId">
+ <job jobId="jobId"/>
+ <granPeriod duration="PT900S" endTime="2018-10-02T12:15:00Z"/>
+ <repPeriod duration="PT900S"/>
+ <measType p="1">a</measType>
+ <measType p="2">z</measType>
+ <measType p="3">b</measType>
+ <measValue measObjLdn="some measObjLdn">
+ <r p="1">1</r>
+ <r p="2">99</r>
+ <r p="3">2</r>
+ <suspect>false</suspect>
+ </measValue>
+ </measInfo>
+ </measData>
+ <fileFooter>
+ <measCollec endTime="2018-10-02T12:15:00+01:00"/>
+ </fileFooter>
+</measCollecFile>
\ No newline at end of file diff --git a/src/test/resources/filter_test/meas_type_and_r_filtered.xml b/src/test/resources/filter_test/meas_type_and_r_filtered.xml new file mode 100644 index 0000000..1b5a362 --- /dev/null +++ b/src/test/resources/filter_test/meas_type_and_r_filtered.xml @@ -0,0 +1,25 @@ +<measCollecFile xmlns="http://www.3gpp.org/ftp/specs/archive/32_series/32.435#measCollec">
+ <fileHeader fileFormatVersion="32.435 V10.0" vendorName="FooBar Ltd" dnPrefix="some dnPrefix">
+ <fileSender localDn="Dublin"/>
+ <measCollec beginTime="2018-10-02T12:00:00+01:00"/>
+ </fileHeader>
+ <measData>
+ <managedElement localDn="Dublin" swVersion="r0.1"/>
+ <measInfo measInfoId="some measInfoId">
+ <job jobId="jobId"/>
+ <granPeriod duration="PT900S" endTime="2018-10-02T12:15:00Z"/>
+ <repPeriod duration="PT900S"/>
+ <measTypes></measTypes>
+ <measType p="1">a</measType>
+ <measType p="3">b</measType>
+ <measValue measObjLdn="some measObjLdn">
+ <r p="1">1</r>
+ <r p="3">2</r>
+ <suspect>false</suspect>
+ </measValue>
+ </measInfo>
+ </measData>
+ <fileFooter>
+ <measCollec endTime="2018-10-02T12:15:00+01:00"/>
+ </fileFooter>
+</measCollecFile>
\ No newline at end of file diff --git a/src/test/resources/filter_test/meas_type_and_r_manyInfo.xml b/src/test/resources/filter_test/meas_type_and_r_manyInfo.xml new file mode 100644 index 0000000..dd35dfc --- /dev/null +++ b/src/test/resources/filter_test/meas_type_and_r_manyInfo.xml @@ -0,0 +1,54 @@ +<measCollecFile xmlns="http://www.3gpp.org/ftp/specs/archive/32_series/32.435#measCollec">
+ <fileHeader fileFormatVersion="32.435 V10.0" vendorName="FooBar Ltd" dnPrefix="some dnPrefix">
+ <fileSender localDn="Dublin"/>
+ <measCollec beginTime="2018-10-02T12:00:00+01:00"/>
+ </fileHeader>
+ <measData>
+ <managedElement localDn="Dublin" swVersion="r0.1"/>
+ <measInfo measInfoId="some measInfoId">
+ <job jobId="jobId"/>
+ <granPeriod duration="PT900S" endTime="2018-10-02T12:15:00Z"/>
+ <repPeriod duration="PT900S"/>
+ <measType p="1">a</measType>
+ <measType p="2">z</measType>
+ <measType p="3">b</measType>
+ <measValue measObjLdn="some measObjLdn">
+ <r p="1">1</r>
+ <r p="2">99</r>
+ <r p="3">2</r>
+ <suspect>false</suspect>
+ </measValue>
+ </measInfo>
+ <measInfo measInfoId="filter will disregard this measInfo">
+ <job jobId="jobId"/>
+ <granPeriod duration="PT900S" endTime="2018-10-02T12:15:00Z"/>
+ <repPeriod duration="PT900S"/>
+ <measType p="1">aa</measType>
+ <measType p="2">z</measType>
+ <measType p="3">bb</measType>
+ <measValue measObjLdn="some measObjLdn">
+ <r p="1">1</r>
+ <r p="2">99</r>
+ <r p="3">2</r>
+ <suspect>false</suspect>
+ </measValue>
+ </measInfo>
+ <measInfo measInfoId="some measInfoId2">
+ <job jobId="jobId"/>
+ <granPeriod duration="PT900S" endTime="2018-10-02T12:15:00Z"/>
+ <repPeriod duration="PT900S"/>
+ <measType p="1">a</measType>
+ <measType p="2">z</measType>
+ <measType p="3">b</measType>
+ <measValue measObjLdn="some measObjLdn">
+ <r p="1">1</r>
+ <r p="2">99</r>
+ <r p="3">2</r>
+ <suspect>false</suspect>
+ </measValue>
+ </measInfo>
+ </measData>
+ <fileFooter>
+ <measCollec endTime="2018-10-02T12:15:00+01:00"/>
+ </fileFooter>
+</measCollecFile>
\ No newline at end of file diff --git a/src/test/resources/filter_test/meas_type_and_r_manyInfo_filtered.xml b/src/test/resources/filter_test/meas_type_and_r_manyInfo_filtered.xml new file mode 100644 index 0000000..db50fca --- /dev/null +++ b/src/test/resources/filter_test/meas_type_and_r_manyInfo_filtered.xml @@ -0,0 +1,38 @@ +<measCollecFile xmlns="http://www.3gpp.org/ftp/specs/archive/32_series/32.435#measCollec">
+ <fileHeader fileFormatVersion="32.435 V10.0" vendorName="FooBar Ltd" dnPrefix="some dnPrefix">
+ <fileSender localDn="Dublin"/>
+ <measCollec beginTime="2018-10-02T12:00:00+01:00"/>
+ </fileHeader>
+ <measData>
+ <managedElement localDn="Dublin" swVersion="r0.1"/>
+ <measInfo measInfoId="some measInfoId">
+ <job jobId="jobId"/>
+ <granPeriod duration="PT900S" endTime="2018-10-02T12:15:00Z"/>
+ <repPeriod duration="PT900S"/>
+ <measTypes></measTypes>
+ <measType p="1">a</measType>
+ <measType p="3">b</measType>
+ <measValue measObjLdn="some measObjLdn">
+ <r p="1">1</r>
+ <r p="3">2</r>
+ <suspect>false</suspect>
+ </measValue>
+ </measInfo>
+ <measInfo measInfoId="some measInfoId2">
+ <job jobId="jobId"/>
+ <granPeriod duration="PT900S" endTime="2018-10-02T12:15:00Z"/>
+ <repPeriod duration="PT900S"/>
+ <measTypes></measTypes>
+ <measType p="1">a</measType>
+ <measType p="3">b</measType>
+ <measValue measObjLdn="some measObjLdn">
+ <r p="1">1</r>
+ <r p="3">2</r>
+ <suspect>false</suspect>
+ </measValue>
+ </measInfo>
+ </measData>
+ <fileFooter>
+ <measCollec endTime="2018-10-02T12:15:00+01:00"/>
+ </fileFooter>
+</measCollecFile>
\ No newline at end of file diff --git a/src/test/resources/mapper_test/mapping_data/valid_data/meas_results.xml b/src/test/resources/mapper_test/mapping_data/valid_data/meas_results.xml index 0b76547..269fdf1 100644 --- a/src/test/resources/mapper_test/mapping_data/valid_data/meas_results.xml +++ b/src/test/resources/mapper_test/mapping_data/valid_data/meas_results.xml @@ -9,8 +9,8 @@ <managedElement swVersion="r0.1" localDn="Dublin"/> <measInfo measInfoId="some measInfoId"> <job jobId="jobId"/> - <granPeriod endTime="2018-10-02T12:15:00Z" duration="some duration"/> - <repPeriod duration="some duration"/> + <granPeriod endTime="2018-10-02T12:15:00Z" duration="PT900S"/> + <repPeriod duration="PT900S"/> <measTypes>a b c</measTypes> <measValue measObjLdn="objLdn"> <measResults>76 27 98</measResults> diff --git a/src/test/resources/mapper_test/mapping_data/valid_data/meas_type_and_r.xml b/src/test/resources/mapper_test/mapping_data/valid_data/meas_type_and_r.xml index 5f4e3c9..8ff79df 100644 --- a/src/test/resources/mapper_test/mapping_data/valid_data/meas_type_and_r.xml +++ b/src/test/resources/mapper_test/mapping_data/valid_data/meas_type_and_r.xml @@ -9,8 +9,8 @@ <managedElement swVersion="r0.1" localDn="Dublin"/> <measInfo measInfoId="some measInfoId"> <job jobId="some Job Id"/> - <granPeriod endTime="2018-10-02T12:15:00Z" duration="some duration"/> - <repPeriod duration="some duration"/> + <granPeriod endTime="2018-10-02T12:15:00Z" duration="PT900S"/> + <repPeriod duration="PT900S"/> <measType p="1">a</measType> <measType p="2">b</measType> <measType p="3">c</measType> diff --git a/src/test/resources/valid_mapper_config.json b/src/test/resources/valid_mapper_config.json index c4423ff..6cd76bd 100644 --- a/src/test/resources/valid_mapper_config.json +++ b/src/test/resources/valid_mapper_config.json @@ -1,5 +1,5 @@ {
- "pm-mapper-filter": "{ \"filters\":[]}",
+ "pm-mapper-filter": {"filters":[]},
"streams_subscribes": {
"dmaap_subscriber": {
"type": "data_router",
|