diff options
Diffstat (limited to 'src')
20 files changed, 2667 insertions, 5 deletions
diff --git a/src/main/java/org/onap/dcaegen2/services/pmmapper/filtering/MeasFilterHandler.java b/src/main/java/org/onap/dcaegen2/services/pmmapper/filtering/MeasFilterHandler.java new file mode 100644 index 0000000..a6017b6 --- /dev/null +++ b/src/main/java/org/onap/dcaegen2/services/pmmapper/filtering/MeasFilterHandler.java @@ -0,0 +1,141 @@ +/*- + * ============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 java.math.BigInteger; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; +import org.onap.dcaegen2.services.pmmapper.model.Event; +import org.onap.dcaegen2.services.pmmapper.model.MeasCollecFile; +import org.onap.dcaegen2.services.pmmapper.model.MeasCollecFile.MeasData; +import org.onap.dcaegen2.services.pmmapper.model.MeasCollecFile.MeasData.MeasInfo; +import org.onap.dcaegen2.services.pmmapper.model.MeasCollecFile.MeasData.MeasInfo.MeasType; +import org.onap.dcaegen2.services.pmmapper.model.MeasCollecFile.MeasData.MeasInfo.MeasValue; +import org.onap.dcaegen2.services.pmmapper.model.MeasCollecFile.MeasData.MeasInfo.MeasValue.R; +import org.onap.dcaegen2.services.pmmapper.model.MeasFilterConfig.Filter; +import org.onap.dcaegen2.services.pmmapper.utils.MeasConverter; +import org.onap.logging.ref.slf4j.ONAPLogAdapter; +import org.slf4j.LoggerFactory; + +/** + * Provides filtering of the contents of the 3GPP PM Measurement file. + **/ +public class MeasFilterHandler { + private static final ONAPLogAdapter logger = new ONAPLogAdapter(LoggerFactory.getLogger(MeasFilterHandler.class)); + private Filter filter; + private MeasConverter converter; + + public MeasFilterHandler(MeasConverter converter) { + this.converter = converter; + } + + public void setFilter(Filter filter) { + this.filter = filter; + } + + /** + * Filters each measInfo node for measTypes that match the given measTypes from filters. + **/ + public boolean filterByMeasType(Event event) { + logger.unwrap().debug("Filtering the measurement file."); + + MeasCollecFile measCollecFile = event.getMeasCollecFile(); + if(filter.getMeasTypes().isEmpty() || measCollecFile.getMeasData().isEmpty()) { + return false; + } + + MeasData measData = measCollecFile.getMeasData().get(0); + List<MeasInfo> measInfos = measData.getMeasInfo(); + List<MeasInfo> filteredMeasInfos = new ArrayList<>(); + + for (int i = 0; i < measInfos.size(); i++) { + MeasInfo currentMeasInfo = measInfos.get(i); + List<String> measTypesNode = currentMeasInfo.getMeasTypes(); + if(!measTypesNode.isEmpty()) { + setMeasInfosFromMeasTypes(currentMeasInfo,filteredMeasInfos); + }else { + setMeasInfoFromMeasType(currentMeasInfo,filteredMeasInfos); + } + } + + if (filteredMeasInfos.isEmpty()) { + return false; + } + + measData.setMeasInfo(filteredMeasInfos); + String filteredXMl = converter.convert(measCollecFile); + event.setBody(filteredXMl); + return true; + } + + private void setMeasInfoFromMeasType(MeasInfo currentMeasInfo, List<MeasInfo> filteredMeasInfos) { + MeasValue currentMeasValue = currentMeasInfo.getMeasValue() + .get(0); + List<R> measResultsRNodes = currentMeasValue.getR(); + Map<BigInteger, R> mappedR = measResultsRNodes.stream() + .collect(Collectors.toMap(R::getP, Function.identity())); + List<R> filteredRs = new ArrayList<>(); + List<MeasType> filteredMeasTypes = currentMeasInfo.getMeasType() + .stream().filter(mt -> { + List<String> measTypeFilters = filter.getMeasTypes(); + if (measTypeFilters.contains(mt.getValue())) { + filteredRs.add(mappedR.get(mt.getP())); + return true; + } + return false; + }) + .collect(Collectors.toList()); + if (!filteredMeasTypes.isEmpty()) { + currentMeasInfo.replaceMeasType(filteredMeasTypes); + currentMeasValue.replaceR(filteredRs); + filteredMeasInfos.add(currentMeasInfo); + } + + } + + private void setMeasInfosFromMeasTypes(MeasInfo currentMeasInfo, List<MeasInfo> filteredMeasInfos) { + MeasValue currentMeasValue = currentMeasInfo.getMeasValue() + .get(0); + List<String> measTypesNode = currentMeasInfo.getMeasTypes(); + List<String> measResultsNode = currentMeasValue.getMeasResults(); + List<String> filteredMeasResults = new ArrayList<>(); + + List<String> filteredMeasTypes = new ArrayList<>(); + for (int j = 0; j < measTypesNode.size(); j++) { + String currentMeasType = measTypesNode.get(j); + List<String> measTypeFilters = filter.getMeasTypes(); + if (measTypeFilters.contains(currentMeasType)) { + filteredMeasTypes.add(currentMeasType); + filteredMeasResults.add(measResultsNode.get(j)); + } + } + + if (!filteredMeasTypes.isEmpty()) { + currentMeasInfo.replaceMeasTypes(filteredMeasTypes); + currentMeasValue.replaceMeasResults(filteredMeasResults); + filteredMeasInfos.add(currentMeasInfo); + } + } + +} diff --git a/src/main/java/org/onap/dcaegen2/services/pmmapper/model/Event.java b/src/main/java/org/onap/dcaegen2/services/pmmapper/model/Event.java index 7a7cb1f..0e82119 100644 --- a/src/main/java/org/onap/dcaegen2/services/pmmapper/model/Event.java +++ b/src/main/java/org/onap/dcaegen2/services/pmmapper/model/Event.java @@ -40,4 +40,6 @@ public class Event { private Map<String, String> mdc; @NonNull private String publishIdentity; + + MeasCollecFile measCollecFile; } diff --git a/src/main/java/org/onap/dcaegen2/services/pmmapper/model/MapperConfig.java b/src/main/java/org/onap/dcaegen2/services/pmmapper/model/MapperConfig.java index 0412ece..2f13080 100644 --- a/src/main/java/org/onap/dcaegen2/services/pmmapper/model/MapperConfig.java +++ b/src/main/java/org/onap/dcaegen2/services/pmmapper/model/MapperConfig.java @@ -141,4 +141,7 @@ public class MapperConfig { @SerializedName("topic_url")
private String topicUrl;
}
+
+ @SerializedName("pm-mapper-filter")
+ MeasFilterConfig filterConfig;
}
\ No newline at end of file diff --git a/src/main/java/org/onap/dcaegen2/services/pmmapper/model/MeasCollecFile.java b/src/main/java/org/onap/dcaegen2/services/pmmapper/model/MeasCollecFile.java new file mode 100644 index 0000000..572b46b --- /dev/null +++ b/src/main/java/org/onap/dcaegen2/services/pmmapper/model/MeasCollecFile.java @@ -0,0 +1,1844 @@ +/*-
+ * ============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.model;
+
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlList;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlSchemaType;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
+import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import javax.xml.datatype.Duration;
+import javax.xml.datatype.XMLGregorianCalendar;
+
+/**
+ * <p>
+ * Generated Java class using XJC to represent 3GPP PM Measurement file
+ *
+ * <p>
+ * The following schema fragment specifies the expected content contained within
+ * this class.
+ *
+ * <pre>
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="fileHeader">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="fileSender">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <attribute name="localDn" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * <attribute name="elementType" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * <element name="measCollec">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <attribute name="beginTime" use="required" type="{http://www.w3.org/2001/XMLSchema}dateTime" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * </sequence>
+ * <attribute name="fileFormatVersion" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * <attribute name="vendorName" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * <attribute name="dnPrefix" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * <element name="measData" maxOccurs="unbounded" minOccurs="0">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="managedElement">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <attribute name="localDn" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * <attribute name="userLabel" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * <attribute name="swVersion" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * <element name="measInfo" maxOccurs="unbounded" minOccurs="0">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="job" minOccurs="0">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <attribute name="jobId" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * <element name="granPeriod">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <attribute name="duration" use="required" type="{http://www.w3.org/2001/XMLSchema}duration" />
+ * <attribute name="endTime" use="required" type="{http://www.w3.org/2001/XMLSchema}dateTime" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * <element name="repPeriod" minOccurs="0">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <attribute name="duration" use="required" type="{http://www.w3.org/2001/XMLSchema}duration" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * <choice>
+ * <element name="measTypes">
+ * <simpleType>
+ * <list itemType="{http://www.w3.org/2001/XMLSchema}Name" />
+ * </simpleType>
+ * </element>
+ * <element name="measType" maxOccurs="unbounded" minOccurs="0">
+ * <complexType>
+ * <simpleContent>
+ * <extension base="<http://www.w3.org/2001/XMLSchema>Name">
+ * <attribute name="p" use="required" type="{http://www.w3.org/2001/XMLSchema}positiveInteger" />
+ * </extension>
+ * </simpleContent>
+ * </complexType>
+ * </element>
+ * </choice>
+ * <element name="measValue" maxOccurs="unbounded" minOccurs="0">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <choice>
+ * <element name="measResults">
+ * <simpleType>
+ * <list itemType="{http://www.3gpp.org/ftp/specs/archive/32_series/32.435#measCollec}measResultType" />
+ * </simpleType>
+ * </element>
+ * <element name="r" maxOccurs="unbounded" minOccurs="0">
+ * <complexType>
+ * <simpleContent>
+ * <extension base="<http://www.3gpp.org/ftp/specs/archive/32_series/32.435#measCollec>measResultType">
+ * <attribute name="p" use="required" type="{http://www.w3.org/2001/XMLSchema}positiveInteger" />
+ * </extension>
+ * </simpleContent>
+ * </complexType>
+ * </element>
+ * </choice>
+ * <element name="suspect" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ * </sequence>
+ * <attribute name="measObjLdn" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * </sequence>
+ * <attribute name="measInfoId" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * <element name="fileFooter">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="measCollec">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <attribute name="endTime" use="required" type="{http://www.w3.org/2001/XMLSchema}dateTime" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "fileHeader",
+ "measData",
+ "fileFooter"
+})
+@XmlRootElement(name = "measCollecFile")
+public class MeasCollecFile {
+
+ @XmlElement(required = true)
+ protected MeasCollecFile.FileHeader fileHeader;
+ protected List<MeasCollecFile.MeasData> measData;
+ @XmlElement(required = true)
+ protected MeasCollecFile.FileFooter fileFooter;
+
+ /**
+ * Gets the value of the fileHeader property.
+ *
+ * @return
+ * possible object is
+ * {@link MeasCollecFile.FileHeader }
+ *
+ */
+ public MeasCollecFile.FileHeader getFileHeader() {
+ return fileHeader;
+ }
+
+ /**
+ * Sets the value of the fileHeader property.
+ *
+ * @param value
+ * allowed object is
+ * {@link MeasCollecFile.FileHeader }
+ *
+ */
+ public void setFileHeader(MeasCollecFile.FileHeader value) {
+ this.fileHeader = value;
+ }
+
+ /**
+ * Gets the value of the measData property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the measData property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getMeasData().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link MeasCollecFile.MeasData }
+ *
+ *
+ */
+ public List<MeasCollecFile.MeasData> getMeasData() {
+ if (measData == null) {
+ measData = new ArrayList<MeasCollecFile.MeasData>();
+ }
+ return this.measData;
+ }
+
+ /**
+ * Gets the value of the fileFooter property.
+ *
+ * @return
+ * possible object is
+ * {@link MeasCollecFile.FileFooter }
+ *
+ */
+ public MeasCollecFile.FileFooter getFileFooter() {
+ return fileFooter;
+ }
+
+ /**
+ * Sets the value of the fileFooter property.
+ *
+ * @param value
+ * allowed object is
+ * {@link MeasCollecFile.FileFooter }
+ *
+ */
+ public void setFileFooter(MeasCollecFile.FileFooter value) {
+ this.fileFooter = value;
+ }
+
+
+ /**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="measCollec">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <attribute name="endTime" use="required" type="{http://www.w3.org/2001/XMLSchema}dateTime" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+ @XmlAccessorType(XmlAccessType.FIELD)
+ @XmlType(name = "", propOrder = {
+ "measCollec"
+ })
+ public static class FileFooter {
+
+ @XmlElement(required = true)
+ protected MeasCollecFile.FileFooter.MeasCollec measCollec;
+
+ /**
+ * Gets the value of the measCollec property.
+ *
+ * @return
+ * possible object is
+ * {@link MeasCollecFile.FileFooter.MeasCollec }
+ *
+ */
+ public MeasCollecFile.FileFooter.MeasCollec getMeasCollec() {
+ return measCollec;
+ }
+
+ /**
+ * Sets the value of the measCollec property.
+ *
+ * @param value
+ * allowed object is
+ * {@link MeasCollecFile.FileFooter.MeasCollec }
+ *
+ */
+ public void setMeasCollec(MeasCollecFile.FileFooter.MeasCollec value) {
+ this.measCollec = value;
+ }
+
+
+ /**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <attribute name="endTime" use="required" type="{http://www.w3.org/2001/XMLSchema}dateTime" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+ @XmlAccessorType(XmlAccessType.FIELD)
+ @XmlType(name = "")
+ public static class MeasCollec {
+
+ @XmlAttribute(name = "endTime", required = true)
+ @XmlSchemaType(name = "dateTime")
+ protected XMLGregorianCalendar endTime;
+
+ /**
+ * Gets the value of the endTime property.
+ *
+ * @return
+ * possible object is
+ * {@link XMLGregorianCalendar }
+ *
+ */
+ public XMLGregorianCalendar getEndTime() {
+ return endTime;
+ }
+
+ /**
+ * Sets the value of the endTime property.
+ *
+ * @param value
+ * allowed object is
+ * {@link XMLGregorianCalendar }
+ *
+ */
+ public void setEndTime(XMLGregorianCalendar value) {
+ this.endTime = value;
+ }
+
+ }
+
+ }
+
+
+ /**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="fileSender">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <attribute name="localDn" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * <attribute name="elementType" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * <element name="measCollec">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <attribute name="beginTime" use="required" type="{http://www.w3.org/2001/XMLSchema}dateTime" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * </sequence>
+ * <attribute name="fileFormatVersion" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * <attribute name="vendorName" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * <attribute name="dnPrefix" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+ @XmlAccessorType(XmlAccessType.FIELD)
+ @XmlType(name = "", propOrder = {
+ "fileSender",
+ "measCollec"
+ })
+ public static class FileHeader {
+
+ @XmlElement(required = true)
+ protected MeasCollecFile.FileHeader.FileSender fileSender;
+ @XmlElement(required = true)
+ protected MeasCollecFile.FileHeader.MeasCollec measCollec;
+ @XmlAttribute(name = "fileFormatVersion", required = true)
+ protected String fileFormatVersion;
+ @XmlAttribute(name = "vendorName")
+ protected String vendorName;
+ @XmlAttribute(name = "dnPrefix")
+ protected String dnPrefix;
+
+ /**
+ * Gets the value of the fileSender property.
+ *
+ * @return
+ * possible object is
+ * {@link MeasCollecFile.FileHeader.FileSender }
+ *
+ */
+ public MeasCollecFile.FileHeader.FileSender getFileSender() {
+ return fileSender;
+ }
+
+ /**
+ * Sets the value of the fileSender property.
+ *
+ * @param value
+ * allowed object is
+ * {@link MeasCollecFile.FileHeader.FileSender }
+ *
+ */
+ public void setFileSender(MeasCollecFile.FileHeader.FileSender value) {
+ this.fileSender = value;
+ }
+
+ /**
+ * Gets the value of the measCollec property.
+ *
+ * @return
+ * possible object is
+ * {@link MeasCollecFile.FileHeader.MeasCollec }
+ *
+ */
+ public MeasCollecFile.FileHeader.MeasCollec getMeasCollec() {
+ return measCollec;
+ }
+
+ /**
+ * Sets the value of the measCollec property.
+ *
+ * @param value
+ * allowed object is
+ * {@link MeasCollecFile.FileHeader.MeasCollec }
+ *
+ */
+ public void setMeasCollec(MeasCollecFile.FileHeader.MeasCollec value) {
+ this.measCollec = value;
+ }
+
+ /**
+ * Gets the value of the fileFormatVersion property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getFileFormatVersion() {
+ return fileFormatVersion;
+ }
+
+ /**
+ * Sets the value of the fileFormatVersion property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setFileFormatVersion(String value) {
+ this.fileFormatVersion = value;
+ }
+
+ /**
+ * Gets the value of the vendorName property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getVendorName() {
+ return vendorName;
+ }
+
+ /**
+ * Sets the value of the vendorName property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setVendorName(String value) {
+ this.vendorName = value;
+ }
+
+ /**
+ * Gets the value of the dnPrefix property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getDnPrefix() {
+ return dnPrefix;
+ }
+
+ /**
+ * Sets the value of the dnPrefix property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setDnPrefix(String value) {
+ this.dnPrefix = value;
+ }
+
+
+ /**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <attribute name="localDn" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * <attribute name="elementType" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+ @XmlAccessorType(XmlAccessType.FIELD)
+ @XmlType(name = "")
+ public static class FileSender {
+
+ @XmlAttribute(name = "localDn")
+ protected String localDn;
+ @XmlAttribute(name = "elementType")
+ protected String elementType;
+
+ /**
+ * Gets the value of the localDn property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getLocalDn() {
+ return localDn;
+ }
+
+ /**
+ * Sets the value of the localDn property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setLocalDn(String value) {
+ this.localDn = value;
+ }
+
+ /**
+ * Gets the value of the elementType property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getElementType() {
+ return elementType;
+ }
+
+ /**
+ * Sets the value of the elementType property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setElementType(String value) {
+ this.elementType = value;
+ }
+
+ }
+
+
+ /**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <attribute name="beginTime" use="required" type="{http://www.w3.org/2001/XMLSchema}dateTime" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+ @XmlAccessorType(XmlAccessType.FIELD)
+ @XmlType(name = "")
+ public static class MeasCollec {
+
+ @XmlAttribute(name = "beginTime", required = true)
+ @XmlSchemaType(name = "dateTime")
+ protected XMLGregorianCalendar beginTime;
+
+ /**
+ * Gets the value of the beginTime property.
+ *
+ * @return
+ * possible object is
+ * {@link XMLGregorianCalendar }
+ *
+ */
+ public XMLGregorianCalendar getBeginTime() {
+ return beginTime;
+ }
+
+ /**
+ * Sets the value of the beginTime property.
+ *
+ * @param value
+ * allowed object is
+ * {@link XMLGregorianCalendar }
+ *
+ */
+ public void setBeginTime(XMLGregorianCalendar value) {
+ this.beginTime = value;
+ }
+
+ }
+
+ }
+
+
+ /**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="managedElement">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <attribute name="localDn" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * <attribute name="userLabel" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * <attribute name="swVersion" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * <element name="measInfo" maxOccurs="unbounded" minOccurs="0">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="job" minOccurs="0">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <attribute name="jobId" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * <element name="granPeriod">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <attribute name="duration" use="required" type="{http://www.w3.org/2001/XMLSchema}duration" />
+ * <attribute name="endTime" use="required" type="{http://www.w3.org/2001/XMLSchema}dateTime" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * <element name="repPeriod" minOccurs="0">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <attribute name="duration" use="required" type="{http://www.w3.org/2001/XMLSchema}duration" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * <choice>
+ * <element name="measTypes">
+ * <simpleType>
+ * <list itemType="{http://www.w3.org/2001/XMLSchema}Name" />
+ * </simpleType>
+ * </element>
+ * <element name="measType" maxOccurs="unbounded" minOccurs="0">
+ * <complexType>
+ * <simpleContent>
+ * <extension base="<http://www.w3.org/2001/XMLSchema>Name">
+ * <attribute name="p" use="required" type="{http://www.w3.org/2001/XMLSchema}positiveInteger" />
+ * </extension>
+ * </simpleContent>
+ * </complexType>
+ * </element>
+ * </choice>
+ * <element name="measValue" maxOccurs="unbounded" minOccurs="0">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <choice>
+ * <element name="measResults">
+ * <simpleType>
+ * <list itemType="{http://www.3gpp.org/ftp/specs/archive/32_series/32.435#measCollec}measResultType" />
+ * </simpleType>
+ * </element>
+ * <element name="r" maxOccurs="unbounded" minOccurs="0">
+ * <complexType>
+ * <simpleContent>
+ * <extension base="<http://www.3gpp.org/ftp/specs/archive/32_series/32.435#measCollec>measResultType">
+ * <attribute name="p" use="required" type="{http://www.w3.org/2001/XMLSchema}positiveInteger" />
+ * </extension>
+ * </simpleContent>
+ * </complexType>
+ * </element>
+ * </choice>
+ * <element name="suspect" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ * </sequence>
+ * <attribute name="measObjLdn" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * </sequence>
+ * <attribute name="measInfoId" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+ @XmlAccessorType(XmlAccessType.FIELD)
+ @XmlType(name = "", propOrder = {
+ "managedElement",
+ "measInfo"
+ })
+ public static class MeasData {
+
+ @XmlElement(required = true)
+ protected MeasCollecFile.MeasData.ManagedElement managedElement;
+ protected List<MeasCollecFile.MeasData.MeasInfo> measInfo;
+
+ /**
+ * Gets the value of the managedElement property.
+ *
+ * @return
+ * possible object is
+ * {@link MeasCollecFile.MeasData.ManagedElement }
+ *
+ */
+ public MeasCollecFile.MeasData.ManagedElement getManagedElement() {
+ return managedElement;
+ }
+
+ /**
+ * Sets the value of the managedElement property.
+ *
+ * @param value
+ * allowed object is
+ * {@link MeasCollecFile.MeasData.ManagedElement }
+ *
+ */
+ public void setManagedElement(MeasCollecFile.MeasData.ManagedElement value) {
+ this.managedElement = value;
+ }
+
+ /**
+ * Gets the value of the measInfo property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the measInfo property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getMeasInfo().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link MeasCollecFile.MeasData.MeasInfo }
+ *
+ *
+ */
+ public List<MeasCollecFile.MeasData.MeasInfo> getMeasInfo() {
+ if (measInfo == null) {
+ measInfo = new ArrayList<MeasCollecFile.MeasData.MeasInfo>();
+ }
+ return this.measInfo;
+ }
+
+
+ /**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <attribute name="localDn" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * <attribute name="userLabel" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * <attribute name="swVersion" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+ @XmlAccessorType(XmlAccessType.FIELD)
+ @XmlType(name = "")
+ public static class ManagedElement {
+
+ @XmlAttribute(name = "localDn")
+ protected String localDn;
+ @XmlAttribute(name = "userLabel")
+ protected String userLabel;
+ @XmlAttribute(name = "swVersion")
+ protected String swVersion;
+
+ /**
+ * Gets the value of the localDn property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getLocalDn() {
+ return localDn;
+ }
+
+ /**
+ * Sets the value of the localDn property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setLocalDn(String value) {
+ this.localDn = value;
+ }
+
+ /**
+ * Gets the value of the userLabel property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getUserLabel() {
+ return userLabel;
+ }
+
+ /**
+ * Sets the value of the userLabel property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setUserLabel(String value) {
+ this.userLabel = value;
+ }
+
+ /**
+ * Gets the value of the swVersion property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getSwVersion() {
+ return swVersion;
+ }
+
+ /**
+ * Sets the value of the swVersion property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setSwVersion(String value) {
+ this.swVersion = value;
+ }
+
+ }
+
+
+ /**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="job" minOccurs="0">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <attribute name="jobId" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * <element name="granPeriod">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <attribute name="duration" use="required" type="{http://www.w3.org/2001/XMLSchema}duration" />
+ * <attribute name="endTime" use="required" type="{http://www.w3.org/2001/XMLSchema}dateTime" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * <element name="repPeriod" minOccurs="0">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <attribute name="duration" use="required" type="{http://www.w3.org/2001/XMLSchema}duration" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * <choice>
+ * <element name="measTypes">
+ * <simpleType>
+ * <list itemType="{http://www.w3.org/2001/XMLSchema}Name" />
+ * </simpleType>
+ * </element>
+ * <element name="measType" maxOccurs="unbounded" minOccurs="0">
+ * <complexType>
+ * <simpleContent>
+ * <extension base="<http://www.w3.org/2001/XMLSchema>Name">
+ * <attribute name="p" use="required" type="{http://www.w3.org/2001/XMLSchema}positiveInteger" />
+ * </extension>
+ * </simpleContent>
+ * </complexType>
+ * </element>
+ * </choice>
+ * <element name="measValue" maxOccurs="unbounded" minOccurs="0">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <choice>
+ * <element name="measResults">
+ * <simpleType>
+ * <list itemType="{http://www.3gpp.org/ftp/specs/archive/32_series/32.435#measCollec}measResultType" />
+ * </simpleType>
+ * </element>
+ * <element name="r" maxOccurs="unbounded" minOccurs="0">
+ * <complexType>
+ * <simpleContent>
+ * <extension base="<http://www.3gpp.org/ftp/specs/archive/32_series/32.435#measCollec>measResultType">
+ * <attribute name="p" use="required" type="{http://www.w3.org/2001/XMLSchema}positiveInteger" />
+ * </extension>
+ * </simpleContent>
+ * </complexType>
+ * </element>
+ * </choice>
+ * <element name="suspect" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ * </sequence>
+ * <attribute name="measObjLdn" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * </sequence>
+ * <attribute name="measInfoId" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+ @XmlAccessorType(XmlAccessType.FIELD)
+ @XmlType(name = "", propOrder = {
+ "job",
+ "granPeriod",
+ "repPeriod",
+ "measTypes",
+ "measType",
+ "measValue"
+ })
+ public static class MeasInfo {
+
+ protected MeasCollecFile.MeasData.MeasInfo.Job job;
+ @XmlElement(required = true)
+ protected MeasCollecFile.MeasData.MeasInfo.GranPeriod granPeriod;
+ protected MeasCollecFile.MeasData.MeasInfo.RepPeriod repPeriod;
+ @XmlList
+ protected List<String> measTypes;
+ protected List<MeasCollecFile.MeasData.MeasInfo.MeasType> measType;
+ protected List<MeasCollecFile.MeasData.MeasInfo.MeasValue> measValue;
+ @XmlAttribute(name = "measInfoId")
+ protected String measInfoId;
+
+ /**
+ * Gets the value of the job property.
+ *
+ * @return
+ * possible object is
+ * {@link MeasCollecFile.MeasData.MeasInfo.Job }
+ *
+ */
+ public MeasCollecFile.MeasData.MeasInfo.Job getJob() {
+ return job;
+ }
+
+ /**
+ * Sets the value of the job property.
+ *
+ * @param value
+ * allowed object is
+ * {@link MeasCollecFile.MeasData.MeasInfo.Job }
+ *
+ */
+ public void setJob(MeasCollecFile.MeasData.MeasInfo.Job value) {
+ this.job = value;
+ }
+
+ /**
+ * Gets the value of the granPeriod property.
+ *
+ * @return
+ * possible object is
+ * {@link MeasCollecFile.MeasData.MeasInfo.GranPeriod }
+ *
+ */
+ public MeasCollecFile.MeasData.MeasInfo.GranPeriod getGranPeriod() {
+ return granPeriod;
+ }
+
+ /**
+ * Sets the value of the granPeriod property.
+ *
+ * @param value
+ * allowed object is
+ * {@link MeasCollecFile.MeasData.MeasInfo.GranPeriod }
+ *
+ */
+ public void setGranPeriod(MeasCollecFile.MeasData.MeasInfo.GranPeriod value) {
+ this.granPeriod = value;
+ }
+
+ /**
+ * Gets the value of the repPeriod property.
+ *
+ * @return
+ * possible object is
+ * {@link MeasCollecFile.MeasData.MeasInfo.RepPeriod }
+ *
+ */
+ public MeasCollecFile.MeasData.MeasInfo.RepPeriod getRepPeriod() {
+ return repPeriod;
+ }
+
+ /**
+ * Sets the value of the repPeriod property.
+ *
+ * @param value
+ * allowed object is
+ * {@link MeasCollecFile.MeasData.MeasInfo.RepPeriod }
+ *
+ */
+ public void setRepPeriod(MeasCollecFile.MeasData.MeasInfo.RepPeriod value) {
+ this.repPeriod = value;
+ }
+
+ /**
+ * Gets the value of the measTypes property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the measTypes property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getMeasTypes().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link String }
+ *
+ *
+ */
+ public List<String> getMeasTypes() {
+ if (measTypes == null) {
+ measTypes = new ArrayList<String>();
+ }
+ return this.measTypes;
+ }
+
+ /**
+ * Gets the value of the measType property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the measType property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getMeasType().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link MeasCollecFile.MeasData.MeasInfo.MeasType }
+ *
+ *
+ */
+ public List<MeasCollecFile.MeasData.MeasInfo.MeasType> getMeasType() {
+ if (measType == null) {
+ measType = new ArrayList<MeasCollecFile.MeasData.MeasInfo.MeasType>();
+ }
+ return this.measType;
+ }
+
+ /**
+ * Gets the value of the measValue property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the measValue property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getMeasValue().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link MeasCollecFile.MeasData.MeasInfo.MeasValue }
+ *
+ *
+ */
+ public List<MeasCollecFile.MeasData.MeasInfo.MeasValue> getMeasValue() {
+ if (measValue == null) {
+ measValue = new ArrayList<MeasCollecFile.MeasData.MeasInfo.MeasValue>();
+ }
+ return this.measValue;
+ }
+
+ /**
+ * Gets the value of the measInfoId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getMeasInfoId() {
+ return measInfoId;
+ }
+
+ /**
+ * Sets the value of the measInfoId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setMeasInfoId(String value) {
+ this.measInfoId = value;
+ }
+
+
+ /**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <attribute name="duration" use="required" type="{http://www.w3.org/2001/XMLSchema}duration" />
+ * <attribute name="endTime" use="required" type="{http://www.w3.org/2001/XMLSchema}dateTime" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+ @XmlAccessorType(XmlAccessType.FIELD)
+ @XmlType(name = "")
+ public static class GranPeriod {
+
+ @XmlAttribute(name = "duration", required = true)
+ protected Duration duration;
+ @XmlAttribute(name = "endTime", required = true)
+ @XmlSchemaType(name = "dateTime")
+ protected XMLGregorianCalendar endTime;
+
+ /**
+ * Gets the value of the duration property.
+ *
+ * @return
+ * possible object is
+ * {@link Duration }
+ *
+ */
+ public Duration getDuration() {
+ return duration;
+ }
+
+ /**
+ * Sets the value of the duration property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Duration }
+ *
+ */
+ public void setDuration(Duration value) {
+ this.duration = value;
+ }
+
+ /**
+ * Gets the value of the endTime property.
+ *
+ * @return
+ * possible object is
+ * {@link XMLGregorianCalendar }
+ *
+ */
+ public XMLGregorianCalendar getEndTime() {
+ return endTime;
+ }
+
+ /**
+ * Sets the value of the endTime property.
+ *
+ * @param value
+ * allowed object is
+ * {@link XMLGregorianCalendar }
+ *
+ */
+ public void setEndTime(XMLGregorianCalendar value) {
+ this.endTime = value;
+ }
+
+ }
+
+
+ /**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <attribute name="jobId" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+ @XmlAccessorType(XmlAccessType.FIELD)
+ @XmlType(name = "")
+ public static class Job {
+
+ @XmlAttribute(name = "jobId", required = true)
+ protected String jobId;
+
+ /**
+ * Gets the value of the jobId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getJobId() {
+ return jobId;
+ }
+
+ /**
+ * Sets the value of the jobId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setJobId(String value) {
+ this.jobId = value;
+ }
+
+ }
+
+
+ /**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType>
+ * <simpleContent>
+ * <extension base="<http://www.w3.org/2001/XMLSchema>Name">
+ * <attribute name="p" use="required" type="{http://www.w3.org/2001/XMLSchema}positiveInteger" />
+ * </extension>
+ * </simpleContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+ @XmlAccessorType(XmlAccessType.FIELD)
+ @XmlType(name = "", propOrder = {
+ "value"
+ })
+ public static class MeasType {
+
+ @XmlValue
+ @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
+ @XmlSchemaType(name = "Name")
+ protected String value;
+ @XmlAttribute(name = "p", required = true)
+ @XmlSchemaType(name = "positiveInteger")
+ protected BigInteger p;
+
+ /**
+ * Gets the value of the value property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * Sets the value of the value property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ /**
+ * Gets the value of the p property.
+ *
+ * @return
+ * possible object is
+ * {@link BigInteger }
+ *
+ */
+ public BigInteger getP() {
+ return p;
+ }
+
+ /**
+ * Sets the value of the p property.
+ *
+ * @param value
+ * allowed object is
+ * {@link BigInteger }
+ *
+ */
+ public void setP(BigInteger value) {
+ this.p = value;
+ }
+
+ }
+
+
+ /**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <choice>
+ * <element name="measResults">
+ * <simpleType>
+ * <list itemType="{http://www.3gpp.org/ftp/specs/archive/32_series/32.435#measCollec}measResultType" />
+ * </simpleType>
+ * </element>
+ * <element name="r" maxOccurs="unbounded" minOccurs="0">
+ * <complexType>
+ * <simpleContent>
+ * <extension base="<http://www.3gpp.org/ftp/specs/archive/32_series/32.435#measCollec>measResultType">
+ * <attribute name="p" use="required" type="{http://www.w3.org/2001/XMLSchema}positiveInteger" />
+ * </extension>
+ * </simpleContent>
+ * </complexType>
+ * </element>
+ * </choice>
+ * <element name="suspect" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ * </sequence>
+ * <attribute name="measObjLdn" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+ @XmlAccessorType(XmlAccessType.FIELD)
+ @XmlType(name = "", propOrder = {
+ "measResults",
+ "r",
+ "suspect"
+ })
+ public static class MeasValue {
+
+ @XmlList
+ protected List<String> measResults;
+ protected List<MeasCollecFile.MeasData.MeasInfo.MeasValue.R> r;
+ protected Boolean suspect;
+ @XmlAttribute(name = "measObjLdn", required = true)
+ protected String measObjLdn;
+
+ /**
+ * Gets the value of the measResults property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the measResults property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getMeasResults().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link String }
+ *
+ *
+ */
+ public List<String> getMeasResults() {
+ if (measResults == null) {
+ measResults = new ArrayList<String>();
+ }
+ return this.measResults;
+ }
+
+ /**
+ * Gets the value of the r property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the r property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getR().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link MeasCollecFile.MeasData.MeasInfo.MeasValue.R }
+ *
+ *
+ */
+ public List<MeasCollecFile.MeasData.MeasInfo.MeasValue.R> getR() {
+ if (r == null) {
+ r = new ArrayList<MeasCollecFile.MeasData.MeasInfo.MeasValue.R>();
+ }
+ return this.r;
+ }
+
+ /**
+ * Gets the value of the suspect property.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public Boolean isSuspect() {
+ return suspect;
+ }
+
+ /**
+ * Sets the value of the suspect property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setSuspect(Boolean value) {
+ this.suspect = value;
+ }
+
+ /**
+ * Gets the value of the measObjLdn property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getMeasObjLdn() {
+ return measObjLdn;
+ }
+
+ /**
+ * Sets the value of the measObjLdn property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setMeasObjLdn(String value) {
+ this.measObjLdn = value;
+ }
+
+
+ /**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType>
+ * <simpleContent>
+ * <extension base="<http://www.3gpp.org/ftp/specs/archive/32_series/32.435#measCollec>measResultType">
+ * <attribute name="p" use="required" type="{http://www.w3.org/2001/XMLSchema}positiveInteger" />
+ * </extension>
+ * </simpleContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+ @XmlAccessorType(XmlAccessType.FIELD)
+ @XmlType(name = "", propOrder = {
+ "value"
+ })
+ public static class R {
+
+ @XmlValue
+ protected String value;
+ @XmlAttribute(name = "p", required = true)
+ @XmlSchemaType(name = "positiveInteger")
+ protected BigInteger p;
+
+ /**
+ * Gets the value of the value property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * Sets the value of the value property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ /**
+ * Gets the value of the p property.
+ *
+ * @return
+ * possible object is
+ * {@link BigInteger }
+ *
+ */
+ public BigInteger getP() {
+ return p;
+ }
+
+ /**
+ * Sets the value of the p property.
+ *
+ * @param value
+ * allowed object is
+ * {@link BigInteger }
+ *
+ */
+ public void setP(BigInteger value) {
+ this.p = value;
+ }
+
+ }
+
+
+ public void replaceR(List<R> filteredRs) {
+ this.r = filteredRs;
+
+ }
+
+ public void replaceMeasResults(List<String> filteredMeasResults) {
+ this.measResults = filteredMeasResults;
+
+ }
+
+ }
+
+
+ /**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <attribute name="duration" use="required" type="{http://www.w3.org/2001/XMLSchema}duration" />
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+ @XmlAccessorType(XmlAccessType.FIELD)
+ @XmlType(name = "")
+ public static class RepPeriod {
+
+ @XmlAttribute(name = "duration", required = true)
+ protected Duration duration;
+
+ /**
+ * Gets the value of the duration property.
+ *
+ * @return
+ * possible object is
+ * {@link Duration }
+ *
+ */
+ public Duration getDuration() {
+ return duration;
+ }
+
+ /**
+ * Sets the value of the duration property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Duration }
+ *
+ */
+ public void setDuration(Duration value) {
+ this.duration = value;
+ }
+ }
+
+
+ public void replaceMeasTypes(List<String> newMeasTypes) {
+ this.measTypes = newMeasTypes;
+ }
+
+ public void replaceMeasType(List<MeasType> filteredMeasTypes) {
+ this.measType = filteredMeasTypes;
+ }
+
+ }
+
+
+ public void setMeasInfo(List<MeasInfo> filteredMeasInfos) {
+ this.measInfo = filteredMeasInfos;
+ }
+
+ }
+
+}
diff --git a/src/main/java/org/onap/dcaegen2/services/pmmapper/model/MeasFilterConfig.java b/src/main/java/org/onap/dcaegen2/services/pmmapper/model/MeasFilterConfig.java new file mode 100644 index 0000000..458a6cd --- /dev/null +++ b/src/main/java/org/onap/dcaegen2/services/pmmapper/model/MeasFilterConfig.java @@ -0,0 +1,53 @@ +/*-
+ * ============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.model;
+
+import java.util.List;
+import com.google.gson.annotations.SerializedName;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+
+@Data
+@EqualsAndHashCode
+@NoArgsConstructor
+public class MeasFilterConfig {
+
+ @SerializedName("filters")
+ public List<Filter> filters;
+
+ @Data
+ public class Filter {
+ @SerializedName("pmDefVsn")
+ private String dictionaryVersion;
+
+ @SerializedName("nfType")
+ private String nfType;
+
+ @SerializedName("vendor")
+ private String vendor;
+
+ @SerializedName("measTypes")
+ private List<String> measTypes;
+
+ }
+}
diff --git a/src/main/java/org/onap/dcaegen2/services/pmmapper/model/package-info.java b/src/main/java/org/onap/dcaegen2/services/pmmapper/model/package-info.java new file mode 100644 index 0000000..92c83be --- /dev/null +++ b/src/main/java/org/onap/dcaegen2/services/pmmapper/model/package-info.java @@ -0,0 +1,24 @@ +/*-
+ * ============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=========================================================
+ */
+
+@XmlSchema(namespace = "http://www.3gpp.org/ftp/specs/archive/32_series/32.435#measCollec", elementFormDefault = XmlNsForm.QUALIFIED)
+package org.onap.dcaegen2.services.pmmapper.model;
+import javax.xml.bind.annotation.XmlSchema;
+import javax.xml.bind.annotation.XmlNsForm;
\ No newline at end of file diff --git a/src/main/java/org/onap/dcaegen2/services/pmmapper/utils/MeasConverter.java b/src/main/java/org/onap/dcaegen2/services/pmmapper/utils/MeasConverter.java new file mode 100644 index 0000000..b9c01e6 --- /dev/null +++ b/src/main/java/org/onap/dcaegen2/services/pmmapper/utils/MeasConverter.java @@ -0,0 +1,76 @@ +/*-
+ * ============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 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.onap.dcaegen2.services.pmmapper.exceptions.MappingException;
+import org.onap.dcaegen2.services.pmmapper.model.MeasCollecFile;
+import org.onap.logging.ref.slf4j.ONAPLogAdapter;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Converts 3GPP PM Measurement xml string to MeasCollecFil and vice versa.
+ **/
+public class MeasConverter {
+ private static final ONAPLogAdapter logger = new ONAPLogAdapter(LoggerFactory.getLogger(MeasConverter.class));
+
+ /**
+ * Converts 3GPP Measurement xml string to MeasCollecFile.
+ **/
+ public MeasCollecFile convert(String eventBody) {
+ logger.unwrap().debug("Converting 3GPP xml string to MeasCollecFile");
+ MeasCollecFile measCollecFile = null;
+ try {
+ JAXBContext jaxbContext = null;
+ jaxbContext = JAXBContext.newInstance(MeasCollecFile.class);
+ Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
+ measCollecFile = (MeasCollecFile) unmarshaller.unmarshal(new StringReader(eventBody));
+ } catch (JAXBException e) {
+ throw new MappingException("Unable to convert 3GPP xml to MeasCollecFile", e);
+ }
+ return measCollecFile;
+ }
+
+ /**
+ * Converts MeasCollecFile to 3GPP Measurement xml string.
+ **/
+ public String convert(MeasCollecFile measCollecFile) {
+ logger.unwrap().debug("Converting MeasCollecFile to 3GPP xml string");
+ StringWriter writer = new StringWriter();
+ try {
+ JAXBContext jaxbContext = JAXBContext.newInstance(MeasCollecFile.class);
+ Marshaller marshaller = jaxbContext.createMarshaller();
+ marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
+ marshaller.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE);
+ marshaller.marshal(measCollecFile, writer);
+ } catch (JAXBException e) {
+ throw new MappingException("Unable to convert MeasCollecFile to 3GPP xml", e);
+ }
+ return writer.toString();
+ }
+}
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",
|