summaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authoremartin <ephraim.martin@est.tech>2019-04-02 09:17:33 +0000
committeremartin <ephraim.martin@est.tech>2019-04-02 09:17:33 +0000
commit988fa778eb2415a7ae8f1b30df67ebc38eee4665 (patch)
tree51c562886d34e7f6ede400e4c538e597984c94e3 /src/main/java
parenta7da4421da0595dfadf6853f96b2d5f04ff35ec2 (diff)
Fix mapping issue with type C files
Change-Id: I698b84989dc928a09ff5e1c54adf236edd40b622 Issue-ID: DCAEGEN2-1038 Signed-off-by: emartin <ephraim.martin@est.tech>
Diffstat (limited to 'src/main/java')
-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 03d42d5..b411fd7 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);