summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorHenrik Andersson <henrik.b.andersson@est.tech>2019-04-02 12:21:37 +0000
committerGerrit Code Review <gerrit@onap.org>2019-04-02 12:21:37 +0000
commit03e519407ccc47e51efbbfb26cca339f90cbff1b (patch)
tree5e680b42c3e945b1af147c02eef9afb5795a8917 /src/main
parent36605ed860a6eb7fca09156c6e8ae6ebf5259ea3 (diff)
parent988fa778eb2415a7ae8f1b30df67ebc38eee4665 (diff)
Merge "Fix mapping issue with type C files"
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/onap/dcaegen2/services/pmmapper/App.java2
-rw-r--r--src/main/java/org/onap/dcaegen2/services/pmmapper/mapping/Mapper.java8
2 files changed, 7 insertions, 3 deletions
diff --git a/src/main/java/org/onap/dcaegen2/services/pmmapper/App.java b/src/main/java/org/onap/dcaegen2/services/pmmapper/App.java
index b213a45..b52a5f1 100644
--- a/src/main/java/org/onap/dcaegen2/services/pmmapper/App.java
+++ b/src/main/java/org/onap/dcaegen2/services/pmmapper/App.java
@@ -71,7 +71,7 @@ public class App {
MetadataFilter metadataFilter = new MetadataFilter(mapperConfig);
MeasConverter measConverter = new MeasConverter();
MeasFilterHandler filterHandler = new MeasFilterHandler(measConverter);
- Mapper mapper = new Mapper(mappingTemplate);
+ Mapper mapper = new Mapper(mappingTemplate, measConverter);
MeasSplitter splitter = new MeasSplitter(measConverter);
XMLValidator validator = new XMLValidator(xmlSchema);
VESPublisher vesPublisher = new VESPublisher(mapperConfig);
diff --git a/src/main/java/org/onap/dcaegen2/services/pmmapper/mapping/Mapper.java b/src/main/java/org/onap/dcaegen2/services/pmmapper/mapping/Mapper.java
index 44bbc27..a9b7e86 100644
--- a/src/main/java/org/onap/dcaegen2/services/pmmapper/mapping/Mapper.java
+++ b/src/main/java/org/onap/dcaegen2/services/pmmapper/mapping/Mapper.java
@@ -28,6 +28,7 @@ import lombok.NonNull;
import org.onap.dcaegen2.services.pmmapper.exceptions.MappingException;
import org.onap.dcaegen2.services.pmmapper.exceptions.XMLParseException;
import org.onap.dcaegen2.services.pmmapper.model.Event;
+import org.onap.dcaegen2.services.pmmapper.utils.MeasConverter;
import org.onap.logging.ref.slf4j.ONAPLogAdapter;
import org.slf4j.LoggerFactory;
import org.xml.sax.InputSource;
@@ -49,9 +50,11 @@ import java.util.UUID;
public class Mapper {
private static final ONAPLogAdapter logger = new ONAPLogAdapter(LoggerFactory.getLogger(Mapper.class));
private Template mappingTemplate;
+ private MeasConverter converter;
- public Mapper(@NonNull Path pathToTemplate) {
+ public Mapper(@NonNull Path pathToTemplate, MeasConverter converter) {
logger.unwrap().trace("Constructing Mapper from {}", pathToTemplate);
+ this.converter = converter;
Configuration configuration = new Configuration(Configuration.VERSION_2_3_28);
configuration.setTagSyntax(Configuration.ANGLE_BRACKET_TAG_SYNTAX);
try {
@@ -72,7 +75,8 @@ public class Mapper {
logger.unwrap().info("Mapping event");
NodeModel pmNodeModel;
try {
- pmNodeModel = NodeModel.parse(new InputSource(new StringReader(event.getBody())));
+ String measCollecFile = converter.convert(event.getMeasCollecFile());
+ pmNodeModel = NodeModel.parse(new InputSource(new StringReader(measCollecFile)));
} catch (IOException | SAXException | ParserConfigurationException exception) {
logger.unwrap().error("Failed to parse input as XML", exception);
throw new XMLParseException("Failed to parse input as XML", exception);