diff options
Diffstat (limited to 'plugins/plugins-event')
15 files changed, 109 insertions, 14 deletions
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/pom.xml b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/pom.xml index 5a631c5dd..6dd33237d 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/pom.xml +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-grpc/pom.xml @@ -26,7 +26,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-event.plugins-event-carrier</groupId> <artifactId>plugins-event-carrier</artifactId> - <version>2.5.1-SNAPSHOT</version> + <version>2.6.0-SNAPSHOT</version> </parent> <artifactId>plugins-event-carrier-grpc</artifactId> diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/pom.xml b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/pom.xml index d368c02fb..ce1bcd8e4 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/pom.xml +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-jms/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-event.plugins-event-carrier</groupId> <artifactId>plugins-event-carrier</artifactId> - <version>2.5.1-SNAPSHOT</version> + <version>2.6.0-SNAPSHOT</version> </parent> <artifactId>plugins-event-carrier-jms</artifactId> diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/pom.xml b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/pom.xml index 8b891aad2..7d83167b0 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/pom.xml +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-event.plugins-event-carrier</groupId> <artifactId>plugins-event-carrier</artifactId> - <version>2.5.1-SNAPSHOT</version> + <version>2.6.0-SNAPSHOT</version> </parent> <artifactId>plugins-event-carrier-kafka</artifactId> diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/pom.xml b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/pom.xml index a142bd102..f11bd4158 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/pom.xml +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-event.plugins-event-carrier</groupId> <artifactId>plugins-event-carrier</artifactId> - <version>2.5.1-SNAPSHOT</version> + <version>2.6.0-SNAPSHOT</version> </parent> <artifactId>plugins-event-carrier-restclient</artifactId> diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/pom.xml b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/pom.xml index 72184ef87..0bf9921e3 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/pom.xml +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-event.plugins-event-carrier</groupId> <artifactId>plugins-event-carrier</artifactId> - <version>2.5.1-SNAPSHOT</version> + <version>2.6.0-SNAPSHOT</version> </parent> <artifactId>plugins-event-carrier-restrequestor</artifactId> diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/pom.xml b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/pom.xml index 912fdfc51..86e2be5dd 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/pom.xml +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-event.plugins-event-carrier</groupId> <artifactId>plugins-event-carrier</artifactId> - <version>2.5.1-SNAPSHOT</version> + <version>2.6.0-SNAPSHOT</version> </parent> <artifactId>plugins-event-carrier-restserver</artifactId> diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/pom.xml b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/pom.xml index 71eb45c6a..3207faf14 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/pom.xml +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-event.plugins-event-carrier</groupId> <artifactId>plugins-event-carrier</artifactId> - <version>2.5.1-SNAPSHOT</version> + <version>2.6.0-SNAPSHOT</version> </parent> <artifactId>plugins-event-carrier-websocket</artifactId> diff --git a/plugins/plugins-event/plugins-event-carrier/pom.xml b/plugins/plugins-event/plugins-event-carrier/pom.xml index d7d474771..2c83b4e66 100644 --- a/plugins/plugins-event/plugins-event-carrier/pom.xml +++ b/plugins/plugins-event/plugins-event-carrier/pom.xml @@ -24,7 +24,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-event</groupId> <artifactId>plugins-event</artifactId> - <version>2.5.1-SNAPSHOT</version> + <version>2.6.0-SNAPSHOT</version> </parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-event.plugins-event-carrier</groupId> diff --git a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/pom.xml b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/pom.xml index 2caf18ac2..d9f800e12 100644 --- a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/pom.xml +++ b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-jms/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-event.plugins-event-protocol</groupId> <artifactId>plugins-event-protocol</artifactId> - <version>2.5.1-SNAPSHOT</version> + <version>2.6.0-SNAPSHOT</version> </parent> <artifactId>plugins-event-protocol-jms</artifactId> diff --git a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/pom.xml b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/pom.xml index b12606b16..a467304b8 100644 --- a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/pom.xml +++ b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/pom.xml @@ -26,7 +26,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-event.plugins-event-protocol</groupId> <artifactId>plugins-event-protocol</artifactId> - <version>2.5.1-SNAPSHOT</version> + <version>2.6.0-SNAPSHOT</version> </parent> <artifactId>plugins-event-protocol-xml</artifactId> diff --git a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/src/test/java/org/onap/policy/apex/plugins/event/protocol/xml/XmlEventHandlerTest.java b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/src/test/java/org/onap/policy/apex/plugins/event/protocol/xml/XmlEventHandlerTest.java index caa3bd06f..609b0471b 100644 --- a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/src/test/java/org/onap/policy/apex/plugins/event/protocol/xml/XmlEventHandlerTest.java +++ b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/src/test/java/org/onap/policy/apex/plugins/event/protocol/xml/XmlEventHandlerTest.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020-2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,9 +29,13 @@ import static org.junit.Assert.assertTrue; import java.util.Date; import java.util.HashMap; import java.util.Map; +import java.util.Random; +import org.apache.commons.lang3.RandomStringUtils; import org.junit.Test; import org.onap.policy.apex.model.basicmodel.concepts.ApexException; import org.onap.policy.apex.service.engine.event.ApexEvent; +import org.onap.policy.apex.service.engine.event.ApexEventException; +import org.onap.policy.apex.service.engine.event.ApexEventRuntimeException; import org.slf4j.ext.XLogger; import org.slf4j.ext.XLoggerFactory; @@ -44,6 +48,44 @@ public class XmlEventHandlerTest { private static final XLogger logger = XLoggerFactory.getXLogger(XmlEventHandlerTest.class); /** + * Test XML to apex event. Null value is passed as parameter. + * + * @throws ApexException on Apex event handling errors + */ + @Test(expected = ApexException.class) + public void testApexEventToApexNullObject() throws ApexException { + final Apex2XmlEventConverter xmlEventConverter = new Apex2XmlEventConverter(); + // This is only for code coverage stats. This method does nothing + xmlEventConverter.init(null); + + xmlEventConverter.toApexEvent("XMLEventName", null); + } + + /** + * Test XML to apex event. There is no string passed as parameter. + * + * @throws ApexException on Apex event handling errors + */ + @Test(expected = ApexEventRuntimeException.class) + public void testApexEventToApexNotString() throws ApexException { + final Apex2XmlEventConverter xmlEventConverter = new Apex2XmlEventConverter(); + + xmlEventConverter.toApexEvent("XMLEventName", new Random().nextInt()); + } + + /** + * Test not valid XML to apex event. + * + * @throws ApexException on Apex event handling errors + */ + @Test(expected = ApexException.class) + public void testApexEventToApexNotXml() throws ApexException { + final Apex2XmlEventConverter xmlEventConverter = new Apex2XmlEventConverter(); + + xmlEventConverter.toApexEvent("XMLEventName", RandomStringUtils.randomAlphabetic(25)); + } + + /** * Test XML to apex event. * * @throws ApexException on Apex event handling errors @@ -80,6 +122,17 @@ public class XmlEventHandlerTest { } /** + * Test null as apex event to xml. + * + * @throws ApexEventException on Apex event handling errors + */ + @Test(expected = ApexEventException.class) + public void testApexEventToXmlNullEvent() throws ApexEventException { + final Apex2XmlEventConverter xmlEventConverter = new Apex2XmlEventConverter(); + xmlEventConverter.fromApexEvent(null); + } + + /** * Test apex event to xml. * * @throws ApexException on Apex event handling errors @@ -96,6 +149,7 @@ public class XmlEventHandlerTest { event0000DataMap.put("TestMatchCase", 12345); event0000DataMap.put("TestTimestamp", event0000StartTime.getTime()); event0000DataMap.put("TestTemperature", 34.5445667); + event0000DataMap.put("NullValue", null); final ApexEvent apexEvent0000 = new ApexEvent("Event0000", "0.0.1", "org.onap.policy.apex.sample.events", "test", "apex"); @@ -109,6 +163,7 @@ public class XmlEventHandlerTest { assertTrue(apexEvent0000XmlString.contains("<version>0.0.1</version>")); assertTrue(apexEvent0000XmlString.contains("<value>This is a test slogan</value>")); assertTrue(apexEvent0000XmlString.contains("<value>12345</value>")); + assertTrue(apexEvent0000XmlString.contains("<value></value>")); assertTrue(apexEvent0000XmlString.contains("<value>" + event0000StartTime.getTime() + "</value>")); assertTrue(apexEvent0000XmlString.contains("<value>34.5445667</value>")); diff --git a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/src/test/java/org/onap/policy/apex/plugins/event/protocol/xml/XmlEventProtocolParametersTest.java b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/src/test/java/org/onap/policy/apex/plugins/event/protocol/xml/XmlEventProtocolParametersTest.java new file mode 100644 index 000000000..27fd22095 --- /dev/null +++ b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-xml/src/test/java/org/onap/policy/apex/plugins/event/protocol/xml/XmlEventProtocolParametersTest.java @@ -0,0 +1,40 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021 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.policy.apex.plugins.event.protocol.xml; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +public class XmlEventProtocolParametersTest { + + /** + * Test object creation. + */ + @Test + public void instantiationTest() { + final XmlEventProtocolParameters parameters = new XmlEventProtocolParameters(); + + assertEquals(XmlEventProtocolParameters.XML_EVENT_PROTOCOL_LABEL, parameters.getLabel()); + assertEquals("<?xml", parameters.getStartDelimiterToken()); + assertEquals(Apex2XmlEventConverter.class.getName(), parameters.getEventProtocolPluginClass()); + } +}
\ No newline at end of file diff --git a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-yaml/pom.xml b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-yaml/pom.xml index eb92cf3bb..b43873532 100644 --- a/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-yaml/pom.xml +++ b/plugins/plugins-event/plugins-event-protocol/plugins-event-protocol-yaml/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-event.plugins-event-protocol</groupId> <artifactId>plugins-event-protocol</artifactId> - <version>2.5.1-SNAPSHOT</version> + <version>2.6.0-SNAPSHOT</version> </parent> <artifactId>plugins-event-protocol-yaml</artifactId> diff --git a/plugins/plugins-event/plugins-event-protocol/pom.xml b/plugins/plugins-event/plugins-event-protocol/pom.xml index f2dbecbc9..054daa2a7 100644 --- a/plugins/plugins-event/plugins-event-protocol/pom.xml +++ b/plugins/plugins-event/plugins-event-protocol/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-event</groupId> <artifactId>plugins-event</artifactId> - <version>2.5.1-SNAPSHOT</version> + <version>2.6.0-SNAPSHOT</version> </parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-event.plugins-event-protocol</groupId> diff --git a/plugins/plugins-event/pom.xml b/plugins/plugins-event/pom.xml index e8ee90160..e375b54be 100644 --- a/plugins/plugins-event/pom.xml +++ b/plugins/plugins-event/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.onap.policy.apex-pdp.plugins</groupId> <artifactId>plugins</artifactId> - <version>2.5.1-SNAPSHOT</version> + <version>2.6.0-SNAPSHOT</version> </parent> <groupId>org.onap.policy.apex-pdp.plugins.plugins-event</groupId> |