diff options
author | liamfallon <liam.fallon@ericsson.com> | 2018-06-13 16:50:59 +0100 |
---|---|---|
committer | liamfallon <liam.fallon@ericsson.com> | 2018-06-14 11:22:00 +0100 |
commit | 4fcf04234e5e1b1d4338f12d982a45edf317d795 (patch) | |
tree | a17fb2a9dd70064145312b75c9d1019086cb11c1 /plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/src | |
parent | 2e1da7176952e013276ef29638a313f3a1b49c00 (diff) |
Add YAML plugin and cleanup for checkstyle
Bringing in the APEX YAML plugin, allows events with YAML bodies
to be consumed by APEX.
Also clean up of event protocol interface to make it not specific
for JSON.
Also some checkstyle changes on classes impacted by event
protocol interface change.
Change-Id: I7c3867ac508096fd8acad2488e61db87dfa1d6bd
Issue-ID: POLICY-862
Signed-off-by: liamfallon <liam.fallon@ericsson.com>
Diffstat (limited to 'plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/src')
2 files changed, 22 insertions, 22 deletions
diff --git a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/src/main/java/org/onap/policy/apex/plugins/event/protocol/xml/XMLEventProtocolParameters.java b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/src/main/java/org/onap/policy/apex/plugins/event/protocol/xml/XMLEventProtocolParameters.java index e96a3f5d5..0eeb497a1 100644 --- a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/src/main/java/org/onap/policy/apex/plugins/event/protocol/xml/XMLEventProtocolParameters.java +++ b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/src/main/java/org/onap/policy/apex/plugins/event/protocol/xml/XMLEventProtocolParameters.java @@ -45,7 +45,7 @@ public class XMLEventProtocolParameters extends EventProtocolTextTokenDelimitedP this.setLabel(XML_EVENT_PROTOCOL_LABEL); // Set the starting and ending delimiters for text blocks of XML events - this.setDelimiterToken(XML_TEXT_DELIMITER_TOKEN); + this.setStartDelimiterToken(XML_TEXT_DELIMITER_TOKEN); // Set the event protocol plugin class this.setEventProtocolPluginClass(Apex2XMLEventConverter.class.getCanonicalName()); diff --git a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/src/test/java/org/onap/policy/apex/plugins/event/protocol/xml/TestXMLTaggedEventConsumer.java b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/src/test/java/org/onap/policy/apex/plugins/event/protocol/xml/TestXMLTaggedEventConsumer.java index 761357a1d..e02c86a45 100644 --- a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/src/test/java/org/onap/policy/apex/plugins/event/protocol/xml/TestXMLTaggedEventConsumer.java +++ b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/src/test/java/org/onap/policy/apex/plugins/event/protocol/xml/TestXMLTaggedEventConsumer.java @@ -41,7 +41,7 @@ public class TestXMLTaggedEventConsumer { public void testGarbageTextLine() throws IOException { final InputStream xmlInputStream = new ByteArrayInputStream("hello there".getBytes()); - final HeaderDelimitedTextBlockReader xmlTaggedReader = new HeaderDelimitedTextBlockReader("<?xml"); + final HeaderDelimitedTextBlockReader xmlTaggedReader = new HeaderDelimitedTextBlockReader("<?xml", null, true); xmlTaggedReader.init(xmlInputStream); final TextBlock textBlock = xmlTaggedReader.readTextBlock(); @@ -54,7 +54,7 @@ public class TestXMLTaggedEventConsumer { final InputStream xmlInputStream = new ByteArrayInputStream("1469781869268</TestTimestamp></MainTag>".getBytes()); - final HeaderDelimitedTextBlockReader xmlTaggedReader = new HeaderDelimitedTextBlockReader("<?xml"); + final HeaderDelimitedTextBlockReader xmlTaggedReader = new HeaderDelimitedTextBlockReader("<?xml", null, true); xmlTaggedReader.init(xmlInputStream); final TextBlock textBlock = xmlTaggedReader.readTextBlock(); @@ -67,7 +67,7 @@ public class TestXMLTaggedEventConsumer { final InputStream xmlInputStream = new ByteArrayInputStream( "<?xml><MainTag><TestTimestamp>1469781869268</TestTimestamp></MainTag>".getBytes()); - final HeaderDelimitedTextBlockReader xmlTaggedReader = new HeaderDelimitedTextBlockReader("<?xml"); + final HeaderDelimitedTextBlockReader xmlTaggedReader = new HeaderDelimitedTextBlockReader("<?xml", null, true); xmlTaggedReader.init(xmlInputStream); final TextBlock textBlock = xmlTaggedReader.readTextBlock(); @@ -80,7 +80,7 @@ public class TestXMLTaggedEventConsumer { final InputStream xmlInputStream = new ByteArrayInputStream( "Garbage<?xml><MainTag><TestTimestamp>1469781869268</TestTimestamp></MainTag>".getBytes()); - final HeaderDelimitedTextBlockReader xmlTaggedReader = new HeaderDelimitedTextBlockReader("<?xml"); + final HeaderDelimitedTextBlockReader xmlTaggedReader = new HeaderDelimitedTextBlockReader("<?xml", null, true); xmlTaggedReader.init(xmlInputStream); final TextBlock textBlock = xmlTaggedReader.readTextBlock(); @@ -92,7 +92,7 @@ public class TestXMLTaggedEventConsumer { final InputStream xmlInputStream = new ByteArrayInputStream( "Garbage<?xml><MainTag><TestTimestamp>1469781869268</TestTimestamp></MainTag>Rubbish".getBytes()); - final HeaderDelimitedTextBlockReader xmlTaggedReader = new HeaderDelimitedTextBlockReader("<?xml"); + final HeaderDelimitedTextBlockReader xmlTaggedReader = new HeaderDelimitedTextBlockReader("<?xml", null, true); xmlTaggedReader.init(xmlInputStream); final TextBlock textBlock = xmlTaggedReader.readTextBlock(); @@ -104,7 +104,7 @@ public class TestXMLTaggedEventConsumer { final InputStream xmlInputStream = new ByteArrayInputStream( "<?xml><MainTag><TestTimestamp>1469781869268</TestTimestamp></MainTag>Rubbish".getBytes()); - final HeaderDelimitedTextBlockReader xmlTaggedReader = new HeaderDelimitedTextBlockReader("<?xml"); + final HeaderDelimitedTextBlockReader xmlTaggedReader = new HeaderDelimitedTextBlockReader("<?xml", null, true); xmlTaggedReader.init(xmlInputStream); final TextBlock textBlock = xmlTaggedReader.readTextBlock(); @@ -117,7 +117,7 @@ public class TestXMLTaggedEventConsumer { public void testGarbageTextMultiLine() throws IOException { final InputStream xmlInputStream = new ByteArrayInputStream("hello\nthere".getBytes()); - final HeaderDelimitedTextBlockReader xmlTaggedReader = new HeaderDelimitedTextBlockReader("<?xml"); + final HeaderDelimitedTextBlockReader xmlTaggedReader = new HeaderDelimitedTextBlockReader("<?xml", null, true); xmlTaggedReader.init(xmlInputStream); final TextBlock textBlock = xmlTaggedReader.readTextBlock(); @@ -129,7 +129,7 @@ public class TestXMLTaggedEventConsumer { final InputStream xmlInputStream = new ByteArrayInputStream("1469781869268\n</TestTimestamp>\n</MainTag>".getBytes()); - final HeaderDelimitedTextBlockReader xmlTaggedReader = new HeaderDelimitedTextBlockReader("<?xml"); + final HeaderDelimitedTextBlockReader xmlTaggedReader = new HeaderDelimitedTextBlockReader("<?xml", null, true); xmlTaggedReader.init(xmlInputStream); final TextBlock textBlock = xmlTaggedReader.readTextBlock(); @@ -141,7 +141,7 @@ public class TestXMLTaggedEventConsumer { final InputStream xmlInputStream = new ByteArrayInputStream( "<?xml>\n<MainTag>\n<TestTimestamp>1469781869268</TestTimestamp>\n</MainTag>\n\n".getBytes()); - final HeaderDelimitedTextBlockReader xmlTaggedReader = new HeaderDelimitedTextBlockReader("<?xml"); + final HeaderDelimitedTextBlockReader xmlTaggedReader = new HeaderDelimitedTextBlockReader("<?xml", null, true); xmlTaggedReader.init(xmlInputStream); final TextBlock textBlock = xmlTaggedReader.readTextBlock(); @@ -155,7 +155,7 @@ public class TestXMLTaggedEventConsumer { final InputStream xmlInputStream = new ByteArrayInputStream( "Garbage\n<?xml>\n<MainTag>\n<TestTimestamp>1469781869268</TestTimestamp>\n</MainTag>\n\n".getBytes()); - final HeaderDelimitedTextBlockReader xmlTaggedReader = new HeaderDelimitedTextBlockReader("<?xml"); + final HeaderDelimitedTextBlockReader xmlTaggedReader = new HeaderDelimitedTextBlockReader("<?xml", null, true); xmlTaggedReader.init(xmlInputStream); final TextBlock textBlock = xmlTaggedReader.readTextBlock(); @@ -170,7 +170,7 @@ public class TestXMLTaggedEventConsumer { "Garbage\n<?xml>\n<MainTag>\n<TestTimestamp>1469781869268</TestTimestamp>\n</MainTag>\nRubbish\n\n" .getBytes()); - final HeaderDelimitedTextBlockReader xmlTaggedReader = new HeaderDelimitedTextBlockReader("<?xml"); + final HeaderDelimitedTextBlockReader xmlTaggedReader = new HeaderDelimitedTextBlockReader("<?xml", null, true); xmlTaggedReader.init(xmlInputStream); final TextBlock textBlock = xmlTaggedReader.readTextBlock(); @@ -184,7 +184,7 @@ public class TestXMLTaggedEventConsumer { final InputStream xmlInputStream = new ByteArrayInputStream( "<?xml>\n<MainTag>\n<TestTimestamp>1469781869268</TestTimestamp>\n</MainTag>\nRubbish".getBytes()); - final HeaderDelimitedTextBlockReader xmlTaggedReader = new HeaderDelimitedTextBlockReader("<?xml"); + final HeaderDelimitedTextBlockReader xmlTaggedReader = new HeaderDelimitedTextBlockReader("<?xml", null, true); xmlTaggedReader.init(xmlInputStream); final TextBlock textBlock = xmlTaggedReader.readTextBlock(); @@ -199,7 +199,7 @@ public class TestXMLTaggedEventConsumer { "1469781869268</TestTimestamp></MainTag><?xml><MainTag><TestTimestamp>1469781869268</TestTimestamp>" .getBytes()); - final HeaderDelimitedTextBlockReader xmlTaggedReader = new HeaderDelimitedTextBlockReader("<?xml"); + final HeaderDelimitedTextBlockReader xmlTaggedReader = new HeaderDelimitedTextBlockReader("<?xml", null, true); xmlTaggedReader.init(xmlInputStream); final TextBlock textBlock = xmlTaggedReader.readTextBlock(); @@ -212,7 +212,7 @@ public class TestXMLTaggedEventConsumer { "Garbage<?xml><MainTag><TestTimestamp>1469781869268</TestTimestamp></MainTag><?xml><MainTag><TestTimestamp>" .getBytes()); - final HeaderDelimitedTextBlockReader xmlTaggedReader = new HeaderDelimitedTextBlockReader("<?xml"); + final HeaderDelimitedTextBlockReader xmlTaggedReader = new HeaderDelimitedTextBlockReader("<?xml", null, true); xmlTaggedReader.init(xmlInputStream); final TextBlock textBlock = xmlTaggedReader.readTextBlock(); @@ -225,7 +225,7 @@ public class TestXMLTaggedEventConsumer { "Garbage<?xml><MainTag><TestTimestamp>1469781869268</TestTimestamp></MainTag>Rubbish<?xml><MainTag><TestTimestamp>\nRefuse" .getBytes()); - final HeaderDelimitedTextBlockReader xmlTaggedReader = new HeaderDelimitedTextBlockReader("<?xml"); + final HeaderDelimitedTextBlockReader xmlTaggedReader = new HeaderDelimitedTextBlockReader("<?xml", null, true); xmlTaggedReader.init(xmlInputStream); final TextBlock textBlock = xmlTaggedReader.readTextBlock(); @@ -238,7 +238,7 @@ public class TestXMLTaggedEventConsumer { "<?xml><MainTag><TestTimestamp>1469781869268</TestTimestamp></MainTag>Rubbish<?xml><MainTag><TestTimestamp>Refuse" .getBytes()); - final HeaderDelimitedTextBlockReader xmlTaggedReader = new HeaderDelimitedTextBlockReader("<?xml"); + final HeaderDelimitedTextBlockReader xmlTaggedReader = new HeaderDelimitedTextBlockReader("<?xml", null, true); xmlTaggedReader.init(xmlInputStream); final TextBlock textBlock = xmlTaggedReader.readTextBlock(); @@ -252,7 +252,7 @@ public class TestXMLTaggedEventConsumer { final InputStream xmlInputStream = new ByteArrayInputStream( "1469781869268\n</TestTimestamp>\n</MainTag>\n<?xml>\n<MainTag>\n<TestTimestamp>".getBytes()); - final HeaderDelimitedTextBlockReader xmlTaggedReader = new HeaderDelimitedTextBlockReader("<?xml"); + final HeaderDelimitedTextBlockReader xmlTaggedReader = new HeaderDelimitedTextBlockReader("<?xml", null, true); xmlTaggedReader.init(xmlInputStream); final TextBlock textBlock = xmlTaggedReader.readTextBlock(); @@ -266,7 +266,7 @@ public class TestXMLTaggedEventConsumer { "<?xml>\n<MainTag>\n<TestTimestamp>1469781869268</TestTimestamp>\n</MainTag>\n<?xml>\n<MainTag>\n<TestTimestamp>1469781869268</TestTimestamp>\n</MainTag>\n" .getBytes()); - final HeaderDelimitedTextBlockReader xmlTaggedReader = new HeaderDelimitedTextBlockReader("<?xml"); + final HeaderDelimitedTextBlockReader xmlTaggedReader = new HeaderDelimitedTextBlockReader("<?xml", null, true); xmlTaggedReader.init(xmlInputStream); TextBlock textBlock = xmlTaggedReader.readTextBlock(); @@ -286,7 +286,7 @@ public class TestXMLTaggedEventConsumer { "Garbage\n<?xml>\n<MainTag>\n<TestTimestamp>1469781869268</TestTimestamp>\n</MainTag>\n\n<?xml>\n<MainTag>\n<TestTimestamp>1469781869268</TestTimestamp>\n</MainTag>\n" .getBytes()); - final HeaderDelimitedTextBlockReader xmlTaggedReader = new HeaderDelimitedTextBlockReader("<?xml"); + final HeaderDelimitedTextBlockReader xmlTaggedReader = new HeaderDelimitedTextBlockReader("<?xml", null, true); xmlTaggedReader.init(xmlInputStream); TextBlock textBlock = xmlTaggedReader.readTextBlock(); @@ -306,7 +306,7 @@ public class TestXMLTaggedEventConsumer { "Garbage\n<?xml>\n<MainTag>\n<TestTimestamp>1469781869268</TestTimestamp>\n</MainTag>\nRubbish\n<?xml>\n<MainTag>\n<TestTimestamp>1469781869268</TestTimestamp>\n</MainTag>\nRefuse\n" .getBytes()); - final HeaderDelimitedTextBlockReader xmlTaggedReader = new HeaderDelimitedTextBlockReader("<?xml"); + final HeaderDelimitedTextBlockReader xmlTaggedReader = new HeaderDelimitedTextBlockReader("<?xml", null, true); xmlTaggedReader.init(xmlInputStream); TextBlock textBlock = xmlTaggedReader.readTextBlock(); @@ -325,7 +325,7 @@ public class TestXMLTaggedEventConsumer { final InputStream xmlInputStream = new ByteArrayInputStream( "<?xml>\n<MainTag>\n<TestTimestamp>1469781869268</TestTimestamp>\n</MainTag>\nRubbish".getBytes()); - final HeaderDelimitedTextBlockReader xmlTaggedReader = new HeaderDelimitedTextBlockReader("<?xml"); + final HeaderDelimitedTextBlockReader xmlTaggedReader = new HeaderDelimitedTextBlockReader("<?xml", null, true); xmlTaggedReader.init(xmlInputStream); final TextBlock textBlock = xmlTaggedReader.readTextBlock(); |