From 9e5c4b882728ebf3330568d068f109965d599410 Mon Sep 17 00:00:00 2001 From: liamfallon Date: Mon, 2 Mar 2020 17:08:47 +0000 Subject: Preparing integration tests for Graal Javascript Graal enforces Javascript more strictly than Nashorn does. This review changes the tests in apex-pdp to comply with the stricter -Javascript checking, re-enabling the integration test module. - All log calls must be passed as strings, using toString() - Byte/Float/Long Java types not supported in Javascript Disable integration tests so that other changes can be brought in. JMS integration test is disabled for now, it will be re-enabled in a review shortly. Issue-ID: POLICY-2106 Change-Id: I14bdb930eff735e862b51802cf72e4793cec3699 Signed-off-by: liamfallon --- .../scripts/TestPolicyAvroEventContext.apex | 30 +- .../scripts/TestPolicyJavaEventContext.apex | 19 +- .../CommandLineEditorEventsContextTest.java | 8 +- .../carrier/restclient/ApexRestClientConsumer.java | 7 +- .../carrier/restclient/ApexRestClientProducer.java | 27 +- .../restclient/ApexRestClientProducerTest.java | 41 ++- .../test/concepts/TestContextBooleanItem.java | 66 +--- .../context/test/concepts/TestContextByteItem.java | 64 +--- .../context/test/concepts/TestContextDateItem.java | 131 +------ .../test/concepts/TestContextDateLocaleItem.java | 175 +-------- .../test/concepts/TestContextDateTzItem.java | 126 +------ .../test/concepts/TestContextDoubleItem.java | 67 +--- .../test/concepts/TestContextFloatItem.java | 64 +--- .../context/test/concepts/TestContextIntItem.java | 64 +--- .../context/test/concepts/TestContextLongItem.java | 65 +--- .../test/concepts/TestContextLongObjectItem.java | 71 +--- .../test/concepts/TestContextStringItem.java | 71 +--- .../test/concepts/TestContextTreeMapItem.java | 75 +--- .../test/concepts/TestContextTreeSetItem.java | 75 +--- .../test/concepts/TestExternalContextItem.java | 389 +-------------------- .../test/concepts/TestGlobalContextItem.java | 389 +-------------------- .../test/concepts/TestPolicyContextItem.java | 203 +---------- .../examples/models/JMS/JMSTestModel.json | 2 +- .../model/javascript/DefaultStateLogic.javascript | 7 +- .../model/javascript/DefaultTaskLogic.javascript | 9 +- .../model/javascript/EvalStateLogic.javascript | 3 +- .../model/javascript/EvalTaskLogic.javascript | 7 +- .../context/distribution/ContextInstantiation.java | 6 +- .../uservice/adapt/jms/TestJms2Jms.java | 7 +- .../restclient/TestExecutionPropertyRest.java | 30 +- .../uservice/adapt/restclient/TestFile2Rest.java | 57 +-- .../uservice/adapt/restclient/TestRest2File.java | 2 +- .../Context_AvroEventAlbum_EventOutCompare.json | 4 +- .../Context_JavaEventAlbum_EventOutCompare.json | 8 +- .../executionproperties/logic/AddPropertyTask.js | 7 +- .../logic/DefinedToEmptyTask.js | 7 +- .../logic/EmptyToDefinedTask.js | 7 +- .../executionproperties/logic/EmptyToEmptyTask.js | 7 +- .../executionproperties/logic/ReadOnlyTask.js | 7 +- .../logic/RemovePropertyTask.js | 7 +- .../executionproperties/logic/RunTestStateTSL.js | 5 +- .../executionproperties/logic/TaskFetchHttpCode.js | 13 +- .../executionproperties/logic/TaskTagUrl.js | 7 +- .../ExecutionPropertiesRestTestPolicyModel.apex | 6 +- .../taskparameters/SetControlLoopNameForTest.js | 14 +- .../policies/taskparameters/SetServiceIdForTest.js | 14 +- testsuites/integration/pom.xml | 4 +- 47 files changed, 283 insertions(+), 2191 deletions(-) diff --git a/auth/cli-editor/src/main/resources/examples/scripts/TestPolicyAvroEventContext.apex b/auth/cli-editor/src/main/resources/examples/scripts/TestPolicyAvroEventContext.apex index 9f62eca74..2cd94416f 100644 --- a/auth/cli-editor/src/main/resources/examples/scripts/TestPolicyAvroEventContext.apex +++ b/auth/cli-editor/src/main/resources/examples/scripts/TestPolicyAvroEventContext.apex @@ -1,6 +1,7 @@ #------------------------------------------------------------------------------- # ============LICENSE_START======================================================= # Copyright (C) 2016-2018 Ericsson. All rights reserved. +# Modifications Copyright (C) 2020 Nordix Foundation. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -52,7 +53,7 @@ LE schema create name=AvroFloat_type flavour=Avro schema=LS { - "type" : "float" + "type" : "double" } LE @@ -423,18 +424,16 @@ task contextref create name=Test_Task albumName=CustomSetAlbum task contextref create name=Test_Task albumName=CustomMapAlbum task logic create name=Test_Task logicFlavour=JAVASCRIPT logic=LS -executor.logger.debug(executor.subject.id); - -executor.logger.debug(executor.inFields); - -executor.getContextAlbum("AvroBooleanAlbum" ).put("AvroBoolean" , executor.inFields.get("AvroBoolean")); -executor.getContextAlbum("AvroByteAlbum" ).put("AvroByte" , executor.inFields.get("AvroByte" )); -executor.getContextAlbum("AvroShortAlbum" ).put("AvroShort" , executor.inFields.get("AvroShort" )); -executor.getContextAlbum("AvroIntegerAlbum" ).put("AvroInteger" , executor.inFields.get("AvroInteger")); -executor.getContextAlbum("AvroLongAlbum" ).put("AvroLong" , executor.inFields.get("AvroLong" )); -executor.getContextAlbum("AvroFloatAlbum" ).put("AvroFloat" , executor.inFields.get("AvroFloat" )); -executor.getContextAlbum("AvroDoubleAlbum" ).put("AvroDouble" , executor.inFields.get("AvroDouble" )); -executor.getContextAlbum("AvroStringAlbum" ).put("AvroString" , executor.inFields.get("AvroString" )); +executor.logger.debug(executor.getSubject().getId()); + +executor.getContextAlbum("AvroBooleanAlbum" ).put("AvroBoolean" , executor.inFields.get("AvroBoolean" )); +executor.getContextAlbum("AvroByteAlbum" ).put("AvroByte" , executor.inFields.get("AvroByte" )); +executor.getContextAlbum("AvroShortAlbum" ).put("AvroShort" , executor.inFields.get("AvroShort" )); +executor.getContextAlbum("AvroIntegerAlbum" ).put("AvroInteger" , executor.inFields.get("AvroInteger" )); +executor.getContextAlbum("AvroLongAlbum" ).put("AvroLong" , executor.inFields.get("AvroLong" )); +executor.getContextAlbum("AvroFloatAlbum" ).put("AvroFloat" , executor.inFields.get("AvroFloat" )); +executor.getContextAlbum("AvroDoubleAlbum" ).put("AvroDouble" , executor.inFields.get("AvroDouble" )); +executor.getContextAlbum("AvroStringAlbum" ).put("AvroString" , executor.inFields.get("AvroString" )); executor.getContextAlbum("AvroMapAlbum" ).put("AvroMap" , executor.inFields.get("AvroMap" )); executor.getContextAlbum("AvroArrayAlbum" ).put("AvroArray" , executor.inFields.get("AvroArray" )); executor.getContextAlbum("CustomBooleanAlbum").put("CustomBoolean", executor.inFields.get("CustomBoolean")); @@ -488,11 +487,8 @@ avroString = avroString + " added to end of string"; customBoolean.put("flag", !customBoolean.get("flag")); customByte .put("byteValue" , customByte .get("byteValue" ) + 1); customInteger.put("intValue" , customInteger.get("intValue" ) + 1); -customLong .put("longValue" , new javaLongType (customLong .get("longValue" ) + 1)); -customFloat .put("floatValue" , new javaFloatType(customFloat.get("floatValue") + 1.0)); customDouble .put("doubleValue", customDouble .get("doubleValue") + 1.0); customString .put("stringValue", customString .get("stringValue") + " added to end of string"); -customALong .put("longValue" , new javaLongType (customALong.get("longValue" ) + 1)); customDate0.put("year", 1922); customDate0.put("month", 12); @@ -555,8 +551,6 @@ executor.outFields.put("CustomDate2" , executor.getContextAlbum("CustomDate2Alb executor.outFields.put("CustomSet" , executor.getContextAlbum("CustomSetAlbum" ).get("CustomSet" )); executor.outFields.put("CustomMap" , executor.getContextAlbum("CustomMapAlbum" ).get("CustomMap" )); -executor.logger.debug(executor.outFields); - var returnValueType = Java.type("java.lang.Boolean"); var returnValue = new returnValueType(true); diff --git a/auth/cli-editor/src/main/resources/examples/scripts/TestPolicyJavaEventContext.apex b/auth/cli-editor/src/main/resources/examples/scripts/TestPolicyJavaEventContext.apex index e978f15bb..2a36c4fa1 100644 --- a/auth/cli-editor/src/main/resources/examples/scripts/TestPolicyJavaEventContext.apex +++ b/auth/cli-editor/src/main/resources/examples/scripts/TestPolicyJavaEventContext.apex @@ -1,6 +1,7 @@ #------------------------------------------------------------------------------- # ============LICENSE_START======================================================= # Copyright (C) 2016-2018 Ericsson. All rights reserved. +# Modifications Copyright (C) 2020 Nordix Foundation. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -181,9 +182,7 @@ task contextref create name=Test_Task albumName=CustomSetAlbum task contextref create name=Test_Task albumName=CustomMapAlbum task logic create name=Test_Task logicFlavour=JAVASCRIPT logic=LS -executor.logger.debug(executor.subject.id); - -executor.logger.debug(executor.inFields); +executor.logger.debug(executor.getSubject().getId()); executor.getContextAlbum("JavaBooleanAlbum" ).put("JavaBoolean" , executor.inFields.get("JavaBoolean" )); executor.getContextAlbum("JavaByteAlbum" ).put("JavaByte" , executor.inFields.get("JavaByte" )); @@ -239,13 +238,13 @@ javaFloat += 0.99; javaDouble += 0.99; javaString = javaString + " added to end of string"; customBoolean.setFlag(!customBoolean); -customByte .setByteValue (customByte .getByteValue() + 1); -customInteger.setIntValue (customInteger.getIntValue() + 1); -customLong .setLongValue (customLong .getLongValue() + 1); -customFloat .setFloatValue (customFloat .getFloatValue() + 1); -customDouble .setDoubleValue(customDouble .getDoubleValue() + 1); +customByte .setByteValue (customByte .getIncrementedByteValue()); +customInteger.setIntValue (customInteger.getIncrementedIntValue()); +customLong .setLongValue (customLong .getIncrementedLongValue()); +customFloat .setFloatValue (customFloat .getIncrementedFloatValue()); +customDouble .setDoubleValue(customDouble .getIncrementedDoubleValue()); customString .setStringValue(customString .getStringValue() + " added to end of string"); -customJLong .setLongValue (customJLong .getLongValue() + 1); +customJLong .setLongValue (customJLong .getIncrementedLongValue()); customDate0Type = Java.type("org.onap.policy.apex.context.test.concepts.TestContextDateItem"); customDate0 = new customDate0Type(1499868391); @@ -310,8 +309,6 @@ executor.outFields.put("CustomDate2" , executor.getContextAlbum("CustomDate2Alb executor.outFields.put("CustomSet" , executor.getContextAlbum("CustomSetAlbum" ).get("CustomSet" )); executor.outFields.put("CustomMap" , executor.getContextAlbum("CustomMapAlbum" ).get("CustomMap" )); -executor.logger.debug(executor.outFields); - var returnValueType = Java.type("java.lang.Boolean"); var returnValue = new returnValueType(true); diff --git a/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/CommandLineEditorEventsContextTest.java b/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/CommandLineEditorEventsContextTest.java index 88d99a27d..9c7143ef1 100644 --- a/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/CommandLineEditorEventsContextTest.java +++ b/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/CommandLineEditorEventsContextTest.java @@ -84,8 +84,8 @@ public class CommandLineEditorEventsContextTest { final int logCharCount = logString.replaceAll(SPACES, EMPTY_STRING).length(); final int modelCharCount = modelString.replaceAll(SPACES, EMPTY_STRING).length(); - assertEquals(25962, logCharCount); - assertEquals(46189, modelCharCount); + assertEquals(25996, logCharCount); + assertEquals(46162, modelCharCount); } /** @@ -114,8 +114,8 @@ public class CommandLineEditorEventsContextTest { final int logCharCount = logString.replaceAll(SPACES, EMPTY_STRING).length(); final int modelCharCount = modelString.replaceAll(SPACES, EMPTY_STRING).length(); - assertEquals(30407, logCharCount); - assertEquals(53022, modelCharCount); + assertEquals(30154, logCharCount); + assertEquals(52690, modelCharCount); } diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java index aa8185fdb..a3d273dfd 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java @@ -22,9 +22,9 @@ package org.onap.policy.apex.plugins.event.carrier.restclient; import java.util.Properties; - import java.util.regex.Matcher; import java.util.regex.Pattern; + import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.core.Response; @@ -35,6 +35,7 @@ import org.onap.policy.apex.service.engine.event.ApexEventException; import org.onap.policy.apex.service.engine.event.ApexEventReceiver; import org.onap.policy.apex.service.engine.event.ApexEventRuntimeException; import org.onap.policy.apex.service.engine.event.ApexPluginsEventConsumer; +import org.onap.policy.apex.service.parameters.carriertechnology.RestPluginCarrierTechnologyParameters; import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -86,10 +87,10 @@ public class ApexRestClientConsumer extends ApexPluginsEventConsumer { // Check if the HTTP method has been set if (restConsumerProperties.getHttpMethod() == null) { - restConsumerProperties.setHttpMethod(RestClientCarrierTechnologyParameters.HttpMethod.GET); + restConsumerProperties.setHttpMethod(RestPluginCarrierTechnologyParameters.HttpMethod.GET); } - if (!RestClientCarrierTechnologyParameters.HttpMethod.GET.equals(restConsumerProperties.getHttpMethod())) { + if (!RestPluginCarrierTechnologyParameters.HttpMethod.GET.equals(restConsumerProperties.getHttpMethod())) { final String errorMessage = "specified HTTP method of \"" + restConsumerProperties.getHttpMethod() + "\" is invalid, only HTTP method \"GET\" " + "is supported for event reception on REST client consumer (" + this.name + ")"; diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducer.java index 3506ace3c..cf3500065 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducer.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducer.java @@ -21,8 +21,6 @@ package org.onap.policy.apex.plugins.event.carrier.restclient; -import java.util.EnumMap; -import java.util.Map; import java.util.Optional; import java.util.Properties; import java.util.Set; @@ -33,12 +31,10 @@ import javax.ws.rs.client.Entity; import javax.ws.rs.core.Response; import org.onap.policy.apex.service.engine.event.ApexEventException; -import org.onap.policy.apex.service.engine.event.ApexPluginsEventProducer; import org.onap.policy.apex.service.engine.event.ApexEventRuntimeException; -import org.onap.policy.apex.service.engine.event.PeeredReference; -import org.onap.policy.apex.service.engine.event.SynchronousEventCache; +import org.onap.policy.apex.service.engine.event.ApexPluginsEventProducer; +import org.onap.policy.apex.service.parameters.carriertechnology.RestPluginCarrierTechnologyParameters; import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters; -import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerPeeredMode; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -77,14 +73,14 @@ public class ApexRestClientProducer extends ApexPluginsEventProducer { // Check if the HTTP method has been set if (restProducerProperties.getHttpMethod() == null) { - restProducerProperties.setHttpMethod(RestClientCarrierTechnologyParameters.HttpMethod.POST); + restProducerProperties.setHttpMethod(RestPluginCarrierTechnologyParameters.HttpMethod.POST); } - if (!RestClientCarrierTechnologyParameters.HttpMethod.POST.equals(restProducerProperties.getHttpMethod()) - && !RestClientCarrierTechnologyParameters.HttpMethod.PUT + if (!RestPluginCarrierTechnologyParameters.HttpMethod.POST.equals(restProducerProperties.getHttpMethod()) + && !RestPluginCarrierTechnologyParameters.HttpMethod.PUT .equals(restProducerProperties.getHttpMethod())) { final String errorMessage = "specified HTTP method of \"" + restProducerProperties.getHttpMethod() - + "\" is invalid, only HTTP methods \"POST\" and \"PUT\" are supproted " + + "\" is invalid, only HTTP methods \"POST\" and \"PUT\" are supported " + "for event sending on REST client producer (" + this.name + ")"; LOGGER.warn(errorMessage); throw new ApexEventException(errorMessage); @@ -97,6 +93,7 @@ public class ApexRestClientProducer extends ApexPluginsEventProducer { /** * {@inheritDoc}. */ + @Override public void sendEvent(final long executionId, final Properties executionProperties, final String eventName, final Object event) { super.sendEvent(executionId, executionProperties, eventName, event); @@ -106,15 +103,17 @@ public class ApexRestClientProducer extends ApexPluginsEventProducer { Set names = restProducerProperties.getKeysFromUrl(); Set inputProperty = executionProperties.stringPropertyNames(); + // @formatter:off names.stream().map(Optional::of).forEach(op -> op.filter(inputProperty::contains) .orElseThrow(() -> new ApexEventRuntimeException( - "key\"" + op.get() + "\"specified on url \"" + restProducerProperties.getUrl() - + "\"not found in execution properties passed by the current policy")) + "key \"" + op.get() + "\" specified on url \"" + restProducerProperties.getUrl() + + "\" not found in execution properties passed by the current policy")) ); untaggedUrl = names.stream().reduce(untaggedUrl, (acc, str) -> acc.replace("{" + str + "}", (String) executionProperties.get(str))); + // @formatter:on } // Send the event as a REST request @@ -131,7 +130,7 @@ public class ApexRestClientProducer extends ApexPluginsEventProducer { if (LOGGER.isTraceEnabled()) { LOGGER.trace("event sent from engine using {} to URL {} with HTTP {} : {} and response {} ", this.name, - untaggedUrl, restProducerProperties.getHttpMethod(), event, response); + untaggedUrl, restProducerProperties.getHttpMethod(), event, response); } } @@ -152,7 +151,7 @@ public class ApexRestClientProducer extends ApexPluginsEventProducer { */ private Response sendEventAsRestRequest(final String untaggedUrl, final String event) { // We have already checked that it is a PUT or POST request - if (RestClientCarrierTechnologyParameters.HttpMethod.POST.equals(restProducerProperties.getHttpMethod())) { + if (RestPluginCarrierTechnologyParameters.HttpMethod.POST.equals(restProducerProperties.getHttpMethod())) { return client.target(untaggedUrl).request("application/json") .headers(restProducerProperties.getHttpHeadersAsMultivaluedMap()).post(Entity.json(event)); } else { diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducerTest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducerTest.java index b67a339aa..ce688d62d 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducerTest.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/test/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientProducerTest.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,8 +25,6 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; -import ch.qos.logback.classic.Level; - import java.util.Properties; import javax.ws.rs.client.Client; @@ -47,6 +45,8 @@ import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerPeeredMo import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import ch.qos.logback.classic.Level; + /** * Test the ApexRestClientProducer class. * @@ -77,8 +77,8 @@ public class ApexRestClientProducerTest { fail("test should throw an exception here"); } catch (ApexEventException e) { assertEquals( - "specified producer properties are not applicable to REST client producer (RestClientProducer)", - e.getMessage()); + "specified producer properties are not applicable to REST client producer (RestClientProducer)", + e.getMessage()); } RestClientCarrierTechnologyParameters rcctp = new RestClientCarrierTechnologyParameters(); @@ -89,8 +89,10 @@ public class ApexRestClientProducerTest { assertEquals(RestClientCarrierTechnologyParameters.HttpMethod.GET, rcctp.getHttpMethod()); fail("test should throw an exception here"); } catch (ApexEventException e) { - assertEquals("specified HTTP method of \"DELETE\" is invalid, only HTTP methods \"POST\" and \"PUT\" " - + "are supproted for event sending on REST client producer (RestClientConsumer)", e.getMessage()); + assertEquals( + "specified HTTP method of \"DELETE\" is invalid, only HTTP methods \"POST\" and \"PUT\" " + + "are supported for event sending on REST client producer (RestClientConsumer)", + e.getMessage()); } rcctp.setHttpMethod(null); @@ -109,7 +111,6 @@ public class ApexRestClientProducerTest { assertEquals(null, arcp.getPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS)); arcp.stop(); - rcctp.setHttpMethod(RestClientCarrierTechnologyParameters.HttpMethod.PUT); arcp.init("RestClientConsumer", producerParameters); assertEquals(RestClientCarrierTechnologyParameters.HttpMethod.PUT, rcctp.getHttpMethod()); @@ -171,7 +172,7 @@ public class ApexRestClientProducerTest { Mockito.doReturn(targetMock).when(httpClientMock).target(rcctp.getUrl()); arcp.setClient(httpClientMock); - //test property not found + // test property not found rcctp.setUrl("http://some.place2.that.{key}.not/{tag}and.again.{tag}"); Properties properties = new Properties(); properties.put("tag", "exist"); @@ -180,11 +181,9 @@ public class ApexRestClientProducerTest { arcp.stop(); fail("test should throw an exception"); } catch (Exception e) { - assertEquals( - "key\"key\"specified on url " - + "\"http://some.place2.that.{key}.not/{tag}and.again.{tag}\"not found " - + "in execution properties passed by the current policy", - e.getMessage()); + assertEquals("key \"key\" specified on url " + + "\"http://some.place2.that.{key}.not/{tag}and.again.{tag}\" not found " + + "in execution properties passed by the current policy", e.getMessage()); } } @@ -234,8 +233,8 @@ public class ApexRestClientProducerTest { rcctp.setHttpMethod(RestClientCarrierTechnologyParameters.HttpMethod.POST); ApexEventConsumer consumer = new ApexFileEventConsumer(); - SynchronousEventCache cache = new SynchronousEventCache(EventHandlerPeeredMode.SYNCHRONOUS, consumer, arcp, - 1000); + SynchronousEventCache cache = + new SynchronousEventCache(EventHandlerPeeredMode.SYNCHRONOUS, consumer, arcp, 1000); arcp.setPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS, cache); assertEquals(cache, arcp.getPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS)); arcp.init("RestClientConsumer", producerParameters); @@ -271,8 +270,8 @@ public class ApexRestClientProducerTest { rcctp.setHttpMethod(RestClientCarrierTechnologyParameters.HttpMethod.POST); ApexEventConsumer consumer = new ApexFileEventConsumer(); - SynchronousEventCache cache = new SynchronousEventCache(EventHandlerPeeredMode.SYNCHRONOUS, consumer, arcp, - 1000); + SynchronousEventCache cache = + new SynchronousEventCache(EventHandlerPeeredMode.SYNCHRONOUS, consumer, arcp, 1000); arcp.setPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS, cache); assertEquals(cache, arcp.getPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS)); arcp.init("RestClientConsumer", producerParameters); @@ -320,9 +319,9 @@ public class ApexRestClientProducerTest { fail("test should throw an exception here"); } catch (Exception e) { assertEquals( - "send of event to URL \"http://some.place.that.does.not/exist\" using HTTP \"POST\" " - + "failed with status code 400 and message \"null\", event:\n" + "This is an Event", - e.getMessage()); + "send of event to URL \"http://some.place.that.does.not/exist\" using HTTP \"POST\" " + + "failed with status code 400 and message \"null\", event:\n" + "This is an Event", + e.getMessage()); } } } \ No newline at end of file diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextBooleanItem.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextBooleanItem.java index 208571a3e..1ef830c56 100644 --- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextBooleanItem.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextBooleanItem.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,14 +23,13 @@ package org.onap.policy.apex.context.test.concepts; import java.io.Serializable; +import lombok.Data; + /** - * The Class TestContextItem000. + * The Class TestContextBooleanItem. */ +@Data public class TestContextBooleanItem implements Serializable { - private static final int HASH_PRIME_1 = 31; - private static final int HASH_PRIME_2 = 1231; - private static final int HASH_PRIME_3 = 1237; - private static final long serialVersionUID = 7241008665286367796L; private boolean flag = false; @@ -50,59 +49,4 @@ public class TestContextBooleanItem implements Serializable { public TestContextBooleanItem(final Boolean flag) { this.flag = flag; } - - /** - * Gets the flag. - * - * @return the flag - */ - public boolean getFlag() { - return flag; - } - - /** - * Sets the flag. - * - * @param flag the flag - */ - public void setFlag(final boolean flag) { - this.flag = flag; - } - - /** - * {@inheritDoc}. - */ - @Override - public int hashCode() { - final int prime = HASH_PRIME_1; - int result = 1; - result = prime * result + (flag ? HASH_PRIME_2 : HASH_PRIME_3); - return result; - } - - /** - * {@inheritDoc}. - */ - @Override - public boolean equals(final Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final TestContextBooleanItem other = (TestContextBooleanItem) obj; - return flag == other.flag; - } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - return "TestContextItem000 [flag=" + flag + "]"; - } } diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextByteItem.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextByteItem.java index b152f2715..91d383a62 100644 --- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextByteItem.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextByteItem.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,14 +23,15 @@ package org.onap.policy.apex.context.test.concepts; import java.io.Serializable; +import lombok.Data; + /** - * The Class TestContextItem001. + * The Class TestContextByteItem. */ +@Data public class TestContextByteItem implements Serializable { private static final long serialVersionUID = 1361938145823720386L; - private static final int HASH_PRIME_1 = 31; - private byte byteValue = 0; /** @@ -49,58 +50,7 @@ public class TestContextByteItem implements Serializable { this.byteValue = byteValue; } - /** - * Gets the byte value. - * - * @return the byte value - */ - public byte getByteValue() { - return byteValue; - } - - /** - * Sets the byte value. - * - * @param byteValue the byte value - */ - public void setByteValue(final byte byteValue) { - this.byteValue = byteValue; - } - - /** - * {@inheritDoc}. - */ - @Override - public int hashCode() { - final int prime = HASH_PRIME_1; - int result = 1; - result = prime * result + byteValue; - return result; - } - - /** - * {@inheritDoc}. - */ - @Override - public boolean equals(final Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final TestContextByteItem other = (TestContextByteItem) obj; - return byteValue == other.byteValue; - } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - return "TestContextItem001 [byteValue=" + byteValue + "]"; + public Byte getIncrementedByteValue() { + return (byte) (byteValue + 1); } } diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateItem.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateItem.java index 4ed506977..b35b061a7 100644 --- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateItem.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateItem.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,15 +26,15 @@ import java.util.Calendar; import java.util.Date; import java.util.TimeZone; +import lombok.Data; + /** - * The Class TestContextItem008. + * The Class TestContextDateItem. */ +@Data public class TestContextDateItem implements Serializable { private static final long serialVersionUID = -6984963129968805460L; - private static final int HASH_PRIME_1 = 31; - private static final int FOUR_BYTES = 32; - private long time; private int year; @@ -60,8 +60,7 @@ public class TestContextDateItem implements Serializable { public TestContextDateItem(final Date dateValue) { if (dateValue != null) { setDateValue(dateValue.getTime()); - } - else { + } else { new Date(0); } } @@ -75,78 +74,6 @@ public class TestContextDateItem implements Serializable { setDateValue(time); } - /** - * Gets the time. - * - * @return the time - */ - public long getTime() { - return time; - } - - /** - * Gets the year. - * - * @return the year - */ - public int getYear() { - return year; - } - - /** - * Gets the month. - * - * @return the month - */ - public int getMonth() { - return month; - } - - /** - * Gets the day. - * - * @return the day - */ - public int getDay() { - return day; - } - - /** - * Gets the hour. - * - * @return the hour - */ - public int getHour() { - return hour; - } - - /** - * Gets the minute. - * - * @return the minute - */ - public int getMinute() { - return minute; - } - - /** - * Gets the second. - * - * @return the second - */ - public int getSecond() { - return second; - } - - /** - * Gets the milli second. - * - * @return the milli second - */ - public int getMilliSecond() { - return milliSecond; - } - /** * Gets the date value. * @@ -187,50 +114,4 @@ public class TestContextDateItem implements Serializable { second = calendar.get(Calendar.SECOND); milliSecond = calendar.get(Calendar.MILLISECOND); } - - - /** - * {@inheritDoc}. - */ - @Override - public int hashCode() { - final int prime = HASH_PRIME_1; - int result = 1; - result = prime * result + day; - result = prime * result + hour; - result = prime * result + milliSecond; - result = prime * result + minute; - result = prime * result + month; - result = prime * result + second; - result = prime * result + (int) (time ^ (time >>> FOUR_BYTES)); - result = prime * result + year; - return result; - } - - /** - * {@inheritDoc}. - */ - @Override - public boolean equals(final Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final TestContextDateItem other = (TestContextDateItem) obj; - return time == other.time; - } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - return "TestContextItem008 [time=" + time + ", year=" + year + ", month=" + month + ", day=" + day + ", hour=" - + hour + ", minute=" + minute + ", second=" + second + ", milliSecond=" + milliSecond + "]"; - } } diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateLocaleItem.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateLocaleItem.java index 22c46b4a7..a3d2fc475 100644 --- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateLocaleItem.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateLocaleItem.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,18 +25,17 @@ import java.io.Serializable; import java.util.Locale; import java.util.TimeZone; +import lombok.Data; + /** - * The Class TestContextItem00A. + * The Class TestContextDateLocaleItem. */ +@Data public class TestContextDateLocaleItem implements Serializable { private static final long serialVersionUID = -6579903685538233754L; - private static final int HASH_PRIME_1 = 31; - private static final int HASH_PRIME_2 = 1231; - private static final int HASH_PRIME_3 = 1237; - private TestContextDateItem dateValue = new TestContextDateItem(System.currentTimeMillis()); - private String timeZoneString = TimeZone.getTimeZone("Europe/Dublin").getDisplayName(); + private String tzValue = TimeZone.getTimeZone("Europe/Dublin").getDisplayName(); private boolean dst = false; private int utcOffset = 0; private Locale locale = Locale.ENGLISH; @@ -58,9 +57,9 @@ public class TestContextDateLocaleItem implements Serializable { * @param country the country */ public TestContextDateLocaleItem(final TestContextDateItem dateValue, final String tzValue, final boolean dst, - final int utcOffset, final String language, final String country) { + final int utcOffset, final String language, final String country) { this.dateValue = dateValue; - this.timeZoneString = TimeZone.getTimeZone(tzValue).getDisplayName(); + this.tzValue = TimeZone.getTimeZone(tzValue).getDisplayName(); this.dst = dst; this.utcOffset = utcOffset; @@ -74,40 +73,13 @@ public class TestContextDateLocaleItem implements Serializable { */ public TestContextDateLocaleItem(final TestContextDateLocaleItem original) { this.dateValue = original.dateValue; - this.timeZoneString = TimeZone.getTimeZone(original.timeZoneString).getDisplayName(); + this.tzValue = TimeZone.getTimeZone(original.tzValue).getDisplayName(); this.dst = original.dst; this.utcOffset = original.utcOffset; this.locale = new Locale(original.getLocale().getCountry(), original.getLocale().getLanguage()); } - /** - * Gets the date value. - * - * @return the date value - */ - public TestContextDateItem getDateValue() { - return dateValue; - } - - /** - * Sets the date value. - * - * @param dateValue the date value - */ - public void setDateValue(final TestContextDateItem dateValue) { - this.dateValue = dateValue; - } - - /** - * Gets the TZ value. - * - * @return the TZ value - */ - public String getTzValue() { - return timeZoneString; - } - /** * Sets the TZ value. * @@ -115,134 +87,9 @@ public class TestContextDateLocaleItem implements Serializable { */ public void setTzValue(final String tzValue) { if (tzValue != null) { - this.timeZoneString = TimeZone.getTimeZone(tzValue).getDisplayName(); + this.tzValue = TimeZone.getTimeZone(tzValue).getDisplayName(); } else { - this.timeZoneString = null; - } - } - - /** - * Gets the DST. - * - * @return the dst - */ - public boolean getDst() { - return dst; - } - - /** - * Sets the DST. - * - * @param newDst the dst - */ - public void setDst(final boolean newDst) { - this.dst = newDst; - } - - /** - * Gets the UTC offset. - * - * @return the UTC offset - */ - public int getUtcOffset() { - return utcOffset; - } - - /** - * Sets the UTC offset. - * - * @param newUtcOffset the UTC offset - */ - public void setUtcOffset(final int newUtcOffset) { - this.utcOffset = newUtcOffset; - } - - /** - * Gets the locale. - * - * @return the locale - */ - public Locale getLocale() { - return locale; - } - - /** - * Sets the locale. - * - * @param locale the locale - */ - public void setLocale(final Locale locale) { - if (locale != null) { - this.locale = locale; - } - else { - this.locale = null; + this.tzValue = null; } } - - /** - * {@inheritDoc}. - */ - @Override - public int hashCode() { - final int prime = HASH_PRIME_1; - int result = 1; - result = prime * result + ((dateValue == null) ? 0 : dateValue.hashCode()); - result = prime * result + (dst ? HASH_PRIME_2 : HASH_PRIME_3); - result = prime * result + ((locale == null) ? 0 : locale.hashCode()); - result = prime * result + ((timeZoneString == null) ? 0 : timeZoneString.hashCode()); - result = prime * result + utcOffset; - return result; - } - - /** - * {@inheritDoc}. - */ - @Override - public boolean equals(final Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final TestContextDateLocaleItem other = (TestContextDateLocaleItem) obj; - if (dateValue == null) { - if (other.dateValue != null) { - return false; - } - } else if (!dateValue.equals(other.dateValue)) { - return false; - } - if (dst != other.dst) { - return false; - } - if (locale == null) { - if (other.locale != null) { - return false; - } - } else if (!locale.equals(other.locale)) { - return false; - } - if (timeZoneString == null) { - if (other.timeZoneString != null) { - return false; - } - } else if (!timeZoneString.equals(other.timeZoneString)) { - return false; - } - return utcOffset == other.utcOffset; - } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - return "TestContextItem00A [dateValue=" + dateValue + ", timeZoneString=" + timeZoneString + ", dst=" + dst - + ", utcOffset=" + utcOffset + ", locale=" + locale + "]"; - } } diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateTzItem.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateTzItem.java index 602f20917..029719afb 100644 --- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateTzItem.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateTzItem.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,18 +24,17 @@ package org.onap.policy.apex.context.test.concepts; import java.io.Serializable; import java.util.TimeZone; +import lombok.Data; + /** - * The Class TestContextItem009. + * The Class TestContextDateTzItem. */ +@Data public class TestContextDateTzItem implements Serializable { private static final long serialVersionUID = 5604426823170331706L; - private static final int HASH_PRIME_1 = 31; - private static final int HASH_PRIME_2 = 1231; - private static final int HASH_PRIME_3 = 1237; - private TestContextDateItem dateValue = new TestContextDateItem(System.currentTimeMillis()); - private String timeZoneString = TimeZone.getTimeZone("Europe/Dublin").getDisplayName(); + private String tzValue = TimeZone.getTimeZone("Europe/Dublin").getDisplayName(); private boolean dst = false; /** @@ -54,7 +53,7 @@ public class TestContextDateTzItem implements Serializable { */ public TestContextDateTzItem(final TestContextDateItem dateValue, final String tzValue, final boolean dst) { this.dateValue = dateValue; - this.timeZoneString = TimeZone.getTimeZone(tzValue).getDisplayName(); + this.tzValue = TimeZone.getTimeZone(tzValue).getDisplayName(); this.dst = dst; } @@ -65,37 +64,10 @@ public class TestContextDateTzItem implements Serializable { */ public TestContextDateTzItem(final TestContextDateTzItem original) { this.dateValue = original.dateValue; - this.timeZoneString = original.timeZoneString; + this.tzValue = original.tzValue; this.dst = original.dst; } - /** - * Gets the date value. - * - * @return the date value - */ - public TestContextDateItem getDateValue() { - return dateValue; - } - - /** - * Sets the date value. - * - * @param dateValue the date value - */ - public void setDateValue(final TestContextDateItem dateValue) { - this.dateValue = dateValue; - } - - /** - * Gets the TZ value. - * - * @return the TZ value - */ - public String getTzValue() { - return timeZoneString; - } - /** * Sets the TZ value. * @@ -103,85 +75,9 @@ public class TestContextDateTzItem implements Serializable { */ public void setTzValue(final String tzValue) { if (tzValue != null) { - this.timeZoneString = TimeZone.getTimeZone(tzValue).getDisplayName(); + this.tzValue = TimeZone.getTimeZone(tzValue).getDisplayName(); + } else { + this.tzValue = null; } - else { - this.timeZoneString = null; - } - } - - /** - * Gets the DST. - * - * @return the dst - */ - public boolean getDst() { - return dst; - } - - /** - * Sets the DST. - * - * @param newDst the dst - */ - public void setDst(final boolean newDst) { - this.dst = newDst; - } - - /** - * {@inheritDoc}. - */ - @Override - public int hashCode() { - final int prime = HASH_PRIME_1; - int result = 1; - result = prime * result + ((dateValue == null) ? 0 : dateValue.hashCode()); - result = prime * result + (dst ? HASH_PRIME_2 : HASH_PRIME_3); - result = prime * result + ((timeZoneString == null) ? 0 : timeZoneString.hashCode()); - return result; - } - - /** - * {@inheritDoc}. - */ - @Override - public boolean equals(final Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final TestContextDateTzItem other = (TestContextDateTzItem) obj; - if (dateValue == null) { - if (other.dateValue != null) { - return false; - } - } else if (!dateValue.equals(other.dateValue)) { - return false; - } - if (dst != other.dst) { - return false; - } - if (timeZoneString == null) { - if (other.timeZoneString != null) { - return false; - } - } - else if (!timeZoneString.equals(other.timeZoneString)) { - return false; - } - return true; - } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - return "TestContextItem009 [dateValue=" + dateValue + ", tzValue=" + timeZoneString + ", dst=" + dst + "]"; } } diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDoubleItem.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDoubleItem.java index e67ba5e7e..dede657c6 100644 --- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDoubleItem.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDoubleItem.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,15 +23,15 @@ package org.onap.policy.apex.context.test.concepts; import java.io.Serializable; +import lombok.Data; + /** - * The Class TestContextItem005. + * The Class TestContextDoubleItem. */ +@Data public class TestContextDoubleItem implements Serializable { private static final long serialVersionUID = -2958758261076734821L; - private static final int HASH_PRIME_1 = 31; - private static final int FOUR_BYTES = 32; - private double doubleValue = 0; /** @@ -50,60 +50,7 @@ public class TestContextDoubleItem implements Serializable { this.doubleValue = doubleValue; } - /** - * Gets the double value. - * - * @return the double value - */ - public double getDoubleValue() { - return doubleValue; - } - - /** - * Sets the double value. - * - * @param doubleValue the double value - */ - public void setDoubleValue(final double doubleValue) { - this.doubleValue = doubleValue; - } - - /** - * {@inheritDoc}. - */ - @Override - public int hashCode() { - final int prime = HASH_PRIME_1; - int result = 1; - long temp; - temp = Double.doubleToLongBits(doubleValue); - result = prime * result + (int) (temp ^ (temp >>> FOUR_BYTES)); - return result; - } - - /** - * {@inheritDoc}. - */ - @Override - public boolean equals(final Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final TestContextDoubleItem other = (TestContextDoubleItem) obj; - return Double.doubleToLongBits(doubleValue) == Double.doubleToLongBits(other.doubleValue); - } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - return "TestContextItem005 [doubleValue=" + doubleValue + "]"; + public Double getIncrementedDoubleValue() { + return doubleValue + 1; } } diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextFloatItem.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextFloatItem.java index fec1c2545..8337d8006 100644 --- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextFloatItem.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextFloatItem.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,14 +23,15 @@ package org.onap.policy.apex.context.test.concepts; import java.io.Serializable; +import lombok.Data; + /** - * The Class TestContextItem004. + * The Class TestContextFloatItem. */ +@Data public class TestContextFloatItem implements Serializable { private static final long serialVersionUID = -3359180576903272400L; - private static final int HASH_PRIME_1 = 31; - private float floatValue = 0; /** @@ -49,58 +50,7 @@ public class TestContextFloatItem implements Serializable { this.floatValue = floatValue; } - /** - * Gets the float value. - * - * @return the float value - */ - public float getFloatValue() { - return floatValue; - } - - /** - * Sets the float value. - * - * @param floatValue the float value - */ - public void setFloatValue(final float floatValue) { - this.floatValue = floatValue; - } - - /** - * {@inheritDoc}. - */ - @Override - public int hashCode() { - final int prime = HASH_PRIME_1; - int result = 1; - result = prime * result + Float.floatToIntBits(floatValue); - return result; - } - - /** - * {@inheritDoc}. - */ - @Override - public boolean equals(final Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final TestContextFloatItem other = (TestContextFloatItem) obj; - return Float.floatToIntBits(floatValue) == Float.floatToIntBits(other.floatValue); - } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - return "TestContextItem004 [floatValue=" + floatValue + "]"; + public Float getIncrementedFloatValue() { + return floatValue + 1; } } diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextIntItem.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextIntItem.java index ea76f7049..fde563cf3 100644 --- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextIntItem.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextIntItem.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,14 +23,15 @@ package org.onap.policy.apex.context.test.concepts; import java.io.Serializable; +import lombok.Data; + /** - * The Class TestContextItem002. + * The Class TestContextIntItem. */ +@Data public class TestContextIntItem implements Serializable { private static final long serialVersionUID = -8978435658277900984L; - private static final int HASH_PRIME_1 = 31; - private int intValue = 0; /** @@ -58,58 +59,7 @@ public class TestContextIntItem implements Serializable { this.intValue = original.intValue; } - /** - * Gets the int value. - * - * @return the int value - */ - public int getIntValue() { - return intValue; - } - - /** - * Sets the int value. - * - * @param intValue the int value - */ - public void setIntValue(final int intValue) { - this.intValue = intValue; - } - - /** - * {@inheritDoc}. - */ - @Override - public int hashCode() { - final int prime = HASH_PRIME_1; - int result = 1; - result = prime * result + intValue; - return result; - } - - /** - * {@inheritDoc}. - */ - @Override - public boolean equals(final Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final TestContextIntItem other = (TestContextIntItem) obj; - return intValue == other.intValue; - } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - return "TestContextItem002 [intValue=" + intValue + "]"; + public Integer getIncrementedIntValue() { + return intValue + 1; } } diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextLongItem.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextLongItem.java index dc18da5f5..ac70dafcc 100644 --- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextLongItem.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextLongItem.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,15 +23,15 @@ package org.onap.policy.apex.context.test.concepts; import java.io.Serializable; +import lombok.Data; + /** - * The Class TestContextItem003. + * The Class TestContextLongItem. */ +@Data public class TestContextLongItem implements Serializable { private static final long serialVersionUID = 3599267534512489386L; - private static final int HASH_PRIME_1 = 31; - private static final int FOUR_BYTES = 33; - private long longValue = 0; /** @@ -50,58 +50,7 @@ public class TestContextLongItem implements Serializable { this.longValue = longValue; } - /** - * Gets the long value. - * - * @return the long value - */ - public long getLongValue() { - return longValue; - } - - /** - * Sets the long value. - * - * @param longValue the long value - */ - public void setLongValue(final long longValue) { - this.longValue = longValue; - } - - /** - * {@inheritDoc}. - */ - @Override - public int hashCode() { - final int prime = HASH_PRIME_1; - int result = 1; - result = prime * result + (int) (longValue ^ (longValue >>> FOUR_BYTES)); - return result; - } - - /** - * {@inheritDoc}. - */ - @Override - public boolean equals(final Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final TestContextLongItem other = (TestContextLongItem) obj; - return longValue == other.longValue; - } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - return "TestContextItem003 [longValue=" + longValue + "]"; + public Long getIncrementedLongValue() { + return longValue + 1; } } diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextLongObjectItem.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextLongObjectItem.java index fb1e9319d..cadc66f95 100644 --- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextLongObjectItem.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextLongObjectItem.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,14 +23,15 @@ package org.onap.policy.apex.context.test.concepts; import java.io.Serializable; +import lombok.Data; + /** - * The Class TestContextItem007. + * The Class TestContextLongObjectItem. */ +@Data public class TestContextLongObjectItem implements Serializable { private static final long serialVersionUID = -1029406737866392421L; - private static final int HASH_PRIME_1 = 31; - private Long longValue = 0L; /** @@ -49,65 +50,7 @@ public class TestContextLongObjectItem implements Serializable { this.longValue = longValue; } - /** - * Gets the long value. - * - * @return the long value - */ - public Long getLongValue() { - return longValue; - } - - /** - * Sets the long value. - * - * @param longValue the long value - */ - public void setLongValue(final Long longValue) { - this.longValue = longValue; - } - - /** - * {@inheritDoc}. - */ - @Override - public int hashCode() { - final int prime = HASH_PRIME_1; - int result = 1; - result = prime * result + ((longValue == null) ? 0 : longValue.hashCode()); - return result; - } - - /** - * {@inheritDoc}. - */ - @Override - public boolean equals(final Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final TestContextLongObjectItem other = (TestContextLongObjectItem) obj; - if (longValue == null) { - if (other.longValue != null) { - return false; - } - } else if (!longValue.equals(other.longValue)) { - return false; - } - return true; - } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - return "TestContextItem007 [longValue=" + longValue + "]"; + public Long getIncrementedLongValue() { + return longValue + 1; } } diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextStringItem.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextStringItem.java index 16a180a64..e443b9c8a 100644 --- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextStringItem.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextStringItem.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,14 +23,15 @@ package org.onap.policy.apex.context.test.concepts; import java.io.Serializable; +import lombok.Data; + /** - * The Class TestContextItem006. + * The Class TestContextStringItem. */ +@Data public class TestContextStringItem implements Serializable { private static final long serialVersionUID = -1074772190611125121L; - private static final int HASH_PRIME_1 = 31; - private String stringValue = ""; /** @@ -48,66 +49,4 @@ public class TestContextStringItem implements Serializable { public TestContextStringItem(final String stringValue) { this.stringValue = stringValue; } - - /** - * Gets the string value. - * - * @return the string value - */ - public String getStringValue() { - return stringValue; - } - - /** - * Sets the string value. - * - * @param stringValue the string value - */ - public void setStringValue(final String stringValue) { - this.stringValue = stringValue; - } - - /** - * {@inheritDoc}. - */ - @Override - public int hashCode() { - final int prime = HASH_PRIME_1; - int result = 1; - result = prime * result + ((stringValue == null) ? 0 : stringValue.hashCode()); - return result; - } - - /** - * {@inheritDoc}. - */ - @Override - public boolean equals(final Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final TestContextStringItem other = (TestContextStringItem) obj; - if (stringValue == null) { - if (other.stringValue != null) { - return false; - } - } else if (!stringValue.equals(other.stringValue)) { - return false; - } - return true; - } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - return "TestContextItem006 [stringValue=" + stringValue + "]"; - } } diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextTreeMapItem.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextTreeMapItem.java index 3e3aae121..fcdd1ad06 100644 --- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextTreeMapItem.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextTreeMapItem.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,14 +25,15 @@ import java.io.Serializable; import java.util.Map; import java.util.TreeMap; +import lombok.Data; + /** - * The Class TestContextItem00C. + * The Class TestContextTreeMapItem. */ +@Data public class TestContextTreeMapItem implements Serializable { private static final long serialVersionUID = -7497746259264651884L; - private static final int HASH_PRIME_1 = 31; - private Map mapValue = new TreeMap<>(); /** @@ -50,70 +51,4 @@ public class TestContextTreeMapItem implements Serializable { public TestContextTreeMapItem(final Map mapValue) { this.mapValue = mapValue; } - - /** - * Gets the map value. - * - * @return the map value - */ - public Map getMapValue() { - if (mapValue == null) { - mapValue = new TreeMap<>(); - } - return mapValue; - } - - /** - * Sets the map value. - * - * @param mapValue the map value - */ - public void setMapValue(final Map mapValue) { - this.mapValue = mapValue; - } - - /** - * {@inheritDoc}. - */ - @Override - public int hashCode() { - final int prime = HASH_PRIME_1; - int result = 1; - result = prime * result + ((mapValue == null) ? 0 : mapValue.hashCode()); - return result; - } - - /** - * {@inheritDoc}. - */ - @Override - public boolean equals(final Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final TestContextTreeMapItem other = (TestContextTreeMapItem) obj; - if (mapValue == null) { - if (other.mapValue != null) { - return false; - } - } else if (!mapValue.equals(other.mapValue)) { - return false; - } - return true; - } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - return "TestContextItem00C [mapValue=" + mapValue + "]"; - } - } diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextTreeSetItem.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextTreeSetItem.java index 7c83d48e5..d84aebbff 100644 --- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextTreeSetItem.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextTreeSetItem.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,18 +23,18 @@ package org.onap.policy.apex.context.test.concepts; import java.io.Serializable; import java.util.Arrays; -import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; +import lombok.Data; + /** - * The Class TestContextItem00B. + * The Class TestContextTreeSetItem. */ +@Data public class TestContextTreeSetItem implements Serializable { private static final long serialVersionUID = 1254589722957250388L; - private static final int HASH_PRIME_1 = 31; - private SortedSet setValue = new TreeSet<>(); /** @@ -61,69 +61,4 @@ public class TestContextTreeSetItem implements Serializable { public TestContextTreeSetItem(final SortedSet setValue) { this.setValue = setValue; } - - /** - * Gets the set value. - * - * @return the sets the value - */ - public Set getSetValue() { - if (setValue == null) { - setValue = new TreeSet<>(); - } - return setValue; - } - - /** - * Sets the set value. - * - * @param setValue the sets the value - */ - public void setSetValue(final SortedSet setValue) { - this.setValue = setValue; - } - - /** - * {@inheritDoc}. - */ - @Override - public int hashCode() { - final int prime = HASH_PRIME_1; - int result = 1; - result = prime * result + ((setValue == null) ? 0 : setValue.hashCode()); - return result; - } - - /** - * {@inheritDoc}. - */ - @Override - public boolean equals(final Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final TestContextTreeSetItem other = (TestContextTreeSetItem) obj; - if (setValue == null) { - if (other.setValue != null) { - return false; - } - } else if (!setValue.equals(other.setValue)) { - return false; - } - return true; - } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - return "TestContextItem00B [setValue=" + setValue + "]"; - } } diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestExternalContextItem.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestExternalContextItem.java index 3d17eeccc..d20e4bde8 100644 --- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestExternalContextItem.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestExternalContextItem.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,14 +23,15 @@ package org.onap.policy.apex.context.test.concepts; import java.io.Serializable; +import lombok.Data; + /** * The Class TestExternalContextItem. */ +@Data public class TestExternalContextItem implements Serializable { private static final long serialVersionUID = 3512435733818672173L; - private static final int HASH_PRIME_1 = 31; - private TestContextBooleanItem testExternalContextItem000; private TestContextByteItem testExternalContextItem001; private TestContextIntItem testExternalContextItem002; @@ -44,386 +45,4 @@ public class TestExternalContextItem implements Serializable { private TestContextDateLocaleItem testExternalContextItem00A; private TestContextTreeSetItem testExternalContextItem00B; private TestContextTreeMapItem testExternalContextItem00C; - - /** - * Gets the test external context item 000. - * - * @return the test external context item 000 - */ - public TestContextBooleanItem getTestExternalContextItem000() { - return testExternalContextItem000; - } - - /** - * Sets the test external context item 000. - * - * @param testExternalContextItem000 the test external context item 000 - */ - public void setTestExternalContextItem000(final TestContextBooleanItem testExternalContextItem000) { - this.testExternalContextItem000 = testExternalContextItem000; - } - - /** - * Gets the test external context item 001. - * - * @return the test external context item 001 - */ - public TestContextByteItem getTestExternalContextItem001() { - return testExternalContextItem001; - } - - /** - * Sets the test external context item 001. - * - * @param testExternalContextItem001 the test external context item 001 - */ - public void setTestExternalContextItem001(final TestContextByteItem testExternalContextItem001) { - this.testExternalContextItem001 = testExternalContextItem001; - } - - /** - * Gets the test external context item 002. - * - * @return the test external context item 002 - */ - public TestContextIntItem getTestExternalContextItem002() { - return testExternalContextItem002; - } - - /** - * Sets the test external context item 002. - * - * @param testExternalContextItem002 the test external context item 002 - */ - public void setTestExternalContextItem002(final TestContextIntItem testExternalContextItem002) { - this.testExternalContextItem002 = testExternalContextItem002; - } - - /** - * Gets the test external context item 003. - * - * @return the test external context item 003 - */ - public TestContextLongItem getTestExternalContextItem003() { - return testExternalContextItem003; - } - - /** - * Sets the test external context item 003. - * - * @param testExternalContextItem003 the test external context item 003 - */ - public void setTestExternalContextItem003(final TestContextLongItem testExternalContextItem003) { - this.testExternalContextItem003 = testExternalContextItem003; - } - - /** - * Gets the test external context item 004. - * - * @return the test external context item 004 - */ - public TestContextFloatItem getTestExternalContextItem004() { - return testExternalContextItem004; - } - - /** - * Sets the test external context item 004. - * - * @param testExternalContextItem004 the test external context item 004 - */ - public void setTestExternalContextItem004(final TestContextFloatItem testExternalContextItem004) { - this.testExternalContextItem004 = testExternalContextItem004; - } - - /** - * Gets the test external context item 005. - * - * @return the test external context item 005 - */ - public TestContextDoubleItem getTestExternalContextItem005() { - return testExternalContextItem005; - } - - /** - * Sets the test external context item 005. - * - * @param testExternalContextItem005 the test external context item 005 - */ - public void setTestExternalContextItem005(final TestContextDoubleItem testExternalContextItem005) { - this.testExternalContextItem005 = testExternalContextItem005; - } - - /** - * Gets the test external context item 006. - * - * @return the test external context item 006 - */ - public TestContextStringItem getTestExternalContextItem006() { - return testExternalContextItem006; - } - - /** - * Sets the test external context item 006. - * - * @param testExternalContextItem006 the test external context item 006 - */ - public void setTestExternalContextItem006(final TestContextStringItem testExternalContextItem006) { - this.testExternalContextItem006 = testExternalContextItem006; - } - - /** - * Gets the test external context item 007. - * - * @return the test external context item 007 - */ - public TestContextLongObjectItem getTestExternalContextItem007() { - return testExternalContextItem007; - } - - /** - * Sets the test external context item 007. - * - * @param testExternalContextItem007 the test external context item 007 - */ - public void setTestExternalContextItem007(final TestContextLongObjectItem testExternalContextItem007) { - this.testExternalContextItem007 = testExternalContextItem007; - } - - /** - * Gets the test external context item 008. - * - * @return the test external context item 008 - */ - public TestContextDateItem getTestExternalContextItem008() { - return testExternalContextItem008; - } - - /** - * Sets the test external context item 008. - * - * @param testExternalContextItem008 the test external context item 008 - */ - public void setTestExternalContextItem008(final TestContextDateItem testExternalContextItem008) { - this.testExternalContextItem008 = testExternalContextItem008; - } - - /** - * Gets the test external context item 009. - * - * @return the test external context item 009 - */ - public TestContextDateTzItem getTestExternalContextItem009() { - return testExternalContextItem009; - } - - /** - * Sets the test external context item 009. - * - * @param testExternalContextItem009 the test external context item 009 - */ - public void setTestExternalContextItem009(final TestContextDateTzItem testExternalContextItem009) { - this.testExternalContextItem009 = testExternalContextItem009; - } - - /** - * Gets the test external context item 00 A. - * - * @return the test external context item 00 A - */ - public TestContextDateLocaleItem getTestExternalContextItem00A() { - return testExternalContextItem00A; - } - - /** - * Sets the test external context item 00 A. - * - * @param testExternalContextItem00A the test external context item 00 A - */ - public void setTestExternalContextItem00A(final TestContextDateLocaleItem testExternalContextItem00A) { - this.testExternalContextItem00A = testExternalContextItem00A; - } - - /** - * Gets the test external context item 00 B. - * - * @return the test external context item 00 B - */ - public TestContextTreeSetItem getTestExternalContextItem00B() { - return testExternalContextItem00B; - } - - /** - * Sets the test external context item 00 B. - * - * @param testExternalContextItem00B the test external context item 00 B - */ - public void setTestExternalContextItem00B(final TestContextTreeSetItem testExternalContextItem00B) { - this.testExternalContextItem00B = testExternalContextItem00B; - } - - /** - * Gets the test external context item 00 C. - * - * @return the test external context item 00 C - */ - public TestContextTreeMapItem getTestExternalContextItem00C() { - return testExternalContextItem00C; - } - - /** - * Sets the test external context item 00 C. - * - * @param testExternalContextItem00C the test external context item 00 C - */ - public void setTestExternalContextItem00C(final TestContextTreeMapItem testExternalContextItem00C) { - this.testExternalContextItem00C = testExternalContextItem00C; - } - - /** - * {@inheritDoc}. - */ - @Override - public int hashCode() { - final int prime = HASH_PRIME_1; - int result = 1; - result = prime * result + ((testExternalContextItem000 == null) ? 0 : testExternalContextItem000.hashCode()); - result = prime * result + ((testExternalContextItem001 == null) ? 0 : testExternalContextItem001.hashCode()); - result = prime * result + ((testExternalContextItem002 == null) ? 0 : testExternalContextItem002.hashCode()); - result = prime * result + ((testExternalContextItem003 == null) ? 0 : testExternalContextItem003.hashCode()); - result = prime * result + ((testExternalContextItem004 == null) ? 0 : testExternalContextItem004.hashCode()); - result = prime * result + ((testExternalContextItem005 == null) ? 0 : testExternalContextItem005.hashCode()); - result = prime * result + ((testExternalContextItem006 == null) ? 0 : testExternalContextItem006.hashCode()); - result = prime * result + ((testExternalContextItem007 == null) ? 0 : testExternalContextItem007.hashCode()); - result = prime * result + ((testExternalContextItem008 == null) ? 0 : testExternalContextItem008.hashCode()); - result = prime * result + ((testExternalContextItem009 == null) ? 0 : testExternalContextItem009.hashCode()); - result = prime * result + ((testExternalContextItem00A == null) ? 0 : testExternalContextItem00A.hashCode()); - result = prime * result + ((testExternalContextItem00B == null) ? 0 : testExternalContextItem00B.hashCode()); - result = prime * result + ((testExternalContextItem00C == null) ? 0 : testExternalContextItem00C.hashCode()); - return result; - } - - /** - * {@inheritDoc}. - */ - @Override - public boolean equals(final Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final TestExternalContextItem other = (TestExternalContextItem) obj; - if (testExternalContextItem000 == null) { - if (other.testExternalContextItem000 != null) { - return false; - } - } else if (!testExternalContextItem000.equals(other.testExternalContextItem000)) { - return false; - } - if (testExternalContextItem001 == null) { - if (other.testExternalContextItem001 != null) { - return false; - } - } else if (!testExternalContextItem001.equals(other.testExternalContextItem001)) { - return false; - } - if (testExternalContextItem002 == null) { - if (other.testExternalContextItem002 != null) { - return false; - } - } else if (!testExternalContextItem002.equals(other.testExternalContextItem002)) { - return false; - } - if (testExternalContextItem003 == null) { - if (other.testExternalContextItem003 != null) { - return false; - } - } else if (!testExternalContextItem003.equals(other.testExternalContextItem003)) { - return false; - } - if (testExternalContextItem004 == null) { - if (other.testExternalContextItem004 != null) { - return false; - } - } else if (!testExternalContextItem004.equals(other.testExternalContextItem004)) { - return false; - } - if (testExternalContextItem005 == null) { - if (other.testExternalContextItem005 != null) { - return false; - } - } else if (!testExternalContextItem005.equals(other.testExternalContextItem005)) { - return false; - } - if (testExternalContextItem006 == null) { - if (other.testExternalContextItem006 != null) { - return false; - } - } else if (!testExternalContextItem006.equals(other.testExternalContextItem006)) { - return false; - } - if (testExternalContextItem007 == null) { - if (other.testExternalContextItem007 != null) { - return false; - } - } else if (!testExternalContextItem007.equals(other.testExternalContextItem007)) { - return false; - } - if (testExternalContextItem008 == null) { - if (other.testExternalContextItem008 != null) { - return false; - } - } else if (!testExternalContextItem008.equals(other.testExternalContextItem008)) { - return false; - } - if (testExternalContextItem009 == null) { - if (other.testExternalContextItem009 != null) { - return false; - } - } else if (!testExternalContextItem009.equals(other.testExternalContextItem009)) { - return false; - } - if (testExternalContextItem00A == null) { - if (other.testExternalContextItem00A != null) { - return false; - } - } else if (!testExternalContextItem00A.equals(other.testExternalContextItem00A)) { - return false; - } - if (testExternalContextItem00B == null) { - if (other.testExternalContextItem00B != null) { - return false; - } - } else if (!testExternalContextItem00B.equals(other.testExternalContextItem00B)) { - return false; - } - if (testExternalContextItem00C == null) { - if (other.testExternalContextItem00C != null) { - return false; - } - } else if (!testExternalContextItem00C.equals(other.testExternalContextItem00C)) { - return false; - } - return true; - } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - return "TestExternalContextItem [testExternalContextItem000=" + testExternalContextItem000 - + ", testExternalContextItem001=" + testExternalContextItem001 + ", testExternalContextItem002=" - + testExternalContextItem002 + ", testExternalContextItem003=" + testExternalContextItem003 - + ", testExternalContextItem004=" + testExternalContextItem004 + ", testExternalContextItem005=" - + testExternalContextItem005 + ", testExternalContextItem006=" + testExternalContextItem006 - + ", testExternalContextItem007=" + testExternalContextItem007 + ", testExternalContextItem008=" - + testExternalContextItem008 + ", testExternalContextItem009=" + testExternalContextItem009 - + ", testExternalContextItem00A=" + testExternalContextItem00A + ", testExternalContextItem00B=" - + testExternalContextItem00B + ", testExternalContextItem00C=" + testExternalContextItem00C + "]"; - } } diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestGlobalContextItem.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestGlobalContextItem.java index 94707082d..f10d8c823 100644 --- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestGlobalContextItem.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestGlobalContextItem.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,14 +23,15 @@ package org.onap.policy.apex.context.test.concepts; import java.io.Serializable; +import lombok.Data; + /** * The Class TestGlobalContextItem. */ +@Data public class TestGlobalContextItem implements Serializable { private static final long serialVersionUID = 3348445332683174361L; - private static final int HASH_PRIME_1 = 31; - private TestContextBooleanItem testGlobalContextItem000; private TestContextByteItem testGlobalContextItem001; private TestContextIntItem testGlobalContextItem002; @@ -44,386 +45,4 @@ public class TestGlobalContextItem implements Serializable { private TestContextDateLocaleItem testGlobalContextItem00A; private TestContextTreeSetItem testGlobalContextItem00B; private TestContextTreeMapItem testGlobalContextItem00C; - - /** - * Gets the test global context item 000. - * - * @return the test global context item 000 - */ - public TestContextBooleanItem getTestGlobalContextItem000() { - return testGlobalContextItem000; - } - - /** - * Sets the test global context item 000. - * - * @param testGlobalContextItem000 the test global context item 000 - */ - public void setTestGlobalContextItem000(final TestContextBooleanItem testGlobalContextItem000) { - this.testGlobalContextItem000 = testGlobalContextItem000; - } - - /** - * Gets the test global context item 001. - * - * @return the test global context item 001 - */ - public TestContextByteItem getTestGlobalContextItem001() { - return testGlobalContextItem001; - } - - /** - * Sets the test global context item 001. - * - * @param testGlobalContextItem001 the test global context item 001 - */ - public void setTestGlobalContextItem001(final TestContextByteItem testGlobalContextItem001) { - this.testGlobalContextItem001 = testGlobalContextItem001; - } - - /** - * Gets the test global context item 002. - * - * @return the test global context item 002 - */ - public TestContextIntItem getTestGlobalContextItem002() { - return testGlobalContextItem002; - } - - /** - * Sets the test global context item 002. - * - * @param testGlobalContextItem002 the test global context item 002 - */ - public void setTestGlobalContextItem002(final TestContextIntItem testGlobalContextItem002) { - this.testGlobalContextItem002 = testGlobalContextItem002; - } - - /** - * Gets the test global context item 003. - * - * @return the test global context item 003 - */ - public TestContextLongItem getTestGlobalContextItem003() { - return testGlobalContextItem003; - } - - /** - * Sets the test global context item 003. - * - * @param testGlobalContextItem003 the test global context item 003 - */ - public void setTestGlobalContextItem003(final TestContextLongItem testGlobalContextItem003) { - this.testGlobalContextItem003 = testGlobalContextItem003; - } - - /** - * Gets the test global context item 004. - * - * @return the test global context item 004 - */ - public TestContextFloatItem getTestGlobalContextItem004() { - return testGlobalContextItem004; - } - - /** - * Sets the test global context item 004. - * - * @param testGlobalContextItem004 the test global context item 004 - */ - public void setTestGlobalContextItem004(final TestContextFloatItem testGlobalContextItem004) { - this.testGlobalContextItem004 = testGlobalContextItem004; - } - - /** - * Gets the test global context item 005. - * - * @return the test global context item 005 - */ - public TestContextDoubleItem getTestGlobalContextItem005() { - return testGlobalContextItem005; - } - - /** - * Sets the test global context item 005. - * - * @param testGlobalContextItem005 the test global context item 005 - */ - public void setTestGlobalContextItem005(final TestContextDoubleItem testGlobalContextItem005) { - this.testGlobalContextItem005 = testGlobalContextItem005; - } - - /** - * Gets the test global context item 006. - * - * @return the test global context item 006 - */ - public TestContextStringItem getTestGlobalContextItem006() { - return testGlobalContextItem006; - } - - /** - * Sets the test global context item 006. - * - * @param testGlobalContextItem006 the test global context item 006 - */ - public void setTestGlobalContextItem006(final TestContextStringItem testGlobalContextItem006) { - this.testGlobalContextItem006 = testGlobalContextItem006; - } - - /** - * Gets the test global context item 007. - * - * @return the test global context item 007 - */ - public TestContextLongObjectItem getTestGlobalContextItem007() { - return testGlobalContextItem007; - } - - /** - * Sets the test global context item 007. - * - * @param testGlobalContextItem007 the test global context item 007 - */ - public void setTestGlobalContextItem007(final TestContextLongObjectItem testGlobalContextItem007) { - this.testGlobalContextItem007 = testGlobalContextItem007; - } - - /** - * Gets the test global context item 008. - * - * @return the test global context item 008 - */ - public TestContextDateItem getTestGlobalContextItem008() { - return testGlobalContextItem008; - } - - /** - * Sets the test global context item 008. - * - * @param testGlobalContextItem008 the test global context item 008 - */ - public void setTestGlobalContextItem008(final TestContextDateItem testGlobalContextItem008) { - this.testGlobalContextItem008 = testGlobalContextItem008; - } - - /** - * Gets the test global context item 009. - * - * @return the test global context item 009 - */ - public TestContextDateTzItem getTestGlobalContextItem009() { - return testGlobalContextItem009; - } - - /** - * Sets the test global context item 009. - * - * @param testGlobalContextItem009 the test global context item 009 - */ - public void setTestGlobalContextItem009(final TestContextDateTzItem testGlobalContextItem009) { - this.testGlobalContextItem009 = testGlobalContextItem009; - } - - /** - * Gets the test global context item 00 A. - * - * @return the test global context item 00 A - */ - public TestContextDateLocaleItem getTestGlobalContextItem00A() { - return testGlobalContextItem00A; - } - - /** - * Sets the test global context item 00 A. - * - * @param testGlobalContextItem00A the test global context item 00 A - */ - public void setTestGlobalContextItem00A(final TestContextDateLocaleItem testGlobalContextItem00A) { - this.testGlobalContextItem00A = testGlobalContextItem00A; - } - - /** - * Gets the test global context item 00 B. - * - * @return the test global context item 00 B - */ - public TestContextTreeSetItem getTestGlobalContextItem00B() { - return testGlobalContextItem00B; - } - - /** - * Sets the test global context item 00 B. - * - * @param testGlobalContextItem00B the test global context item 00 B - */ - public void setTestGlobalContextItem00B(final TestContextTreeSetItem testGlobalContextItem00B) { - this.testGlobalContextItem00B = testGlobalContextItem00B; - } - - /** - * Gets the test global context item 00 C. - * - * @return the test global context item 00 C - */ - public TestContextTreeMapItem getTestGlobalContextItem00C() { - return testGlobalContextItem00C; - } - - /** - * Sets the test global context item 00 C. - * - * @param testGlobalContextItem00C the test global context item 00 C - */ - public void setTestGlobalContextItem00C(final TestContextTreeMapItem testGlobalContextItem00C) { - this.testGlobalContextItem00C = testGlobalContextItem00C; - } - - /** - * {@inheritDoc}. - */ - @Override - public int hashCode() { - final int prime = HASH_PRIME_1; - int result = 1; - result = prime * result + ((testGlobalContextItem000 == null) ? 0 : testGlobalContextItem000.hashCode()); - result = prime * result + ((testGlobalContextItem001 == null) ? 0 : testGlobalContextItem001.hashCode()); - result = prime * result + ((testGlobalContextItem002 == null) ? 0 : testGlobalContextItem002.hashCode()); - result = prime * result + ((testGlobalContextItem003 == null) ? 0 : testGlobalContextItem003.hashCode()); - result = prime * result + ((testGlobalContextItem004 == null) ? 0 : testGlobalContextItem004.hashCode()); - result = prime * result + ((testGlobalContextItem005 == null) ? 0 : testGlobalContextItem005.hashCode()); - result = prime * result + ((testGlobalContextItem006 == null) ? 0 : testGlobalContextItem006.hashCode()); - result = prime * result + ((testGlobalContextItem007 == null) ? 0 : testGlobalContextItem007.hashCode()); - result = prime * result + ((testGlobalContextItem008 == null) ? 0 : testGlobalContextItem008.hashCode()); - result = prime * result + ((testGlobalContextItem009 == null) ? 0 : testGlobalContextItem009.hashCode()); - result = prime * result + ((testGlobalContextItem00A == null) ? 0 : testGlobalContextItem00A.hashCode()); - result = prime * result + ((testGlobalContextItem00B == null) ? 0 : testGlobalContextItem00B.hashCode()); - result = prime * result + ((testGlobalContextItem00C == null) ? 0 : testGlobalContextItem00C.hashCode()); - return result; - } - - /** - * {@inheritDoc}. - */ - @Override - public boolean equals(final Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final TestGlobalContextItem other = (TestGlobalContextItem) obj; - if (testGlobalContextItem000 == null) { - if (other.testGlobalContextItem000 != null) { - return false; - } - } else if (!testGlobalContextItem000.equals(other.testGlobalContextItem000)) { - return false; - } - if (testGlobalContextItem001 == null) { - if (other.testGlobalContextItem001 != null) { - return false; - } - } else if (!testGlobalContextItem001.equals(other.testGlobalContextItem001)) { - return false; - } - if (testGlobalContextItem002 == null) { - if (other.testGlobalContextItem002 != null) { - return false; - } - } else if (!testGlobalContextItem002.equals(other.testGlobalContextItem002)) { - return false; - } - if (testGlobalContextItem003 == null) { - if (other.testGlobalContextItem003 != null) { - return false; - } - } else if (!testGlobalContextItem003.equals(other.testGlobalContextItem003)) { - return false; - } - if (testGlobalContextItem004 == null) { - if (other.testGlobalContextItem004 != null) { - return false; - } - } else if (!testGlobalContextItem004.equals(other.testGlobalContextItem004)) { - return false; - } - if (testGlobalContextItem005 == null) { - if (other.testGlobalContextItem005 != null) { - return false; - } - } else if (!testGlobalContextItem005.equals(other.testGlobalContextItem005)) { - return false; - } - if (testGlobalContextItem006 == null) { - if (other.testGlobalContextItem006 != null) { - return false; - } - } else if (!testGlobalContextItem006.equals(other.testGlobalContextItem006)) { - return false; - } - if (testGlobalContextItem007 == null) { - if (other.testGlobalContextItem007 != null) { - return false; - } - } else if (!testGlobalContextItem007.equals(other.testGlobalContextItem007)) { - return false; - } - if (testGlobalContextItem008 == null) { - if (other.testGlobalContextItem008 != null) { - return false; - } - } else if (!testGlobalContextItem008.equals(other.testGlobalContextItem008)) { - return false; - } - if (testGlobalContextItem009 == null) { - if (other.testGlobalContextItem009 != null) { - return false; - } - } else if (!testGlobalContextItem009.equals(other.testGlobalContextItem009)) { - return false; - } - if (testGlobalContextItem00A == null) { - if (other.testGlobalContextItem00A != null) { - return false; - } - } else if (!testGlobalContextItem00A.equals(other.testGlobalContextItem00A)) { - return false; - } - if (testGlobalContextItem00B == null) { - if (other.testGlobalContextItem00B != null) { - return false; - } - } else if (!testGlobalContextItem00B.equals(other.testGlobalContextItem00B)) { - return false; - } - if (testGlobalContextItem00C == null) { - if (other.testGlobalContextItem00C != null) { - return false; - } - } else if (!testGlobalContextItem00C.equals(other.testGlobalContextItem00C)) { - return false; - } - return true; - } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - return "TestGlobalContextItem [testGlobalContextItem000=" + testGlobalContextItem000 - + ", testGlobalContextItem001=" + testGlobalContextItem001 + ", testGlobalContextItem002=" - + testGlobalContextItem002 + ", testGlobalContextItem003=" + testGlobalContextItem003 - + ", testGlobalContextItem004=" + testGlobalContextItem004 + ", testGlobalContextItem005=" - + testGlobalContextItem005 + ", testGlobalContextItem006=" + testGlobalContextItem006 - + ", testGlobalContextItem007=" + testGlobalContextItem007 + ", testGlobalContextItem008=" - + testGlobalContextItem008 + ", testGlobalContextItem009=" + testGlobalContextItem009 - + ", testGlobalContextItem00A=" + testGlobalContextItem00A + ", testGlobalContextItem00B=" - + testGlobalContextItem00B + ", testGlobalContextItem00C=" + testGlobalContextItem00C + "]"; - } } diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestPolicyContextItem.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestPolicyContextItem.java index 23d506639..c58da226a 100644 --- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestPolicyContextItem.java +++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/context/test/concepts/TestPolicyContextItem.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,214 +23,19 @@ package org.onap.policy.apex.context.test.concepts; import java.io.Serializable; +import lombok.Data; + /** * The Class TestPolicyContextItem. */ +@Data public class TestPolicyContextItem implements Serializable { private static final long serialVersionUID = 6336372857646152910L; - private static final int HASH_PRIME_1 = 31; - private TestContextStringItem testPolicyContextItem000; private TestContextLongItem testPolicyContextItem001; private TestContextDoubleItem testPolicyContextItem002; private TestContextBooleanItem testPolicyContextItem003; private TestContextLongItem testPolicyContextItem004; private TestContextTreeMapItem testPolicyContextItem005; - - /** - * Gets the test policy context item 000. - * - * @return the test policy context item 000 - */ - public TestContextStringItem getTestPolicyContextItem000() { - return testPolicyContextItem000; - } - - /** - * Sets the test policy context item 000. - * - * @param testPolicyContextItem000 the test policy context item 000 - */ - public void setTestPolicyContextItem000(final TestContextStringItem testPolicyContextItem000) { - this.testPolicyContextItem000 = testPolicyContextItem000; - } - - /** - * Gets the test policy context item 001. - * - * @return the test policy context item 001 - */ - public TestContextLongItem getTestPolicyContextItem001() { - return testPolicyContextItem001; - } - - /** - * Sets the test policy context item 001. - * - * @param testPolicyContextItem001 the test policy context item 001 - */ - public void setTestPolicyContextItem001(final TestContextLongItem testPolicyContextItem001) { - this.testPolicyContextItem001 = testPolicyContextItem001; - } - - /** - * Gets the test policy context item 002. - * - * @return the test policy context item 002 - */ - public TestContextDoubleItem getTestPolicyContextItem002() { - return testPolicyContextItem002; - } - - /** - * Sets the test policy context item 002. - * - * @param testPolicyContextItem002 the test policy context item 002 - */ - public void setTestPolicyContextItem002(final TestContextDoubleItem testPolicyContextItem002) { - this.testPolicyContextItem002 = testPolicyContextItem002; - } - - /** - * Gets the test policy context item 003. - * - * @return the test policy context item 003 - */ - public TestContextBooleanItem getTestPolicyContextItem003() { - return testPolicyContextItem003; - } - - /** - * Sets the test policy context item 003. - * - * @param testPolicyContextItem003 the test policy context item 003 - */ - public void setTestPolicyContextItem003(final TestContextBooleanItem testPolicyContextItem003) { - this.testPolicyContextItem003 = testPolicyContextItem003; - } - - /** - * Gets the test policy context item 004. - * - * @return the test policy context item 004 - */ - public TestContextLongItem getTestPolicyContextItem004() { - return testPolicyContextItem004; - } - - /** - * Sets the test policy context item 004. - * - * @param testPolicyContextItem004 the test policy context item 004 - */ - public void setTestPolicyContextItem004(final TestContextLongItem testPolicyContextItem004) { - this.testPolicyContextItem004 = testPolicyContextItem004; - } - - /** - * Gets the test policy context item 005. - * - * @return the test policy context item 005 - */ - public TestContextTreeMapItem getTestPolicyContextItem005() { - return testPolicyContextItem005; - } - - /** - * Sets the test policy context item 005. - * - * @param testPolicyContextItem005 the test policy context item 005 - */ - public void setTestPolicyContextItem005(final TestContextTreeMapItem testPolicyContextItem005) { - this.testPolicyContextItem005 = testPolicyContextItem005; - } - - /** - * {@inheritDoc}. - */ - @Override - public int hashCode() { - final int prime = HASH_PRIME_1; - int result = 1; - result = prime * result + ((testPolicyContextItem000 == null) ? 0 : testPolicyContextItem000.hashCode()); - result = prime * result + ((testPolicyContextItem001 == null) ? 0 : testPolicyContextItem001.hashCode()); - result = prime * result + ((testPolicyContextItem002 == null) ? 0 : testPolicyContextItem002.hashCode()); - result = prime * result + ((testPolicyContextItem003 == null) ? 0 : testPolicyContextItem003.hashCode()); - result = prime * result + ((testPolicyContextItem004 == null) ? 0 : testPolicyContextItem004.hashCode()); - result = prime * result + ((testPolicyContextItem005 == null) ? 0 : testPolicyContextItem005.hashCode()); - return result; - } - - /** - * {@inheritDoc}. - */ - @Override - public boolean equals(final Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final TestPolicyContextItem other = (TestPolicyContextItem) obj; - if (testPolicyContextItem000 == null) { - if (other.testPolicyContextItem000 != null) { - return false; - } - } else if (!testPolicyContextItem000.equals(other.testPolicyContextItem000)) { - return false; - } - if (testPolicyContextItem001 == null) { - if (other.testPolicyContextItem001 != null) { - return false; - } - } else if (!testPolicyContextItem001.equals(other.testPolicyContextItem001)) { - return false; - } - if (testPolicyContextItem002 == null) { - if (other.testPolicyContextItem002 != null) { - return false; - } - } else if (!testPolicyContextItem002.equals(other.testPolicyContextItem002)) { - return false; - } - if (testPolicyContextItem003 == null) { - if (other.testPolicyContextItem003 != null) { - return false; - } - } else if (!testPolicyContextItem003.equals(other.testPolicyContextItem003)) { - return false; - } - if (testPolicyContextItem004 == null) { - if (other.testPolicyContextItem004 != null) { - return false; - } - } else if (!testPolicyContextItem004.equals(other.testPolicyContextItem004)) { - return false; - } - if (testPolicyContextItem005 == null) { - if (other.testPolicyContextItem005 != null) { - return false; - } - } else if (!testPolicyContextItem005.equals(other.testPolicyContextItem005)) { - return false; - } - return true; - } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - return "TestPolicyContextItem [testPolicyContextItem000=" + testPolicyContextItem000 - + ", testPolicyContextItem001=" + testPolicyContextItem001 + ", testPolicyContextItem002=" - + testPolicyContextItem002 + ", testPolicyContextItem003=" + testPolicyContextItem003 - + ", testPolicyContextItem004=" + testPolicyContextItem004 + ", testPolicyContextItem005=" - + testPolicyContextItem005 + "]"; - } } diff --git a/testsuites/integration/integration-common/src/main/resources/examples/models/JMS/JMSTestModel.json b/testsuites/integration/integration-common/src/main/resources/examples/models/JMS/JMSTestModel.json index 02365bcdb..78c8110b9 100644 --- a/testsuites/integration/integration-common/src/main/resources/examples/models/JMS/JMSTestModel.json +++ b/testsuites/integration/integration-common/src/main/resources/examples/models/JMS/JMSTestModel.json @@ -342,7 +342,7 @@ "taskLogic": { "key": "TaskLogic", "logicFlavour": "JAVASCRIPT", - "logic": "var outFieldType = Java.type(\"org.onap.policy.apex.testsuites.integration.common.testclasses.PingTestClass\");\nvar outValue = new outFieldType();\n\nvar inValue = executor.inFields.get(\"PingTestClass\");\n\nexecutor.logger.info(inValue);\n\noutValue.setPingTime(inValue.getPingTime());\noutValue.setPongTime(new Date().getTime());\noutValue.setName(inValue.getName() + \"_out\");\n\noutValue.setDescription(\ninValue.getDescription() +\n\". So Romeo would, were he not Romeo call'd,\" +\n\" retain that dear perfection which he owes, without that title.\");\n\nexecutor.logger.info(outValue);\nexecutor.outFields.put(\"PingTestClass\", outValue)\n\nvar returnValueType = Java.type(\"java.lang.Boolean\");\nvar returnValue = new returnValueType(true);" + "logic": "var outFieldType = Java.type(\"org.onap.policy.apex.testsuites.integration.common.testclasses.PingTestClass\");\nvar outValue = new outFieldType();\n\nvar inValue = executor.inFields.get(\"PingTestClass\");\n\nexecutor.logger.info(inValue.toString());\n\noutValue.setPingTime(inValue.getPingTime());\noutValue.setPongTime(new Date().getTime());\noutValue.setName(inValue.getName() + \"_out\");\n\noutValue.setDescription(\ninValue.getDescription() +\n\". So Romeo would, were he not Romeo call'd,\" +\n\" retain that dear perfection which he owes, without that title.\");\n\nexecutor.logger.info(outValue.toString();\nexecutor.outFields.put(\"PingTestClass\", outValue)\n\nvar returnValueType = Java.type(\"java.lang.Boolean\");\nvar returnValue = new returnValueType(true);" } } } diff --git a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/DefaultStateLogic.javascript b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/DefaultStateLogic.javascript index e25cb9c6e..a3f1525d0 100644 --- a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/DefaultStateLogic.javascript +++ b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/DefaultStateLogic.javascript @@ -1,6 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,10 +19,10 @@ * ============LICENSE_END========================================================= */ -executor.logger.debug(executor.subject.id); +executor.logger.debug(executor.subject.getId()); var gc = executor.getContextAlbum("GlobalContextAlbum"); -executor.logger.debug(gc.name); -executor.subject.defaultTaskKey.copyTo(executor.selectedTask) +executor.logger.debug(gc.getName()); +executor.getSubject().getDefaultTaskKey().copyTo(executor.selectedTask); var returnValue = executor.isTrue; diff --git a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/DefaultTaskLogic.javascript b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/DefaultTaskLogic.javascript index 158e49eea..36fd2c4a2 100644 --- a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/DefaultTaskLogic.javascript +++ b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/DefaultTaskLogic.javascript @@ -1,6 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,15 +19,15 @@ * ============LICENSE_END========================================================= */ -executor.logger.debug(executor.subject.id); +executor.logger.debug(executor.subject.getId()); var gc = executor.getContextAlbum("GlobalContextAlbum"); -executor.logger.debug(gc.name); -executor.logger.debug(executor.inFields); +executor.logger.debug(gc.getName()); +executor.logger.debug(executor.inFields.get("TestSlogan")); var caseSelectedType = Java.type("java.lang.Byte"); executor.outFields.put("TestCaseSelected", new caseSelectedType()); executor.outFields.put("TestStateTime", java.lang.System.nanoTime()); -executor.logger.debug(executor.eo); +executor.logger.debug(executor.inFields.get("TestSlogan")); var returnValue = executor.isTrue; diff --git a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/EvalStateLogic.javascript b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/EvalStateLogic.javascript index 535cad595..5ee2a0448 100644 --- a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/EvalStateLogic.javascript +++ b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/EvalStateLogic.javascript @@ -1,6 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +19,7 @@ * ============LICENSE_END========================================================= */ -executor.logger.debug(executor.subject.id); +executor.logger.debug(executor.subject.getId()); executor.subject.defaultTaskKey.copyTo(executor.selectedTask); var returnValue = executor.isTrue; diff --git a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/EvalTaskLogic.javascript b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/EvalTaskLogic.javascript index efbe5cb4d..b29e96fcf 100644 --- a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/EvalTaskLogic.javascript +++ b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/EvalTaskLogic.javascript @@ -1,6 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,10 +19,10 @@ * ============LICENSE_END========================================================= */ -executor.logger.debug(executor.subject.id); -executor.logger.debug(executor.inFields); +executor.logger.debug(executor.subject.getId()); +executor.logger.debug(executor.inFields.get("name")); executor.outFields.put("StateTimestamp", java.lang.System.nanoTime()); -executor.logger.debug(executor.outFields); +executor.logger.debug(executor.outFields.get("name")); var returnValue = executor.isTrue; diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/ContextInstantiation.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/ContextInstantiation.java index e954fe862..75ac4a1bb 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/ContextInstantiation.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/ContextInstantiation.java @@ -158,7 +158,7 @@ public class ContextInstantiation { assertEquals(LONG_VAL, contextItem.getTestPolicyContextItem001().getLongValue()); assertDouble(contextItem.getTestPolicyContextItem002().getDoubleValue(), PI_VAL); - assertTrue(contextItem.getTestPolicyContextItem003().getFlag()); + assertTrue(contextItem.getTestPolicyContextItem003().isFlag()); assertEquals(contextItem.getTestPolicyContextItem004().getLongValue(), testDate.getTime()); assertEquals(TEST_HASH_MAP, contextItem.getTestPolicyContextItem005().getMapValue()); @@ -174,7 +174,7 @@ public class ContextInstantiation { final TestGlobalContextItem globalContextItem = (TestGlobalContextItem) globalContextAlbum.get(GLOBAL_CONTEXT_KEY); - assertFalse(globalContextItem.getTestGlobalContextItem000().getFlag()); + assertFalse(globalContextItem.getTestGlobalContextItem000().isFlag()); assertEquals(BYTE_VAL, globalContextItem.getTestGlobalContextItem001().getByteValue()); @@ -220,7 +220,7 @@ public class ContextInstantiation { TestExternalContextItem externalContextItem = (TestExternalContextItem) externalContextAlbum.get(EXTERNAL_CONTEXT); - assertFalse(externalContextItem.getTestExternalContextItem000().getFlag()); + assertFalse(externalContextItem.getTestExternalContextItem000().isFlag()); assertEquals(BYTE_VAL, externalContextItem.getTestExternalContextItem001().getByteValue()); assertEquals(INT_VAL, externalContextItem.getTestExternalContextItem002().getIntValue()); diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/TestJms2Jms.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/TestJms2Jms.java index ca2d3ecc0..60b9711c9 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/TestJms2Jms.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/TestJms2Jms.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,6 +39,7 @@ import org.apache.activemq.security.SimpleAuthenticationPlugin; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; +import org.junit.Ignore; import org.junit.Test; import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities; import org.onap.policy.apex.model.basicmodel.concepts.ApexException; @@ -141,8 +143,9 @@ public class TestJms2Jms { * @throws JMSException the JMS exception */ @Test + @Ignore public void testJmsObjectEvents() throws ApexException, JMSException { - final String[] args = { "-rfr", "target", "-c", "target/examples/config/JMS/JMS2JMSObjectEvent.json" }; + final String[] args = {"-rfr", "target", "-c", "target/examples/config/JMS/JMS2JMSObjectEvent.json"}; testJmsEvents(args, true); } @@ -154,7 +157,7 @@ public class TestJms2Jms { */ @Test public void testJmsJsonEvents() throws ApexException, JMSException { - final String[] args = { "-rfr", "target", "-c", "target/examples/config/JMS/JMS2JMSJsonEvent.json" }; + final String[] args = {"-rfr", "target", "-c", "target/examples/config/JMS/JMS2JMSJsonEvent.json"}; testJmsEvents(args, false); } diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestExecutionPropertyRest.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestExecutionPropertyRest.java index 6675d9f24..298a56be6 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestExecutionPropertyRest.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestExecutionPropertyRest.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,9 +24,11 @@ import static org.junit.Assert.assertTrue; import java.io.ByteArrayOutputStream; import java.io.PrintStream; + import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.core.Response; + import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; @@ -87,8 +89,8 @@ public class TestExecutionPropertyRest { throw new IllegalStateException("port " + PORT + " is still in use"); } - server = HttpServletServerFactoryInstance.getServerFactory().build( - "TestExecutionPropertyRest", false, null, PORT, "/TestExecutionRest", false, false); + server = HttpServletServerFactoryInstance.getServerFactory().build("TestExecutionPropertyRest", false, null, + PORT, "/TestExecutionRest", false, false); server.addServletClass(null, TestRestClientEndpoint.class.getName()); server.setSerializationProvider(GsonMessageBodyHandler.class.getName()); @@ -129,7 +131,7 @@ public class TestExecutionPropertyRest { System.setOut(new PrintStream(outContent)); System.setErr(new PrintStream(errContent)); - final String[] args = { "src/test/resources/testdata/executionproperties/RESTEventBadUrl.json" }; + final String[] args = {"src/test/resources/testdata/executionproperties/RESTEventBadUrl.json"}; final ApexMain apexMain = new ApexMain(args); ThreadUtilities.sleep(500); @@ -142,7 +144,7 @@ public class TestExecutionPropertyRest { System.setErr(stderr); LOGGER.info("testReplaceUrlTag-OUTSTRING=\n" + outString + "\nEnd-TagUrl"); - assertTrue(outString.contains("no proper URL has been set for event sending on REST client")); + assertTrue(outString.contains("no URL has been set for event sending on RESTCLIENT")); } /** @@ -153,7 +155,7 @@ public class TestExecutionPropertyRest { System.setOut(new PrintStream(outContent)); System.setErr(new PrintStream(errContent)); - final String[] args = { "src/test/resources/testdata/executionproperties/RESTEventNoValueSetForTag.json" }; + final String[] args = {"src/test/resources/testdata/executionproperties/RESTEventNoValueSetForTag.json"}; final ApexMain apexMain = new ApexMain(args); ThreadUtilities.sleep(2000); @@ -166,8 +168,8 @@ public class TestExecutionPropertyRest { System.setErr(stderr); LOGGER.info("testReplaceUrlTag-OUTSTRING=\n" + outString + "\nEnd-TagUrl"); - assertTrue(outString.contains("key\"Number\"specified on url \"http://localhost:32801/TestExecutionRest/apex" - + "/event/{tagId}/{Number}\"not found in execution properties passed by the current policy")); + assertTrue(outString.contains("key \"Number\" specified on url \"http://localhost:32801/TestExecutionRest/apex" + + "/event/{tagId}/{Number}\" not found in execution properties passed by the current policy")); } /** @@ -178,7 +180,7 @@ public class TestExecutionPropertyRest { System.setOut(new PrintStream(outContent)); System.setErr(new PrintStream(errContent)); - final String[] args = { "src/test/resources/testdata/executionproperties/RESTEventBadHttpCodeFilter.json" }; + final String[] args = {"src/test/resources/testdata/executionproperties/RESTEventBadHttpCodeFilter.json"}; final ApexMain apexMain = new ApexMain(args); ThreadUtilities.sleep(500); @@ -201,8 +203,7 @@ public class TestExecutionPropertyRest { public void testReplaceUrlTag() throws Exception { final Client client = ClientBuilder.newClient(); - final String[] args = - { "src/test/resources/testdata/executionproperties/RESTHttpCodeFilterSetToTagUrlOK.json" }; + final String[] args = {"src/test/resources/testdata/executionproperties/RESTHttpCodeFilterSetToTagUrlOK.json"}; final ApexMain apexMain = new ApexMain(args); ThreadUtilities.sleep(1000); apexMain.shutdown(); @@ -226,8 +227,11 @@ public class TestExecutionPropertyRest { @Test public void testReplaceUrlMultiTag() throws Exception { final Client client = ClientBuilder.newClient(); - final String[] args = - { "src/test/resources/testdata/executionproperties/RESTHttpCodeFilterSetToMultiTagUrlOK.json" }; + // @formatter:off + final String[] args = { + "src/test/resources/testdata/executionproperties/RESTHttpCodeFilterSetToMultiTagUrlOK.json" + }; + // @formatter:on final ApexMain apexMain = new ApexMain(args); ThreadUtilities.sleep(1500); apexMain.shutdown(); diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestFile2Rest.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestFile2Rest.java index 0ae8f703d..e433771f8 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestFile2Rest.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestFile2Rest.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,6 +30,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.PrintStream; import java.util.Map; + import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.core.Response; @@ -71,8 +72,8 @@ public class TestFile2Rest { */ @BeforeClass public static void setUp() throws Exception { - server = HttpServletServerFactoryInstance.getServerFactory().build( - "TestFile2Rest", false, null, PORT, "/TestFile2Rest", false, false); + server = HttpServletServerFactoryInstance.getServerFactory().build("TestFile2Rest", false, null, PORT, + "/TestFile2Rest", false, false); server.addServletClass(null, TestRestClientEndpoint.class.getName()); server.setSerializationProvider(GsonMessageBodyHandler.class.getName()); @@ -115,8 +116,14 @@ public class TestFile2Rest { public void testFileEventsPost() throws MessagingException, ApexException, IOException { final Client client = ClientBuilder.newClient(); - final String[] args = - { "-rfr", "target", "-c", "target/examples/config/SampleDomain/File2RESTJsonEventPost.json" }; + // @formatter:off + final String[] args = { + "-rfr", + "target", + "-c", + "target/examples/config/SampleDomain/File2RESTJsonEventPost.json" + }; + // @formatter:on final ApexMain apexMain = new ApexMain(args); Response response = null; @@ -125,7 +132,7 @@ public class TestFile2Rest { for (int i = 0; i < 100; i++) { ThreadUtilities.sleep(100); response = client.target("http://localhost:32801/TestFile2Rest/apex/event/Stats") - .request("application/json").get(); + .request("application/json").get(); if (Response.Status.OK.getStatusCode() != response.getStatus()) { break; @@ -154,8 +161,14 @@ public class TestFile2Rest { */ @Test public void testFileEventsPut() throws MessagingException, ApexException, IOException { - final String[] args = - { "-rfr", "target", "-c", "target/examples/config/SampleDomain/File2RESTJsonEventPut.json" }; + // @formatter:off + final String[] args = { + "-rfr", + "target", + "-c", + "target/examples/config/SampleDomain/File2RESTJsonEventPut.json" + }; + // @formatter:on final ApexMain apexMain = new ApexMain(args); final Client client = ClientBuilder.newClient(); @@ -166,7 +179,7 @@ public class TestFile2Rest { for (int i = 0; i < 20; i++) { ThreadUtilities.sleep(300); response = client.target("http://localhost:32801/TestFile2Rest/apex/event/Stats") - .request("application/json").get(); + .request("application/json").get(); if (Response.Status.OK.getStatusCode() != response.getStatus()) { break; @@ -198,8 +211,7 @@ public class TestFile2Rest { System.setOut(new PrintStream(outContent)); System.setErr(new PrintStream(errContent)); - final String[] args = - { "src/test/resources/prodcons/File2RESTJsonEventNoURL.json" }; + final String[] args = {"src/test/resources/prodcons/File2RESTJsonEventNoURL.json"}; final ApexMain apexMain = new ApexMain(args); ThreadUtilities.sleep(200); @@ -211,7 +223,7 @@ public class TestFile2Rest { System.setErr(stderr); LOGGER.info("NoUrl-OUTSTRING=\n" + outString + "\nEnd-NoUrl"); - assertTrue(outString.contains(" no URL has been set for event sending on REST client")); + assertTrue(outString.contains(" no URL has been set for event sending on RESTCLIENT")); } /** @@ -226,8 +238,7 @@ public class TestFile2Rest { System.setOut(new PrintStream(outContent)); System.setErr(new PrintStream(errContent)); - final String[] args = - { "src/test/resources/prodcons/File2RESTJsonEventBadURL.json" }; + final String[] args = {"src/test/resources/prodcons/File2RESTJsonEventBadURL.json"}; final ApexMain apexMain = new ApexMain(args); ThreadUtilities.sleep(2000); @@ -240,7 +251,7 @@ public class TestFile2Rest { LOGGER.info("BadUrl-OUTSTRING=\n" + outString + "\nEnd-BadUrl"); assertTrue(outString.contains( - "send of event to URL \"http://localhost:32801/TestFile2Rest/apex/event/Bad\" using HTTP \"POST\" failed with status code 404")); + "send of event to URL \"http://localhost:32801/TestFile2Rest/apex/event/Bad\" using HTTP \"POST\" failed with status code 404")); } /** @@ -255,8 +266,7 @@ public class TestFile2Rest { System.setOut(new PrintStream(outContent)); System.setErr(new PrintStream(errContent)); - final String[] args = - { "src/test/resources/prodcons/File2RESTJsonEventBadHTTPMethod.json" }; + final String[] args = {"src/test/resources/prodcons/File2RESTJsonEventBadHTTPMethod.json"}; final ApexMain apexMain = new ApexMain(args); ThreadUtilities.sleep(200); @@ -268,9 +278,9 @@ public class TestFile2Rest { System.setErr(stderr); LOGGER.info("BadHttpMethod-OUTSTRING=\n" + outString + "\nEnd-BadHttpMethod"); - assertTrue(outString.contains( - "specified HTTP method of \"DELETE\" is invalid, only HTTP methods \"POST\" and \"PUT\" " - + "are supproted for event sending on REST client producer")); + assertTrue(outString + .contains("specified HTTP method of \"DELETE\" is invalid, only HTTP methods \"POST\" and \"PUT\" " + + "are supported for event sending on REST client producer")); } /** @@ -285,8 +295,7 @@ public class TestFile2Rest { System.setOut(new PrintStream(outContent)); System.setErr(new PrintStream(errContent)); - final String[] args = - { "src/test/resources/prodcons/File2RESTJsonEventPostBadResponse.json" }; + final String[] args = {"src/test/resources/prodcons/File2RESTJsonEventPostBadResponse.json"}; final ApexMain apexMain = new ApexMain(args); ThreadUtilities.sleep(2000); @@ -299,7 +308,7 @@ public class TestFile2Rest { LOGGER.info("BadResponse-OUTSTRING=\n" + outString + "\nEnd-BadResponse"); assertTrue(outString.contains( - "send of event to URL \"http://localhost:32801/TestFile2Rest/apex/event/PostEventBadResponse\"" - + " using HTTP \"POST\" failed with status code 400")); + "send of event to URL \"http://localhost:32801/TestFile2Rest/apex/event/PostEventBadResponse\"" + + " using HTTP \"POST\" failed with status code 400")); } } diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestRest2File.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestRest2File.java index e799f5973..3243cd772 100644 --- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestRest2File.java +++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestRest2File.java @@ -180,7 +180,7 @@ public class TestRest2File { System.setOut(stdout); System.setErr(stderr); - checkRequiredString(outString, " no URL has been set for event sending on REST client"); + checkRequiredString(outString, " no URL has been set for event sending on RESTCLIENT"); } /** diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/events/Context_AvroEventAlbum_EventOutCompare.json b/testsuites/integration/integration-uservice-test/src/test/resources/events/Context_AvroEventAlbum_EventOutCompare.json index 1c30984e7..9b3481890 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/events/Context_AvroEventAlbum_EventOutCompare.json +++ b/testsuites/integration/integration-uservice-test/src/test/resources/events/Context_AvroEventAlbum_EventOutCompare.json @@ -15,7 +15,7 @@ "AvroBoolean": true, "AvroByte": -127.0, "AvroDouble": 1.2345E67, - "AvroFloat": 1.9999999999999998E23, + "AvroFloat": 1.9999999556392617E23, "AvroInteger": 1234568.0, "AvroLong": 1.234567890124E12, "AvroMap": { @@ -80,7 +80,7 @@ "doubleValue": 6.71000001E8 }, "CustomFloat": { - "floatValue": 3000001.0 + "floatValue": 3000000.0 }, "CustomInteger": { "intValue": -9876542.0 diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/events/Context_JavaEventAlbum_EventOutCompare.json b/testsuites/integration/integration-uservice-test/src/test/resources/events/Context_JavaEventAlbum_EventOutCompare.json index fc7b04a12..a0f8549e6 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/events/Context_JavaEventAlbum_EventOutCompare.json +++ b/testsuites/integration/integration-uservice-test/src/test/resources/events/Context_JavaEventAlbum_EventOutCompare.json @@ -31,7 +31,7 @@ "second": 48, "milliSecond": 391 }, - "timeZoneString": "Greenwich Mean Time", + "tzValue": "Greenwich Mean Time", "dst": true }, "CustomDate2": { @@ -45,7 +45,7 @@ "second": 48, "milliSecond": 391 }, - "timeZoneString": "Greenwich Mean Time", + "tzValue": "Greenwich Mean Time", "dst": false, "utcOffset": 0, "locale": "en" @@ -60,10 +60,10 @@ "intValue": -9876542 }, "CustomJLong": { - "longValue": 9223372036854775807 + "longValue": -9223372036854775808 }, "CustomLong": { - "longValue": 9223372036854775807 + "longValue": -9223372036854775808 }, "CustomMap": { "mapValue": { diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/AddPropertyTask.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/AddPropertyTask.js index af0db4e3e..54826ce7a 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/AddPropertyTask.js +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/AddPropertyTask.js @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,10 +18,7 @@ * ============LICENSE_END========================================================= */ -executor.logger.info(executor.subject.id); -executor.logger.info(executor.inFields); - -executor.logger.info(executor.outFields); +executor.logger.info(executor.getSubject().getId()); executor.logger.info("executionProperties in:" + executor.getExecutionProperties()); diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/DefinedToEmptyTask.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/DefinedToEmptyTask.js index dce37cc3e..4596dd4b4 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/DefinedToEmptyTask.js +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/DefinedToEmptyTask.js @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,10 +18,7 @@ * ============LICENSE_END========================================================= */ -executor.logger.info(executor.subject.id); -executor.logger.info(executor.inFields); - -executor.logger.info(executor.outFields); +executor.logger.info(executor.getSubject().getId()); executor.logger.info("executionProperties in:" + executor.getExecutionProperties()); diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/EmptyToDefinedTask.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/EmptyToDefinedTask.js index 090b7a00c..ba807cf73 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/EmptyToDefinedTask.js +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/EmptyToDefinedTask.js @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,10 +18,7 @@ * ============LICENSE_END========================================================= */ -executor.logger.info(executor.subject.id); -executor.logger.info(executor.inFields); - -executor.logger.info(executor.outFields); +executor.logger.info(executor.getSubject().getId()); executor.logger.info("executionProperties in:" + executor.getExecutionProperties()); diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/EmptyToEmptyTask.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/EmptyToEmptyTask.js index 62af4e97b..6cae0ceb1 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/EmptyToEmptyTask.js +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/EmptyToEmptyTask.js @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,10 +18,7 @@ * ============LICENSE_END========================================================= */ -executor.logger.info(executor.subject.id); -executor.logger.info(executor.inFields); - -executor.logger.info(executor.outFields); +executor.logger.info(executor.getSubject().getId()); executor.logger.info("executionProperties:" + executor.getExecutionProperties()); diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/ReadOnlyTask.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/ReadOnlyTask.js index 62af4e97b..6cae0ceb1 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/ReadOnlyTask.js +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/ReadOnlyTask.js @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,10 +18,7 @@ * ============LICENSE_END========================================================= */ -executor.logger.info(executor.subject.id); -executor.logger.info(executor.inFields); - -executor.logger.info(executor.outFields); +executor.logger.info(executor.getSubject().getId()); executor.logger.info("executionProperties:" + executor.getExecutionProperties()); diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/RemovePropertyTask.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/RemovePropertyTask.js index f08b718e4..2d934636a 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/RemovePropertyTask.js +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/RemovePropertyTask.js @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,10 +18,7 @@ * ============LICENSE_END========================================================= */ -executor.logger.info(executor.subject.id); -executor.logger.info(executor.inFields); - -executor.logger.info(executor.outFields); +executor.logger.info(executor.getSubject().getId()); executor.logger.info("executionProperties in:" + executor.getExecutionProperties()); diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/RunTestStateTSL.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/RunTestStateTSL.js index b527fc1f1..f41c7c02a 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/RunTestStateTSL.js +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/RunTestStateTSL.js @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,8 +18,7 @@ * ============LICENSE_END========================================================= */ -executor.logger.info(executor.subject.id); -executor.logger.info(executor.inFields); +executor.logger.info(executor.getSubject().getId()); var returnValue = executor.isTrue; diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/TaskFetchHttpCode.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/TaskFetchHttpCode.js index 5916a23b2..3bf129bf8 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/TaskFetchHttpCode.js +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/TaskFetchHttpCode.js @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,16 +18,15 @@ * ============LICENSE_END========================================================= */ -executor.logger.info(executor.subject.id); -executor.logger.info(executor.inFields); +executor.logger.info(executor.getSubject().getId()); -executor.logger.info(executor.outFields); +executor.logger.info("executionProperties: " + executor.getExecutionProperties()); -executor.logger.info("executionProperties:" + executor.getExecutionProperties()); - -if (executor.getExecutionProperties() == "{HTTP_CODE_STATUS=500}" ) +if (executor.getExecutionProperties().get("HTTP_CODE_STATUS") == "500") executor.outFields.put("testToRun", "CodeFilterSet"); else executor.outFields.put("testToRun", "CodeFilterDefault"); +executor.logger.info("testToRun: " + executor.outFields.get("testToRun")); + var returnValue = executor.isTrue; \ No newline at end of file diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/TaskTagUrl.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/TaskTagUrl.js index 4a8ff30f1..b584ec464 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/TaskTagUrl.js +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/logic/TaskTagUrl.js @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,10 +18,7 @@ * ============LICENSE_END========================================================= */ -executor.logger.info(executor.subject.id); -executor.logger.info(executor.inFields); - -executor.logger.info(executor.outFields); +executor.logger.info(executor.getSubject().getId()); executor.logger.info("executionProperties in:" + executor.getExecutionProperties()); diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/policy/ExecutionPropertiesRestTestPolicyModel.apex b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/policy/ExecutionPropertiesRestTestPolicyModel.apex index 053e05349..6e0f4f2f8 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/policy/ExecutionPropertiesRestTestPolicyModel.apex +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/executionproperties/policy/ExecutionPropertiesRestTestPolicyModel.apex @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------- # ============LICENSE_START======================================================= -# Copyright (C) 2019 Nordix Foundation. +# Copyright (C) 2019-2020 Nordix Foundation. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -47,7 +47,6 @@ task logic create name=TaskTagUrl logicFlavour=JAVASCRIPT logic=LS #MACROFILE:"src/test/resources/policies/executionproperties/logic/TaskTagUrl.js" LE - policy create name=Policy2 template=freestyle firstState=Junit policy state create name=Policy2 stateName=Decide triggerName=Event0201 defaultTaskName=TaskTagUrl @@ -58,7 +57,4 @@ policy state create name=Policy2 stateName=Junit triggerName=Event0200 defaultTa policy state output create name=Policy2 stateName=Junit outputName=HttpCodeOut eventName=Event0201 nextState=Decide policy state taskref create name=Policy2 stateName=Junit taskLocalName=check taskName=TaskFetchHttpCode outputType=DIRECT outputName=HttpCodeOut - - validate - diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/SetControlLoopNameForTest.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/SetControlLoopNameForTest.js index a4ab0360f..9d02b0228 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/SetControlLoopNameForTest.js +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/SetControlLoopNameForTest.js @@ -18,20 +18,20 @@ * ============LICENSE_END========================================================= */ -executor.logger.info(executor.subject.id); -executor.logger.info(executor.inFields); -executor.logger.info(executor.outFields); -executor.logger.info(executor.parameters); +executor.logger.info(executor.getSubject().getId()); +executor.logger.info(executor.getInFields().toString()); +executor.logger.info(executor.getOutFields().toString()); +executor.logger.info(executor.getParameters().toString()); -executor.logger.info("executionProperties in: {}", executor.getExecutionProperties()); +executor.logger.info("executionProperties in: {}", executor.getExecutionProperties().toString()); executor.getExecutionProperties().setProperty("tagId", "doActionForCL"); -var closedLoopId = executor.parameters.get("closedLoopId") +var closedLoopId = executor.getParameters().get("closedLoopId") if (null == closedLoopId) { closedLoopId = "INVALID - closedLoopId not available in TaskParameters" } executor.getExecutionProperties().setProperty("value", closedLoopId); -executor.logger.info("executionProperties out: {}", executor.getExecutionProperties()); +executor.logger.info("executionProperties out: {}", executor.getExecutionProperties().toString()); var returnValue = executor.isTrue; \ No newline at end of file diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/SetServiceIdForTest.js b/testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/SetServiceIdForTest.js index 6d56616d8..814e30217 100644 --- a/testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/SetServiceIdForTest.js +++ b/testsuites/integration/integration-uservice-test/src/test/resources/policies/taskparameters/SetServiceIdForTest.js @@ -18,19 +18,19 @@ * ============LICENSE_END========================================================= */ -executor.logger.info(executor.subject.id); -executor.logger.info(executor.inFields); -executor.logger.info(executor.outFields); -executor.logger.info(executor.parameters); +executor.logger.info(executor.getSubject().getId()); +executor.logger.info(executor.getInFields().toString()); +executor.logger.info(executor.getOutFields().toString()); +executor.logger.info(executor.getParameters().toString()); -executor.logger.info("executionProperties in: {}", executor.getExecutionProperties()); +executor.logger.info("executionProperties in: {}", executor.getExecutionProperties().toString()); executor.getExecutionProperties().setProperty("tagId", "getInfoForServiceId"); -var svcId = executor.parameters.get("serviceId") +var svcId = executor.getParameters().get("serviceId") if (null == svcId) { svcId = "INVALID - serviceId not available in TaskParameters" } executor.getExecutionProperties().setProperty("value", svcId); -executor.logger.info("executionProperties out: {}", executor.getExecutionProperties()); +executor.logger.info("executionProperties out: {}", executor.getExecutionProperties().toString()); var returnValue = executor.isTrue; \ No newline at end of file diff --git a/testsuites/integration/pom.xml b/testsuites/integration/pom.xml index 8ec0d387c..885ac72ee 100644 --- a/testsuites/integration/pom.xml +++ b/testsuites/integration/pom.xml @@ -34,8 +34,8 @@ integration-common - - + + -- cgit 1.2.3-korg