aboutsummaryrefslogtreecommitdiffstats
path: root/testsuites
diff options
context:
space:
mode:
Diffstat (limited to 'testsuites')
-rw-r--r--testsuites/integration/integration-common/pom.xml2
-rw-r--r--testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/SampleDomainModelFactory.java717
-rw-r--r--testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/EvalDomainModelFactory.java (renamed from testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/EvalDomainModelFactory.java)340
-rw-r--r--testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/SampleDomainModelFactory.java776
-rw-r--r--testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/SampleDomainModelSaver.java (renamed from testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/SampleDomainModelSaver.java)24
-rw-r--r--testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/DefaultStateLogic.java (renamed from testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/java/DefaultState_Logic.java)6
-rw-r--r--testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/DefaultTaskLogic.java (renamed from testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/java/DefaultTask_Logic.java)27
-rw-r--r--testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/EvalStateLogic.java (renamed from testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/java/EvalState_Logic.java)6
-rw-r--r--testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/EvalTaskLogic.java (renamed from testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/java/EvalTask_Logic.java)16
-rw-r--r--testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/package-info.java (renamed from testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/java/package-info.java)2
-rw-r--r--testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/package-info.java (renamed from testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/package-info.java)2
-rw-r--r--testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/DefaultStateLogic.javascript (renamed from testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/javascript/DefaultState_Logic.javascript)0
-rw-r--r--testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/DefaultTaskLogic.javascript (renamed from testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/javascript/DefaultTask_Logic.javascript)0
-rw-r--r--testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/EvalStateLogic.javascript (renamed from testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/javascript/EvalState_Logic.javascript)0
-rw-r--r--testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/EvalTaskLogic.javascript (renamed from testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/javascript/EvalTask_Logic.javascript)0
-rw-r--r--testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/jruby/DefaultStateLogic.jruby (renamed from testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/jruby/DefaultState_Logic.jruby)0
-rw-r--r--testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/jruby/DefaultTaskLogic.jruby (renamed from testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/jruby/DefaultTask_Logic.jruby)0
-rw-r--r--testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/jruby/EvalStateLogic.jruby (renamed from testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/jruby/EvalState_Logic.jruby)0
-rw-r--r--testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/jruby/EvalTaskLogic.jruby (renamed from testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/jruby/EvalTask_Logic.jruby)0
-rw-r--r--testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/jython/DefaultStateLogic.jython (renamed from testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/jython/DefaultState_Logic.jython)0
-rw-r--r--testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/jython/DefaultTaskLogic.jython (renamed from testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/jython/DefaultTask_Logic.jython)0
-rw-r--r--testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/jython/EvalStateLogic.jython (renamed from testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/jython/EvalState_Logic.jython)0
-rw-r--r--testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/jython/EvalTaskLogic.jython (renamed from testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/jython/EvalTask_Logic.jython)0
-rw-r--r--testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/mvel/DefaultStateLogic.mvel (renamed from testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/mvel/DefaultState_Logic.mvel)0
-rw-r--r--testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/mvel/DefaultTaskLogic.mvel (renamed from testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/mvel/DefaultTask_Logic.mvel)0
-rw-r--r--testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/mvel/EvalStateLogic.mvel (renamed from testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/mvel/EvalState_Logic.mvel)0
-rw-r--r--testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/mvel/EvalTaskLogic.mvel (renamed from testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/mvel/EvalTask_Logic.mvel)0
-rw-r--r--testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/TestConcurrentContext.java (renamed from testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/plugins/context/test/locking/TestConcurrentContext.java)87
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexActionListener.java (renamed from testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexActionListener.java)2
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngine.java (renamed from testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexEngine.java)4
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJRuby.java (renamed from testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexEngineJRuby.java)11
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJava.java (renamed from testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexEngineJava.java)8
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJavascript.java (renamed from testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexEngineJavascript.java)11
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJython.java (renamed from testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexEngineJython.java)11
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineMvel.java (renamed from testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexEngineMvel.java)13
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/event/TestEventInstantiation.java (renamed from testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/event/TestEventInstantiation.java)28
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexModelExport.java (renamed from testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestApexModelExport.java)2
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexPolicyModelAnalysis.java (renamed from testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestApexPolicyModelAnalysis.java)2
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyCreateModelFiles.java (renamed from testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestApexSamplePolicyCreateModelFiles.java)2
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyDbWrite.java (renamed from testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestApexSamplePolicyDBWrite.java)24
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyModel.java (renamed from testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestApexSamplePolicyModel.java)41
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyModelCreator.java (renamed from testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestApexSamplePolicyModelCreator.java)26
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestContextUpdateDifferentModels.java (renamed from testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestContextUpdateDifferentModels.java)19
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestContextUpdateModel.java (renamed from testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestContextUpdateModel.java)37
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/EventGenerator.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/events/EventGenerator.java)111
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/file/TestFile2File.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/file/TestFile2File.java)4
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/file/TestFile2FileFiltered.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/file/TestFile2FileFiltered.java)14
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/file/TestFile2FileIgnore.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/file/TestFile2FileIgnore.java)23
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/JmsEventProducer.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/jms/JMSEventProducer.java)45
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/JmsEventSubscriber.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/jms/JMSEventSubscriber.java)32
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/TestContext.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/jms/TestContext.java)105
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/TestInitialContextFactory.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/jms/TestInitialContextFactory.java)10
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/TestJms2Jms.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/jms/TestJMS2JMS.java)72
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/TestPing.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/jms/TestPing.java)52
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/KafkaEventProducer.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/kafka/KafkaEventProducer.java)39
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/KafkaEventSubscriber.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/kafka/KafkaEventSubscriber.java)28
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/TestKafka2Kafka.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/kafka/TestKafka2Kafka.java)2
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/TestKafkaXmlEventProducer.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/kafka/TestKafkaXMLEventProducer.java)11
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestFile2Rest.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restclient/TestFile2REST.java)101
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestRest2File.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restclient/TestREST2File.java)105
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestRestClientEndpoint.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restclient/TestRESTClientEndpoint.java)50
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restserver/TestRestServer.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restserver/TestRESTServer.java)214
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restserver/TestRestServerVpnContext.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restserver/TestRESTServerVPNContext.java)14
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/sampletypes/Foo.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/sampletypes/Foo.java)2
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/sampletypes/FooMap.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/sampletypes/FooMap.java)6
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/TestWs2WsClient.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/TestWs2WsClient.java)12
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/TestWs2WsServer.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/TestWs2WsServer.java)35
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventProducerClient.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventProducerClient.java)4
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventProducerServer.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventProducerServer.java)4
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventSubscriberClient.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventSubscriberClient.java)2
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventSubscriberServer.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventSubscriberServer.java)2
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/context/EventAlbumContextTest.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/context/EventAlbumContextTest.java)2
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engdep/EngDepMessagingTest.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/engdep/EngDepMessagingTest.java)34
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engdep/EngineTestServer.java (renamed from testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/engdep/EngineTestServer.java)4
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/resources/policymodels/JMSTestModel.json8
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/resources/prodcons/JMS2JMSJsonEvent.json4
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/resources/prodcons/JMS2JMSObjectEvent.json4
-rw-r--r--testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/engine/benchmark/ApexBaseBenchMarkTest.java (renamed from testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/service/engine/benchmark/ApexBaseBenchMarkTest.java)40
-rw-r--r--testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/engine/benchmark/ApexEngineBenchmark.java (renamed from testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/service/engine/benchmark/ApexEngineBenchmark.java)82
-rw-r--r--testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/engine/benchmark/TestApexEventListener.java (renamed from testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/service/engine/benchmark/TestApexEventListener.java)36
-rw-r--r--testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/engine/main/BaseTest.java (renamed from testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/service/engine/main/BaseTest.java)6
-rw-r--r--testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/engine/main/TestAsyncEventMimo.java (renamed from testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/service/engine/main/TestAsyncEventMIMO.java)19
-rw-r--r--testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/engine/main/TestAsyncEventMiso.java (renamed from testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/service/engine/main/TestAsyncEventMISO.java)6
-rw-r--r--testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/engine/main/TestAsyncEventSimo.java (renamed from testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/service/engine/main/TestAsyncEventSIMO.java)19
-rw-r--r--testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/engine/main/TestAsyncEventSiso.java (renamed from testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/service/engine/main/TestAsyncEventSISO.java)6
-rw-r--r--testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/engine/main/TestSyncEventMimo.java (renamed from testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/service/engine/main/TestSyncEventMIMO.java)19
-rw-r--r--testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/engine/main/TestSyncEventSiso.java (renamed from testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/service/engine/main/TestSyncEventSISO.java)6
-rw-r--r--testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/engine/runtime/ApexServiceModelUpdateTest.java (renamed from testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/service/engine/runtime/ApexServiceModelUpdateTest.java)57
-rw-r--r--testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/engine/runtime/ApexServiceTest.java (renamed from testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/service/engine/runtime/ApexServiceTest.java)9
-rw-r--r--testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/engine/utils/Utils.java (renamed from testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/service/engine/utils/Utils.java)17
-rw-r--r--testsuites/performance/performance-context-metrics/src/main/java/org/onap/policy/apex/testsuites/performance/context/metrics/ConcurrentContextMetrics.java (renamed from testsuites/performance/performance-context-metrics/src/main/java/org/onap/policy/apex/plugins/context/metrics/ConcurrentContextMetrics.java)69
-rw-r--r--testsuites/performance/performance-context-metrics/src/main/java/org/onap/policy/apex/testsuites/performance/context/metrics/package-info.java (renamed from testsuites/performance/performance-context-metrics/src/main/java/org/onap/policy/apex/plugins/context/metrics/package-info.java)2
-rw-r--r--testsuites/performance/performance-context-metrics/src/test/java/org/onap/policy/apex/testsuites/performance/context/metrics/TestMetrics.java (renamed from testsuites/performance/performance-context-metrics/src/test/java/org/onap/policy/apex/plugins/context/metrics/TestMetrics.java)18
93 files changed, 2562 insertions, 1250 deletions
diff --git a/testsuites/integration/integration-common/pom.xml b/testsuites/integration/integration-common/pom.xml
index 7cb679815..8c2e39086 100644
--- a/testsuites/integration/integration-common/pom.xml
+++ b/testsuites/integration/integration-common/pom.xml
@@ -88,7 +88,7 @@
<argument>-classpath</argument>
<!-- automatically creates the classpath using all project dependencies, also adding the project build directory -->
<classpath />
- <argument>org.onap.policy.apex.test.common.model.SampleDomainModelSaver</argument>
+ <argument>org.onap.policy.apex.testsuites.integration.common.model.SampleDomainModelSaver</argument>
<argument>${project.build.directory}/classes/examples/models/SampleDomain</argument>
</arguments>
</configuration>
diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/SampleDomainModelFactory.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/SampleDomainModelFactory.java
deleted file mode 100644
index 184529fa9..000000000
--- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/SampleDomainModelFactory.java
+++ /dev/null
@@ -1,717 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.test.common.model;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-import java.util.TreeSet;
-
-import org.onap.policy.apex.model.basicmodel.concepts.ApexRuntimeException;
-import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation;
-import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
-import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
-import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum;
-import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbums;
-import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema;
-import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas;
-import org.onap.policy.apex.model.eventmodel.concepts.AxEvent;
-import org.onap.policy.apex.model.eventmodel.concepts.AxEvents;
-import org.onap.policy.apex.model.eventmodel.concepts.AxField;
-import org.onap.policy.apex.model.policymodel.concepts.AxLogicReader;
-import org.onap.policy.apex.model.policymodel.concepts.AxPolicies;
-import org.onap.policy.apex.model.policymodel.concepts.AxPolicy;
-import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
-import org.onap.policy.apex.model.policymodel.concepts.AxState;
-import org.onap.policy.apex.model.policymodel.concepts.AxStateOutput;
-import org.onap.policy.apex.model.policymodel.concepts.AxStateTaskOutputType;
-import org.onap.policy.apex.model.policymodel.concepts.AxStateTaskReference;
-import org.onap.policy.apex.model.policymodel.concepts.AxTask;
-import org.onap.policy.apex.model.policymodel.concepts.AxTaskLogic;
-import org.onap.policy.apex.model.policymodel.concepts.AxTaskParameter;
-import org.onap.policy.apex.model.policymodel.concepts.AxTaskSelectionLogic;
-import org.onap.policy.apex.model.policymodel.concepts.AxTasks;
-import org.onap.policy.apex.model.policymodel.handling.PolicyLogicReader;
-
-/**
- * This class creates sample Policy Models.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-public class SampleDomainModelFactory {
- private static final int THIRD_ENTRY = 3;
-
- /**
- * Get a sample policy model.
- *
- * @param axLogicExecutorType The type of logic executor, the scripting language being used
- * @return the sample policy model
- */
- // CHECKSTYLE:OFF: checkstyle:maximumMethodLength
- public AxPolicyModel getSamplePolicyModel(final String axLogicExecutorType) {
- AxContextSchema testSlogan =
- new AxContextSchema(new AxArtifactKey("TestSlogan", "0.0.1"), "Java", "java.lang.String");
- AxContextSchema testCase =
- new AxContextSchema(new AxArtifactKey("TestCase", "0.0.1"), "Java", "java.lang.Byte");
- AxContextSchema testTimestamp =
- new AxContextSchema(new AxArtifactKey("TestTimestamp", "0.0.1"), "Java", "java.lang.Long");
- AxContextSchema testTemperature =
- new AxContextSchema(new AxArtifactKey("TestTemperature", "0.0.1"), "Java", "java.lang.Double");
-
- AxContextSchema testContextItem000 = new AxContextSchema(new AxArtifactKey("TestContextItem000", "0.0.1"),
- "Java", "org.onap.policy.apex.context.test.concepts.TestContextItem000");
- AxContextSchema testContextItem001 = new AxContextSchema(new AxArtifactKey("TestContextItem001", "0.0.1"),
- "Java", "org.onap.policy.apex.context.test.concepts.TestContextItem001");
- AxContextSchema testContextItem002 = new AxContextSchema(new AxArtifactKey("TestContextItem002", "0.0.1"),
- "Java", "org.onap.policy.apex.context.test.concepts.TestContextItem002");
- AxContextSchema testContextItem003 = new AxContextSchema(new AxArtifactKey("TestContextItem003", "0.0.1"),
- "Java", "org.onap.policy.apex.context.test.concepts.TestContextItem003");
- AxContextSchema testContextItem004 = new AxContextSchema(new AxArtifactKey("TestContextItem004", "0.0.1"),
- "Java", "org.onap.policy.apex.context.test.concepts.TestContextItem004");
- AxContextSchema testContextItem005 = new AxContextSchema(new AxArtifactKey("TestContextItem005", "0.0.1"),
- "Java", "org.onap.policy.apex.context.test.concepts.TestContextItem005");
- AxContextSchema testContextItem006 = new AxContextSchema(new AxArtifactKey("TestContextItem006", "0.0.1"),
- "Java", "org.onap.policy.apex.context.test.concepts.TestContextItem006");
- AxContextSchema testContextItem007 = new AxContextSchema(new AxArtifactKey("TestContextItem007", "0.0.1"),
- "Java", "org.onap.policy.apex.context.test.concepts.TestContextItem007");
- AxContextSchema testContextItem008 = new AxContextSchema(new AxArtifactKey("TestContextItem008", "0.0.1"),
- "Java", "org.onap.policy.apex.context.test.concepts.TestContextItem008");
- AxContextSchema testContextItem009 = new AxContextSchema(new AxArtifactKey("TestContextItem009", "0.0.1"),
- "Java", "org.onap.policy.apex.context.test.concepts.TestContextItem009");
- AxContextSchema testContextItem00A = new AxContextSchema(new AxArtifactKey("TestContextItem00A", "0.0.1"),
- "Java", "org.onap.policy.apex.context.test.concepts.TestContextItem00A");
- AxContextSchema testContextItem00B = new AxContextSchema(new AxArtifactKey("TestContextItem00B", "0.0.1"),
- "Java", "org.onap.policy.apex.context.test.concepts.TestContextItem00B");
- AxContextSchema testContextItem00C = new AxContextSchema(new AxArtifactKey("TestContextItem00C", "0.0.1"),
- "Java", "org.onap.policy.apex.context.test.concepts.TestContextItem00C");
-
- AxContextSchema testPolicyContextItem = new AxContextSchema(new AxArtifactKey("TestPolicyContextItem", "0.0.1"),
- "Java", "org.onap.policy.apex.context.test.concepts.TestPolicyContextItem");
- AxContextSchema testGlobalContextItem = new AxContextSchema(new AxArtifactKey("TestGlobalContextItem", "0.0.1"),
- "Java", "org.onap.policy.apex.context.test.concepts.TestGlobalContextItem");
- AxContextSchema testExternalContextItem =
- new AxContextSchema(new AxArtifactKey("TestExternalContextItem", "0.0.1"), "Java",
- "org.onap.policy.apex.context.test.concepts.TestExternalContextItem");
-
- AxContextSchemas axContextSchemas = new AxContextSchemas(new AxArtifactKey("TestDatatypes", "0.0.1"));
- axContextSchemas.getSchemasMap().put(testSlogan.getKey(), testSlogan);
- axContextSchemas.getSchemasMap().put(testCase.getKey(), testCase);
- axContextSchemas.getSchemasMap().put(testTimestamp.getKey(), testTimestamp);
- axContextSchemas.getSchemasMap().put(testTemperature.getKey(), testTemperature);
-
- axContextSchemas.getSchemasMap().put(testContextItem000.getKey(), testContextItem000);
- axContextSchemas.getSchemasMap().put(testContextItem001.getKey(), testContextItem001);
- axContextSchemas.getSchemasMap().put(testContextItem002.getKey(), testContextItem002);
- axContextSchemas.getSchemasMap().put(testContextItem003.getKey(), testContextItem003);
- axContextSchemas.getSchemasMap().put(testContextItem004.getKey(), testContextItem004);
- axContextSchemas.getSchemasMap().put(testContextItem005.getKey(), testContextItem005);
- axContextSchemas.getSchemasMap().put(testContextItem006.getKey(), testContextItem006);
- axContextSchemas.getSchemasMap().put(testContextItem007.getKey(), testContextItem007);
- axContextSchemas.getSchemasMap().put(testContextItem008.getKey(), testContextItem008);
- axContextSchemas.getSchemasMap().put(testContextItem009.getKey(), testContextItem009);
- axContextSchemas.getSchemasMap().put(testContextItem00A.getKey(), testContextItem00A);
- axContextSchemas.getSchemasMap().put(testContextItem00B.getKey(), testContextItem00B);
- axContextSchemas.getSchemasMap().put(testContextItem00C.getKey(), testContextItem00C);
-
- axContextSchemas.getSchemasMap().put(testPolicyContextItem.getKey(), testPolicyContextItem);
- axContextSchemas.getSchemasMap().put(testGlobalContextItem.getKey(), testGlobalContextItem);
- axContextSchemas.getSchemasMap().put(testExternalContextItem.getKey(), testExternalContextItem);
-
- AxEvent event0000 = new AxEvent(new AxArtifactKey("Event0000", "0.0.1"), "org.onap.policy.apex.sample.events");
- event0000.setSource("Outside");
- event0000.setTarget("Match");
- event0000.getParameterMap().put("TestSlogan",
- new AxField(new AxReferenceKey(event0000.getKey(), "TestSlogan"), testSlogan.getKey()));
- event0000.getParameterMap().put("TestMatchCase",
- new AxField(new AxReferenceKey(event0000.getKey(), "TestMatchCase"), testCase.getKey()));
- event0000.getParameterMap().put("TestTimestamp",
- new AxField(new AxReferenceKey(event0000.getKey(), "TestTimestamp"), testTimestamp.getKey()));
- event0000.getParameterMap().put("TestTemperature",
- new AxField(new AxReferenceKey(event0000.getKey(), "TestTemperature"), testTemperature.getKey()));
-
- AxEvent event0001 = new AxEvent(new AxArtifactKey("Event0001", "0.0.1"), "org.onap.policy.apex.sample.events");
- event0001.setSource("Match");
- event0001.setTarget("Establish");
- event0001.getParameterMap().put("TestSlogan",
- new AxField(new AxReferenceKey(event0001.getKey(), "TestSlogan"), testSlogan.getKey()));
- event0001.getParameterMap().put("TestMatchCase",
- new AxField(new AxReferenceKey(event0001.getKey(), "TestMatchCase"), testCase.getKey()));
- event0001.getParameterMap().put("TestTimestamp",
- new AxField(new AxReferenceKey(event0001.getKey(), "TestTimestamp"), testTimestamp.getKey()));
- event0001.getParameterMap().put("TestTemperature",
- new AxField(new AxReferenceKey(event0001.getKey(), "TestTemperature"), testTemperature.getKey()));
- event0001.getParameterMap().put("TestMatchCaseSelected",
- new AxField(new AxReferenceKey(event0001.getKey(), "TestMatchCaseSelected"), testCase.getKey()));
- event0001.getParameterMap().put("TestMatchStateTime",
- new AxField(new AxReferenceKey(event0001.getKey(), "TestMatchStateTime"), testTimestamp.getKey()));
-
- AxEvent event0002 = new AxEvent(new AxArtifactKey("Event0002", "0.0.1"), "org.onap.policy.apex.sample.events");
- event0002.setSource("Establish");
- event0002.setTarget("Decide");
- event0002.getParameterMap().put("TestSlogan",
- new AxField(new AxReferenceKey(event0002.getKey(), "TestSlogan"), testSlogan.getKey()));
- event0002.getParameterMap().put("TestMatchCase",
- new AxField(new AxReferenceKey(event0002.getKey(), "TestMatchCase"), testCase.getKey()));
- event0002.getParameterMap().put("TestTimestamp",
- new AxField(new AxReferenceKey(event0002.getKey(), "TestTimestamp"), testTimestamp.getKey()));
- event0002.getParameterMap().put("TestTemperature",
- new AxField(new AxReferenceKey(event0002.getKey(), "TestTemperature"), testTemperature.getKey()));
- event0002.getParameterMap().put("TestMatchCaseSelected",
- new AxField(new AxReferenceKey(event0002.getKey(), "TestMatchCaseSelected"), testCase.getKey()));
- event0002.getParameterMap().put("TestMatchStateTime",
- new AxField(new AxReferenceKey(event0002.getKey(), "TestMatchStateTime"), testTimestamp.getKey()));
- event0002.getParameterMap().put("TestEstablishCaseSelected",
- new AxField(new AxReferenceKey(event0002.getKey(), "TestEstablishCaseSelected"), testCase.getKey()));
- event0002.getParameterMap().put("TestEstablishStateTime",
- new AxField(new AxReferenceKey(event0002.getKey(), "TestEstablishStateTime"), testTimestamp.getKey()));
-
- AxEvent event0003 = new AxEvent(new AxArtifactKey("Event0003", "0.0.1"), "org.onap.policy.apex.sample.events");
- event0003.setSource("Decide");
- event0003.setTarget("Act");
- event0003.getParameterMap().put("TestSlogan",
- new AxField(new AxReferenceKey(event0003.getKey(), "TestSlogan"), testSlogan.getKey()));
- event0003.getParameterMap().put("TestMatchCase",
- new AxField(new AxReferenceKey(event0003.getKey(), "TestMatchCase"), testCase.getKey()));
- event0003.getParameterMap().put("TestTimestamp",
- new AxField(new AxReferenceKey(event0003.getKey(), "TestTimestamp"), testTimestamp.getKey()));
- event0003.getParameterMap().put("TestTemperature",
- new AxField(new AxReferenceKey(event0003.getKey(), "TestTemperature"), testTemperature.getKey()));
- event0003.getParameterMap().put("TestMatchCaseSelected",
- new AxField(new AxReferenceKey(event0003.getKey(), "TestMatchCaseSelected"), testCase.getKey()));
- event0003.getParameterMap().put("TestMatchStateTime",
- new AxField(new AxReferenceKey(event0003.getKey(), "TestMatchStateTime"), testTimestamp.getKey()));
- event0003.getParameterMap().put("TestEstablishCaseSelected",
- new AxField(new AxReferenceKey(event0003.getKey(), "TestEstablishCaseSelected"), testCase.getKey()));
- event0003.getParameterMap().put("TestEstablishStateTime",
- new AxField(new AxReferenceKey(event0003.getKey(), "TestEstablishStateTime"), testTimestamp.getKey()));
- event0003.getParameterMap().put("TestDecideCaseSelected",
- new AxField(new AxReferenceKey(event0003.getKey(), "TestDecideCaseSelected"), testCase.getKey()));
- event0003.getParameterMap().put("TestDecideStateTime",
- new AxField(new AxReferenceKey(event0003.getKey(), "TestDecideStateTime"), testTimestamp.getKey()));
-
- AxEvent event0004 = new AxEvent(new AxArtifactKey("Event0004", "0.0.1"), "org.onap.policy.apex.sample.events");
- event0004.setSource("Act");
- event0004.setTarget("Outside");
- event0004.getParameterMap().put("TestSlogan",
- new AxField(new AxReferenceKey(event0004.getKey(), "TestSlogan"), testSlogan.getKey()));
- event0004.getParameterMap().put("TestMatchCase",
- new AxField(new AxReferenceKey(event0004.getKey(), "TestMatchCase"), testCase.getKey()));
- event0004.getParameterMap().put("TestTimestamp",
- new AxField(new AxReferenceKey(event0004.getKey(), "TestTimestamp"), testTimestamp.getKey()));
- event0004.getParameterMap().put("TestTemperature",
- new AxField(new AxReferenceKey(event0004.getKey(), "TestTemperature"), testTemperature.getKey()));
- event0004.getParameterMap().put("TestMatchCaseSelected",
- new AxField(new AxReferenceKey(event0004.getKey(), "TestMatchCaseSelected"), testCase.getKey()));
- event0004.getParameterMap().put("TestMatchStateTime",
- new AxField(new AxReferenceKey(event0004.getKey(), "TestMatchStateTime"), testTimestamp.getKey()));
- event0004.getParameterMap().put("TestEstablishCaseSelected",
- new AxField(new AxReferenceKey(event0004.getKey(), "TestEstablishCaseSelected"), testCase.getKey()));
- event0004.getParameterMap().put("TestEstablishStateTime",
- new AxField(new AxReferenceKey(event0004.getKey(), "TestEstablishStateTime"), testTimestamp.getKey()));
- event0004.getParameterMap().put("TestDecideCaseSelected",
- new AxField(new AxReferenceKey(event0004.getKey(), "TestDecideCaseSelected"), testCase.getKey()));
- event0004.getParameterMap().put("TestDecideStateTime",
- new AxField(new AxReferenceKey(event0004.getKey(), "TestDecideStateTime"), testTimestamp.getKey()));
- event0004.getParameterMap().put("TestActCaseSelected",
- new AxField(new AxReferenceKey(event0004.getKey(), "TestActCaseSelected"), testCase.getKey()));
- event0004.getParameterMap().put("TestActStateTime",
- new AxField(new AxReferenceKey(event0004.getKey(), "TestActStateTime"), testTimestamp.getKey()));
-
- AxEvent event0100 = new AxEvent(new AxArtifactKey("Event0100", "0.0.1"), "org.onap.policy.apex.sample.events");
- event0100.setSource("Outside");
- event0100.setTarget("Match");
- event0100.getParameterMap().put("TestSlogan",
- new AxField(new AxReferenceKey(event0100.getKey(), "TestSlogan"), testSlogan.getKey()));
- event0100.getParameterMap().put("TestMatchCase",
- new AxField(new AxReferenceKey(event0100.getKey(), "TestMatchCase"), testCase.getKey()));
- event0100.getParameterMap().put("TestTimestamp",
- new AxField(new AxReferenceKey(event0100.getKey(), "TestTimestamp"), testTimestamp.getKey()));
- event0100.getParameterMap().put("TestTemperature",
- new AxField(new AxReferenceKey(event0100.getKey(), "TestTemperature"), testTemperature.getKey()));
-
- AxEvent event0101 = new AxEvent(new AxArtifactKey("Event0101", "0.0.1"), "org.onap.policy.apex.sample.events");
- event0101.setSource("Match");
- event0101.setTarget("Establish");
- event0101.getParameterMap().put("TestSlogan",
- new AxField(new AxReferenceKey(event0101.getKey(), "TestSlogan"), testSlogan.getKey()));
- event0101.getParameterMap().put("TestMatchCase",
- new AxField(new AxReferenceKey(event0101.getKey(), "TestMatchCase"), testCase.getKey()));
- event0101.getParameterMap().put("TestTimestamp",
- new AxField(new AxReferenceKey(event0101.getKey(), "TestTimestamp"), testTimestamp.getKey()));
- event0101.getParameterMap().put("TestTemperature",
- new AxField(new AxReferenceKey(event0101.getKey(), "TestTemperature"), testTemperature.getKey()));
- event0101.getParameterMap().put("TestMatchCaseSelected",
- new AxField(new AxReferenceKey(event0101.getKey(), "TestMatchCaseSelected"), testCase.getKey()));
- event0101.getParameterMap().put("TestMatchStateTime",
- new AxField(new AxReferenceKey(event0101.getKey(), "TestMatchStateTime"), testTimestamp.getKey()));
-
- AxEvent event0102 = new AxEvent(new AxArtifactKey("Event0102", "0.0.1"), "org.onap.policy.apex.sample.events");
- event0102.setSource("Establish");
- event0102.setTarget("Decide");
- event0102.getParameterMap().put("TestSlogan",
- new AxField(new AxReferenceKey(event0102.getKey(), "TestSlogan"), testSlogan.getKey()));
- event0102.getParameterMap().put("TestMatchCase",
- new AxField(new AxReferenceKey(event0102.getKey(), "TestMatchCase"), testCase.getKey()));
- event0102.getParameterMap().put("TestTimestamp",
- new AxField(new AxReferenceKey(event0102.getKey(), "TestTimestamp"), testTimestamp.getKey()));
- event0102.getParameterMap().put("TestTemperature",
- new AxField(new AxReferenceKey(event0102.getKey(), "TestTemperature"), testTemperature.getKey()));
- event0102.getParameterMap().put("TestMatchCaseSelected",
- new AxField(new AxReferenceKey(event0102.getKey(), "TestMatchCaseSelected"), testCase.getKey()));
- event0102.getParameterMap().put("TestMatchStateTime",
- new AxField(new AxReferenceKey(event0102.getKey(), "TestMatchStateTime"), testTimestamp.getKey()));
- event0102.getParameterMap().put("TestEstablishCaseSelected",
- new AxField(new AxReferenceKey(event0102.getKey(), "TestEstablishCaseSelected"), testCase.getKey()));
- event0102.getParameterMap().put("TestEstablishStateTime",
- new AxField(new AxReferenceKey(event0102.getKey(), "TestEstablishStateTime"), testTimestamp.getKey()));
-
- AxEvent event0103 = new AxEvent(new AxArtifactKey("Event0103", "0.0.1"), "org.onap.policy.apex.sample.events");
- event0103.setSource("Decide");
- event0103.setTarget("Act");
- event0103.getParameterMap().put("TestSlogan",
- new AxField(new AxReferenceKey(event0103.getKey(), "TestSlogan"), testSlogan.getKey()));
- event0103.getParameterMap().put("TestMatchCase",
- new AxField(new AxReferenceKey(event0103.getKey(), "TestMatchCase"), testCase.getKey()));
- event0103.getParameterMap().put("TestTimestamp",
- new AxField(new AxReferenceKey(event0103.getKey(), "TestTimestamp"), testTimestamp.getKey()));
- event0103.getParameterMap().put("TestTemperature",
- new AxField(new AxReferenceKey(event0103.getKey(), "TestTemperature"), testTemperature.getKey()));
- event0103.getParameterMap().put("TestMatchCaseSelected",
- new AxField(new AxReferenceKey(event0103.getKey(), "TestMatchCaseSelected"), testCase.getKey()));
- event0103.getParameterMap().put("TestMatchStateTime",
- new AxField(new AxReferenceKey(event0103.getKey(), "TestMatchStateTime"), testTimestamp.getKey()));
- event0103.getParameterMap().put("TestEstablishCaseSelected",
- new AxField(new AxReferenceKey(event0103.getKey(), "TestEstablishCaseSelected"), testCase.getKey()));
- event0103.getParameterMap().put("TestEstablishStateTime",
- new AxField(new AxReferenceKey(event0103.getKey(), "TestEstablishStateTime"), testTimestamp.getKey()));
- event0103.getParameterMap().put("TestDecideCaseSelected",
- new AxField(new AxReferenceKey(event0103.getKey(), "TestDecideCaseSelected"), testCase.getKey()));
- event0103.getParameterMap().put("TestDecideStateTime",
- new AxField(new AxReferenceKey(event0103.getKey(), "TestDecideStateTime"), testTimestamp.getKey()));
-
- AxEvent event0104 = new AxEvent(new AxArtifactKey("Event0104", "0.0.1"), "org.onap.policy.apex.sample.events");
- event0104.setSource("Act");
- event0104.setTarget("Outside");
- event0104.getParameterMap().put("TestSlogan",
- new AxField(new AxReferenceKey(event0104.getKey(), "TestSlogan"), testSlogan.getKey()));
- event0104.getParameterMap().put("TestMatchCase",
- new AxField(new AxReferenceKey(event0104.getKey(), "TestMatchCase"), testCase.getKey()));
- event0104.getParameterMap().put("TestTimestamp",
- new AxField(new AxReferenceKey(event0104.getKey(), "TestTimestamp"), testTimestamp.getKey()));
- event0104.getParameterMap().put("TestTemperature",
- new AxField(new AxReferenceKey(event0104.getKey(), "TestTemperature"), testTemperature.getKey()));
- event0104.getParameterMap().put("TestMatchCaseSelected",
- new AxField(new AxReferenceKey(event0104.getKey(), "TestMatchCaseSelected"), testCase.getKey()));
- event0104.getParameterMap().put("TestMatchStateTime",
- new AxField(new AxReferenceKey(event0104.getKey(), "TestMatchStateTime"), testTimestamp.getKey()));
- event0104.getParameterMap().put("TestEstablishCaseSelected",
- new AxField(new AxReferenceKey(event0104.getKey(), "TestEstablishCaseSelected"), testCase.getKey()));
- event0104.getParameterMap().put("TestEstablishStateTime",
- new AxField(new AxReferenceKey(event0104.getKey(), "TestEstablishStateTime"), testTimestamp.getKey()));
- event0104.getParameterMap().put("TestDecideCaseSelected",
- new AxField(new AxReferenceKey(event0104.getKey(), "TestDecideCaseSelected"), testCase.getKey()));
- event0104.getParameterMap().put("TestDecideStateTime",
- new AxField(new AxReferenceKey(event0104.getKey(), "TestDecideStateTime"), testTimestamp.getKey()));
- event0104.getParameterMap().put("TestActCaseSelected",
- new AxField(new AxReferenceKey(event0104.getKey(), "TestActCaseSelected"), testCase.getKey()));
- event0104.getParameterMap().put("TestActStateTime",
- new AxField(new AxReferenceKey(event0104.getKey(), "TestActStateTime"), testTimestamp.getKey()));
-
- AxEvents events = new AxEvents(new AxArtifactKey("Events", "0.0.1"));
- events.getEventMap().put(event0000.getKey(), event0000);
- events.getEventMap().put(event0001.getKey(), event0001);
- events.getEventMap().put(event0002.getKey(), event0002);
- events.getEventMap().put(event0003.getKey(), event0003);
- events.getEventMap().put(event0004.getKey(), event0004);
- events.getEventMap().put(event0100.getKey(), event0100);
- events.getEventMap().put(event0101.getKey(), event0101);
- events.getEventMap().put(event0102.getKey(), event0102);
- events.getEventMap().put(event0103.getKey(), event0103);
- events.getEventMap().put(event0104.getKey(), event0104);
-
- AxContextAlbum externalContextAlbum = new AxContextAlbum(new AxArtifactKey("ExternalContextAlbum", "0.0.1"),
- "EXTERNAL", false, testExternalContextItem.getKey());
- AxContextAlbum globalContextAlbum = new AxContextAlbum(new AxArtifactKey("GlobalContextAlbum", "0.0.1"),
- "GLOBAL", true, testGlobalContextItem.getKey());
- AxContextAlbum policy0ContextAlbum = new AxContextAlbum(new AxArtifactKey("Policy0ContextAlbum", "0.0.1"),
- "APPLICATION", true, testPolicyContextItem.getKey());
- AxContextAlbum policy1ContextAlbum = new AxContextAlbum(new AxArtifactKey("Policy1ContextAlbum", "0.0.1"),
- "APPLICATION", true, testPolicyContextItem.getKey());
-
- AxContextAlbums albums = new AxContextAlbums(new AxArtifactKey("Context", "0.0.1"));
- albums.getAlbumsMap().put(externalContextAlbum.getKey(), externalContextAlbum);
- albums.getAlbumsMap().put(globalContextAlbum.getKey(), globalContextAlbum);
- albums.getAlbumsMap().put(policy0ContextAlbum.getKey(), policy0ContextAlbum);
- albums.getAlbumsMap().put(policy1ContextAlbum.getKey(), policy1ContextAlbum);
-
- Set<AxArtifactKey> referenceKeySet0 = new TreeSet<AxArtifactKey>();
- referenceKeySet0.add(policy0ContextAlbum.getKey());
- referenceKeySet0.add(policy1ContextAlbum.getKey());
- referenceKeySet0.add(globalContextAlbum.getKey());
- referenceKeySet0.add(externalContextAlbum.getKey());
-
- Set<AxArtifactKey> referenceKeySet1 = new TreeSet<AxArtifactKey>();
- referenceKeySet1.add(policy0ContextAlbum.getKey());
- referenceKeySet1.add(globalContextAlbum.getKey());
-
- Set<AxArtifactKey> referenceKeySet2 = new TreeSet<AxArtifactKey>();
- referenceKeySet2.add(policy1ContextAlbum.getKey());
- referenceKeySet2.add(globalContextAlbum.getKey());
-
- Set<AxArtifactKey> referenceKeySet3 = new TreeSet<AxArtifactKey>();
- referenceKeySet3.add(globalContextAlbum.getKey());
- referenceKeySet3.add(externalContextAlbum.getKey());
-
- List<Set<AxArtifactKey>> referenceKeySetList = new ArrayList<Set<AxArtifactKey>>();
- referenceKeySetList.add(referenceKeySet0);
- referenceKeySetList.add(referenceKeySet1);
- referenceKeySetList.add(referenceKeySet2);
- referenceKeySetList.add(referenceKeySet3);
-
- AxTasks tasks = new AxTasks(new AxArtifactKey("Tasks", "0.0.1"));
- tasks.getTaskMap().putAll(getTaskMap("Match", event0000.getParameterMap(), event0001.getParameterMap(),
- referenceKeySetList, axLogicExecutorType));
- tasks.getTaskMap().putAll(getTaskMap("Establish", event0001.getParameterMap(), event0002.getParameterMap(),
- referenceKeySetList, axLogicExecutorType));
- tasks.getTaskMap().putAll(getTaskMap("Decide", event0002.getParameterMap(), event0003.getParameterMap(),
- referenceKeySetList, axLogicExecutorType));
- tasks.getTaskMap().putAll(getTaskMap("Act", event0003.getParameterMap(), event0004.getParameterMap(),
- referenceKeySetList, axLogicExecutorType));
-
- Set<AxArtifactKey> matchTasks = new TreeSet<AxArtifactKey>();
- Set<AxArtifactKey> establishTasks = new TreeSet<AxArtifactKey>();
- Set<AxArtifactKey> decideTasks = new TreeSet<AxArtifactKey>();
- Set<AxArtifactKey> actTasks = new TreeSet<AxArtifactKey>();
- for (AxTask task : tasks.getTaskMap().values()) {
- if (task.getKey().getName().contains("Match")) {
- matchTasks.add(task.getKey());
- }
- if (task.getKey().getName().contains("Establish")) {
- establishTasks.add(task.getKey());
- }
- if (task.getKey().getName().contains("Decide")) {
- decideTasks.add(task.getKey());
- }
- if (task.getKey().getName().contains("Act")) {
- actTasks.add(task.getKey());
- }
- }
- List<Set<AxArtifactKey>> taskReferenceList = new ArrayList<Set<AxArtifactKey>>();
- taskReferenceList.add(matchTasks);
- taskReferenceList.add(establishTasks);
- taskReferenceList.add(decideTasks);
- taskReferenceList.add(actTasks);
-
- List<AxArtifactKey> p0InEventList = new ArrayList<AxArtifactKey>();
- p0InEventList.add(event0000.getKey());
- p0InEventList.add(event0001.getKey());
- p0InEventList.add(event0002.getKey());
- p0InEventList.add(event0003.getKey());
-
- List<AxArtifactKey> p0OutEventList = new ArrayList<AxArtifactKey>();
- p0OutEventList.add(event0001.getKey());
- p0OutEventList.add(event0002.getKey());
- p0OutEventList.add(event0003.getKey());
- p0OutEventList.add(event0004.getKey());
-
- List<AxArtifactKey> p0defaultTaskList = new ArrayList<AxArtifactKey>();
- p0defaultTaskList.add(tasks.get("Task_Match0").getKey());
- p0defaultTaskList.add(tasks.get("Task_Establish2").getKey());
- p0defaultTaskList.add(tasks.get("Task_Decide3").getKey());
- p0defaultTaskList.add(tasks.get("Task_Act1").getKey());
-
- List<AxArtifactKey> p1InEventList = new ArrayList<AxArtifactKey>();
- p1InEventList.add(event0100.getKey());
- p1InEventList.add(event0101.getKey());
- p1InEventList.add(event0102.getKey());
- p1InEventList.add(event0103.getKey());
-
- List<AxArtifactKey> p1OutEventList = new ArrayList<AxArtifactKey>();
- p1OutEventList.add(event0101.getKey());
- p1OutEventList.add(event0102.getKey());
- p1OutEventList.add(event0103.getKey());
- p1OutEventList.add(event0104.getKey());
-
- List<AxArtifactKey> p1defaultTaskList = new ArrayList<AxArtifactKey>();
- p1defaultTaskList.add(tasks.get("Task_Match3").getKey());
- p1defaultTaskList.add(tasks.get("Task_Establish1").getKey());
- p1defaultTaskList.add(tasks.get("Task_Decide3").getKey());
- p1defaultTaskList.add(tasks.get("Task_Act0").getKey());
-
- Set<AxArtifactKey> p0ReferenceKeySet0 = new TreeSet<AxArtifactKey>();
- p0ReferenceKeySet0.add(policy0ContextAlbum.getKey());
- p0ReferenceKeySet0.add(globalContextAlbum.getKey());
-
- Set<AxArtifactKey> p0ReferenceKeySet1 = new TreeSet<AxArtifactKey>();
- p0ReferenceKeySet1.add(policy1ContextAlbum.getKey());
- p0ReferenceKeySet1.add(globalContextAlbum.getKey());
- p0ReferenceKeySet1.add(externalContextAlbum.getKey());
-
- Set<AxArtifactKey> p0ReferenceKeySet2 = new TreeSet<AxArtifactKey>();
- p0ReferenceKeySet2.add(policy0ContextAlbum.getKey());
- p0ReferenceKeySet2.add(globalContextAlbum.getKey());
- p0ReferenceKeySet2.add(externalContextAlbum.getKey());
-
- Set<AxArtifactKey> p0ReferenceKeySet3 = new TreeSet<AxArtifactKey>();
- p0ReferenceKeySet3.add(globalContextAlbum.getKey());
-
- List<Set<AxArtifactKey>> p0ReferenceKeySetList = new ArrayList<Set<AxArtifactKey>>();
- p0ReferenceKeySetList.add(p0ReferenceKeySet0);
- p0ReferenceKeySetList.add(p0ReferenceKeySet1);
- p0ReferenceKeySetList.add(p0ReferenceKeySet2);
- p0ReferenceKeySetList.add(p0ReferenceKeySet3);
-
- AxPolicy policy0 = new AxPolicy(new AxArtifactKey("Policy0", "0.0.1"));
- policy0.setTemplate("MEDA");
- policy0.setStateMap(getStateMap(policy0.getKey(), p0InEventList, p0OutEventList, p0ReferenceKeySetList,
- axLogicExecutorType, p0defaultTaskList, taskReferenceList));
- policy0.setFirstState(policy0.getStateMap().get("Match").getKey().getLocalName());
-
- Set<AxArtifactKey> p1ReferenceKeySet0 = new TreeSet<AxArtifactKey>();
- p1ReferenceKeySet0.add(policy1ContextAlbum.getKey());
- p1ReferenceKeySet0.add(globalContextAlbum.getKey());
- p1ReferenceKeySet0.add(externalContextAlbum.getKey());
-
- Set<AxArtifactKey> p1ReferenceKeySet1 = new TreeSet<AxArtifactKey>();
- p1ReferenceKeySet1.add(policy1ContextAlbum.getKey());
- p1ReferenceKeySet1.add(globalContextAlbum.getKey());
- p1ReferenceKeySet1.add(externalContextAlbum.getKey());
-
- Set<AxArtifactKey> p1ReferenceKeySet2 = new TreeSet<AxArtifactKey>();
- p1ReferenceKeySet2.add(policy1ContextAlbum.getKey());
- p1ReferenceKeySet2.add(globalContextAlbum.getKey());
- p1ReferenceKeySet2.add(externalContextAlbum.getKey());
-
- Set<AxArtifactKey> p1ReferenceKeySet3 = new TreeSet<AxArtifactKey>();
- p1ReferenceKeySet3.add(globalContextAlbum.getKey());
-
- List<Set<AxArtifactKey>> p1ReferenceKeySetList = new ArrayList<Set<AxArtifactKey>>();
- p1ReferenceKeySetList.add(p1ReferenceKeySet0);
- p1ReferenceKeySetList.add(p1ReferenceKeySet1);
- p1ReferenceKeySetList.add(p1ReferenceKeySet2);
- p1ReferenceKeySetList.add(p1ReferenceKeySet3);
-
- AxPolicy policy1 = new AxPolicy(new AxArtifactKey("Policy1", "0.0.1"));
- policy1.setTemplate("MEDA");
- policy1.setStateMap(getStateMap(policy1.getKey(), p1InEventList, p1OutEventList, p1ReferenceKeySetList,
- axLogicExecutorType, p1defaultTaskList, taskReferenceList));
- policy1.setFirstState(policy1.getStateMap().get("Match").getKey().getLocalName());
-
- AxPolicies policies = new AxPolicies(new AxArtifactKey("Policies", "0.0.1"));
- policies.getPolicyMap().put(policy0.getKey(), policy0);
- policies.getPolicyMap().put(policy1.getKey(), policy1);
-
- AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInformation", "0.0.1"));
- AxPolicyModel policyModel =
- new AxPolicyModel(new AxArtifactKey("SamplePolicyModel" + axLogicExecutorType, "0.0.1"));
- policyModel.setKeyInformation(keyInformation);
- policyModel.setPolicies(policies);
- policyModel.setEvents(events);
- policyModel.setTasks(tasks);
- policyModel.setAlbums(albums);
- policyModel.setSchemas(axContextSchemas);
- policyModel.getKeyInformation().generateKeyInfo(policyModel);
-
- AxValidationResult result = policyModel.validate(new AxValidationResult());
- if (!result.getValidationResult().equals(AxValidationResult.ValidationResult.VALID)) {
- throw new ApexRuntimeException("model " + policyModel.getId() + " is not valid" + result);
- }
- return policyModel;
- }
-
- /**
- * Gets the state map.
- *
- * @param policyKey the policy key
- * @param inEventKeyList the in event key list
- * @param outEventKeyList the out event key list
- * @param referenceKeySetList the reference key set list
- * @param axLogicExecutorType the ax logic executor type
- * @param defaultTaskList the default task list
- * @param taskKeySetList the task key set list
- * @return the state map
- */
- private Map<String, AxState> getStateMap(final AxArtifactKey policyKey, final List<AxArtifactKey> inEventKeyList,
- final List<AxArtifactKey> outEventKeyList, final List<Set<AxArtifactKey>> referenceKeySetList,
- final String axLogicExecutorType, final List<AxArtifactKey> defaultTaskList,
- final List<Set<AxArtifactKey>> taskKeySetList) {
- AxLogicReader logicReader = new PolicyLogicReader().setLogicPackage(this.getClass().getPackage().getName())
- .setDefaultLogic("DefaultState_Logic");
-
- AxState actState = new AxState(new AxReferenceKey(policyKey, "Act"));
- actState.setTrigger(inEventKeyList.get(3));
- AxStateOutput act2Out =
- new AxStateOutput(actState.getKey(), AxReferenceKey.getNullKey(), outEventKeyList.get(3));
- actState.getStateOutputs().put(act2Out.getKey().getLocalName(), act2Out);
- actState.setContextAlbumReferences(referenceKeySetList.get(3));
- actState.setTaskSelectionLogic(
- new AxTaskSelectionLogic(actState.getKey(), "TaskSelectionLigic", axLogicExecutorType, logicReader));
- actState.setDefaultTask(defaultTaskList.get(3));
- for (AxArtifactKey taskKey : taskKeySetList.get(3)) {
- actState.getTaskReferences().put(taskKey, new AxStateTaskReference(actState.getKey(), taskKey,
- AxStateTaskOutputType.DIRECT, act2Out.getKey()));
- }
-
- AxState decideState = new AxState(new AxReferenceKey(policyKey, "Decide"));
- decideState.setTrigger(inEventKeyList.get(2));
- AxStateOutput decide2Act = new AxStateOutput(decideState.getKey(), actState.getKey(), outEventKeyList.get(2));
- decideState.getStateOutputs().put(decide2Act.getKey().getLocalName(), decide2Act);
- decideState.setContextAlbumReferences(referenceKeySetList.get(2));
- decideState.setTaskSelectionLogic(
- new AxTaskSelectionLogic(decideState.getKey(), "TaskSelectionLigic", axLogicExecutorType, logicReader));
- decideState.setDefaultTask(defaultTaskList.get(2));
- for (AxArtifactKey taskKey : taskKeySetList.get(2)) {
- decideState.getTaskReferences().put(taskKey, new AxStateTaskReference(decideState.getKey(), taskKey,
- AxStateTaskOutputType.DIRECT, decide2Act.getKey()));
- }
-
- AxState establishState = new AxState(new AxReferenceKey(policyKey, "Establish"));
- establishState.setTrigger(inEventKeyList.get(1));
- AxStateOutput establish2Decide =
- new AxStateOutput(establishState.getKey(), decideState.getKey(), outEventKeyList.get(1));
- establishState.getStateOutputs().put(establish2Decide.getKey().getLocalName(), establish2Decide);
- establishState.setContextAlbumReferences(referenceKeySetList.get(1));
- establishState.setTaskSelectionLogic(new AxTaskSelectionLogic(establishState.getKey(), "TaskSelectionLigic",
- axLogicExecutorType, logicReader));
- establishState.setDefaultTask(defaultTaskList.get(1));
- for (AxArtifactKey taskKey : taskKeySetList.get(1)) {
- establishState.getTaskReferences().put(taskKey, new AxStateTaskReference(establishState.getKey(), taskKey,
- AxStateTaskOutputType.DIRECT, establish2Decide.getKey()));
- }
-
- AxState matchState = new AxState(new AxReferenceKey(policyKey, "Match"));
- matchState.setTrigger(inEventKeyList.get(0));
- AxStateOutput match2Establish =
- new AxStateOutput(matchState.getKey(), establishState.getKey(), outEventKeyList.get(0));
- matchState.getStateOutputs().put(match2Establish.getKey().getLocalName(), match2Establish);
- matchState.setContextAlbumReferences(referenceKeySetList.get(0));
- matchState.setTaskSelectionLogic(
- new AxTaskSelectionLogic(matchState.getKey(), "TaskSelectionLigic", axLogicExecutorType, logicReader));
- matchState.setDefaultTask(defaultTaskList.get(0));
- for (AxArtifactKey taskKey : taskKeySetList.get(0)) {
- matchState.getTaskReferences().put(taskKey, new AxStateTaskReference(matchState.getKey(), taskKey,
- AxStateTaskOutputType.DIRECT, match2Establish.getKey()));
- }
-
- Map<String, AxState> stateMap = new TreeMap<String, AxState>();
- stateMap.put(matchState.getKey().getLocalName(), matchState);
- stateMap.put(establishState.getKey().getLocalName(), establishState);
- stateMap.put(decideState.getKey().getLocalName(), decideState);
- stateMap.put(actState.getKey().getLocalName(), actState);
-
- return stateMap;
- }
- // CHECKSTYLE:ON: checkstyle:maximumMethodLength
-
- /**
- * Gets the task map.
- *
- * @param state the state
- * @param inputFields the input fields
- * @param outputFields the output fields
- * @param referenceKeySetList the reference key set list
- * @param axLogicExecutorType the ax logic executor type
- * @return the task map
- */
- private Map<AxArtifactKey, AxTask> getTaskMap(final String state, final Map<String, AxField> inputFields,
- final Map<String, AxField> outputFields, final List<Set<AxArtifactKey>> referenceKeySetList,
- final String axLogicExecutorType) {
- AxLogicReader logicReader = new PolicyLogicReader().setLogicPackage(this.getClass().getPackage().getName())
- .setDefaultLogic("DefaultTask_Logic");
-
- AxTask testTask0 = new AxTask(new AxArtifactKey("Task_" + state + "0", "0.0.1"));
- testTask0.duplicateInputFields(inputFields);
- testTask0.duplicateOutputFields(outputFields);
- AxTaskParameter parameter00 =
- new AxTaskParameter(new AxReferenceKey(testTask0.getKey(), "Parameter0"), "DefaultValue0");
- AxTaskParameter parameter01 =
- new AxTaskParameter(new AxReferenceKey(testTask0.getKey(), "Parameter1"), "DefaultValue1");
- AxTaskParameter parameter02 =
- new AxTaskParameter(new AxReferenceKey(testTask0.getKey(), "Parameter2"), "DefaultValue2");
- testTask0.getTaskParameters().put(parameter00.getKey().getLocalName(), parameter00);
- testTask0.getTaskParameters().put(parameter01.getKey().getLocalName(), parameter01);
- testTask0.getTaskParameters().put(parameter02.getKey().getLocalName(), parameter02);
- testTask0.setContextAlbumReferences(referenceKeySetList.get(0));
- testTask0.setTaskLogic(getTaskLogic(testTask0, logicReader, axLogicExecutorType, state, "2"));
-
- AxTask testTask1 = new AxTask(new AxArtifactKey("Task_" + state + "1", "0.0.1"));
- testTask1.duplicateInputFields(inputFields);
- testTask1.duplicateOutputFields(outputFields);
- AxTaskParameter parameter10 =
- new AxTaskParameter(new AxReferenceKey(testTask1.getKey(), "Parameter0"), "DefaultValue0");
- AxTaskParameter parameter11 =
- new AxTaskParameter(new AxReferenceKey(testTask1.getKey(), "Parameter1"), "DefaultValue1");
- testTask1.getTaskParameters().put(parameter10.getKey().getLocalName(), parameter10);
- testTask1.getTaskParameters().put(parameter11.getKey().getLocalName(), parameter11);
- testTask1.setContextAlbumReferences(referenceKeySetList.get(1));
- testTask1.setTaskLogic(getTaskLogic(testTask1, logicReader, axLogicExecutorType, state, "3"));
-
- AxTask testTask2 = new AxTask(new AxArtifactKey("Task_" + state + "2", "0.0.1"));
- testTask2.duplicateInputFields(inputFields);
- testTask2.duplicateOutputFields(outputFields);
- AxTaskParameter parameter20 =
- new AxTaskParameter(new AxReferenceKey(testTask2.getKey(), "Parameter0"), "DefaultValue0");
- testTask2.getTaskParameters().put(parameter20.getKey().getLocalName(), parameter20);
- testTask2.setContextAlbumReferences(referenceKeySetList.get(2));
- testTask2.setTaskLogic(getTaskLogic(testTask2, logicReader, axLogicExecutorType, state, "0"));
-
- AxTask testTask3 = new AxTask(new AxArtifactKey("Task_" + state + "3", "0.0.1"));
- testTask3.duplicateInputFields(inputFields);
- testTask3.duplicateOutputFields(outputFields);
- AxTaskParameter parameter30 =
- new AxTaskParameter(new AxReferenceKey(testTask3.getKey(), "Parameter0"), "DefaultValue0");
- testTask3.getTaskParameters().put(parameter30.getKey().getLocalName(), parameter30);
- testTask3.setContextAlbumReferences(referenceKeySetList.get(THIRD_ENTRY));
- testTask3.setTaskLogic(getTaskLogic(testTask3, logicReader, axLogicExecutorType, state, "1"));
-
- Map<AxArtifactKey, AxTask> taskMap = new TreeMap<AxArtifactKey, AxTask>();
- taskMap.put(testTask0.getKey(), testTask0);
- taskMap.put(testTask1.getKey(), testTask1);
- taskMap.put(testTask2.getKey(), testTask2);
- taskMap.put(testTask3.getKey(), testTask3);
-
- return taskMap;
- }
-
- /**
- * Gets the task logic.
- *
- * @param task the task
- * @param logicReader the logic reader
- * @param logicFlavour the logic flavour
- * @param stateName the state name
- * @param caseToUse the case to use
- * @return the task logic
- */
- private AxTaskLogic getTaskLogic(final AxTask task, final AxLogicReader logicReader, final String logicFlavour,
- final String stateName, final String caseToUse) {
- AxTaskLogic axLogic =
- new AxTaskLogic(new AxReferenceKey(task.getKey(), "_TaskLogic"), logicFlavour, logicReader);
-
- axLogic.setLogic(axLogic.getLogic().replaceAll("<STATE_NAME>", stateName)
- .replaceAll("<TASK_NAME>", task.getKey().getName()).replaceAll("<RANDOM_BYTE_VALUE>", caseToUse));
-
- return axLogic;
- }
-}
diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/EvalDomainModelFactory.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/EvalDomainModelFactory.java
index a3f626f48..a36aa1030 100644
--- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/EvalDomainModelFactory.java
+++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/EvalDomainModelFactory.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.test.common.model;
+package org.onap.policy.apex.testsuites.integration.common.model;
import java.util.ArrayList;
import java.util.Arrays;
@@ -59,6 +59,29 @@ import org.onap.policy.apex.model.policymodel.handling.PolicyLogicReader;
* @author John Keeney (john.keeney@ericsson.com)
*/
public class EvalDomainModelFactory {
+ // Recurring string constants
+ private static final String ACTION = "Action";
+ private static final String CONDITION = "Condition";
+ private static final String EVENT = "Event";
+ private static final String TASK_SELECTION_LOGIC = "TaskSelectionLogic";
+ private static final String JYTHON = "JYTHON";
+ private static final String ORIENT = "Orient";
+ private static final String STATE_NAME = "<STATE_NAME>";
+ private static final String OBSERVE = "Observe";
+ private static final String JAVASCRIPT = "JAVASCRIPT";
+ private static final String TASK_NAME = "<TASK_NAME>";
+ private static final String TASK_LOGIC = "TaskLogic";
+ private static final String STATE_NUMBER = "<STATE_NUMBER>";
+ private static final String STATE3_TIMESTAMP = "State3Timestamp";
+ private static final String EVENT_NUMBER = "EventNumber";
+ private static final String FIRST_EVENT_TIMESTAMP = "FirstEventTimestamp";
+ private static final String STATE2_TIMESTAMP = "State2Timestamp";
+ private static final String STATE1_TIMESTAMP = "State1Timestamp";
+ private static final String TEST_TEMPERATURE = "TestTemperature";
+ private static final String SENT_TIMESTAMP = "SentTimestamp";
+ private static final String EVENT_TAG = ".events";
+ private static final String DEFAULT_VERSION = "0.0.1";
+
private static final int THIRD_MEMBER = 3;
private static final String PACKAGE = EvalDomainModelFactory.class.getPackage().getName();
@@ -91,61 +114,89 @@ public class EvalDomainModelFactory {
public EvalDomainModelFactory(final String justOneLang) {
this.justOneLang = justOneLang;
- typeTimestamp = new AxContextSchema(new AxArtifactKey("TestTimestamp", "0.0.1"), "Java", "java.lang.Long");
- typeDouble = new AxContextSchema(new AxArtifactKey("TestTemperature", "0.0.1"), "Java", "java.lang.Double");
- typeCounter = new AxContextSchema(new AxArtifactKey("TestTimestamp", "0.0.1"), "Java", "java.lang.Long");
+ typeTimestamp = new AxContextSchema(new AxArtifactKey("TestTimestamp", DEFAULT_VERSION), "Java",
+ "java.lang.Long");
+ typeDouble = new AxContextSchema(new AxArtifactKey(TEST_TEMPERATURE, DEFAULT_VERSION), "Java",
+ "java.lang.Double");
+ typeCounter = new AxContextSchema(new AxArtifactKey("TestTimestamp", DEFAULT_VERSION), "Java",
+ "java.lang.Long");
- schemas = new AxContextSchemas(new AxArtifactKey("TestDatatypes", "0.0.1"));
+ schemas = new AxContextSchemas(new AxArtifactKey("TestDatatypes", DEFAULT_VERSION));
schemas.getSchemasMap().put(typeTimestamp.getKey(), typeTimestamp);
schemas.getSchemasMap().put(typeDouble.getKey(), typeDouble);
schemas.getSchemasMap().put(typeCounter.getKey(), typeCounter);
- event0000 = new AxEvent(new AxArtifactKey("Event0000", "0.0.1"), PACKAGE + ".events");
- event0000.getParameterMap().put("SentTimestamp", new AxField(new AxReferenceKey(event0000.getKey(), "SentTimestamp"), typeTimestamp.getKey()));
- event0000.getParameterMap().put("TestTemperature", new AxField(new AxReferenceKey(event0000.getKey(), "TestTemperature"), typeDouble.getKey()));
- event0000.getParameterMap().put("FirstEventTimestamp",
- new AxField(new AxReferenceKey(event0000.getKey(), "FirstEventTimestamp"), typeTimestamp.getKey()));
- event0000.getParameterMap().put("EventNumber", new AxField(new AxReferenceKey(event0000.getKey(), "EventNumber"), typeCounter.getKey()));
-
- event0001 = new AxEvent(new AxArtifactKey("Event0001", "0.0.1"), PACKAGE + ".events");
- event0001.getParameterMap().put("SentTimestamp", new AxField(new AxReferenceKey(event0001.getKey(), "SentTimestamp"), typeTimestamp.getKey()));
- event0001.getParameterMap().put("State1Timestamp", new AxField(new AxReferenceKey(event0001.getKey(), "State1Timestamp"), typeTimestamp.getKey()));
- event0001.getParameterMap().put("TestTemperature", new AxField(new AxReferenceKey(event0001.getKey(), "TestTemperature"), typeDouble.getKey()));
- event0001.getParameterMap().put("FirstEventTimestamp",
- new AxField(new AxReferenceKey(event0001.getKey(), "FirstEventTimestamp"), typeTimestamp.getKey()));
- event0001.getParameterMap().put("EventNumber", new AxField(new AxReferenceKey(event0001.getKey(), "EventNumber"), typeCounter.getKey()));
-
- event0002 = new AxEvent(new AxArtifactKey("Event0002", "0.0.1"), PACKAGE + ".events");
- event0002.getParameterMap().put("SentTimestamp", new AxField(new AxReferenceKey(event0002.getKey(), "SentTimestamp"), typeTimestamp.getKey()));
- event0002.getParameterMap().put("State1Timestamp", new AxField(new AxReferenceKey(event0002.getKey(), "State1Timestamp"), typeTimestamp.getKey()));
- event0002.getParameterMap().put("State2Timestamp", new AxField(new AxReferenceKey(event0002.getKey(), "State2Timestamp"), typeTimestamp.getKey()));
- event0002.getParameterMap().put("TestTemperature", new AxField(new AxReferenceKey(event0002.getKey(), "TestTemperature"), typeDouble.getKey()));
- event0002.getParameterMap().put("FirstEventTimestamp",
- new AxField(new AxReferenceKey(event0002.getKey(), "FirstEventTimestamp"), typeTimestamp.getKey()));
- event0002.getParameterMap().put("EventNumber", new AxField(new AxReferenceKey(event0002.getKey(), "EventNumber"), typeCounter.getKey()));
-
- event0003 = new AxEvent(new AxArtifactKey("Event0003", "0.0.1"), PACKAGE + ".events");
- event0003.getParameterMap().put("SentTimestamp", new AxField(new AxReferenceKey(event0003.getKey(), "SentTimestamp"), typeTimestamp.getKey()));
- event0003.getParameterMap().put("State1Timestamp", new AxField(new AxReferenceKey(event0003.getKey(), "State1Timestamp"), typeTimestamp.getKey()));
- event0003.getParameterMap().put("State2Timestamp", new AxField(new AxReferenceKey(event0003.getKey(), "State2Timestamp"), typeTimestamp.getKey()));
- event0003.getParameterMap().put("State3Timestamp", new AxField(new AxReferenceKey(event0003.getKey(), "State3Timestamp"), typeTimestamp.getKey()));
- event0003.getParameterMap().put("TestTemperature", new AxField(new AxReferenceKey(event0003.getKey(), "TestTemperature"), typeDouble.getKey()));
- event0003.getParameterMap().put("FirstEventTimestamp",
- new AxField(new AxReferenceKey(event0003.getKey(), "FirstEventTimestamp"), typeTimestamp.getKey()));
- event0003.getParameterMap().put("EventNumber", new AxField(new AxReferenceKey(event0003.getKey(), "EventNumber"), typeCounter.getKey()));
-
- event0004 = new AxEvent(new AxArtifactKey("Event0004", "0.0.1"), PACKAGE + ".events");
- event0004.getParameterMap().put("SentTimestamp", new AxField(new AxReferenceKey(event0004.getKey(), "SentTimestamp"), typeTimestamp.getKey()));
- event0004.getParameterMap().put("State1Timestamp", new AxField(new AxReferenceKey(event0004.getKey(), "State1Timestamp"), typeTimestamp.getKey()));
- event0004.getParameterMap().put("State2Timestamp", new AxField(new AxReferenceKey(event0004.getKey(), "State2Timestamp"), typeTimestamp.getKey()));
- event0004.getParameterMap().put("State3Timestamp", new AxField(new AxReferenceKey(event0004.getKey(), "State3Timestamp"), typeTimestamp.getKey()));
- event0004.getParameterMap().put("State4Timestamp", new AxField(new AxReferenceKey(event0004.getKey(), "State4Timestamp"), typeTimestamp.getKey()));
- event0004.getParameterMap().put("TestTemperature", new AxField(new AxReferenceKey(event0004.getKey(), "TestTemperature"), typeDouble.getKey()));
- event0004.getParameterMap().put("FirstEventTimestamp",
- new AxField(new AxReferenceKey(event0004.getKey(), "FirstEventTimestamp"), typeTimestamp.getKey()));
- event0004.getParameterMap().put("EventNumber", new AxField(new AxReferenceKey(event0004.getKey(), "EventNumber"), typeCounter.getKey()));
-
- events = new AxEvents(new AxArtifactKey("Events", "0.0.1"));
+ event0000 = new AxEvent(new AxArtifactKey("Event0000", DEFAULT_VERSION), PACKAGE + EVENT_TAG);
+ event0000.getParameterMap().put(SENT_TIMESTAMP,
+ new AxField(new AxReferenceKey(event0000.getKey(), SENT_TIMESTAMP), typeTimestamp.getKey()));
+ event0000.getParameterMap().put(TEST_TEMPERATURE,
+ new AxField(new AxReferenceKey(event0000.getKey(), TEST_TEMPERATURE), typeDouble.getKey()));
+ event0000.getParameterMap().put(FIRST_EVENT_TIMESTAMP, new AxField(
+ new AxReferenceKey(event0000.getKey(), FIRST_EVENT_TIMESTAMP), typeTimestamp.getKey()));
+ event0000.getParameterMap().put(EVENT_NUMBER,
+ new AxField(new AxReferenceKey(event0000.getKey(), EVENT_NUMBER), typeCounter.getKey()));
+
+ event0001 = new AxEvent(new AxArtifactKey("Event0001", DEFAULT_VERSION), PACKAGE + EVENT_TAG);
+ event0001.getParameterMap().put(SENT_TIMESTAMP,
+ new AxField(new AxReferenceKey(event0001.getKey(), SENT_TIMESTAMP), typeTimestamp.getKey()));
+ event0001.getParameterMap().put(STATE1_TIMESTAMP,
+ new AxField(new AxReferenceKey(event0001.getKey(), STATE1_TIMESTAMP), typeTimestamp.getKey()));
+ event0001.getParameterMap().put(TEST_TEMPERATURE,
+ new AxField(new AxReferenceKey(event0001.getKey(), TEST_TEMPERATURE), typeDouble.getKey()));
+ event0001.getParameterMap().put(FIRST_EVENT_TIMESTAMP, new AxField(
+ new AxReferenceKey(event0001.getKey(), FIRST_EVENT_TIMESTAMP), typeTimestamp.getKey()));
+ event0001.getParameterMap().put(EVENT_NUMBER,
+ new AxField(new AxReferenceKey(event0001.getKey(), EVENT_NUMBER), typeCounter.getKey()));
+
+ event0002 = new AxEvent(new AxArtifactKey("Event0002", DEFAULT_VERSION), PACKAGE + EVENT_TAG);
+ event0002.getParameterMap().put(SENT_TIMESTAMP,
+ new AxField(new AxReferenceKey(event0002.getKey(), SENT_TIMESTAMP), typeTimestamp.getKey()));
+ event0002.getParameterMap().put(STATE1_TIMESTAMP,
+ new AxField(new AxReferenceKey(event0002.getKey(), STATE1_TIMESTAMP), typeTimestamp.getKey()));
+ event0002.getParameterMap().put(STATE2_TIMESTAMP,
+ new AxField(new AxReferenceKey(event0002.getKey(), STATE2_TIMESTAMP), typeTimestamp.getKey()));
+ event0002.getParameterMap().put(TEST_TEMPERATURE,
+ new AxField(new AxReferenceKey(event0002.getKey(), TEST_TEMPERATURE), typeDouble.getKey()));
+ event0002.getParameterMap().put(FIRST_EVENT_TIMESTAMP, new AxField(
+ new AxReferenceKey(event0002.getKey(), FIRST_EVENT_TIMESTAMP), typeTimestamp.getKey()));
+ event0002.getParameterMap().put(EVENT_NUMBER,
+ new AxField(new AxReferenceKey(event0002.getKey(), EVENT_NUMBER), typeCounter.getKey()));
+
+ event0003 = new AxEvent(new AxArtifactKey("Event0003", DEFAULT_VERSION), PACKAGE + EVENT_TAG);
+ event0003.getParameterMap().put(SENT_TIMESTAMP,
+ new AxField(new AxReferenceKey(event0003.getKey(), SENT_TIMESTAMP), typeTimestamp.getKey()));
+ event0003.getParameterMap().put(STATE1_TIMESTAMP,
+ new AxField(new AxReferenceKey(event0003.getKey(), STATE1_TIMESTAMP), typeTimestamp.getKey()));
+ event0003.getParameterMap().put(STATE2_TIMESTAMP,
+ new AxField(new AxReferenceKey(event0003.getKey(), STATE2_TIMESTAMP), typeTimestamp.getKey()));
+ event0003.getParameterMap().put(STATE3_TIMESTAMP,
+ new AxField(new AxReferenceKey(event0003.getKey(), STATE3_TIMESTAMP), typeTimestamp.getKey()));
+ event0003.getParameterMap().put(TEST_TEMPERATURE,
+ new AxField(new AxReferenceKey(event0003.getKey(), TEST_TEMPERATURE), typeDouble.getKey()));
+ event0003.getParameterMap().put(FIRST_EVENT_TIMESTAMP, new AxField(
+ new AxReferenceKey(event0003.getKey(), FIRST_EVENT_TIMESTAMP), typeTimestamp.getKey()));
+ event0003.getParameterMap().put(EVENT_NUMBER,
+ new AxField(new AxReferenceKey(event0003.getKey(), EVENT_NUMBER), typeCounter.getKey()));
+
+ event0004 = new AxEvent(new AxArtifactKey("Event0004", DEFAULT_VERSION), PACKAGE + EVENT_TAG);
+ event0004.getParameterMap().put(SENT_TIMESTAMP,
+ new AxField(new AxReferenceKey(event0004.getKey(), SENT_TIMESTAMP), typeTimestamp.getKey()));
+ event0004.getParameterMap().put(STATE1_TIMESTAMP,
+ new AxField(new AxReferenceKey(event0004.getKey(), STATE1_TIMESTAMP), typeTimestamp.getKey()));
+ event0004.getParameterMap().put(STATE2_TIMESTAMP,
+ new AxField(new AxReferenceKey(event0004.getKey(), STATE2_TIMESTAMP), typeTimestamp.getKey()));
+ event0004.getParameterMap().put(STATE3_TIMESTAMP,
+ new AxField(new AxReferenceKey(event0004.getKey(), STATE3_TIMESTAMP), typeTimestamp.getKey()));
+ event0004.getParameterMap().put("State4Timestamp",
+ new AxField(new AxReferenceKey(event0004.getKey(), "State4Timestamp"), typeTimestamp.getKey()));
+ event0004.getParameterMap().put(TEST_TEMPERATURE,
+ new AxField(new AxReferenceKey(event0004.getKey(), TEST_TEMPERATURE), typeDouble.getKey()));
+ event0004.getParameterMap().put(FIRST_EVENT_TIMESTAMP, new AxField(
+ new AxReferenceKey(event0004.getKey(), FIRST_EVENT_TIMESTAMP), typeTimestamp.getKey()));
+ event0004.getParameterMap().put(EVENT_NUMBER,
+ new AxField(new AxReferenceKey(event0004.getKey(), EVENT_NUMBER), typeCounter.getKey()));
+
+ events = new AxEvents(new AxArtifactKey("Events", DEFAULT_VERSION));
events.getEventMap().put(event0000.getKey(), event0000);
events.getEventMap().put(event0001.getKey(), event0001);
events.getEventMap().put(event0002.getKey(), event0002);
@@ -158,41 +209,46 @@ public class EvalDomainModelFactory {
*
* @return the sample policy model
*/
- public AxPolicyModel getOODAPolicyModel() {
+ public AxPolicyModel getOodaPolicyModel() {
final AxTasks tasks = new AxTasks(new AxArtifactKey("Tasks", "0.0.1"));
- final AxLogicReader logicReader = new PolicyLogicReader().setLogicPackage(PACKAGE).setDefaultLogic("EvalTask_Logic");
+ final AxLogicReader logicReader = new PolicyLogicReader().setLogicPackage(PACKAGE)
+ .setDefaultLogic("EvalTask_Logic");
final AxTask obTask = new AxTask(new AxArtifactKey("Task_Observe_0", "0.0.1"));
obTask.duplicateInputFields(event0000.getParameterMap());
obTask.duplicateOutputFields(event0001.getParameterMap());
- final AxTaskLogic obAxLogic = new AxTaskLogic(obTask.getKey(), "TaskLogic", (justOneLang == null ? "JRUBY" : justOneLang), logicReader);
- obAxLogic.setLogic(obAxLogic.getLogic().replaceAll("<STATE_NAME>", "Observe").replaceAll("<TASK_NAME>", obTask.getKey().getName())
- .replaceAll("<STATE_NUMBER>", "1"));
+ final AxTaskLogic obAxLogic = new AxTaskLogic(obTask.getKey(), TASK_LOGIC,
+ (justOneLang == null ? "JRUBY" : justOneLang), logicReader);
+ obAxLogic.setLogic(obAxLogic.getLogic().replaceAll(STATE_NAME, OBSERVE)
+ .replaceAll(TASK_NAME, obTask.getKey().getName()).replaceAll(STATE_NUMBER, "1"));
obTask.setTaskLogic(obAxLogic);
final AxTask orTask = new AxTask(new AxArtifactKey("Task_Orient_0", "0.0.1"));
orTask.duplicateInputFields(event0001.getParameterMap());
orTask.duplicateOutputFields(event0002.getParameterMap());
- final AxTaskLogic orAxLogic = new AxTaskLogic(orTask.getKey(), "TaskLogic", (justOneLang == null ? "JAVASCRIPT" : justOneLang), logicReader);
- orAxLogic.setLogic(orAxLogic.getLogic().replaceAll("<STATE_NAME>", "Orient").replaceAll("<TASK_NAME>", orTask.getKey().getName())
- .replaceAll("<STATE_NUMBER>", "2"));
+ final AxTaskLogic orAxLogic = new AxTaskLogic(orTask.getKey(), TASK_LOGIC,
+ (justOneLang == null ? JAVASCRIPT : justOneLang), logicReader);
+ orAxLogic.setLogic(orAxLogic.getLogic().replaceAll(STATE_NAME, ORIENT)
+ .replaceAll(TASK_NAME, orTask.getKey().getName()).replaceAll(STATE_NUMBER, "2"));
orTask.setTaskLogic(orAxLogic);
final AxTask dTask = new AxTask(new AxArtifactKey("Task_Decide_0", "0.0.1"));
dTask.duplicateInputFields(event0002.getParameterMap());
dTask.duplicateOutputFields(event0003.getParameterMap());
- final AxTaskLogic dAxLogic = new AxTaskLogic(dTask.getKey(), "TaskLogic", (justOneLang == null ? "MVEL" : justOneLang), logicReader);
- dAxLogic.setLogic(
- dAxLogic.getLogic().replaceAll("<STATE_NAME>", "Orient").replaceAll("<TASK_NAME>", dTask.getKey().getName()).replaceAll("<STATE_NUMBER>", "3"));
+ final AxTaskLogic dAxLogic = new AxTaskLogic(dTask.getKey(), TASK_LOGIC,
+ (justOneLang == null ? "MVEL" : justOneLang), logicReader);
+ dAxLogic.setLogic(dAxLogic.getLogic().replaceAll(STATE_NAME, ORIENT)
+ .replaceAll(TASK_NAME, dTask.getKey().getName()).replaceAll(STATE_NUMBER, "3"));
dTask.setTaskLogic(dAxLogic);
final AxTask aTask = new AxTask(new AxArtifactKey("Task_Act_0", "0.0.1"));
aTask.duplicateInputFields(event0003.getParameterMap());
aTask.duplicateOutputFields(event0004.getParameterMap());
- final AxTaskLogic aAxLogic = new AxTaskLogic(aTask.getKey(), "TaskLogic", (justOneLang == null ? "JAVA" : justOneLang), logicReader);
- aAxLogic.setLogic(
- aAxLogic.getLogic().replaceAll("<STATE_NAME>", "Act").replaceAll("<TASK_NAME>", aTask.getKey().getName()).replaceAll("<STATE_NUMBER>", "4"));
+ final AxTaskLogic aAxLogic = new AxTaskLogic(aTask.getKey(), TASK_LOGIC,
+ (justOneLang == null ? "JAVA" : justOneLang), logicReader);
+ aAxLogic.setLogic(aAxLogic.getLogic().replaceAll(STATE_NAME, "Act")
+ .replaceAll(TASK_NAME, aTask.getKey().getName()).replaceAll(STATE_NUMBER, "4"));
aTask.setTaskLogic(aAxLogic);
tasks.getTaskMap().put(obTask.getKey(), obTask);
@@ -206,10 +262,10 @@ public class EvalDomainModelFactory {
final Set<AxArtifactKey> actTasks = new TreeSet<>();
for (final AxTask task : tasks.getTaskMap().values()) {
- if (task.getKey().getName().contains("Observe")) {
+ if (task.getKey().getName().contains(OBSERVE)) {
obTasks.add(task.getKey());
}
- if (task.getKey().getName().contains("Orient")) {
+ if (task.getKey().getName().contains(ORIENT)) {
orTasks.add(task.getKey());
}
if (task.getKey().getName().contains("Decide")) {
@@ -244,10 +300,12 @@ public class EvalDomainModelFactory {
p0defaultTaskList.add(tasks.get("Task_Act_0").getKey());
final AxPolicy policy0 = new AxPolicy(new AxArtifactKey("OODAPolicy_0", "0.0.1"));
- final List<String> axLogicExecutorTypeList = Arrays.asList((justOneLang == null ? "JAVASCRIPT" : justOneLang),
- (justOneLang == null ? "MVEL" : justOneLang), (justOneLang == null ? "JYTHON" : justOneLang), (justOneLang == null ? "JRUBY" : justOneLang));
- policy0.setStateMap(getOODAStateMap(policy0.getKey(), p0InEventList, p0OutEventList, axLogicExecutorTypeList, p0defaultTaskList, taskReferenceList));
- policy0.setFirstState(policy0.getStateMap().get("Observe").getKey().getLocalName());
+ final List<String> axLogicExecutorTypeList = Arrays.asList((justOneLang == null ? JAVASCRIPT : justOneLang),
+ (justOneLang == null ? "MVEL" : justOneLang), (justOneLang == null ? JYTHON : justOneLang),
+ (justOneLang == null ? "JRUBY" : justOneLang));
+ policy0.setStateMap(getOodaStateMap(policy0.getKey(), p0InEventList, p0OutEventList, axLogicExecutorTypeList,
+ p0defaultTaskList, taskReferenceList));
+ policy0.setFirstState(policy0.getStateMap().get(OBSERVE).getKey().getLocalName());
final AxPolicies policies = new AxPolicies(new AxArtifactKey("OODAPolicies", "0.0.1"));
policies.getPolicyMap().put(policy0.getKey(), policy0);
@@ -280,55 +338,67 @@ public class EvalDomainModelFactory {
* @param taskKeySetList the task key set list
* @return the OODA state map
*/
- private Map<String, AxState> getOODAStateMap(final AxArtifactKey policyKey, final List<AxArtifactKey> inEventKeyList,
- final List<AxArtifactKey> outEventKeyList, final List<String> axLogicExecutorTypeList, final List<AxArtifactKey> defaultTaskList,
- final List<Set<AxArtifactKey>> taskKeySetList) {
- final AxLogicReader logicReader = new PolicyLogicReader().setLogicPackage(PACKAGE).setDefaultLogic("EvalState_Logic");
+ private Map<String, AxState> getOodaStateMap(final AxArtifactKey policyKey,
+ final List<AxArtifactKey> inEventKeyList, final List<AxArtifactKey> outEventKeyList,
+ final List<String> axLogicExecutorTypeList, final List<AxArtifactKey> defaultTaskList,
+ final List<Set<AxArtifactKey>> taskKeySetList) {
+ final AxLogicReader logicReader = new PolicyLogicReader().setLogicPackage(PACKAGE)
+ .setDefaultLogic("EvalState_Logic");
final AxState actState = new AxState(new AxReferenceKey(policyKey, "Act"));
actState.setTrigger(inEventKeyList.get(THIRD_MEMBER));
- final AxStateOutput act2Out = new AxStateOutput(new AxReferenceKey(actState.getKey(), "Act2Out"), outEventKeyList.get(THIRD_MEMBER),
- AxReferenceKey.getNullKey());
+ final AxStateOutput act2Out = new AxStateOutput(new AxReferenceKey(actState.getKey(), "Act2Out"),
+ outEventKeyList.get(THIRD_MEMBER), AxReferenceKey.getNullKey());
actState.getStateOutputs().put(act2Out.getKey().getLocalName(), act2Out);
- actState.setTaskSelectionLogic(
- new AxTaskSelectionLogic(actState.getKey(), "TaskSelectionLogic", axLogicExecutorTypeList.get(THIRD_MEMBER), logicReader));
+ actState.setTaskSelectionLogic(new AxTaskSelectionLogic(actState.getKey(), TASK_SELECTION_LOGIC,
+ axLogicExecutorTypeList.get(THIRD_MEMBER), logicReader));
actState.setDefaultTask(defaultTaskList.get(THIRD_MEMBER));
for (final AxArtifactKey taskKey : taskKeySetList.get(THIRD_MEMBER)) {
actState.getTaskReferences().put(taskKey,
- new AxStateTaskReference(new AxReferenceKey(actState.getKey(), taskKey.getName()), AxStateTaskOutputType.DIRECT, act2Out.getKey()));
+ new AxStateTaskReference(new AxReferenceKey(actState.getKey(), taskKey.getName()),
+ AxStateTaskOutputType.DIRECT, act2Out.getKey()));
}
final AxState decState = new AxState(new AxReferenceKey(policyKey, "Decide"));
decState.setTrigger(inEventKeyList.get(2));
- final AxStateOutput dec2Act = new AxStateOutput(new AxReferenceKey(decState.getKey(), "Dec2Act"), outEventKeyList.get(2), actState.getKey());
+ final AxStateOutput dec2Act = new AxStateOutput(new AxReferenceKey(decState.getKey(), "Dec2Act"),
+ outEventKeyList.get(2), actState.getKey());
decState.getStateOutputs().put(dec2Act.getKey().getLocalName(), dec2Act);
- decState.setTaskSelectionLogic(new AxTaskSelectionLogic(decState.getKey(), "TaskSelectionLogic", axLogicExecutorTypeList.get(2), logicReader));
+ decState.setTaskSelectionLogic(new AxTaskSelectionLogic(decState.getKey(), TASK_SELECTION_LOGIC,
+ axLogicExecutorTypeList.get(2), logicReader));
decState.setDefaultTask(defaultTaskList.get(2));
for (final AxArtifactKey taskKey : taskKeySetList.get(2)) {
decState.getTaskReferences().put(taskKey,
- new AxStateTaskReference(new AxReferenceKey(decState.getKey(), taskKey.getName()), AxStateTaskOutputType.DIRECT, dec2Act.getKey()));
+ new AxStateTaskReference(new AxReferenceKey(decState.getKey(), taskKey.getName()),
+ AxStateTaskOutputType.DIRECT, dec2Act.getKey()));
}
- final AxState orState = new AxState(new AxReferenceKey(policyKey, "Orient"));
+ final AxState orState = new AxState(new AxReferenceKey(policyKey, ORIENT));
orState.setTrigger(inEventKeyList.get(1));
- final AxStateOutput or2Dec = new AxStateOutput(new AxReferenceKey(orState.getKey(), "Or2Dec"), outEventKeyList.get(1), decState.getKey());
+ final AxStateOutput or2Dec = new AxStateOutput(new AxReferenceKey(orState.getKey(), "Or2Dec"),
+ outEventKeyList.get(1), decState.getKey());
orState.getStateOutputs().put(or2Dec.getKey().getLocalName(), or2Dec);
- orState.setTaskSelectionLogic(new AxTaskSelectionLogic(orState.getKey(), "TaskSelectionLogic", axLogicExecutorTypeList.get(1), logicReader));
+ orState.setTaskSelectionLogic(new AxTaskSelectionLogic(orState.getKey(), TASK_SELECTION_LOGIC,
+ axLogicExecutorTypeList.get(1), logicReader));
orState.setDefaultTask(defaultTaskList.get(1));
for (final AxArtifactKey taskKey : taskKeySetList.get(1)) {
orState.getTaskReferences().put(taskKey,
- new AxStateTaskReference(new AxReferenceKey(orState.getKey(), taskKey.getName()), AxStateTaskOutputType.DIRECT, or2Dec.getKey()));
+ new AxStateTaskReference(new AxReferenceKey(orState.getKey(), taskKey.getName()),
+ AxStateTaskOutputType.DIRECT, or2Dec.getKey()));
}
- final AxState obState = new AxState(new AxReferenceKey(policyKey, "Observe"));
+ final AxState obState = new AxState(new AxReferenceKey(policyKey, OBSERVE));
obState.setTrigger(inEventKeyList.get(0));
- final AxStateOutput ob2Or = new AxStateOutput(new AxReferenceKey(obState.getKey(), "Ob2Or"), outEventKeyList.get(0), orState.getKey());
+ final AxStateOutput ob2Or = new AxStateOutput(new AxReferenceKey(obState.getKey(), "Ob2Or"),
+ outEventKeyList.get(0), orState.getKey());
obState.getStateOutputs().put(ob2Or.getKey().getLocalName(), ob2Or);
- obState.setTaskSelectionLogic(new AxTaskSelectionLogic(obState.getKey(), "TaskSelectionLogic", axLogicExecutorTypeList.get(0), logicReader));
+ obState.setTaskSelectionLogic(new AxTaskSelectionLogic(obState.getKey(), TASK_SELECTION_LOGIC,
+ axLogicExecutorTypeList.get(0), logicReader));
obState.setDefaultTask(defaultTaskList.get(0));
for (final AxArtifactKey taskKey : taskKeySetList.get(0)) {
obState.getTaskReferences().put(taskKey,
- new AxStateTaskReference(new AxReferenceKey(obState.getKey(), taskKey.getName()), AxStateTaskOutputType.DIRECT, ob2Or.getKey()));
+ new AxStateTaskReference(new AxReferenceKey(obState.getKey(), taskKey.getName()),
+ AxStateTaskOutputType.DIRECT, ob2Or.getKey()));
}
final Map<String, AxState> stateMap = new TreeMap<>();
@@ -345,34 +415,38 @@ public class EvalDomainModelFactory {
*
* @return the sample policy model
*/
- public AxPolicyModel getECAPolicyModel() {
+ public AxPolicyModel getEcaPolicyModel() {
final AxTasks tasks = new AxTasks(new AxArtifactKey("Tasks", "0.0.1"));
- final AxLogicReader logicReader = new PolicyLogicReader().setLogicPackage(PACKAGE).setDefaultLogic("EvalTask_Logic");
+ final AxLogicReader logicReader = new PolicyLogicReader().setLogicPackage(PACKAGE)
+ .setDefaultLogic("EvalTask_Logic");
final AxTask eTask = new AxTask(new AxArtifactKey("Task_Event_0", "0.0.1"));
eTask.duplicateInputFields(event0000.getParameterMap());
eTask.duplicateOutputFields(event0001.getParameterMap());
- final AxTaskLogic eAxLogic = new AxTaskLogic(eTask.getKey(), "TaskLogic", (justOneLang == null ? "JYTHON" : justOneLang), logicReader);
- eAxLogic.setLogic(
- eAxLogic.getLogic().replaceAll("<STATE_NAME>", "Event").replaceAll("<TASK_NAME>", eTask.getKey().getName()).replaceAll("<STATE_NUMBER>", "1"));
+ final AxTaskLogic eAxLogic = new AxTaskLogic(eTask.getKey(), TASK_LOGIC,
+ (justOneLang == null ? JYTHON : justOneLang), logicReader);
+ eAxLogic.setLogic(eAxLogic.getLogic().replaceAll(STATE_NAME, EVENT)
+ .replaceAll(TASK_NAME, eTask.getKey().getName()).replaceAll(STATE_NUMBER, "1"));
eTask.setTaskLogic(eAxLogic);
final AxTask cTask = new AxTask(new AxArtifactKey("Task_Condition_0", "0.0.1"));
cTask.duplicateInputFields(event0001.getParameterMap());
cTask.duplicateOutputFields(event0002.getParameterMap());
- final AxTaskLogic cAxLogic = new AxTaskLogic(cTask.getKey(), "TaskLogic", (justOneLang == null ? "JAVASCRIPT" : justOneLang), logicReader);
- cAxLogic.setLogic(cAxLogic.getLogic().replaceAll("<STATE_NAME>", "Condition").replaceAll("<TASK_NAME>", cTask.getKey().getName())
- .replaceAll("<STATE_NUMBER>", "2"));
+ final AxTaskLogic cAxLogic = new AxTaskLogic(cTask.getKey(), TASK_LOGIC,
+ (justOneLang == null ? JAVASCRIPT : justOneLang), logicReader);
+ cAxLogic.setLogic(cAxLogic.getLogic().replaceAll(STATE_NAME, CONDITION)
+ .replaceAll(TASK_NAME, cTask.getKey().getName()).replaceAll(STATE_NUMBER, "2"));
cTask.setTaskLogic(cAxLogic);
final AxTask aTask = new AxTask(new AxArtifactKey("Task_Action_0", "0.0.1"));
aTask.duplicateInputFields(event0002.getParameterMap());
aTask.duplicateOutputFields(event0003.getParameterMap());
- final AxTaskLogic aAxLogic = new AxTaskLogic(aTask.getKey(), "TaskLogic", (justOneLang == null ? "JAVA" : justOneLang), logicReader);
- aAxLogic.setLogic(
- aAxLogic.getLogic().replaceAll("<STATE_NAME>", "Action").replaceAll("<TASK_NAME>", aTask.getKey().getName()).replaceAll("<STATE_NUMBER>", "3"));
+ final AxTaskLogic aAxLogic = new AxTaskLogic(aTask.getKey(), TASK_LOGIC,
+ (justOneLang == null ? "JAVA" : justOneLang), logicReader);
+ aAxLogic.setLogic(aAxLogic.getLogic().replaceAll(STATE_NAME, ACTION)
+ .replaceAll(TASK_NAME, aTask.getKey().getName()).replaceAll(STATE_NUMBER, "3"));
aTask.setTaskLogic(aAxLogic);
tasks.getTaskMap().put(eTask.getKey(), eTask);
@@ -384,13 +458,13 @@ public class EvalDomainModelFactory {
final Set<AxArtifactKey> actionTasks = new TreeSet<>();
for (final AxTask task : tasks.getTaskMap().values()) {
- if (task.getKey().getName().contains("Event")) {
+ if (task.getKey().getName().contains(EVENT)) {
eventTasks.add(task.getKey());
}
- if (task.getKey().getName().contains("Condition")) {
+ if (task.getKey().getName().contains(CONDITION)) {
conditionTasks.add(task.getKey());
}
- if (task.getKey().getName().contains("Action")) {
+ if (task.getKey().getName().contains(ACTION)) {
actionTasks.add(task.getKey());
}
}
@@ -415,10 +489,11 @@ public class EvalDomainModelFactory {
p0defaultTaskList.add(tasks.get("Task_Action_0").getKey());
final AxPolicy policy0 = new AxPolicy(new AxArtifactKey("ECAPolicy_0", "0.0.1"));
- final List<String> axLogicExecutorTypeList = Arrays.asList((justOneLang == null ? "JAVASCRIPT" : justOneLang),
- (justOneLang == null ? "MVEL" : justOneLang), (justOneLang == null ? "JYTHON" : justOneLang));
- policy0.setStateMap(getECAStateMap(policy0.getKey(), p0InEventList, p0OutEventList, axLogicExecutorTypeList, p0defaultTaskList, taskReferenceList));
- policy0.setFirstState(policy0.getStateMap().get("Event").getKey().getLocalName());
+ final List<String> axLogicExecutorTypeList = Arrays.asList((justOneLang == null ? JAVASCRIPT : justOneLang),
+ (justOneLang == null ? "MVEL" : justOneLang), (justOneLang == null ? JYTHON : justOneLang));
+ policy0.setStateMap(getEcaStateMap(policy0.getKey(), p0InEventList, p0OutEventList, axLogicExecutorTypeList,
+ p0defaultTaskList, taskReferenceList));
+ policy0.setFirstState(policy0.getStateMap().get(EVENT).getKey().getLocalName());
final AxPolicies policies = new AxPolicies(new AxArtifactKey("ECAPolicies", "0.0.1"));
policies.getPolicyMap().put(policy0.getKey(), policy0);
@@ -451,43 +526,52 @@ public class EvalDomainModelFactory {
* @param taskKeySetList the task key set list
* @return the ECA state map
*/
- private Map<String, AxState> getECAStateMap(final AxArtifactKey policyKey, final List<AxArtifactKey> inEventKeyList,
- final List<AxArtifactKey> outEventKeyList, final List<String> axLogicExecutorTypeList, final List<AxArtifactKey> defaultTaskList,
- final List<Set<AxArtifactKey>> taskKeySetList) {
- final AxLogicReader logicReader = new PolicyLogicReader().setLogicPackage(PACKAGE).setDefaultLogic("EvalState_Logic");
+ private Map<String, AxState> getEcaStateMap(final AxArtifactKey policyKey, final List<AxArtifactKey> inEventKeyList,
+ final List<AxArtifactKey> outEventKeyList, final List<String> axLogicExecutorTypeList,
+ final List<AxArtifactKey> defaultTaskList, final List<Set<AxArtifactKey>> taskKeySetList) {
+ final AxLogicReader logicReader = new PolicyLogicReader().setLogicPackage(PACKAGE)
+ .setDefaultLogic("EvalState_Logic");
- final AxState actionState = new AxState(new AxReferenceKey(policyKey, "Action"));
+ final AxState actionState = new AxState(new AxReferenceKey(policyKey, ACTION));
actionState.setTrigger(inEventKeyList.get(2));
- final AxStateOutput action2Out = new AxStateOutput(actionState.getKey(), AxReferenceKey.getNullKey(), outEventKeyList.get(2));
+ final AxStateOutput action2Out = new AxStateOutput(actionState.getKey(), AxReferenceKey.getNullKey(),
+ outEventKeyList.get(2));
actionState.getStateOutputs().put(action2Out.getKey().getLocalName(), action2Out);
- actionState.setTaskSelectionLogic(new AxTaskSelectionLogic(actionState.getKey(), "TaskSelectionLogic", axLogicExecutorTypeList.get(2), logicReader));
+ actionState.setTaskSelectionLogic(new AxTaskSelectionLogic(actionState.getKey(), TASK_SELECTION_LOGIC,
+ axLogicExecutorTypeList.get(2), logicReader));
actionState.setDefaultTask(defaultTaskList.get(2));
for (final AxArtifactKey taskKey : taskKeySetList.get(2)) {
actionState.getTaskReferences().put(taskKey,
- new AxStateTaskReference(new AxReferenceKey(actionState.getKey(), taskKey.getName()), AxStateTaskOutputType.DIRECT, action2Out.getKey()));
+ new AxStateTaskReference(new AxReferenceKey(actionState.getKey(), taskKey.getName()),
+ AxStateTaskOutputType.DIRECT, action2Out.getKey()));
}
- final AxState conditionState = new AxState(new AxReferenceKey(policyKey, "Condition"));
+ final AxState conditionState = new AxState(new AxReferenceKey(policyKey, CONDITION));
conditionState.setTrigger(inEventKeyList.get(1));
- final AxStateOutput condition2Action = new AxStateOutput(conditionState.getKey(), actionState.getKey(), outEventKeyList.get(1));
+ final AxStateOutput condition2Action = new AxStateOutput(conditionState.getKey(), actionState.getKey(),
+ outEventKeyList.get(1));
conditionState.getStateOutputs().put(condition2Action.getKey().getLocalName(), condition2Action);
- conditionState
- .setTaskSelectionLogic(new AxTaskSelectionLogic(conditionState.getKey(), "TaskSelectionLogic", axLogicExecutorTypeList.get(1), logicReader));
+ conditionState.setTaskSelectionLogic(new AxTaskSelectionLogic(conditionState.getKey(), TASK_SELECTION_LOGIC,
+ axLogicExecutorTypeList.get(1), logicReader));
conditionState.setDefaultTask(defaultTaskList.get(1));
for (final AxArtifactKey taskKey : taskKeySetList.get(1)) {
- conditionState.getTaskReferences().put(taskKey, new AxStateTaskReference(new AxReferenceKey(conditionState.getKey(), taskKey.getName()),
- AxStateTaskOutputType.DIRECT, condition2Action.getKey()));
+ conditionState.getTaskReferences().put(taskKey,
+ new AxStateTaskReference(new AxReferenceKey(conditionState.getKey(), taskKey.getName()),
+ AxStateTaskOutputType.DIRECT, condition2Action.getKey()));
}
- final AxState eventState = new AxState(new AxReferenceKey(policyKey, "Event"));
+ final AxState eventState = new AxState(new AxReferenceKey(policyKey, EVENT));
eventState.setTrigger(inEventKeyList.get(0));
- final AxStateOutput event2Condition = new AxStateOutput(eventState.getKey(), conditionState.getKey(), outEventKeyList.get(0));
+ final AxStateOutput event2Condition = new AxStateOutput(eventState.getKey(), conditionState.getKey(),
+ outEventKeyList.get(0));
eventState.getStateOutputs().put(event2Condition.getKey().getLocalName(), event2Condition);
- eventState.setTaskSelectionLogic(new AxTaskSelectionLogic(eventState.getKey(), "TaskSelectionLogic", axLogicExecutorTypeList.get(0), logicReader));
+ eventState.setTaskSelectionLogic(new AxTaskSelectionLogic(eventState.getKey(), TASK_SELECTION_LOGIC,
+ axLogicExecutorTypeList.get(0), logicReader));
eventState.setDefaultTask(defaultTaskList.get(0));
for (final AxArtifactKey taskKey : taskKeySetList.get(0)) {
- eventState.getTaskReferences().put(taskKey, new AxStateTaskReference(new AxReferenceKey(eventState.getKey(), taskKey.getName()),
- AxStateTaskOutputType.DIRECT, event2Condition.getKey()));
+ eventState.getTaskReferences().put(taskKey,
+ new AxStateTaskReference(new AxReferenceKey(eventState.getKey(), taskKey.getName()),
+ AxStateTaskOutputType.DIRECT, event2Condition.getKey()));
}
final Map<String, AxState> stateMap = new TreeMap<>();
diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/SampleDomainModelFactory.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/SampleDomainModelFactory.java
new file mode 100644
index 000000000..5e9958ff0
--- /dev/null
+++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/SampleDomainModelFactory.java
@@ -0,0 +1,776 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.apex.testsuites.integration.common.model;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.TreeSet;
+
+import org.onap.policy.apex.model.basicmodel.concepts.ApexRuntimeException;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation;
+import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbums;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas;
+import org.onap.policy.apex.model.eventmodel.concepts.AxEvent;
+import org.onap.policy.apex.model.eventmodel.concepts.AxEvents;
+import org.onap.policy.apex.model.eventmodel.concepts.AxField;
+import org.onap.policy.apex.model.policymodel.concepts.AxLogicReader;
+import org.onap.policy.apex.model.policymodel.concepts.AxPolicies;
+import org.onap.policy.apex.model.policymodel.concepts.AxPolicy;
+import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
+import org.onap.policy.apex.model.policymodel.concepts.AxState;
+import org.onap.policy.apex.model.policymodel.concepts.AxStateOutput;
+import org.onap.policy.apex.model.policymodel.concepts.AxStateTaskOutputType;
+import org.onap.policy.apex.model.policymodel.concepts.AxStateTaskReference;
+import org.onap.policy.apex.model.policymodel.concepts.AxTask;
+import org.onap.policy.apex.model.policymodel.concepts.AxTaskLogic;
+import org.onap.policy.apex.model.policymodel.concepts.AxTaskParameter;
+import org.onap.policy.apex.model.policymodel.concepts.AxTaskSelectionLogic;
+import org.onap.policy.apex.model.policymodel.concepts.AxTasks;
+import org.onap.policy.apex.model.policymodel.handling.PolicyLogicReader;
+
+/**
+ * This class creates sample Policy Models.
+ *
+ * @author Liam Fallon (liam.fallon@ericsson.com)
+ */
+public class SampleDomainModelFactory {
+ // Recurring string constants
+ private static final String TASK = "Task_";
+ private static final String PARAMETER2 = "Parameter2";
+ private static final String PARAMETER1 = "Parameter1";
+ private static final String DEFAULT_VALUE2 = "DefaultValue2";
+ private static final String DEFAULT_VALUE1 = "DefaultValue1";
+ private static final String PARAMETER0 = "Parameter0";
+ private static final String DEFAULT_VALUE0 = "DefaultValue0";
+ private static final String TASK_SELECTION_LIGIC = "TaskSelectionLigic";
+ private static final String TEST_ACT_STATE_TIME = "TestActStateTime";
+ private static final String TEST_ACT_CASE_SELECTED = "TestActCaseSelected";
+ private static final String TEST_DECIDE_STATE_TIME = "TestDecideStateTime";
+ private static final String TEST_DECIDE_CASE_SELECTED = "TestDecideCaseSelected";
+ private static final String TEST_ESTABLISH_STATE_TIME = "TestEstablishStateTime";
+ private static final String TEST_ESTABLISH_CASE_SELECTED = "TestEstablishCaseSelected";
+ private static final String DECIDE = "Decide";
+ private static final String TEST_MATCH_STATE_TIME = "TestMatchStateTime";
+ private static final String TEST_MATCH_CASE_SELECTED = "TestMatchCaseSelected";
+ private static final String ESTABLISH = "Establish";
+ private static final String TEST_MATCH_CASE = "TestMatchCase";
+ private static final String MATCH = "Match";
+ private static final String DEFAULT_SOURCE = "Outside";
+ private static final String DEFAULT_NAMESPACE = "org.onap.policy.apex.sample.events";
+ private static final String TEST_TEMPERATURE = "TestTemperature";
+ private static final String TEST_TIMESTAMP = "TestTimestamp";
+ private static final String TEST_SLOGAN = "TestSlogan";
+ private static final String DEFAULT_VERSION = "0.0.1";
+
+ private static final int THIRD_ENTRY = 3;
+
+ /**
+ * Get a sample policy model.
+ *
+ * @param axLogicExecutorType The type of logic executor, the scripting language being used
+ * @return the sample policy model
+ */
+ // CHECKSTYLE:OFF: checkstyle:maximumMethodLength
+ public AxPolicyModel getSamplePolicyModel(final String axLogicExecutorType) {
+ AxContextSchema testSlogan = new AxContextSchema(new AxArtifactKey(TEST_SLOGAN, DEFAULT_VERSION), "Java",
+ "java.lang.String");
+ AxContextSchema testCase = new AxContextSchema(new AxArtifactKey("TestCase", DEFAULT_VERSION), "Java",
+ "java.lang.Byte");
+ AxContextSchema testTimestamp = new AxContextSchema(new AxArtifactKey(TEST_TIMESTAMP, DEFAULT_VERSION), "Java",
+ "java.lang.Long");
+ AxContextSchema testTemperature = new AxContextSchema(new AxArtifactKey(TEST_TEMPERATURE, DEFAULT_VERSION),
+ "Java", "java.lang.Double");
+
+ AxContextSchema testContextItem000 = new AxContextSchema(
+ new AxArtifactKey("TestContextItem000", DEFAULT_VERSION), "Java",
+ "org.onap.policy.apex.context.test.concepts.TestContextItem000");
+ AxContextSchema testContextItem001 = new AxContextSchema(
+ new AxArtifactKey("TestContextItem001", DEFAULT_VERSION), "Java",
+ "org.onap.policy.apex.context.test.concepts.TestContextItem001");
+ AxContextSchema testContextItem002 = new AxContextSchema(
+ new AxArtifactKey("TestContextItem002", DEFAULT_VERSION), "Java",
+ "org.onap.policy.apex.context.test.concepts.TestContextItem002");
+ AxContextSchema testContextItem003 = new AxContextSchema(
+ new AxArtifactKey("TestContextItem003", DEFAULT_VERSION), "Java",
+ "org.onap.policy.apex.context.test.concepts.TestContextItem003");
+ AxContextSchema testContextItem004 = new AxContextSchema(
+ new AxArtifactKey("TestContextItem004", DEFAULT_VERSION), "Java",
+ "org.onap.policy.apex.context.test.concepts.TestContextItem004");
+ AxContextSchema testContextItem005 = new AxContextSchema(
+ new AxArtifactKey("TestContextItem005", DEFAULT_VERSION), "Java",
+ "org.onap.policy.apex.context.test.concepts.TestContextItem005");
+ AxContextSchema testContextItem006 = new AxContextSchema(
+ new AxArtifactKey("TestContextItem006", DEFAULT_VERSION), "Java",
+ "org.onap.policy.apex.context.test.concepts.TestContextItem006");
+ AxContextSchema testContextItem007 = new AxContextSchema(
+ new AxArtifactKey("TestContextItem007", DEFAULT_VERSION), "Java",
+ "org.onap.policy.apex.context.test.concepts.TestContextItem007");
+ AxContextSchema testContextItem008 = new AxContextSchema(
+ new AxArtifactKey("TestContextItem008", DEFAULT_VERSION), "Java",
+ "org.onap.policy.apex.context.test.concepts.TestContextItem008");
+ AxContextSchema testContextItem009 = new AxContextSchema(
+ new AxArtifactKey("TestContextItem009", DEFAULT_VERSION), "Java",
+ "org.onap.policy.apex.context.test.concepts.TestContextItem009");
+ AxContextSchema testContextItem00A = new AxContextSchema(
+ new AxArtifactKey("TestContextItem00A", DEFAULT_VERSION), "Java",
+ "org.onap.policy.apex.context.test.concepts.TestContextItem00A");
+ AxContextSchema testContextItem00B = new AxContextSchema(
+ new AxArtifactKey("TestContextItem00B", DEFAULT_VERSION), "Java",
+ "org.onap.policy.apex.context.test.concepts.TestContextItem00B");
+ AxContextSchema testContextItem00C = new AxContextSchema(
+ new AxArtifactKey("TestContextItem00C", DEFAULT_VERSION), "Java",
+ "org.onap.policy.apex.context.test.concepts.TestContextItem00C");
+
+ AxContextSchema testPolicyContextItem = new AxContextSchema(
+ new AxArtifactKey("TestPolicyContextItem", DEFAULT_VERSION), "Java",
+ "org.onap.policy.apex.context.test.concepts.TestPolicyContextItem");
+ AxContextSchema testGlobalContextItem = new AxContextSchema(
+ new AxArtifactKey("TestGlobalContextItem", DEFAULT_VERSION), "Java",
+ "org.onap.policy.apex.context.test.concepts.TestGlobalContextItem");
+ AxContextSchema testExternalContextItem = new AxContextSchema(
+ new AxArtifactKey("TestExternalContextItem", DEFAULT_VERSION), "Java",
+ "org.onap.policy.apex.context.test.concepts.TestExternalContextItem");
+
+ AxContextSchemas axContextSchemas = new AxContextSchemas(new AxArtifactKey("TestDatatypes", DEFAULT_VERSION));
+ axContextSchemas.getSchemasMap().put(testSlogan.getKey(), testSlogan);
+ axContextSchemas.getSchemasMap().put(testCase.getKey(), testCase);
+ axContextSchemas.getSchemasMap().put(testTimestamp.getKey(), testTimestamp);
+ axContextSchemas.getSchemasMap().put(testTemperature.getKey(), testTemperature);
+
+ axContextSchemas.getSchemasMap().put(testContextItem000.getKey(), testContextItem000);
+ axContextSchemas.getSchemasMap().put(testContextItem001.getKey(), testContextItem001);
+ axContextSchemas.getSchemasMap().put(testContextItem002.getKey(), testContextItem002);
+ axContextSchemas.getSchemasMap().put(testContextItem003.getKey(), testContextItem003);
+ axContextSchemas.getSchemasMap().put(testContextItem004.getKey(), testContextItem004);
+ axContextSchemas.getSchemasMap().put(testContextItem005.getKey(), testContextItem005);
+ axContextSchemas.getSchemasMap().put(testContextItem006.getKey(), testContextItem006);
+ axContextSchemas.getSchemasMap().put(testContextItem007.getKey(), testContextItem007);
+ axContextSchemas.getSchemasMap().put(testContextItem008.getKey(), testContextItem008);
+ axContextSchemas.getSchemasMap().put(testContextItem009.getKey(), testContextItem009);
+ axContextSchemas.getSchemasMap().put(testContextItem00A.getKey(), testContextItem00A);
+ axContextSchemas.getSchemasMap().put(testContextItem00B.getKey(), testContextItem00B);
+ axContextSchemas.getSchemasMap().put(testContextItem00C.getKey(), testContextItem00C);
+
+ axContextSchemas.getSchemasMap().put(testPolicyContextItem.getKey(), testPolicyContextItem);
+ axContextSchemas.getSchemasMap().put(testGlobalContextItem.getKey(), testGlobalContextItem);
+ axContextSchemas.getSchemasMap().put(testExternalContextItem.getKey(), testExternalContextItem);
+
+ AxEvent event0000 = new AxEvent(new AxArtifactKey("Event0000", DEFAULT_VERSION),
+ DEFAULT_NAMESPACE);
+ event0000.setSource(DEFAULT_SOURCE);
+ event0000.setTarget(MATCH);
+ event0000.getParameterMap().put(TEST_SLOGAN,
+ new AxField(new AxReferenceKey(event0000.getKey(), TEST_SLOGAN), testSlogan.getKey()));
+ event0000.getParameterMap().put(TEST_MATCH_CASE,
+ new AxField(new AxReferenceKey(event0000.getKey(), TEST_MATCH_CASE), testCase.getKey()));
+ event0000.getParameterMap().put(TEST_TIMESTAMP,
+ new AxField(new AxReferenceKey(event0000.getKey(), TEST_TIMESTAMP), testTimestamp.getKey()));
+ event0000.getParameterMap().put(TEST_TEMPERATURE, new AxField(
+ new AxReferenceKey(event0000.getKey(), TEST_TEMPERATURE), testTemperature.getKey()));
+
+ AxEvent event0001 = new AxEvent(new AxArtifactKey("Event0001", DEFAULT_VERSION),
+ DEFAULT_NAMESPACE);
+ event0001.setSource(MATCH);
+ event0001.setTarget(ESTABLISH);
+ event0001.getParameterMap().put(TEST_SLOGAN,
+ new AxField(new AxReferenceKey(event0001.getKey(), TEST_SLOGAN), testSlogan.getKey()));
+ event0001.getParameterMap().put(TEST_MATCH_CASE,
+ new AxField(new AxReferenceKey(event0001.getKey(), TEST_MATCH_CASE), testCase.getKey()));
+ event0001.getParameterMap().put(TEST_TIMESTAMP,
+ new AxField(new AxReferenceKey(event0001.getKey(), TEST_TIMESTAMP), testTimestamp.getKey()));
+ event0001.getParameterMap().put(TEST_TEMPERATURE, new AxField(
+ new AxReferenceKey(event0001.getKey(), TEST_TEMPERATURE), testTemperature.getKey()));
+ event0001.getParameterMap().put(TEST_MATCH_CASE_SELECTED, new AxField(
+ new AxReferenceKey(event0001.getKey(), TEST_MATCH_CASE_SELECTED), testCase.getKey()));
+ event0001.getParameterMap().put(TEST_MATCH_STATE_TIME, new AxField(
+ new AxReferenceKey(event0001.getKey(), TEST_MATCH_STATE_TIME), testTimestamp.getKey()));
+
+ AxEvent event0002 = new AxEvent(new AxArtifactKey("Event0002", DEFAULT_VERSION),
+ DEFAULT_NAMESPACE);
+ event0002.setSource(ESTABLISH);
+ event0002.setTarget(DECIDE);
+ event0002.getParameterMap().put(TEST_SLOGAN,
+ new AxField(new AxReferenceKey(event0002.getKey(), TEST_SLOGAN), testSlogan.getKey()));
+ event0002.getParameterMap().put(TEST_MATCH_CASE,
+ new AxField(new AxReferenceKey(event0002.getKey(), TEST_MATCH_CASE), testCase.getKey()));
+ event0002.getParameterMap().put(TEST_TIMESTAMP,
+ new AxField(new AxReferenceKey(event0002.getKey(), TEST_TIMESTAMP), testTimestamp.getKey()));
+ event0002.getParameterMap().put(TEST_TEMPERATURE, new AxField(
+ new AxReferenceKey(event0002.getKey(), TEST_TEMPERATURE), testTemperature.getKey()));
+ event0002.getParameterMap().put(TEST_MATCH_CASE_SELECTED, new AxField(
+ new AxReferenceKey(event0002.getKey(), TEST_MATCH_CASE_SELECTED), testCase.getKey()));
+ event0002.getParameterMap().put(TEST_MATCH_STATE_TIME, new AxField(
+ new AxReferenceKey(event0002.getKey(), TEST_MATCH_STATE_TIME), testTimestamp.getKey()));
+ event0002.getParameterMap().put(TEST_ESTABLISH_CASE_SELECTED, new AxField(
+ new AxReferenceKey(event0002.getKey(), TEST_ESTABLISH_CASE_SELECTED), testCase.getKey()));
+ event0002.getParameterMap().put(TEST_ESTABLISH_STATE_TIME, new AxField(
+ new AxReferenceKey(event0002.getKey(), TEST_ESTABLISH_STATE_TIME), testTimestamp.getKey()));
+
+ AxEvent event0003 = new AxEvent(new AxArtifactKey("Event0003", DEFAULT_VERSION),
+ DEFAULT_NAMESPACE);
+ event0003.setSource(DECIDE);
+ event0003.setTarget("Act");
+ event0003.getParameterMap().put(TEST_SLOGAN,
+ new AxField(new AxReferenceKey(event0003.getKey(), TEST_SLOGAN), testSlogan.getKey()));
+ event0003.getParameterMap().put(TEST_MATCH_CASE,
+ new AxField(new AxReferenceKey(event0003.getKey(), TEST_MATCH_CASE), testCase.getKey()));
+ event0003.getParameterMap().put(TEST_TIMESTAMP,
+ new AxField(new AxReferenceKey(event0003.getKey(), TEST_TIMESTAMP), testTimestamp.getKey()));
+ event0003.getParameterMap().put(TEST_TEMPERATURE, new AxField(
+ new AxReferenceKey(event0003.getKey(), TEST_TEMPERATURE), testTemperature.getKey()));
+ event0003.getParameterMap().put(TEST_MATCH_CASE_SELECTED, new AxField(
+ new AxReferenceKey(event0003.getKey(), TEST_MATCH_CASE_SELECTED), testCase.getKey()));
+ event0003.getParameterMap().put(TEST_MATCH_STATE_TIME, new AxField(
+ new AxReferenceKey(event0003.getKey(), TEST_MATCH_STATE_TIME), testTimestamp.getKey()));
+ event0003.getParameterMap().put(TEST_ESTABLISH_CASE_SELECTED, new AxField(
+ new AxReferenceKey(event0003.getKey(), TEST_ESTABLISH_CASE_SELECTED), testCase.getKey()));
+ event0003.getParameterMap().put(TEST_ESTABLISH_STATE_TIME, new AxField(
+ new AxReferenceKey(event0003.getKey(), TEST_ESTABLISH_STATE_TIME), testTimestamp.getKey()));
+ event0003.getParameterMap().put(TEST_DECIDE_CASE_SELECTED, new AxField(
+ new AxReferenceKey(event0003.getKey(), TEST_DECIDE_CASE_SELECTED), testCase.getKey()));
+ event0003.getParameterMap().put(TEST_DECIDE_STATE_TIME, new AxField(
+ new AxReferenceKey(event0003.getKey(), TEST_DECIDE_STATE_TIME), testTimestamp.getKey()));
+
+ AxEvent event0004 = new AxEvent(new AxArtifactKey("Event0004", DEFAULT_VERSION),
+ DEFAULT_NAMESPACE);
+ event0004.setSource("Act");
+ event0004.setTarget(DEFAULT_SOURCE);
+ event0004.getParameterMap().put(TEST_SLOGAN,
+ new AxField(new AxReferenceKey(event0004.getKey(), TEST_SLOGAN), testSlogan.getKey()));
+ event0004.getParameterMap().put(TEST_MATCH_CASE,
+ new AxField(new AxReferenceKey(event0004.getKey(), TEST_MATCH_CASE), testCase.getKey()));
+ event0004.getParameterMap().put(TEST_TIMESTAMP,
+ new AxField(new AxReferenceKey(event0004.getKey(), TEST_TIMESTAMP), testTimestamp.getKey()));
+ event0004.getParameterMap().put(TEST_TEMPERATURE, new AxField(
+ new AxReferenceKey(event0004.getKey(), TEST_TEMPERATURE), testTemperature.getKey()));
+ event0004.getParameterMap().put(TEST_MATCH_CASE_SELECTED, new AxField(
+ new AxReferenceKey(event0004.getKey(), TEST_MATCH_CASE_SELECTED), testCase.getKey()));
+ event0004.getParameterMap().put(TEST_MATCH_STATE_TIME, new AxField(
+ new AxReferenceKey(event0004.getKey(), TEST_MATCH_STATE_TIME), testTimestamp.getKey()));
+ event0004.getParameterMap().put(TEST_ESTABLISH_CASE_SELECTED, new AxField(
+ new AxReferenceKey(event0004.getKey(), TEST_ESTABLISH_CASE_SELECTED), testCase.getKey()));
+ event0004.getParameterMap().put(TEST_ESTABLISH_STATE_TIME, new AxField(
+ new AxReferenceKey(event0004.getKey(), TEST_ESTABLISH_STATE_TIME), testTimestamp.getKey()));
+ event0004.getParameterMap().put(TEST_DECIDE_CASE_SELECTED, new AxField(
+ new AxReferenceKey(event0004.getKey(), TEST_DECIDE_CASE_SELECTED), testCase.getKey()));
+ event0004.getParameterMap().put(TEST_DECIDE_STATE_TIME, new AxField(
+ new AxReferenceKey(event0004.getKey(), TEST_DECIDE_STATE_TIME), testTimestamp.getKey()));
+ event0004.getParameterMap().put(TEST_ACT_CASE_SELECTED,
+ new AxField(new AxReferenceKey(event0004.getKey(), TEST_ACT_CASE_SELECTED), testCase.getKey()));
+ event0004.getParameterMap().put(TEST_ACT_STATE_TIME, new AxField(
+ new AxReferenceKey(event0004.getKey(), TEST_ACT_STATE_TIME), testTimestamp.getKey()));
+
+ AxEvent event0100 = new AxEvent(new AxArtifactKey("Event0100", DEFAULT_VERSION),
+ DEFAULT_NAMESPACE);
+ event0100.setSource(DEFAULT_SOURCE);
+ event0100.setTarget(MATCH);
+ event0100.getParameterMap().put(TEST_SLOGAN,
+ new AxField(new AxReferenceKey(event0100.getKey(), TEST_SLOGAN), testSlogan.getKey()));
+ event0100.getParameterMap().put(TEST_MATCH_CASE,
+ new AxField(new AxReferenceKey(event0100.getKey(), TEST_MATCH_CASE), testCase.getKey()));
+ event0100.getParameterMap().put(TEST_TIMESTAMP,
+ new AxField(new AxReferenceKey(event0100.getKey(), TEST_TIMESTAMP), testTimestamp.getKey()));
+ event0100.getParameterMap().put(TEST_TEMPERATURE, new AxField(
+ new AxReferenceKey(event0100.getKey(), TEST_TEMPERATURE), testTemperature.getKey()));
+
+ AxEvent event0101 = new AxEvent(new AxArtifactKey("Event0101", DEFAULT_VERSION),
+ DEFAULT_NAMESPACE);
+ event0101.setSource(MATCH);
+ event0101.setTarget(ESTABLISH);
+ event0101.getParameterMap().put(TEST_SLOGAN,
+ new AxField(new AxReferenceKey(event0101.getKey(), TEST_SLOGAN), testSlogan.getKey()));
+ event0101.getParameterMap().put(TEST_MATCH_CASE,
+ new AxField(new AxReferenceKey(event0101.getKey(), TEST_MATCH_CASE), testCase.getKey()));
+ event0101.getParameterMap().put(TEST_TIMESTAMP,
+ new AxField(new AxReferenceKey(event0101.getKey(), TEST_TIMESTAMP), testTimestamp.getKey()));
+ event0101.getParameterMap().put(TEST_TEMPERATURE, new AxField(
+ new AxReferenceKey(event0101.getKey(), TEST_TEMPERATURE), testTemperature.getKey()));
+ event0101.getParameterMap().put(TEST_MATCH_CASE_SELECTED, new AxField(
+ new AxReferenceKey(event0101.getKey(), TEST_MATCH_CASE_SELECTED), testCase.getKey()));
+ event0101.getParameterMap().put(TEST_MATCH_STATE_TIME, new AxField(
+ new AxReferenceKey(event0101.getKey(), TEST_MATCH_STATE_TIME), testTimestamp.getKey()));
+
+ AxEvent event0102 = new AxEvent(new AxArtifactKey("Event0102", DEFAULT_VERSION),
+ DEFAULT_NAMESPACE);
+ event0102.setSource(ESTABLISH);
+ event0102.setTarget(DECIDE);
+ event0102.getParameterMap().put(TEST_SLOGAN,
+ new AxField(new AxReferenceKey(event0102.getKey(), TEST_SLOGAN), testSlogan.getKey()));
+ event0102.getParameterMap().put(TEST_MATCH_CASE,
+ new AxField(new AxReferenceKey(event0102.getKey(), TEST_MATCH_CASE), testCase.getKey()));
+ event0102.getParameterMap().put(TEST_TIMESTAMP,
+ new AxField(new AxReferenceKey(event0102.getKey(), TEST_TIMESTAMP), testTimestamp.getKey()));
+ event0102.getParameterMap().put(TEST_TEMPERATURE, new AxField(
+ new AxReferenceKey(event0102.getKey(), TEST_TEMPERATURE), testTemperature.getKey()));
+ event0102.getParameterMap().put(TEST_MATCH_CASE_SELECTED, new AxField(
+ new AxReferenceKey(event0102.getKey(), TEST_MATCH_CASE_SELECTED), testCase.getKey()));
+ event0102.getParameterMap().put(TEST_MATCH_STATE_TIME, new AxField(
+ new AxReferenceKey(event0102.getKey(), TEST_MATCH_STATE_TIME), testTimestamp.getKey()));
+ event0102.getParameterMap().put(TEST_ESTABLISH_CASE_SELECTED, new AxField(
+ new AxReferenceKey(event0102.getKey(), TEST_ESTABLISH_CASE_SELECTED), testCase.getKey()));
+ event0102.getParameterMap().put(TEST_ESTABLISH_STATE_TIME, new AxField(
+ new AxReferenceKey(event0102.getKey(), TEST_ESTABLISH_STATE_TIME), testTimestamp.getKey()));
+
+ AxEvent event0103 = new AxEvent(new AxArtifactKey("Event0103", DEFAULT_VERSION),
+ DEFAULT_NAMESPACE);
+ event0103.setSource(DECIDE);
+ event0103.setTarget("Act");
+ event0103.getParameterMap().put(TEST_SLOGAN,
+ new AxField(new AxReferenceKey(event0103.getKey(), TEST_SLOGAN), testSlogan.getKey()));
+ event0103.getParameterMap().put(TEST_MATCH_CASE,
+ new AxField(new AxReferenceKey(event0103.getKey(), TEST_MATCH_CASE), testCase.getKey()));
+ event0103.getParameterMap().put(TEST_TIMESTAMP,
+ new AxField(new AxReferenceKey(event0103.getKey(), TEST_TIMESTAMP), testTimestamp.getKey()));
+ event0103.getParameterMap().put(TEST_TEMPERATURE, new AxField(
+ new AxReferenceKey(event0103.getKey(), TEST_TEMPERATURE), testTemperature.getKey()));
+ event0103.getParameterMap().put(TEST_MATCH_CASE_SELECTED, new AxField(
+ new AxReferenceKey(event0103.getKey(), TEST_MATCH_CASE_SELECTED), testCase.getKey()));
+ event0103.getParameterMap().put(TEST_MATCH_STATE_TIME, new AxField(
+ new AxReferenceKey(event0103.getKey(), TEST_MATCH_STATE_TIME), testTimestamp.getKey()));
+ event0103.getParameterMap().put(TEST_ESTABLISH_CASE_SELECTED, new AxField(
+ new AxReferenceKey(event0103.getKey(), TEST_ESTABLISH_CASE_SELECTED), testCase.getKey()));
+ event0103.getParameterMap().put(TEST_ESTABLISH_STATE_TIME, new AxField(
+ new AxReferenceKey(event0103.getKey(), TEST_ESTABLISH_STATE_TIME), testTimestamp.getKey()));
+ event0103.getParameterMap().put(TEST_DECIDE_CASE_SELECTED, new AxField(
+ new AxReferenceKey(event0103.getKey(), TEST_DECIDE_CASE_SELECTED), testCase.getKey()));
+ event0103.getParameterMap().put(TEST_DECIDE_STATE_TIME, new AxField(
+ new AxReferenceKey(event0103.getKey(), TEST_DECIDE_STATE_TIME), testTimestamp.getKey()));
+
+ AxEvent event0104 = new AxEvent(new AxArtifactKey("Event0104", DEFAULT_VERSION),
+ DEFAULT_NAMESPACE);
+ event0104.setSource("Act");
+ event0104.setTarget(DEFAULT_SOURCE);
+ event0104.getParameterMap().put(TEST_SLOGAN,
+ new AxField(new AxReferenceKey(event0104.getKey(), TEST_SLOGAN), testSlogan.getKey()));
+ event0104.getParameterMap().put(TEST_MATCH_CASE,
+ new AxField(new AxReferenceKey(event0104.getKey(), TEST_MATCH_CASE), testCase.getKey()));
+ event0104.getParameterMap().put(TEST_TIMESTAMP,
+ new AxField(new AxReferenceKey(event0104.getKey(), TEST_TIMESTAMP), testTimestamp.getKey()));
+ event0104.getParameterMap().put(TEST_TEMPERATURE, new AxField(
+ new AxReferenceKey(event0104.getKey(), TEST_TEMPERATURE), testTemperature.getKey()));
+ event0104.getParameterMap().put(TEST_MATCH_CASE_SELECTED, new AxField(
+ new AxReferenceKey(event0104.getKey(), TEST_MATCH_CASE_SELECTED), testCase.getKey()));
+ event0104.getParameterMap().put(TEST_MATCH_STATE_TIME, new AxField(
+ new AxReferenceKey(event0104.getKey(), TEST_MATCH_STATE_TIME), testTimestamp.getKey()));
+ event0104.getParameterMap().put(TEST_ESTABLISH_CASE_SELECTED, new AxField(
+ new AxReferenceKey(event0104.getKey(), TEST_ESTABLISH_CASE_SELECTED), testCase.getKey()));
+ event0104.getParameterMap().put(TEST_ESTABLISH_STATE_TIME, new AxField(
+ new AxReferenceKey(event0104.getKey(), TEST_ESTABLISH_STATE_TIME), testTimestamp.getKey()));
+ event0104.getParameterMap().put(TEST_DECIDE_CASE_SELECTED, new AxField(
+ new AxReferenceKey(event0104.getKey(), TEST_DECIDE_CASE_SELECTED), testCase.getKey()));
+ event0104.getParameterMap().put(TEST_DECIDE_STATE_TIME, new AxField(
+ new AxReferenceKey(event0104.getKey(), TEST_DECIDE_STATE_TIME), testTimestamp.getKey()));
+ event0104.getParameterMap().put(TEST_ACT_CASE_SELECTED,
+ new AxField(new AxReferenceKey(event0104.getKey(), TEST_ACT_CASE_SELECTED), testCase.getKey()));
+ event0104.getParameterMap().put(TEST_ACT_STATE_TIME, new AxField(
+ new AxReferenceKey(event0104.getKey(), TEST_ACT_STATE_TIME), testTimestamp.getKey()));
+
+ AxEvents events = new AxEvents(new AxArtifactKey("Events", DEFAULT_VERSION));
+ events.getEventMap().put(event0000.getKey(), event0000);
+ events.getEventMap().put(event0001.getKey(), event0001);
+ events.getEventMap().put(event0002.getKey(), event0002);
+ events.getEventMap().put(event0003.getKey(), event0003);
+ events.getEventMap().put(event0004.getKey(), event0004);
+ events.getEventMap().put(event0100.getKey(), event0100);
+ events.getEventMap().put(event0101.getKey(), event0101);
+ events.getEventMap().put(event0102.getKey(), event0102);
+ events.getEventMap().put(event0103.getKey(), event0103);
+ events.getEventMap().put(event0104.getKey(), event0104);
+
+ AxContextAlbum externalContextAlbum = new AxContextAlbum(
+ new AxArtifactKey("ExternalContextAlbum", DEFAULT_VERSION), "EXTERNAL", false,
+ testExternalContextItem.getKey());
+ AxContextAlbum globalContextAlbum = new AxContextAlbum(new AxArtifactKey("GlobalContextAlbum", DEFAULT_VERSION),
+ "GLOBAL", true, testGlobalContextItem.getKey());
+ AxContextAlbum policy0ContextAlbum = new AxContextAlbum(
+ new AxArtifactKey("Policy0ContextAlbum", DEFAULT_VERSION), "APPLICATION", true,
+ testPolicyContextItem.getKey());
+ AxContextAlbum policy1ContextAlbum = new AxContextAlbum(
+ new AxArtifactKey("Policy1ContextAlbum", DEFAULT_VERSION), "APPLICATION", true,
+ testPolicyContextItem.getKey());
+
+ AxContextAlbums albums = new AxContextAlbums(new AxArtifactKey("Context", DEFAULT_VERSION));
+ albums.getAlbumsMap().put(externalContextAlbum.getKey(), externalContextAlbum);
+ albums.getAlbumsMap().put(globalContextAlbum.getKey(), globalContextAlbum);
+ albums.getAlbumsMap().put(policy0ContextAlbum.getKey(), policy0ContextAlbum);
+ albums.getAlbumsMap().put(policy1ContextAlbum.getKey(), policy1ContextAlbum);
+
+ Set<AxArtifactKey> referenceKeySet0 = new TreeSet<>();
+ referenceKeySet0.add(policy0ContextAlbum.getKey());
+ referenceKeySet0.add(policy1ContextAlbum.getKey());
+ referenceKeySet0.add(globalContextAlbum.getKey());
+ referenceKeySet0.add(externalContextAlbum.getKey());
+
+ Set<AxArtifactKey> referenceKeySet1 = new TreeSet<>();
+ referenceKeySet1.add(policy0ContextAlbum.getKey());
+ referenceKeySet1.add(globalContextAlbum.getKey());
+
+ Set<AxArtifactKey> referenceKeySet2 = new TreeSet<>();
+ referenceKeySet2.add(policy1ContextAlbum.getKey());
+ referenceKeySet2.add(globalContextAlbum.getKey());
+
+ Set<AxArtifactKey> referenceKeySet3 = new TreeSet<>();
+ referenceKeySet3.add(globalContextAlbum.getKey());
+ referenceKeySet3.add(externalContextAlbum.getKey());
+
+ List<Set<AxArtifactKey>> referenceKeySetList = new ArrayList<>();
+ referenceKeySetList.add(referenceKeySet0);
+ referenceKeySetList.add(referenceKeySet1);
+ referenceKeySetList.add(referenceKeySet2);
+ referenceKeySetList.add(referenceKeySet3);
+
+ AxTasks tasks = new AxTasks(new AxArtifactKey("Tasks", DEFAULT_VERSION));
+ tasks.getTaskMap().putAll(getTaskMap(MATCH, event0000.getParameterMap(), event0001.getParameterMap(),
+ referenceKeySetList, axLogicExecutorType));
+ tasks.getTaskMap().putAll(getTaskMap(ESTABLISH, event0001.getParameterMap(), event0002.getParameterMap(),
+ referenceKeySetList, axLogicExecutorType));
+ tasks.getTaskMap().putAll(getTaskMap(DECIDE, event0002.getParameterMap(), event0003.getParameterMap(),
+ referenceKeySetList, axLogicExecutorType));
+ tasks.getTaskMap().putAll(getTaskMap("Act", event0003.getParameterMap(), event0004.getParameterMap(),
+ referenceKeySetList, axLogicExecutorType));
+
+ Set<AxArtifactKey> matchTasks = new TreeSet<>();
+ Set<AxArtifactKey> establishTasks = new TreeSet<>();
+ Set<AxArtifactKey> decideTasks = new TreeSet<>();
+ Set<AxArtifactKey> actTasks = new TreeSet<>();
+ for (AxTask task : tasks.getTaskMap().values()) {
+ if (task.getKey().getName().contains(MATCH)) {
+ matchTasks.add(task.getKey());
+ }
+ if (task.getKey().getName().contains(ESTABLISH)) {
+ establishTasks.add(task.getKey());
+ }
+ if (task.getKey().getName().contains(DECIDE)) {
+ decideTasks.add(task.getKey());
+ }
+ if (task.getKey().getName().contains("Act")) {
+ actTasks.add(task.getKey());
+ }
+ }
+ List<Set<AxArtifactKey>> taskReferenceList = new ArrayList<>();
+ taskReferenceList.add(matchTasks);
+ taskReferenceList.add(establishTasks);
+ taskReferenceList.add(decideTasks);
+ taskReferenceList.add(actTasks);
+
+ List<AxArtifactKey> p0InEventList = new ArrayList<>();
+ p0InEventList.add(event0000.getKey());
+ p0InEventList.add(event0001.getKey());
+ p0InEventList.add(event0002.getKey());
+ p0InEventList.add(event0003.getKey());
+
+ List<AxArtifactKey> p0OutEventList = new ArrayList<>();
+ p0OutEventList.add(event0001.getKey());
+ p0OutEventList.add(event0002.getKey());
+ p0OutEventList.add(event0003.getKey());
+ p0OutEventList.add(event0004.getKey());
+
+ List<AxArtifactKey> p0defaultTaskList = new ArrayList<>();
+ p0defaultTaskList.add(tasks.get("Task_Match0").getKey());
+ p0defaultTaskList.add(tasks.get("Task_Establish2").getKey());
+ p0defaultTaskList.add(tasks.get("Task_Decide3").getKey());
+ p0defaultTaskList.add(tasks.get("Task_Act1").getKey());
+
+ List<AxArtifactKey> p1InEventList = new ArrayList<>();
+ p1InEventList.add(event0100.getKey());
+ p1InEventList.add(event0101.getKey());
+ p1InEventList.add(event0102.getKey());
+ p1InEventList.add(event0103.getKey());
+
+ List<AxArtifactKey> p1OutEventList = new ArrayList<>();
+ p1OutEventList.add(event0101.getKey());
+ p1OutEventList.add(event0102.getKey());
+ p1OutEventList.add(event0103.getKey());
+ p1OutEventList.add(event0104.getKey());
+
+ List<AxArtifactKey> p1defaultTaskList = new ArrayList<>();
+ p1defaultTaskList.add(tasks.get("Task_Match3").getKey());
+ p1defaultTaskList.add(tasks.get("Task_Establish1").getKey());
+ p1defaultTaskList.add(tasks.get("Task_Decide3").getKey());
+ p1defaultTaskList.add(tasks.get("Task_Act0").getKey());
+
+ Set<AxArtifactKey> p0ReferenceKeySet0 = new TreeSet<>();
+ p0ReferenceKeySet0.add(policy0ContextAlbum.getKey());
+ p0ReferenceKeySet0.add(globalContextAlbum.getKey());
+
+ Set<AxArtifactKey> p0ReferenceKeySet1 = new TreeSet<>();
+ p0ReferenceKeySet1.add(policy1ContextAlbum.getKey());
+ p0ReferenceKeySet1.add(globalContextAlbum.getKey());
+ p0ReferenceKeySet1.add(externalContextAlbum.getKey());
+
+ Set<AxArtifactKey> p0ReferenceKeySet2 = new TreeSet<>();
+ p0ReferenceKeySet2.add(policy0ContextAlbum.getKey());
+ p0ReferenceKeySet2.add(globalContextAlbum.getKey());
+ p0ReferenceKeySet2.add(externalContextAlbum.getKey());
+
+ Set<AxArtifactKey> p0ReferenceKeySet3 = new TreeSet<>();
+ p0ReferenceKeySet3.add(globalContextAlbum.getKey());
+
+ List<Set<AxArtifactKey>> p0ReferenceKeySetList = new ArrayList<>();
+ p0ReferenceKeySetList.add(p0ReferenceKeySet0);
+ p0ReferenceKeySetList.add(p0ReferenceKeySet1);
+ p0ReferenceKeySetList.add(p0ReferenceKeySet2);
+ p0ReferenceKeySetList.add(p0ReferenceKeySet3);
+
+ AxPolicy policy0 = new AxPolicy(new AxArtifactKey("Policy0", DEFAULT_VERSION));
+ policy0.setTemplate("MEDA");
+ policy0.setStateMap(getStateMap(policy0.getKey(), p0InEventList, p0OutEventList, p0ReferenceKeySetList,
+ axLogicExecutorType, p0defaultTaskList, taskReferenceList));
+ policy0.setFirstState(policy0.getStateMap().get(MATCH).getKey().getLocalName());
+
+ Set<AxArtifactKey> p1ReferenceKeySet0 = new TreeSet<>();
+ p1ReferenceKeySet0.add(policy1ContextAlbum.getKey());
+ p1ReferenceKeySet0.add(globalContextAlbum.getKey());
+ p1ReferenceKeySet0.add(externalContextAlbum.getKey());
+
+ Set<AxArtifactKey> p1ReferenceKeySet1 = new TreeSet<>();
+ p1ReferenceKeySet1.add(policy1ContextAlbum.getKey());
+ p1ReferenceKeySet1.add(globalContextAlbum.getKey());
+ p1ReferenceKeySet1.add(externalContextAlbum.getKey());
+
+ Set<AxArtifactKey> p1ReferenceKeySet2 = new TreeSet<>();
+ p1ReferenceKeySet2.add(policy1ContextAlbum.getKey());
+ p1ReferenceKeySet2.add(globalContextAlbum.getKey());
+ p1ReferenceKeySet2.add(externalContextAlbum.getKey());
+
+ Set<AxArtifactKey> p1ReferenceKeySet3 = new TreeSet<>();
+ p1ReferenceKeySet3.add(globalContextAlbum.getKey());
+
+ List<Set<AxArtifactKey>> p1ReferenceKeySetList = new ArrayList<>();
+ p1ReferenceKeySetList.add(p1ReferenceKeySet0);
+ p1ReferenceKeySetList.add(p1ReferenceKeySet1);
+ p1ReferenceKeySetList.add(p1ReferenceKeySet2);
+ p1ReferenceKeySetList.add(p1ReferenceKeySet3);
+
+ AxPolicy policy1 = new AxPolicy(new AxArtifactKey("Policy1", DEFAULT_VERSION));
+ policy1.setTemplate("MEDA");
+ policy1.setStateMap(getStateMap(policy1.getKey(), p1InEventList, p1OutEventList, p1ReferenceKeySetList,
+ axLogicExecutorType, p1defaultTaskList, taskReferenceList));
+ policy1.setFirstState(policy1.getStateMap().get(MATCH).getKey().getLocalName());
+
+ AxPolicies policies = new AxPolicies(new AxArtifactKey("Policies", DEFAULT_VERSION));
+ policies.getPolicyMap().put(policy0.getKey(), policy0);
+ policies.getPolicyMap().put(policy1.getKey(), policy1);
+
+ AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInformation", DEFAULT_VERSION));
+ AxPolicyModel policyModel = new AxPolicyModel(
+ new AxArtifactKey("SamplePolicyModel" + axLogicExecutorType, DEFAULT_VERSION));
+ policyModel.setKeyInformation(keyInformation);
+ policyModel.setPolicies(policies);
+ policyModel.setEvents(events);
+ policyModel.setTasks(tasks);
+ policyModel.setAlbums(albums);
+ policyModel.setSchemas(axContextSchemas);
+ policyModel.getKeyInformation().generateKeyInfo(policyModel);
+
+ AxValidationResult result = policyModel.validate(new AxValidationResult());
+ if (!result.getValidationResult().equals(AxValidationResult.ValidationResult.VALID)) {
+ throw new ApexRuntimeException("model " + policyModel.getId() + " is not valid" + result);
+ }
+ return policyModel;
+ }
+
+ /**
+ * Gets the state map.
+ *
+ * @param policyKey the policy key
+ * @param inEventKeyList the in event key list
+ * @param outEventKeyList the out event key list
+ * @param referenceKeySetList the reference key set list
+ * @param axLogicExecutorType the ax logic executor type
+ * @param defaultTaskList the default task list
+ * @param taskKeySetList the task key set list
+ * @return the state map
+ */
+ private Map<String, AxState> getStateMap(final AxArtifactKey policyKey, final List<AxArtifactKey> inEventKeyList,
+ final List<AxArtifactKey> outEventKeyList, final List<Set<AxArtifactKey>> referenceKeySetList,
+ final String axLogicExecutorType, final List<AxArtifactKey> defaultTaskList,
+ final List<Set<AxArtifactKey>> taskKeySetList) {
+
+ AxState actState = new AxState(new AxReferenceKey(policyKey, "Act"));
+ actState.setTrigger(inEventKeyList.get(3));
+ AxStateOutput act2Out = new AxStateOutput(actState.getKey(), AxReferenceKey.getNullKey(),
+ outEventKeyList.get(3));
+ actState.getStateOutputs().put(act2Out.getKey().getLocalName(), act2Out);
+ actState.setContextAlbumReferences(referenceKeySetList.get(3));
+
+ AxLogicReader logicReader = new PolicyLogicReader().setLogicPackage(this.getClass().getPackage().getName())
+ .setDefaultLogic("DefaultStateLogic");
+ actState.setTaskSelectionLogic(new AxTaskSelectionLogic(actState.getKey(), TASK_SELECTION_LIGIC,
+ axLogicExecutorType, logicReader));
+ actState.setDefaultTask(defaultTaskList.get(3));
+ for (AxArtifactKey taskKey : taskKeySetList.get(3)) {
+ actState.getTaskReferences().put(taskKey, new AxStateTaskReference(actState.getKey(), taskKey,
+ AxStateTaskOutputType.DIRECT, act2Out.getKey()));
+ }
+
+ AxState decideState = new AxState(new AxReferenceKey(policyKey, DECIDE));
+ decideState.setTrigger(inEventKeyList.get(2));
+ AxStateOutput decide2Act = new AxStateOutput(decideState.getKey(), actState.getKey(), outEventKeyList.get(2));
+ decideState.getStateOutputs().put(decide2Act.getKey().getLocalName(), decide2Act);
+ decideState.setContextAlbumReferences(referenceKeySetList.get(2));
+ decideState.setTaskSelectionLogic(new AxTaskSelectionLogic(decideState.getKey(), TASK_SELECTION_LIGIC,
+ axLogicExecutorType, logicReader));
+ decideState.setDefaultTask(defaultTaskList.get(2));
+ for (AxArtifactKey taskKey : taskKeySetList.get(2)) {
+ decideState.getTaskReferences().put(taskKey, new AxStateTaskReference(decideState.getKey(), taskKey,
+ AxStateTaskOutputType.DIRECT, decide2Act.getKey()));
+ }
+
+ AxState establishState = new AxState(new AxReferenceKey(policyKey, ESTABLISH));
+ establishState.setTrigger(inEventKeyList.get(1));
+ AxStateOutput establish2Decide = new AxStateOutput(establishState.getKey(), decideState.getKey(),
+ outEventKeyList.get(1));
+ establishState.getStateOutputs().put(establish2Decide.getKey().getLocalName(), establish2Decide);
+ establishState.setContextAlbumReferences(referenceKeySetList.get(1));
+ establishState.setTaskSelectionLogic(new AxTaskSelectionLogic(establishState.getKey(), TASK_SELECTION_LIGIC,
+ axLogicExecutorType, logicReader));
+ establishState.setDefaultTask(defaultTaskList.get(1));
+ for (AxArtifactKey taskKey : taskKeySetList.get(1)) {
+ establishState.getTaskReferences().put(taskKey, new AxStateTaskReference(establishState.getKey(), taskKey,
+ AxStateTaskOutputType.DIRECT, establish2Decide.getKey()));
+ }
+
+ AxState matchState = new AxState(new AxReferenceKey(policyKey, MATCH));
+ matchState.setTrigger(inEventKeyList.get(0));
+ AxStateOutput match2Establish = new AxStateOutput(matchState.getKey(), establishState.getKey(),
+ outEventKeyList.get(0));
+ matchState.getStateOutputs().put(match2Establish.getKey().getLocalName(), match2Establish);
+ matchState.setContextAlbumReferences(referenceKeySetList.get(0));
+ matchState.setTaskSelectionLogic(new AxTaskSelectionLogic(matchState.getKey(), TASK_SELECTION_LIGIC,
+ axLogicExecutorType, logicReader));
+ matchState.setDefaultTask(defaultTaskList.get(0));
+ for (AxArtifactKey taskKey : taskKeySetList.get(0)) {
+ matchState.getTaskReferences().put(taskKey, new AxStateTaskReference(matchState.getKey(), taskKey,
+ AxStateTaskOutputType.DIRECT, match2Establish.getKey()));
+ }
+
+ Map<String, AxState> stateMap = new TreeMap<>();
+ stateMap.put(matchState.getKey().getLocalName(), matchState);
+ stateMap.put(establishState.getKey().getLocalName(), establishState);
+ stateMap.put(decideState.getKey().getLocalName(), decideState);
+ stateMap.put(actState.getKey().getLocalName(), actState);
+
+ return stateMap;
+ }
+ // CHECKSTYLE:ON: checkstyle:maximumMethodLength
+
+ /**
+ * Gets the task map.
+ *
+ * @param state the state
+ * @param inputFields the input fields
+ * @param outputFields the output fields
+ * @param referenceKeySetList the reference key set list
+ * @param axLogicExecutorType the ax logic executor type
+ * @return the task map
+ */
+ private Map<AxArtifactKey, AxTask> getTaskMap(final String state, final Map<String, AxField> inputFields,
+ final Map<String, AxField> outputFields, final List<Set<AxArtifactKey>> referenceKeySetList,
+ final String axLogicExecutorType) {
+
+ AxTask testTask0 = new AxTask(new AxArtifactKey(TASK + state + "0", DEFAULT_VERSION));
+ testTask0.duplicateInputFields(inputFields);
+ testTask0.duplicateOutputFields(outputFields);
+ AxTaskParameter parameter00 = new AxTaskParameter(new AxReferenceKey(testTask0.getKey(), PARAMETER0),
+ DEFAULT_VALUE0);
+ AxTaskParameter parameter01 = new AxTaskParameter(new AxReferenceKey(testTask0.getKey(), PARAMETER1),
+ DEFAULT_VALUE1);
+ AxTaskParameter parameter02 = new AxTaskParameter(new AxReferenceKey(testTask0.getKey(), PARAMETER2),
+ DEFAULT_VALUE2);
+ testTask0.getTaskParameters().put(parameter00.getKey().getLocalName(), parameter00);
+ testTask0.getTaskParameters().put(parameter01.getKey().getLocalName(), parameter01);
+ testTask0.getTaskParameters().put(parameter02.getKey().getLocalName(), parameter02);
+ testTask0.setContextAlbumReferences(referenceKeySetList.get(0));
+
+ AxLogicReader logicReader = new PolicyLogicReader().setLogicPackage(this.getClass().getPackage().getName())
+ .setDefaultLogic("DefaultTaskLogic");
+ testTask0.setTaskLogic(getTaskLogic(testTask0, logicReader, axLogicExecutorType, state, "2"));
+
+ AxTask testTask1 = new AxTask(new AxArtifactKey(TASK + state + "1", DEFAULT_VERSION));
+ testTask1.duplicateInputFields(inputFields);
+ testTask1.duplicateOutputFields(outputFields);
+ AxTaskParameter parameter10 = new AxTaskParameter(new AxReferenceKey(testTask1.getKey(), PARAMETER0),
+ DEFAULT_VALUE0);
+ AxTaskParameter parameter11 = new AxTaskParameter(new AxReferenceKey(testTask1.getKey(), PARAMETER1),
+ DEFAULT_VALUE1);
+ testTask1.getTaskParameters().put(parameter10.getKey().getLocalName(), parameter10);
+ testTask1.getTaskParameters().put(parameter11.getKey().getLocalName(), parameter11);
+ testTask1.setContextAlbumReferences(referenceKeySetList.get(1));
+ testTask1.setTaskLogic(getTaskLogic(testTask1, logicReader, axLogicExecutorType, state, "3"));
+
+ AxTask testTask2 = new AxTask(new AxArtifactKey(TASK + state + "2", DEFAULT_VERSION));
+ testTask2.duplicateInputFields(inputFields);
+ testTask2.duplicateOutputFields(outputFields);
+ AxTaskParameter parameter20 = new AxTaskParameter(new AxReferenceKey(testTask2.getKey(), PARAMETER0),
+ DEFAULT_VALUE0);
+ testTask2.getTaskParameters().put(parameter20.getKey().getLocalName(), parameter20);
+ testTask2.setContextAlbumReferences(referenceKeySetList.get(2));
+ testTask2.setTaskLogic(getTaskLogic(testTask2, logicReader, axLogicExecutorType, state, "0"));
+
+ AxTask testTask3 = new AxTask(new AxArtifactKey(TASK + state + "3", DEFAULT_VERSION));
+ testTask3.duplicateInputFields(inputFields);
+ testTask3.duplicateOutputFields(outputFields);
+ AxTaskParameter parameter30 = new AxTaskParameter(new AxReferenceKey(testTask3.getKey(), PARAMETER0),
+ DEFAULT_VALUE0);
+ testTask3.getTaskParameters().put(parameter30.getKey().getLocalName(), parameter30);
+ testTask3.setContextAlbumReferences(referenceKeySetList.get(THIRD_ENTRY));
+ testTask3.setTaskLogic(getTaskLogic(testTask3, logicReader, axLogicExecutorType, state, "1"));
+
+ Map<AxArtifactKey, AxTask> taskMap = new TreeMap<>();
+ taskMap.put(testTask0.getKey(), testTask0);
+ taskMap.put(testTask1.getKey(), testTask1);
+ taskMap.put(testTask2.getKey(), testTask2);
+ taskMap.put(testTask3.getKey(), testTask3);
+
+ return taskMap;
+ }
+
+ /**
+ * Gets the task logic.
+ *
+ * @param task the task
+ * @param logicReader the logic reader
+ * @param logicFlavour the logic flavour
+ * @param stateName the state name
+ * @param caseToUse the case to use
+ * @return the task logic
+ */
+ private AxTaskLogic getTaskLogic(final AxTask task, final AxLogicReader logicReader, final String logicFlavour,
+ final String stateName, final String caseToUse) {
+ AxTaskLogic axLogic = new AxTaskLogic(new AxReferenceKey(task.getKey(), "_TaskLogic"), logicFlavour,
+ logicReader);
+
+ axLogic.setLogic(axLogic.getLogic().replaceAll("<STATE_NAME>", stateName)
+ .replaceAll("<TASK_NAME>", task.getKey().getName())
+ .replaceAll("<RANDOM_BYTE_VALUE>", caseToUse));
+
+ return axLogic;
+ }
+}
diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/SampleDomainModelSaver.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/SampleDomainModelSaver.java
index 6ca644ff4..8eb885759 100644
--- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/SampleDomainModelSaver.java
+++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/SampleDomainModelSaver.java
@@ -18,11 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.test.common.model;
+package org.onap.policy.apex.testsuites.integration.common.model;
import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.model.basicmodel.handling.ApexModelSaver;
import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
+import org.slf4j.ext.XLogger;
+import org.slf4j.ext.XLoggerFactory;
/**
* This class saves sample domain models to disk in XML and JSON format.
@@ -30,6 +32,9 @@ import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public final class SampleDomainModelSaver {
+ // Logger for this class
+ private static final XLogger LOGGER = XLoggerFactory.getXLogger(SampleDomainModelSaver.class);
+
/**
* Private default constructor to prevent subclassing.
*/
@@ -44,37 +49,42 @@ public final class SampleDomainModelSaver {
*/
public static void main(final String[] args) throws ApexException {
if (args.length != 1) {
- System.err.println("usage: " + SampleDomainModelSaver.class.getCanonicalName() + " modelDirectory");
+ LOGGER.error("usage: " + SampleDomainModelSaver.class.getCanonicalName() + " modelDirectory");
return;
}
// Save Java model
final AxPolicyModel javaPolicyModel = new SampleDomainModelFactory().getSamplePolicyModel("JAVA");
- final ApexModelSaver<AxPolicyModel> javaModelSaver = new ApexModelSaver<AxPolicyModel>(AxPolicyModel.class, javaPolicyModel, args[0]);
+ final ApexModelSaver<AxPolicyModel> javaModelSaver = new ApexModelSaver<>(AxPolicyModel.class,
+ javaPolicyModel, args[0]);
javaModelSaver.apexModelWriteJson();
javaModelSaver.apexModelWriteXml();
// Save Javascript model
final AxPolicyModel javascriptPolicyModel = new SampleDomainModelFactory().getSamplePolicyModel("JAVASCRIPT");
- final ApexModelSaver<AxPolicyModel> javascriptModelSaver = new ApexModelSaver<AxPolicyModel>(AxPolicyModel.class, javascriptPolicyModel, args[0]);
+ final ApexModelSaver<AxPolicyModel> javascriptModelSaver = new ApexModelSaver<>(
+ AxPolicyModel.class, javascriptPolicyModel, args[0]);
javascriptModelSaver.apexModelWriteJson();
javascriptModelSaver.apexModelWriteXml();
// Save JRuby model
final AxPolicyModel jRubyPolicyModel = new SampleDomainModelFactory().getSamplePolicyModel("JRUBY");
- final ApexModelSaver<AxPolicyModel> jRubyModelSaver = new ApexModelSaver<AxPolicyModel>(AxPolicyModel.class, jRubyPolicyModel, args[0]);
+ final ApexModelSaver<AxPolicyModel> jRubyModelSaver = new ApexModelSaver<>(AxPolicyModel.class,
+ jRubyPolicyModel, args[0]);
jRubyModelSaver.apexModelWriteJson();
jRubyModelSaver.apexModelWriteXml();
// Save Jython model
final AxPolicyModel jythonPolicyModel = new SampleDomainModelFactory().getSamplePolicyModel("JYTHON");
- final ApexModelSaver<AxPolicyModel> jythonModelSaver = new ApexModelSaver<AxPolicyModel>(AxPolicyModel.class, jythonPolicyModel, args[0]);
+ final ApexModelSaver<AxPolicyModel> jythonModelSaver = new ApexModelSaver<>(AxPolicyModel.class,
+ jythonPolicyModel, args[0]);
jythonModelSaver.apexModelWriteJson();
jythonModelSaver.apexModelWriteXml();
// Save MVEL model
final AxPolicyModel mvelPolicyModel = new SampleDomainModelFactory().getSamplePolicyModel("MVEL");
- final ApexModelSaver<AxPolicyModel> mvelModelSaver = new ApexModelSaver<AxPolicyModel>(AxPolicyModel.class, mvelPolicyModel, args[0]);
+ final ApexModelSaver<AxPolicyModel> mvelModelSaver = new ApexModelSaver<>(AxPolicyModel.class,
+ mvelPolicyModel, args[0]);
mvelModelSaver.apexModelWriteJson();
mvelModelSaver.apexModelWriteXml();
}
diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/java/DefaultState_Logic.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/DefaultStateLogic.java
index d970835d0..2669e70d7 100644
--- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/java/DefaultState_Logic.java
+++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/DefaultStateLogic.java
@@ -18,16 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.test.common.model.java;
+package org.onap.policy.apex.testsuites.integration.common.model.java;
import org.onap.policy.apex.core.engine.executor.context.TaskSelectionExecutionContext;
/**
* The Class DefaultState_Logic is default task selection logic in Java.
*/
-// CHECKSTYLE:OFF: checkstyle:typeNames
-public class DefaultState_Logic {
- // CHECKSTYLE:ON: checkstyle:typeNames
+public class DefaultStateLogic {
/**
* Gets the task.
*
diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/java/DefaultTask_Logic.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/DefaultTaskLogic.java
index b22f15d90..86dac6638 100644
--- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/java/DefaultTask_Logic.java
+++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/DefaultTaskLogic.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.test.common.model.java;
+package org.onap.policy.apex.testsuites.integration.common.model.java;
import java.util.Date;
import java.util.Random;
@@ -29,12 +29,10 @@ import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
/**
* The Class DefaultTask_Logic is default task logic in Java.
*/
-//CHECKSTYLE:OFF: checkstyle:typeNames
-public class DefaultTask_Logic {
-// CHECKSTYLE:ON: checkstyle:typeNames
+public class DefaultTaskLogic {
private static final int BOUND_FOR_RANDOM_INT = 4;
- /**
+ /**
* Gets the event.
*
* @param executor the executor
@@ -42,27 +40,32 @@ public class DefaultTask_Logic {
* @throws ApexException the apex exception
*/
public boolean getEvent(final TaskExecutionContext executor) throws ApexException {
- executor.logger.debug(executor.subject.getId());
- executor.logger.debug(executor.getContextAlbum("GlobalContextAlbum").getName());
- executor.logger.debug(executor.inFields.toString());
+ String idString = executor.subject.getId();
+ executor.logger.debug(idString);
+
+ String albumNameString = executor.getContextAlbum("GlobalContextAlbum").getName();
+ executor.logger.debug(albumNameString);
+
+ String inFieldsString = executor.inFields.toString();
+ executor.logger.debug(inFieldsString);
final Date timeNow = new Date();
final Random rand = new Random();
if (executor.inFields.containsKey("TestDecideCaseSelected")) {
- executor.outFields.put("TestActCaseSelected", new Byte((byte) rand.nextInt(BOUND_FOR_RANDOM_INT)));
+ executor.outFields.put("TestActCaseSelected", (byte) rand.nextInt(BOUND_FOR_RANDOM_INT));
executor.outFields.put("TestActStateTime", timeNow.getTime());
}
else if (executor.inFields.containsKey("TestEstablishCaseSelected")) {
- executor.outFields.put("TestDecideCaseSelected", new Byte((byte) rand.nextInt(BOUND_FOR_RANDOM_INT)));
+ executor.outFields.put("TestDecideCaseSelected", (byte) rand.nextInt(BOUND_FOR_RANDOM_INT));
executor.outFields.put("TestDecideStateTime", timeNow.getTime());
}
else if (executor.inFields.containsKey("TestMatchCaseSelected")) {
- executor.outFields.put("TestEstablishCaseSelected", new Byte((byte) rand.nextInt(BOUND_FOR_RANDOM_INT)));
+ executor.outFields.put("TestEstablishCaseSelected", (byte) rand.nextInt(BOUND_FOR_RANDOM_INT));
executor.outFields.put("TestEstablishStateTime", timeNow.getTime());
}
else {
- executor.outFields.put("TestMatchCaseSelected", new Byte((byte) rand.nextInt(BOUND_FOR_RANDOM_INT)));
+ executor.outFields.put("TestMatchCaseSelected", (byte) rand.nextInt(BOUND_FOR_RANDOM_INT));
executor.outFields.put("TestMatchStateTime", timeNow.getTime());
}
diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/java/EvalState_Logic.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/EvalStateLogic.java
index 2180936ed..49fccd75d 100644
--- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/java/EvalState_Logic.java
+++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/EvalStateLogic.java
@@ -18,16 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.test.common.model.java;
+package org.onap.policy.apex.testsuites.integration.common.model.java;
import org.onap.policy.apex.core.engine.executor.context.TaskSelectionExecutionContext;
/**
* The Class EvalState_Logic is default evaluation task selection logic in Java.
*/
-//CHECKSTYLE:OFF: checkstyle:typeNames
-public class EvalState_Logic {
- // CHECKSTYLE:ON: checkstyle:typeNames
+public class EvalStateLogic {
/**
* Gets the task.
*
diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/java/EvalTask_Logic.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/EvalTaskLogic.java
index f4fa533f8..4c37e4d89 100644
--- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/java/EvalTask_Logic.java
+++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/EvalTaskLogic.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.test.common.model.java;
+package org.onap.policy.apex.testsuites.integration.common.model.java;
import java.util.Date;
@@ -28,7 +28,7 @@ import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
/**
* The Class EvalTask_Logic is default evaluation task logic in Java.
*/
-public class EvalTask_Logic {
+public class EvalTaskLogic {
/**
* Gets the event.
@@ -38,13 +38,19 @@ public class EvalTask_Logic {
* @throws ApexException the apex exception
*/
public boolean getEvent(final TaskExecutionContext executor) throws ApexException {
- executor.logger.debug(executor.subject.getId());
- executor.logger.debug(executor.inFields.toString());
+ String idString = executor.subject.getId();
+ executor.logger.debug(idString);
+
+ String inFieldString = executor.inFields.toString();
+ executor.logger.debug(inFieldString);
+
executor.outFields.putAll(executor.inFields);
final Date timeNow = new Date();
executor.outFields.put("State3Timestamp", timeNow.getTime());
- executor.logger.debug(executor.outFields.toString());
+
+ String outFieldString = executor.outFields.toString();
+ executor.logger.debug(outFieldString);
return true;
}
}
diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/java/package-info.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/package-info.java
index 70c8452b5..fb5f414d8 100644
--- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/java/package-info.java
+++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/java/package-info.java
@@ -23,4 +23,4 @@
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
-package org.onap.policy.apex.test.common.model.java;
+package org.onap.policy.apex.testsuites.integration.common.model.java;
diff --git a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/package-info.java b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/package-info.java
index 9277bd43c..e508444c9 100644
--- a/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/test/common/model/package-info.java
+++ b/testsuites/integration/integration-common/src/main/java/org/onap/policy/apex/testsuites/integration/common/model/package-info.java
@@ -23,4 +23,4 @@
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
-package org.onap.policy.apex.test.common.model;
+package org.onap.policy.apex.testsuites.integration.common.model;
diff --git a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/javascript/DefaultState_Logic.javascript b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/DefaultStateLogic.javascript
index e25cb9c6e..e25cb9c6e 100644
--- a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/javascript/DefaultState_Logic.javascript
+++ b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/DefaultStateLogic.javascript
diff --git a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/javascript/DefaultTask_Logic.javascript b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/DefaultTaskLogic.javascript
index f98e16555..f98e16555 100644
--- a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/javascript/DefaultTask_Logic.javascript
+++ b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/DefaultTaskLogic.javascript
diff --git a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/javascript/EvalState_Logic.javascript b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/EvalStateLogic.javascript
index 535cad595..535cad595 100644
--- a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/javascript/EvalState_Logic.javascript
+++ b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/EvalStateLogic.javascript
diff --git a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/javascript/EvalTask_Logic.javascript b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/EvalTaskLogic.javascript
index b0756504c..b0756504c 100644
--- a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/javascript/EvalTask_Logic.javascript
+++ b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/EvalTaskLogic.javascript
diff --git a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/jruby/DefaultState_Logic.jruby b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/jruby/DefaultStateLogic.jruby
index 2965476a8..2965476a8 100644
--- a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/jruby/DefaultState_Logic.jruby
+++ b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/jruby/DefaultStateLogic.jruby
diff --git a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/jruby/DefaultTask_Logic.jruby b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/jruby/DefaultTaskLogic.jruby
index 4ad39f57e..4ad39f57e 100644
--- a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/jruby/DefaultTask_Logic.jruby
+++ b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/jruby/DefaultTaskLogic.jruby
diff --git a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/jruby/EvalState_Logic.jruby b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/jruby/EvalStateLogic.jruby
index e57a62c8b..e57a62c8b 100644
--- a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/jruby/EvalState_Logic.jruby
+++ b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/jruby/EvalStateLogic.jruby
diff --git a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/jruby/EvalTask_Logic.jruby b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/jruby/EvalTaskLogic.jruby
index 72a4ee607..72a4ee607 100644
--- a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/jruby/EvalTask_Logic.jruby
+++ b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/jruby/EvalTaskLogic.jruby
diff --git a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/jython/DefaultState_Logic.jython b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/jython/DefaultStateLogic.jython
index 9752f057d..9752f057d 100644
--- a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/jython/DefaultState_Logic.jython
+++ b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/jython/DefaultStateLogic.jython
diff --git a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/jython/DefaultTask_Logic.jython b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/jython/DefaultTaskLogic.jython
index f57ce3f0a..f57ce3f0a 100644
--- a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/jython/DefaultTask_Logic.jython
+++ b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/jython/DefaultTaskLogic.jython
diff --git a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/jython/EvalState_Logic.jython b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/jython/EvalStateLogic.jython
index 94f90b258..94f90b258 100644
--- a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/jython/EvalState_Logic.jython
+++ b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/jython/EvalStateLogic.jython
diff --git a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/jython/EvalTask_Logic.jython b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/jython/EvalTaskLogic.jython
index aa6525673..aa6525673 100644
--- a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/jython/EvalTask_Logic.jython
+++ b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/jython/EvalTaskLogic.jython
diff --git a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/mvel/DefaultState_Logic.mvel b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/mvel/DefaultStateLogic.mvel
index 1620c6cd5..1620c6cd5 100644
--- a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/mvel/DefaultState_Logic.mvel
+++ b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/mvel/DefaultStateLogic.mvel
diff --git a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/mvel/DefaultTask_Logic.mvel b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/mvel/DefaultTaskLogic.mvel
index 9a1a4bad1..9a1a4bad1 100644
--- a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/mvel/DefaultTask_Logic.mvel
+++ b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/mvel/DefaultTaskLogic.mvel
diff --git a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/mvel/EvalState_Logic.mvel b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/mvel/EvalStateLogic.mvel
index 1620c6cd5..1620c6cd5 100644
--- a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/mvel/EvalState_Logic.mvel
+++ b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/mvel/EvalStateLogic.mvel
diff --git a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/mvel/EvalTask_Logic.mvel b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/mvel/EvalTaskLogic.mvel
index e15a4beec..e15a4beec 100644
--- a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/test/common/model/mvel/EvalTask_Logic.mvel
+++ b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/mvel/EvalTaskLogic.mvel
diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/plugins/context/test/locking/TestConcurrentContext.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/TestConcurrentContext.java
index dd6c4e6f1..5fadb2279 100644
--- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/plugins/context/test/locking/TestConcurrentContext.java
+++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/TestConcurrentContext.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.plugins.context.test.locking;
+package org.onap.policy.apex.testsuites.integration.context;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -95,6 +95,11 @@ public class TestConcurrentContext {
private ZooKeeperServerServiceProvider zooKeeperServerServiceProvider;
+ /**
+ * Configure.
+ *
+ * @throws Exception the exception
+ */
@BeforeClass
public static void configure() throws Exception {
System.setProperty(JAVA_NET_PREFER_IPV4_STACK, "true");
@@ -111,6 +116,11 @@ public class TestConcurrentContext {
}
+ /**
+ * Start zookeeper server.
+ *
+ * @throws Exception the exception
+ */
private void startZookeeperServer() throws Exception {
final File zookeeperDirectory = folder.newFolder("zookeeperDirectory");
@@ -120,14 +130,22 @@ public class TestConcurrentContext {
zooKeeperServerServiceProvider.startZookeeperServer();
}
+ /**
+ * Stop zookeeper server.
+ */
private void stopZookeeperServer() {
if (zooKeeperServerServiceProvider != null) {
zooKeeperServerServiceProvider.stopZookeeperServer();
}
}
+ /**
+ * Test concurrent context jvm local var set.
+ *
+ * @throws Exception the exception
+ */
@Test
- public void testConcurrentContextJVMLocalVarSet() throws Exception {
+ public void testConcurrentContextJvmLocalVarSet() throws Exception {
logger.debug("Running testConcurrentContextJVMLocalVarSet test . . .");
final ContextParameters contextParameters = new ContextParameters();
@@ -149,8 +167,13 @@ public class TestConcurrentContext {
logger.debug("Ran testConcurrentContextJVMLocalVarSet test");
}
+ /**
+ * Test concurrent context jvm local no var set.
+ *
+ * @throws Exception the exception
+ */
@Test
- public void testConcurrentContextJVMLocalNoVarSet() throws Exception {
+ public void testConcurrentContextJvmLocalNoVarSet() throws Exception {
logger.debug("Running testConcurrentContextJVMLocalNoVarSet test . . .");
new ContextParameters();
@@ -168,8 +191,13 @@ public class TestConcurrentContext {
logger.debug("Ran testConcurrentContextJVMLocalNoVarSet test");
}
+ /**
+ * Test concurrent context multi jvm no lock.
+ *
+ * @throws Exception the exception
+ */
@Test
- public void testConcurrentContextMultiJVMNoLock() throws Exception {
+ public void testConcurrentContextMultiJvmNoLock() throws Exception {
logger.debug("Running testConcurrentContextMultiJVMNoLock test . . .");
final ContextParameters contextParameters = new ContextParameters();
@@ -190,6 +218,11 @@ public class TestConcurrentContext {
logger.debug("Ran testConcurrentContextMultiJVMNoLock test");
}
+ /**
+ * Test concurrent context hazelcast lock.
+ *
+ * @throws Exception the exception
+ */
@Test
public void testConcurrentContextHazelcastLock() throws Exception {
logger.debug("Running testConcurrentContextHazelcastLock test . . .");
@@ -212,6 +245,11 @@ public class TestConcurrentContext {
logger.debug("Ran testConcurrentContextHazelcastLock test");
}
+ /**
+ * Test concurrent context curator lock.
+ *
+ * @throws Exception the exception
+ */
@Test
public void testConcurrentContextCuratorLock() throws Exception {
logger.debug("Running testConcurrentContextCuratorLock test . . .");
@@ -243,8 +281,13 @@ public class TestConcurrentContext {
}
}
+ /**
+ * Test concurrent context hazelcast multi jvm hazelcast lock.
+ *
+ * @throws Exception the exception
+ */
@Test
- public void testConcurrentContextHazelcastMultiJVMHazelcastLock() throws Exception {
+ public void testConcurrentContextHazelcastMultiJvmHazelcastLock() throws Exception {
logger.debug("Running testConcurrentContextHazelcastMultiJVMHazelcastLock test . . .");
final ContextParameters contextParameters = new ContextParameters();
@@ -265,8 +308,15 @@ public class TestConcurrentContext {
logger.debug("Ran testConcurrentContextHazelcastMultiJVMHazelcastLock test");
}
+ /**
+ * Test concurrent context infinispan multi jvm hazelcastlock.
+ *
+ * @throws ApexModelException the apex model exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ * @throws ApexException the apex exception
+ */
@Test
- public void testConcurrentContextInfinispanMultiJVMHazelcastlock()
+ public void testConcurrentContextInfinispanMultiJvmHazelcastlock()
throws ApexModelException, IOException, ApexException {
logger.debug("Running testConcurrentContextInfinispanMultiJVMHazelcastlock test . . .");
@@ -290,8 +340,13 @@ public class TestConcurrentContext {
logger.debug("Ran testConcurrentContextInfinispanMultiJVMHazelcastlock test");
}
+ /**
+ * Test concurrent context infinispan multi jvm curator lock.
+ *
+ * @throws Exception the exception
+ */
@Test
- public void testConcurrentContextInfinispanMultiJVMCuratorLock() throws Exception {
+ public void testConcurrentContextInfinispanMultiJvmCuratorLock() throws Exception {
logger.debug("Running testConcurrentContextInfinispanMultiJVMCuratorLock test . . .");
try {
@@ -326,8 +381,13 @@ public class TestConcurrentContext {
logger.debug("Ran testConcurrentContextInfinispanMultiJVMCuratorLock test");
}
+ /**
+ * Test concurrent context hazelcast multi jvm curator lock.
+ *
+ * @throws Exception the exception
+ */
@Test
- public void testConcurrentContextHazelcastMultiJVMCuratorLock() throws Exception {
+ public void testConcurrentContextHazelcastMultiJvmCuratorLock() throws Exception {
logger.debug("Running testConcurrentContextHazelcastMultiJVMCuratorLock test . . .");
try {
@@ -358,6 +418,15 @@ public class TestConcurrentContext {
logger.debug("Ran testConcurrentContextHazelcastMultiJVMCuratorLock test");
}
+ /**
+ * Gets the configration provider.
+ *
+ * @param testType the test type
+ * @param jvmCount the jvm count
+ * @param threadCount the thread count
+ * @param threadLoops the thread loops
+ * @return the configration provider
+ */
ConfigrationProvider getConfigrationProvider(final String testType, final int jvmCount, final int threadCount,
final int threadLoops) {
return new ConfigrationProviderImpl(testType, jvmCount, threadCount, threadLoops, 16,
@@ -365,7 +434,7 @@ public class TestConcurrentContext {
@Override
public Map<String, Object> getContextAlbumInitValues() {
final Map<String, Object> initValues = super.getContextAlbumInitValues();
- initValues.put(TEST_VALUE, new TestContextLongItem(0l));
+ initValues.put(TEST_VALUE, new TestContextLongItem(0L));
return initValues;
}
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexActionListener.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexActionListener.java
index fa79843e9..2860f1736 100644
--- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexActionListener.java
+++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexActionListener.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.plugins.executor.test.script.engine;
+package org.onap.policy.apex.testsuites.integration.executor.engine;
import java.util.ArrayList;
import java.util.List;
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexEngine.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngine.java
index b087552eb..cb51a8e9e 100644
--- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexEngine.java
+++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngine.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.plugins.executor.test.script.engine;
+package org.onap.policy.apex.testsuites.integration.executor.engine;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -37,7 +37,7 @@ import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
import org.onap.policy.apex.model.eventmodel.concepts.AxEvent;
import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
-import org.onap.policy.apex.test.common.model.SampleDomainModelFactory;
+import org.onap.policy.apex.testsuites.integration.common.model.SampleDomainModelFactory;
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexEngineJRuby.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJRuby.java
index 916795deb..108e73ac1 100644
--- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexEngineJRuby.java
+++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJRuby.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.plugins.executor.test.script.engine;
+package org.onap.policy.apex.testsuites.integration.executor.engine;
import java.io.IOException;
@@ -35,11 +35,17 @@ import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.plugins.executor.jruby.JrubyExecutorParameters;
import org.onap.policy.common.parameters.ParameterService;
+/**
+ * The Class TestApexEngineJRuby.
+ */
public class TestApexEngineJRuby {
private SchemaParameters schemaParameters;
private ContextParameters contextParameters;
private EngineParameters engineParameters;
+ /**
+ * Before test.
+ */
@Before
public void beforeTest() {
schemaParameters = new SchemaParameters();
@@ -66,6 +72,9 @@ public class TestApexEngineJRuby {
ParameterService.register(engineParameters);
}
+ /**
+ * After test.
+ */
@After
public void afterTest() {
ParameterService.deregister(engineParameters);
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexEngineJava.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJava.java
index c1d68760d..b551a061e 100644
--- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexEngineJava.java
+++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJava.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.plugins.executor.test.script.engine;
+package org.onap.policy.apex.testsuites.integration.executor.engine;
import java.io.IOException;
@@ -44,6 +44,9 @@ public class TestApexEngineJava {
private ContextParameters contextParameters;
private EngineParameters engineParameters;
+ /**
+ * Before test.
+ */
@Before
public void beforeTest() {
schemaParameters = new SchemaParameters();
@@ -70,6 +73,9 @@ public class TestApexEngineJava {
ParameterService.register(engineParameters);
}
+ /**
+ * After test.
+ */
@After
public void afterTest() {
ParameterService.deregister(engineParameters);
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexEngineJavascript.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJavascript.java
index 1f5c1d4b8..51e39cfe1 100644
--- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexEngineJavascript.java
+++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJavascript.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.plugins.executor.test.script.engine;
+package org.onap.policy.apex.testsuites.integration.executor.engine;
import java.io.IOException;
@@ -34,11 +34,17 @@ import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters;
import org.onap.policy.common.parameters.ParameterService;
+/**
+ * The Class TestApexEngineJavascript.
+ */
public class TestApexEngineJavascript {
private SchemaParameters schemaParameters;
private ContextParameters contextParameters;
private EngineParameters engineParameters;
+ /**
+ * Before test.
+ */
@Before
public void beforeTest() {
schemaParameters = new SchemaParameters();
@@ -65,6 +71,9 @@ public class TestApexEngineJavascript {
ParameterService.register(engineParameters);
}
+ /**
+ * After test.
+ */
@After
public void afterTest() {
ParameterService.deregister(engineParameters);
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexEngineJython.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJython.java
index b5b0f9a78..163a60d20 100644
--- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexEngineJython.java
+++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineJython.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.plugins.executor.test.script.engine;
+package org.onap.policy.apex.testsuites.integration.executor.engine;
import java.io.IOException;
@@ -34,11 +34,17 @@ import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.plugins.executor.jython.JythonExecutorParameters;
import org.onap.policy.common.parameters.ParameterService;
+/**
+ * The Class TestApexEngineJython.
+ */
public class TestApexEngineJython {
private SchemaParameters schemaParameters;
private ContextParameters contextParameters;
private EngineParameters engineParameters;
+ /**
+ * Before test.
+ */
@Before
public void beforeTest() {
schemaParameters = new SchemaParameters();
@@ -65,6 +71,9 @@ public class TestApexEngineJython {
ParameterService.register(engineParameters);
}
+ /**
+ * After test.
+ */
@After
public void afterTest() {
ParameterService.deregister(engineParameters);
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexEngineMvel.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineMvel.java
index 4aab859ca..604105a03 100644
--- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/engine/TestApexEngineMvel.java
+++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/engine/TestApexEngineMvel.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.plugins.executor.test.script.engine;
+package org.onap.policy.apex.testsuites.integration.executor.engine;
import java.io.IOException;
@@ -34,11 +34,17 @@ import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.plugins.executor.mvel.MvelExecutorParameters;
import org.onap.policy.common.parameters.ParameterService;
+/**
+ * The Class TestApexEngineMvel.
+ */
public class TestApexEngineMvel {
private SchemaParameters schemaParameters;
private ContextParameters contextParameters;
private EngineParameters engineParameters;
+ /**
+ * Before test.
+ */
@Before
public void beforeTest() {
schemaParameters = new SchemaParameters();
@@ -65,6 +71,9 @@ public class TestApexEngineMvel {
ParameterService.register(engineParameters);
}
+ /**
+ * After test.
+ */
@After
public void afterTest() {
ParameterService.deregister(engineParameters);
@@ -85,7 +94,7 @@ public class TestApexEngineMvel {
* @throws IOException Signals that an I/O exception has occurred.
*/
@Test
- public void testApexEngineMVEL() throws ApexException, InterruptedException, IOException {
+ public void testApexEngineMvel() throws ApexException, InterruptedException, IOException {
new TestApexEngine("MVEL", engineParameters);
new TestApexEngine("MVEL", engineParameters);
}
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/event/TestEventInstantiation.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/event/TestEventInstantiation.java
index b1542def0..1ae258b01 100644
--- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/event/TestEventInstantiation.java
+++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/event/TestEventInstantiation.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.plugins.executor.test.script.event;
+package org.onap.policy.apex.testsuites.integration.executor.event;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -46,7 +46,7 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
import org.onap.policy.apex.model.basicmodel.handling.ApexModelException;
import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
import org.onap.policy.apex.plugins.executor.mvel.MvelExecutorParameters;
-import org.onap.policy.apex.test.common.model.SampleDomainModelFactory;
+import org.onap.policy.apex.testsuites.integration.common.model.SampleDomainModelFactory;
import org.onap.policy.common.parameters.ParameterService;
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
@@ -64,15 +64,18 @@ public class TestEventInstantiation {
private ContextParameters contextParameters;
private EngineParameters engineParameters;
+ /**
+ * Before test.
+ */
@Before
public void beforeTest() {
schemaParameters = new SchemaParameters();
-
+
schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME);
schemaParameters.getSchemaHelperParameterMap().put("JAVA", new JavaSchemaHelperParameters());
ParameterService.register(schemaParameters);
-
+
contextParameters = new ContextParameters();
contextParameters.setName(ContextParameterConstants.MAIN_GROUP_NAME);
@@ -84,16 +87,19 @@ public class TestEventInstantiation {
ParameterService.register(contextParameters.getDistributorParameters());
ParameterService.register(contextParameters.getLockManagerParameters());
ParameterService.register(contextParameters.getPersistorParameters());
-
+
engineParameters = new EngineParameters();
engineParameters.getExecutorParameterMap().put("MVEL", new MvelExecutorParameters());
ParameterService.register(engineParameters);
}
+ /**
+ * After test.
+ */
@After
public void afterTest() {
ParameterService.deregister(engineParameters);
-
+
ParameterService.deregister(contextParameters.getDistributorParameters());
ParameterService.deregister(contextParameters.getLockManagerParameters());
ParameterService.deregister(contextParameters.getPersistorParameters());
@@ -165,17 +171,15 @@ public class TestEventInstantiation {
try {
event.put("TestMatchCase", "Hello");
} catch (final Exception e) {
- assertEquals(
- "Event0000:0.0.1:NULL:TestMatchCase: object \"Hello\" of class \"java.lang.String\" not compatible with class \"java.lang.Byte\"",
- e.getMessage());
+ assertEquals("Event0000:0.0.1:NULL:TestMatchCase: object \"Hello\" of class \"java.lang.String\" "
+ + "not compatible with class \"java.lang.Byte\"", e.getMessage());
}
try {
event.put("TestMatchCase", 123.45);
} catch (final Exception e) {
- assertEquals(
- "Event0000:0.0.1:NULL:TestMatchCase: object \"123.45\" of class \"java.lang.Double\" not compatible with class \"java.lang.Byte\"",
- e.getMessage());
+ assertEquals("Event0000:0.0.1:NULL:TestMatchCase: object \"123.45\" of class \"java.lang.Double\" "
+ + "not compatible with class \"java.lang.Byte\"", e.getMessage());
}
event.put("TestMatchCase", new Byte("16"));
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestApexModelExport.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexModelExport.java
index 6b72faa8f..1e419521f 100644
--- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestApexModelExport.java
+++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexModelExport.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.plugins.executor.test.script.handling;
+package org.onap.policy.apex.testsuites.integration.executor.handling;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestApexPolicyModelAnalysis.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexPolicyModelAnalysis.java
index 91153d698..abcd22a47 100644
--- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestApexPolicyModelAnalysis.java
+++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexPolicyModelAnalysis.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.plugins.executor.test.script.handling;
+package org.onap.policy.apex.testsuites.integration.executor.handling;
import static org.junit.Assert.assertNotNull;
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestApexSamplePolicyCreateModelFiles.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyCreateModelFiles.java
index 384ad5114..a00729268 100644
--- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestApexSamplePolicyCreateModelFiles.java
+++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyCreateModelFiles.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.plugins.executor.test.script.handling;
+package org.onap.policy.apex.testsuites.integration.executor.handling;
import org.junit.Test;
import org.onap.policy.apex.model.basicmodel.test.TestApexModel;
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestApexSamplePolicyDBWrite.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyDbWrite.java
index 45314672e..e863a990a 100644
--- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestApexSamplePolicyDBWrite.java
+++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyDbWrite.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.plugins.executor.test.script.handling;
+package org.onap.policy.apex.testsuites.integration.executor.handling;
import java.sql.Connection;
import java.sql.DriverManager;
@@ -31,10 +31,18 @@ import org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao;
import org.onap.policy.apex.model.basicmodel.test.TestApexModel;
import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
-public class TestApexSamplePolicyDBWrite {
+/**
+ * The Class TestApexSamplePolicyDbWrite.
+ */
+public class TestApexSamplePolicyDbWrite {
private Connection connection;
TestApexModel<AxPolicyModel> testApexModel;
+ /**
+ * Setup.
+ *
+ * @throws Exception the exception
+ */
@Before
public void setup() throws Exception {
connection = DriverManager.getConnection("jdbc:derby:memory:apex_test;create=true");
@@ -43,13 +51,23 @@ public class TestApexSamplePolicyDBWrite {
testApexModel = new TestApexModel<AxPolicyModel>(AxPolicyModel.class, apexPolicyModelCreator);
}
+ /**
+ * Teardown.
+ *
+ * @throws Exception the exception
+ */
@After
public void teardown() throws Exception {
connection.close();
}
+ /**
+ * Test model write read jpa.
+ *
+ * @throws Exception the exception
+ */
@Test
- public void testModelWriteReadJPA() throws Exception {
+ public void testModelWriteReadJpa() throws Exception {
final DaoParameters DaoParameters = new DaoParameters();
DaoParameters.setPluginClass(DefaultApexDao.class.getCanonicalName());
DaoParameters.setPersistenceUnit("SampleModelTest");
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestApexSamplePolicyModel.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyModel.java
index 36810b44b..1e7daad03 100644
--- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestApexSamplePolicyModel.java
+++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyModel.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.plugins.executor.test.script.handling;
+package org.onap.policy.apex.testsuites.integration.executor.handling;
import static org.junit.Assert.assertTrue;
@@ -34,11 +34,19 @@ import org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao;
import org.onap.policy.apex.model.basicmodel.test.TestApexModel;
import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
+/**
+ * The Class TestApexSamplePolicyModel.
+ */
public class TestApexSamplePolicyModel {
private static final String VALID_MODEL_STRING = "***validation of model successful***";
private Connection connection;
private TestApexModel<AxPolicyModel> testApexModel;
+ /**
+ * Setup.
+ *
+ * @throws Exception the exception
+ */
@Before
public void setup() throws Exception {
connection = DriverManager.getConnection("jdbc:derby:memory:apex_test;create=true");
@@ -47,29 +55,54 @@ public class TestApexSamplePolicyModel {
new TestApexModel<AxPolicyModel>(AxPolicyModel.class, new TestApexSamplePolicyModelCreator("MVEL"));
}
+ /**
+ * Teardown.
+ *
+ * @throws Exception the exception
+ */
@After
public void teardown() throws Exception {
connection.close();
}
+ /**
+ * Test model valid.
+ *
+ * @throws Exception the exception
+ */
@Test
public void testModelValid() throws Exception {
final AxValidationResult result = testApexModel.testApexModelValid();
assertTrue(result.toString().equals(VALID_MODEL_STRING));
}
+ /**
+ * Test model write read xml.
+ *
+ * @throws Exception the exception
+ */
@Test
- public void testModelWriteReadXML() throws Exception {
+ public void testModelWriteReadXml() throws Exception {
testApexModel.testApexModelWriteReadXml();
}
+ /**
+ * Test model write read json.
+ *
+ * @throws Exception the exception
+ */
@Test
- public void testModelWriteReadJSON() throws Exception {
+ public void testModelWriteReadJson() throws Exception {
testApexModel.testApexModelWriteReadJson();
}
+ /**
+ * Test model write read jpa.
+ *
+ * @throws Exception the exception
+ */
@Test
- public void testModelWriteReadJPA() throws Exception {
+ public void testModelWriteReadJpa() throws Exception {
final DaoParameters DaoParameters = new DaoParameters();
DaoParameters.setPluginClass(DefaultApexDao.class.getCanonicalName());
DaoParameters.setPersistenceUnit("SampleModelTest");
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestApexSamplePolicyModelCreator.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyModelCreator.java
index d5ba53699..7e44dd32e 100644
--- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestApexSamplePolicyModelCreator.java
+++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyModelCreator.java
@@ -18,42 +18,64 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.plugins.executor.test.script.handling;
+package org.onap.policy.apex.testsuites.integration.executor.handling;
import org.onap.policy.apex.model.basicmodel.test.TestApexModelCreator;
import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
-import org.onap.policy.apex.test.common.model.SampleDomainModelFactory;
+import org.onap.policy.apex.testsuites.integration.common.model.SampleDomainModelFactory;
/**
+ * The Class TestApexSamplePolicyModelCreator.
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public class TestApexSamplePolicyModelCreator implements TestApexModelCreator<AxPolicyModel> {
private String logicExecutorType;
+ /**
+ * Instantiates a new test apex sample policy model creator.
+ *
+ * @param logicExecutorType the logic executor type
+ */
public TestApexSamplePolicyModelCreator(final String logicExecutorType) {
this.logicExecutorType = logicExecutorType;
}
+ /* (non-Javadoc)
+ * @see org.onap.policy.apex.model.basicmodel.handling.ApexModelCreator#getModel()
+ */
@Override
public AxPolicyModel getModel() {
return new SampleDomainModelFactory().getSamplePolicyModel(logicExecutorType);
}
+ /* (non-Javadoc)
+ * @see org.onap.policy.apex.model.basicmodel.test.TestApexModelCreator#getMalstructuredModel()
+ */
@Override
public AxPolicyModel getMalstructuredModel() {
return null;
}
+ /* (non-Javadoc)
+ * @see org.onap.policy.apex.model.basicmodel.test.TestApexModelCreator#getObservationModel()
+ */
@Override
public AxPolicyModel getObservationModel() {
return null;
}
+ /* (non-Javadoc)
+ * @see org.onap.policy.apex.model.basicmodel.test.TestApexModelCreator#getWarningModel()
+ */
@Override
public AxPolicyModel getWarningModel() {
return getModel();
}
+ /* (non-Javadoc)
+ * @see org.onap.policy.apex.model.basicmodel.test.TestApexModelCreator#getInvalidModel()
+ */
@Override
public AxPolicyModel getInvalidModel() {
return null;
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestContextUpdateDifferentModels.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestContextUpdateDifferentModels.java
index 20159a3bf..e8c45b201 100644
--- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestContextUpdateDifferentModels.java
+++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestContextUpdateDifferentModels.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.plugins.executor.test.script.handling;
+package org.onap.policy.apex.testsuites.integration.executor.handling;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -42,8 +42,8 @@ import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
import org.onap.policy.apex.plugins.executor.mvel.MvelExecutorParameters;
-import org.onap.policy.apex.plugins.executor.test.script.engine.TestApexActionListener;
-import org.onap.policy.apex.test.common.model.SampleDomainModelFactory;
+import org.onap.policy.apex.testsuites.integration.common.model.SampleDomainModelFactory;
+import org.onap.policy.apex.testsuites.integration.executor.engine.TestApexActionListener;
import org.onap.policy.common.parameters.ParameterService;
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
@@ -61,6 +61,9 @@ public class TestContextUpdateDifferentModels {
private ContextParameters contextParameters;
private EngineParameters engineParameters;
+ /**
+ * Before test.
+ */
@Before
public void beforeTest() {
schemaParameters = new SchemaParameters();
@@ -87,6 +90,9 @@ public class TestContextUpdateDifferentModels {
ParameterService.register(engineParameters);
}
+ /**
+ * After test.
+ */
@After
public void afterTest() {
ParameterService.deregister(engineParameters);
@@ -99,6 +105,13 @@ public class TestContextUpdateDifferentModels {
ParameterService.deregister(schemaParameters);
}
+ /**
+ * Test context update different models.
+ *
+ * @throws ApexException the apex exception
+ * @throws InterruptedException the interrupted exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
public void testContextUpdateDifferentModels() throws ApexException, InterruptedException, IOException {
logger.debug("Running test testContextUpdateDifferentModels . . .");
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestContextUpdateModel.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestContextUpdateModel.java
index d5605ea4c..615781ab3 100644
--- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/plugins/executor/test/script/handling/TestContextUpdateModel.java
+++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestContextUpdateModel.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.plugins.executor.test.script.handling;
+package org.onap.policy.apex.testsuites.integration.executor.handling;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -45,8 +45,8 @@ import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
import org.onap.policy.apex.plugins.executor.mvel.MvelExecutorParameters;
-import org.onap.policy.apex.plugins.executor.test.script.engine.TestApexActionListener;
-import org.onap.policy.apex.test.common.model.SampleDomainModelFactory;
+import org.onap.policy.apex.testsuites.integration.common.model.SampleDomainModelFactory;
+import org.onap.policy.apex.testsuites.integration.executor.engine.TestApexActionListener;
import org.onap.policy.common.parameters.ParameterService;
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
@@ -64,6 +64,9 @@ public class TestContextUpdateModel {
private ContextParameters contextParameters;
private EngineParameters engineParameters;
+ /**
+ * Before test.
+ */
@Before
public void beforeTest() {
schemaParameters = new SchemaParameters();
@@ -90,6 +93,9 @@ public class TestContextUpdateModel {
ParameterService.register(engineParameters);
}
+ /**
+ * After test.
+ */
@After
public void afterTest() {
ParameterService.deregister(engineParameters);
@@ -102,6 +108,13 @@ public class TestContextUpdateModel {
ParameterService.deregister(schemaParameters);
}
+ /**
+ * Test context update model.
+ *
+ * @throws ApexException the apex exception
+ * @throws InterruptedException the interrupted exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
public void testContextUpdateModel() throws ApexException, InterruptedException, IOException {
final AxArtifactKey key = new AxArtifactKey("TestApexEngine", "0.0.1");
@@ -152,9 +165,21 @@ public class TestContextUpdateModel {
apexEngine.clear();
}
+ /**
+ * Test context update model after.
+ */
@After
public void testContextUpdateModelAfter() {}
+ /**
+ * Send event.
+ *
+ * @param apexEngine the apex engine
+ * @param listener the listener
+ * @param eventName the event name
+ * @param shouldWork the should work
+ * @throws ContextException the context exception
+ */
private void sendEvent(final ApexEngine apexEngine, final TestApexActionListener listener, final String eventName,
final boolean shouldWork) throws ContextException {
final Date aDate = new Date(1433453067123L);
@@ -173,6 +198,12 @@ public class TestContextUpdateModel {
checkResult(result, shouldWork);
}
+ /**
+ * Check result.
+ *
+ * @param result the result
+ * @param shouldWork the should work
+ */
private void checkResult(final EnEvent result, final boolean shouldWork) {
if (!shouldWork) {
assertNotNull(result.getExceptionMessage());
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/events/EventGenerator.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/EventGenerator.java
index 4c2ed5c88..6a585d7c5 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/events/EventGenerator.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/events/EventGenerator.java
@@ -18,16 +18,24 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.events;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.events;
import java.util.Random;
/**
+ * The Class EventGenerator.
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public class EventGenerator {
private static int nextEventNo = 0;
+ /**
+ * Xml events.
+ *
+ * @param eventCount the event count
+ * @return the string
+ */
public static String xmlEvents(final int eventCount) {
final StringBuilder builder = new StringBuilder();
@@ -41,6 +49,12 @@ public class EventGenerator {
return builder.toString();
}
+ /**
+ * Json events.
+ *
+ * @param eventCount the event count
+ * @return the string
+ */
public static String jsonEvents(final int eventCount) {
final StringBuilder builder = new StringBuilder();
@@ -54,6 +68,11 @@ public class EventGenerator {
return builder.toString();
}
+ /**
+ * Xml event.
+ *
+ * @return the string
+ */
public static String xmlEvent() {
final Random rand = new Random();
@@ -93,6 +112,11 @@ public class EventGenerator {
return builder.toString();
}
+ /**
+ * Json event.
+ *
+ * @return the string
+ */
public static String jsonEvent() {
final Random rand = new Random();
@@ -118,6 +142,11 @@ public class EventGenerator {
return builder.toString();
}
+ /**
+ * Json event no name.
+ *
+ * @return the string
+ */
public static String jsonEventNoName() {
final Random rand = new Random();
@@ -143,6 +172,11 @@ public class EventGenerator {
return builder.toString();
}
+ /**
+ * Json event bad name.
+ *
+ * @return the string
+ */
public static String jsonEventBadName() {
final Random rand = new Random();
@@ -167,6 +201,11 @@ public class EventGenerator {
return builder.toString();
}
+ /**
+ * Json event no ex name.
+ *
+ * @return the string
+ */
public static String jsonEventNoExName() {
final Random rand = new Random();
@@ -190,6 +229,11 @@ public class EventGenerator {
return builder.toString();
}
+ /**
+ * Json event no version.
+ *
+ * @return the string
+ */
public static String jsonEventNoVersion() {
final Random rand = new Random();
@@ -215,6 +259,11 @@ public class EventGenerator {
return builder.toString();
}
+ /**
+ * Json event bad version.
+ *
+ * @return the string
+ */
public static String jsonEventBadVersion() {
final Random rand = new Random();
@@ -240,6 +289,11 @@ public class EventGenerator {
return builder.toString();
}
+ /**
+ * Json event no ex version.
+ *
+ * @return the string
+ */
public static String jsonEventNoExVersion() {
final Random rand = new Random();
@@ -264,6 +318,11 @@ public class EventGenerator {
return builder.toString();
}
+ /**
+ * Json event no namespace.
+ *
+ * @return the string
+ */
public static String jsonEventNoNamespace() {
final Random rand = new Random();
@@ -289,6 +348,11 @@ public class EventGenerator {
return builder.toString();
}
+ /**
+ * Json event bad namespace.
+ *
+ * @return the string
+ */
public static String jsonEventBadNamespace() {
final Random rand = new Random();
@@ -314,6 +378,11 @@ public class EventGenerator {
return builder.toString();
}
+ /**
+ * Json event no ex namespace.
+ *
+ * @return the string
+ */
public static String jsonEventNoExNamespace() {
final Random rand = new Random();
@@ -338,6 +407,11 @@ public class EventGenerator {
return builder.toString();
}
+ /**
+ * Json event no source.
+ *
+ * @return the string
+ */
public static String jsonEventNoSource() {
final Random rand = new Random();
@@ -363,6 +437,11 @@ public class EventGenerator {
return builder.toString();
}
+ /**
+ * Json event bad source.
+ *
+ * @return the string
+ */
public static String jsonEventBadSource() {
final Random rand = new Random();
@@ -388,6 +467,11 @@ public class EventGenerator {
return builder.toString();
}
+ /**
+ * Json event no target.
+ *
+ * @return the string
+ */
public static String jsonEventNoTarget() {
final Random rand = new Random();
@@ -413,6 +497,11 @@ public class EventGenerator {
return builder.toString();
}
+ /**
+ * Json event bad target.
+ *
+ * @return the string
+ */
public static String jsonEventBadTarget() {
final Random rand = new Random();
@@ -438,6 +527,11 @@ public class EventGenerator {
return builder.toString();
}
+ /**
+ * Json event missing fields.
+ *
+ * @return the string
+ */
public static String jsonEventMissingFields() {
final StringBuilder builder = new StringBuilder();
@@ -452,6 +546,11 @@ public class EventGenerator {
return builder.toString();
}
+ /**
+ * Json event null fields.
+ *
+ * @return the string
+ */
public static String jsonEventNullFields() {
final StringBuilder builder = new StringBuilder();
@@ -470,6 +569,11 @@ public class EventGenerator {
return builder.toString();
}
+ /**
+ * The main method.
+ *
+ * @param args the arguments
+ */
public static void main(final String[] args) {
if (args.length != 2) {
System.err.println("usage EventGenerator #events XML|JSON");
@@ -495,6 +599,11 @@ public class EventGenerator {
}
}
+ /**
+ * Gets the next event no.
+ *
+ * @return the next event no
+ */
public static int getNextEventNo() {
return nextEventNo;
}
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/file/TestFile2File.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/file/TestFile2File.java
index 347cce80e..5483501b2 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/file/TestFile2File.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/file/TestFile2File.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.file;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.file;
import static org.junit.Assert.assertEquals;
@@ -42,7 +42,7 @@ public class TestFile2File {
}
@Test
- public void testXMLFileEvents() throws MessagingException, ApexException, IOException {
+ public void testXmlFileEvents() throws MessagingException, ApexException, IOException {
final String[] args = {"src/test/resources/prodcons/File2FileXmlEvent.json"};
testFileEvents(args, "src/test/resources/events/EventsOut.xmlfile", 106739);
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/file/TestFile2FileFiltered.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/file/TestFile2FileFiltered.java
index c2b097273..48cd6c013 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/file/TestFile2FileFiltered.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/file/TestFile2FileFiltered.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.file;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.file;
import static org.junit.Assert.assertEquals;
@@ -38,8 +38,10 @@ public class TestFile2FileFiltered {
public void testJsonFilteredFileInOutEvents() throws MessagingException, ApexException, IOException {
final String[] args = {"src/test/resources/prodcons/File2FileFilteredInOutJsonEvent.json"};
- final String[] outFilePaths =
- {"src/test/resources/events/Events0004Out.json", "src/test/resources/events/Events0104Out.json"};
+ final String[] outFilePaths = {
+ "src/test/resources/events/Events0004Out.json",
+ "src/test/resources/events/Events0104Out.json"
+ };
final long[] expectedFileSizes = {25949, 23007};
@@ -50,8 +52,10 @@ public class TestFile2FileFiltered {
public void testJsonFilteredFileOutEvents() throws MessagingException, ApexException, IOException {
final String[] args = {"src/test/resources/prodcons/File2FileFilteredOutJsonEvent.json"};
- final String[] outFilePaths =
- {"src/test/resources/events/Events0004Out.json", "src/test/resources/events/Events0104Out.json"};
+ final String[] outFilePaths = {
+ "src/test/resources/events/Events0004Out.json",
+ "src/test/resources/events/Events0104Out.json"
+ };
final long[] expectedFileSizes = {25949, 23007};
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/file/TestFile2FileIgnore.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/file/TestFile2FileIgnore.java
index c952d73b5..49c7a96d1 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/file/TestFile2FileIgnore.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/file/TestFile2FileIgnore.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.file;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.file;
import static org.junit.Assert.assertEquals;
@@ -31,10 +31,21 @@ import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.model.utilities.TextFileUtils;
import org.onap.policy.apex.service.engine.main.ApexMain;
+/**
+ * The Class TestFile2FileIgnore.
+ */
public class TestFile2FileIgnore {
// This test is used just to bring up an instance of Apex for manual testing and demonstrations
// It should always be ignored in automated testing because it holds Apex up for a very long
+ /**
+ * The main method.
+ *
+ * @param args the arguments
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
// time
public static void main(final String[] args) throws MessagingException, ApexException, IOException {
final String[] apexArgs = {"src/test/resources/prodcons/File2FileJsonEvent.json"};
@@ -42,6 +53,16 @@ public class TestFile2FileIgnore {
testFileEvents(apexArgs, "src/test/resources/events/EventsOut.json", 48656);
}
+ /**
+ * Test file events.
+ *
+ * @param args the args
+ * @param outFilePath the out file path
+ * @param expectedFileSize the expected file size
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
private static void testFileEvents(final String[] args, final String outFilePath, final long expectedFileSize)
throws MessagingException, ApexException, IOException {
final ApexMain apexMain = new ApexMain(args);
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/jms/JMSEventProducer.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/JmsEventProducer.java
index 8b9f2a112..6a7e61739 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/jms/JMSEventProducer.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/JmsEventProducer.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.jms;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.jms;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
@@ -29,17 +29,19 @@ import javax.jms.Session;
import javax.jms.Topic;
import org.apache.activemq.command.ActiveMQTopic;
-import org.onap.policy.apex.apps.uservice.test.adapt.events.EventGenerator;
import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
import org.onap.policy.apex.service.engine.event.ApexEventRuntimeException;
+import org.onap.policy.apex.testsuites.integration.uservice.adapt.events.EventGenerator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
+ * The Class JmsEventProducer.
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
-public class JMSEventProducer implements Runnable {
- private static final Logger LOGGER = LoggerFactory.getLogger(JMSEventProducer.class);
+public class JmsEventProducer implements Runnable {
+ private static final Logger LOGGER = LoggerFactory.getLogger(JmsEventProducer.class);
private final String topic;
private final int eventCount;
@@ -52,7 +54,19 @@ public class JMSEventProducer implements Runnable {
private boolean stopFlag = false;
private final Connection connection;
- public JMSEventProducer(final String topic, final ConnectionFactory connectionFactory, final String username,
+ /**
+ * Instantiates a new jms event producer.
+ *
+ * @param topic the topic
+ * @param connectionFactory the connection factory
+ * @param username the username
+ * @param password the password
+ * @param eventCount the event count
+ * @param sendObjects the send objects
+ * @param eventInterval the event interval
+ * @throws JMSException the JMS exception
+ */
+ public JmsEventProducer(final String topic, final ConnectionFactory connectionFactory, final String username,
final String password, final int eventCount, final boolean sendObjects, final long eventInterval)
throws JMSException {
this.topic = topic;
@@ -66,6 +80,9 @@ public class JMSEventProducer implements Runnable {
producerThread.start();
}
+ /* (non-Javadoc)
+ * @see java.lang.Runnable#run()
+ */
@Override
public void run() {
final Topic jmsTopic = new ActiveMQTopic(topic);
@@ -86,10 +103,20 @@ public class JMSEventProducer implements Runnable {
}
}
+ /**
+ * Send events.
+ */
public void sendEvents() {
sendEventsFlag = true;
}
+ /**
+ * Send events to topic.
+ *
+ * @param jmsSession the jms session
+ * @param jmsProducer the jms producer
+ * @throws JMSException the JMS exception
+ */
private void sendEventsToTopic(final Session jmsSession, final MessageProducer jmsProducer) throws JMSException {
LOGGER.info("{} : sending events to JMS server, event count {}", this.getClass().getCanonicalName(),
@@ -110,10 +137,18 @@ public class JMSEventProducer implements Runnable {
LOGGER.info("{} : completed, number of events sent", this.getClass().getCanonicalName(), eventsSentCount);
}
+ /**
+ * Gets the events sent count.
+ *
+ * @return the events sent count
+ */
public long getEventsSentCount() {
return eventsSentCount;
}
+ /**
+ * Shutdown.
+ */
public void shutdown() {
LOGGER.info("{} : stopping", this.getClass().getCanonicalName());
stopFlag = true;
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/jms/JMSEventSubscriber.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/JmsEventSubscriber.java
index 916216a5a..d1af8c39a 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/jms/JMSEventSubscriber.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/JmsEventSubscriber.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.jms;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.jms;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
@@ -38,10 +38,12 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
+ * The Class JmsEventSubscriber.
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
-public class JMSEventSubscriber implements Runnable {
- private static final Logger LOGGER = LoggerFactory.getLogger(JMSEventSubscriber.class);
+public class JmsEventSubscriber implements Runnable {
+ private static final Logger LOGGER = LoggerFactory.getLogger(JmsEventSubscriber.class);
private final String topic;
private long eventsReceivedCount = 0;
@@ -50,7 +52,16 @@ public class JMSEventSubscriber implements Runnable {
private final Connection connection;
- public JMSEventSubscriber(final String topic, final ConnectionFactory connectionFactory, final String username,
+ /**
+ * Instantiates a new jms event subscriber.
+ *
+ * @param topic the topic
+ * @param connectionFactory the connection factory
+ * @param username the username
+ * @param password the password
+ * @throws JMSException the JMS exception
+ */
+ public JmsEventSubscriber(final String topic, final ConnectionFactory connectionFactory, final String username,
final String password) throws JMSException {
this.topic = topic;
connection = connectionFactory.createConnection(username, password);
@@ -60,6 +71,9 @@ public class JMSEventSubscriber implements Runnable {
subscriberThread.start();
}
+ /* (non-Javadoc)
+ * @see java.lang.Runnable#run()
+ */
@Override
public void run() {
final Topic jmsTopic = new ActiveMQTopic(topic);
@@ -95,10 +109,20 @@ public class JMSEventSubscriber implements Runnable {
LOGGER.info("{} : event reception completed", this.getClass().getCanonicalName());
}
+ /**
+ * Gets the events received count.
+ *
+ * @return the events received count
+ */
public long getEventsReceivedCount() {
return eventsReceivedCount;
}
+ /**
+ * Shutdown.
+ *
+ * @throws JMSException the JMS exception
+ */
public void shutdown() throws JMSException {
subscriberThread.interrupt();
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/jms/TestContext.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/TestContext.java
index de3c8d37b..b8ea0c7fe 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/jms/TestContext.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/TestContext.java
@@ -18,13 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.jms;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.jms;
-import static org.onap.policy.apex.apps.uservice.test.adapt.jms.TestJMS2JMS.HOST;
-import static org.onap.policy.apex.apps.uservice.test.adapt.jms.TestJMS2JMS.JMS_TOPIC_APEX_IN;
-import static org.onap.policy.apex.apps.uservice.test.adapt.jms.TestJMS2JMS.JMS_TOPIC_APEX_OUT;
-import static org.onap.policy.apex.apps.uservice.test.adapt.jms.TestJMS2JMS.PORT;
-import static org.onap.policy.apex.apps.uservice.test.adapt.jms.TestJMS2JMS.connectionFactory;
+import static org.onap.policy.apex.testsuites.integration.uservice.adapt.jms.TestJms2Jms.HOST;
+import static org.onap.policy.apex.testsuites.integration.uservice.adapt.jms.TestJms2Jms.JMS_TOPIC_APEX_IN;
+import static org.onap.policy.apex.testsuites.integration.uservice.adapt.jms.TestJms2Jms.JMS_TOPIC_APEX_OUT;
+import static org.onap.policy.apex.testsuites.integration.uservice.adapt.jms.TestJms2Jms.PORT;
+import static org.onap.policy.apex.testsuites.integration.uservice.adapt.jms.TestJms2Jms.connectionFactory;
import java.util.HashMap;
import java.util.Hashtable;
@@ -43,12 +43,17 @@ import org.apache.activemq.command.ActiveMQTopic;
import org.onap.policy.apex.model.basicmodel.concepts.ApexRuntimeException;
/**
+ * The Class TestContext.
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public class TestContext implements Context {
private Properties testProperties;
+ /**
+ * Instantiates a new test context.
+ */
public TestContext() {
try {
testProperties = new Properties();
@@ -65,127 +70,213 @@ public class TestContext implements Context {
}
}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#lookup(javax.naming.Name)
+ */
@Override
public Object lookup(final Name name) throws NamingException {
return null;
}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#lookup(java.lang.String)
+ */
@Override
public Object lookup(final String name) throws NamingException {
return testProperties.get(name);
}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#bind(javax.naming.Name, java.lang.Object)
+ */
@Override
public void bind(final Name name, final Object obj) throws NamingException {}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#bind(java.lang.String, java.lang.Object)
+ */
@Override
public void bind(final String name, final Object obj) throws NamingException {}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#rebind(javax.naming.Name, java.lang.Object)
+ */
@Override
public void rebind(final Name name, final Object obj) throws NamingException {}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#rebind(java.lang.String, java.lang.Object)
+ */
@Override
public void rebind(final String name, final Object obj) throws NamingException {}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#unbind(javax.naming.Name)
+ */
@Override
public void unbind(final Name name) throws NamingException {}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#unbind(java.lang.String)
+ */
@Override
public void unbind(final String name) throws NamingException {}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#rename(javax.naming.Name, javax.naming.Name)
+ */
@Override
public void rename(final Name oldName, final Name newName) throws NamingException {}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#rename(java.lang.String, java.lang.String)
+ */
@Override
public void rename(final String oldName, final String newName) throws NamingException {}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#list(javax.naming.Name)
+ */
@Override
public NamingEnumeration<NameClassPair> list(final Name name) throws NamingException {
return null;
}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#list(java.lang.String)
+ */
@Override
public NamingEnumeration<NameClassPair> list(final String name) throws NamingException {
return null;
}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#listBindings(javax.naming.Name)
+ */
@Override
public NamingEnumeration<Binding> listBindings(final Name name) throws NamingException {
return null;
}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#listBindings(java.lang.String)
+ */
@Override
public NamingEnumeration<Binding> listBindings(final String name) throws NamingException {
return null;
}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#destroySubcontext(javax.naming.Name)
+ */
@Override
public void destroySubcontext(final Name name) throws NamingException {}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#destroySubcontext(java.lang.String)
+ */
@Override
public void destroySubcontext(final String name) throws NamingException {}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#createSubcontext(javax.naming.Name)
+ */
@Override
public Context createSubcontext(final Name name) throws NamingException {
return null;
}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#createSubcontext(java.lang.String)
+ */
@Override
public Context createSubcontext(final String name) throws NamingException {
return null;
}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#lookupLink(javax.naming.Name)
+ */
@Override
public Object lookupLink(final Name name) throws NamingException {
return null;
}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#lookupLink(java.lang.String)
+ */
@Override
public Object lookupLink(final String name) throws NamingException {
return null;
}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#getNameParser(javax.naming.Name)
+ */
@Override
public NameParser getNameParser(final Name name) throws NamingException {
return null;
}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#getNameParser(java.lang.String)
+ */
@Override
public NameParser getNameParser(final String name) throws NamingException {
return null;
}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#composeName(javax.naming.Name, javax.naming.Name)
+ */
@Override
public Name composeName(final Name name, final Name prefix) throws NamingException {
return null;
}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#composeName(java.lang.String, java.lang.String)
+ */
@Override
public String composeName(final String name, final String prefix) throws NamingException {
return null;
}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#addToEnvironment(java.lang.String, java.lang.Object)
+ */
@Override
public Object addToEnvironment(final String propName, final Object propVal) throws NamingException {
return null;
}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#removeFromEnvironment(java.lang.String)
+ */
@Override
public Object removeFromEnvironment(final String propName) throws NamingException {
return null;
}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#getEnvironment()
+ */
@Override
public Hashtable<?, ?> getEnvironment() throws NamingException {
return null;
}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#close()
+ */
@Override
public void close() throws NamingException {}
+ /* (non-Javadoc)
+ * @see javax.naming.Context#getNameInNamespace()
+ */
@Override
public String getNameInNamespace() throws NamingException {
return null;
}
-
}
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/jms/TestInitialContextFactory.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/TestInitialContextFactory.java
index 6cb874671..d04cd5791 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/jms/TestInitialContextFactory.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/TestInitialContextFactory.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.jms;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.jms;
import java.util.Hashtable;
@@ -27,12 +27,19 @@ import javax.naming.NamingException;
import javax.naming.spi.InitialContextFactory;
/**
+ * A factory for creating TestInitialContext objects.
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public class TestInitialContextFactory implements InitialContextFactory {
private final Context context = new TestContext();
+ /**
+ * Instantiates a new test initial context factory.
+ *
+ * @throws NamingException the naming exception
+ */
public TestInitialContextFactory() throws NamingException {}
/*
@@ -44,5 +51,4 @@ public class TestInitialContextFactory implements InitialContextFactory {
public Context getInitialContext(final Hashtable<?, ?> environment) throws NamingException {
return context;
}
-
}
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/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 f021b2674..422a97a11 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/jms/TestJMS2JMS.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/TestJms2Jms.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.jms;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.jms;
import static org.junit.Assert.assertEquals;
@@ -44,7 +44,10 @@ import org.onap.policy.apex.service.engine.main.ApexMain;
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
-public class TestJMS2JMS {
+/**
+ * The Class TestJms2Jms.
+ */
+public class TestJms2Jms {
public static final String PORT = "5445";
public static final String HOST = "localhost";
public static final String JMS_TOPIC_APEX_IN = "jms/topic/apexIn";
@@ -52,14 +55,14 @@ public class TestJMS2JMS {
private static final int SLEEP_TIME = 1500;
private static final String GROUP_ROLE = "guests";
- private static final String PACKAGE_NAME = "org.onap.policy.apex.apps.uservice.test.adapt.jms";
+ private static final String PACKAGE_NAME = "org.onap.policy.apex.testsuites.integration.uservice.adapt.jms";
private static final String USERNAME = "guest";
private static final String PASSWORD = "IAmAGuest";
private static final String URL = "tcp://" + HOST + ":" + PORT;
private static final String DATA_PARENT_DIR = Paths.get("target", "activemq-data").toString();
- private static final XLogger LOGGER = XLoggerFactory.getXLogger(TestJMS2JMS.class);
+ private static final XLogger LOGGER = XLoggerFactory.getXLogger(TestJms2Jms.class);
private static final long MAX_TEST_LENGTH = 10000;
private static final int EVENT_COUNT = 100;
@@ -70,8 +73,13 @@ public class TestJMS2JMS {
public static ActiveMQConnectionFactory connectionFactory;
+ /**
+ * Setup embedded jms server.
+ *
+ * @throws Exception the exception
+ */
@BeforeClass
- public static void setupEmbeddedJMSServer() throws Exception {
+ public static void setupEmbeddedJmsServer() throws Exception {
final ArrayList<BrokerPlugin> plugins = new ArrayList<BrokerPlugin>();
final BrokerPlugin authenticationPlugin = getAuthenticationBrokerPlugin();
plugins.add(authenticationPlugin);
@@ -89,6 +97,11 @@ public class TestJMS2JMS {
connectionFactory.setTrustedPackages(Arrays.asList(PACKAGE_NAME));
}
+ /**
+ * Gets the authentication broker plugin.
+ *
+ * @return the authentication broker plugin
+ */
private static BrokerPlugin getAuthenticationBrokerPlugin() {
final List<AuthenticationUser> users = new ArrayList<AuthenticationUser>();
users.add(new AuthenticationUser(USERNAME, PASSWORD, GROUP_ROLE));
@@ -96,8 +109,13 @@ public class TestJMS2JMS {
return authenticationPlugin;
}
+ /**
+ * Shutdown embedded jms server.
+ *
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@AfterClass
- public static void shutdownEmbeddedJMSServer() throws IOException {
+ public static void shutdownEmbeddedJmsServer() throws IOException {
try {
if (broker != null) {
broker.stop();
@@ -108,22 +126,42 @@ public class TestJMS2JMS {
}
+ /**
+ * Test jms object events.
+ *
+ * @throws ApexException the apex exception
+ * @throws JMSException the JMS exception
+ */
@Test
- public void testJMSObjectEvents() throws ApexException, JMSException {
+ public void testJmsObjectEvents() throws ApexException, JMSException {
final String[] args = { "src/test/resources/prodcons/JMS2JMSObjectEvent.json" };
- testJMSEvents(args, true);
+ testJmsEvents(args, true);
}
+ /**
+ * Test jms json events.
+ *
+ * @throws ApexException the apex exception
+ * @throws JMSException the JMS exception
+ */
@Test
- public void testJMSJsonEvents() throws ApexException, JMSException {
+ public void testJmsJsonEvents() throws ApexException, JMSException {
final String[] args = { "src/test/resources/prodcons/JMS2JMSJsonEvent.json" };
- testJMSEvents(args, false);
+ testJmsEvents(args, false);
}
- private void testJMSEvents(final String[] args, final Boolean sendObjects) throws ApexException, JMSException {
- final JMSEventSubscriber subscriber =
- new JMSEventSubscriber(JMS_TOPIC_APEX_OUT, connectionFactory, USERNAME, PASSWORD);
- final JMSEventProducer producer = new JMSEventProducer(JMS_TOPIC_APEX_IN, connectionFactory, USERNAME, PASSWORD,
+ /**
+ * Test jms events.
+ *
+ * @param args the args
+ * @param sendObjects the send objects
+ * @throws ApexException the apex exception
+ * @throws JMSException the JMS exception
+ */
+ private void testJmsEvents(final String[] args, final Boolean sendObjects) throws ApexException, JMSException {
+ final JmsEventSubscriber subscriber =
+ new JmsEventSubscriber(JMS_TOPIC_APEX_OUT, connectionFactory, USERNAME, PASSWORD);
+ final JmsEventProducer producer = new JmsEventProducer(JMS_TOPIC_APEX_IN, connectionFactory, USERNAME, PASSWORD,
EVENT_COUNT, sendObjects, EVENT_INTERVAL);
final ApexMain apexMain = new ApexMain(args);
@@ -148,6 +186,12 @@ public class TestJMS2JMS {
}
+ /**
+ * Checks if is timed out.
+ *
+ * @param testStartTime the test start time
+ * @return true, if is timed out
+ */
private boolean isTimedOut(final long testStartTime) {
return System.currentTimeMillis() < testStartTime + MAX_TEST_LENGTH;
}
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/jms/TestPing.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/TestPing.java
index caf6e2ffd..b0dfb553a 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/jms/TestPing.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/jms/TestPing.java
@@ -18,13 +18,15 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.jms;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.jms;
import java.io.Serializable;
import org.onap.policy.apex.service.engine.event.ApexEventException;
/**
+ * The Class TestPing.
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public class TestPing implements Serializable {
@@ -35,44 +37,92 @@ public class TestPing implements Serializable {
private long pingTime = System.currentTimeMillis();
private long pongTime = -1;
+ /**
+ * Gets the name.
+ *
+ * @return the name
+ */
public String getName() {
return name;
}
+ /**
+ * Sets the name.
+ *
+ * @param name the new name
+ */
public void setName(final String name) {
this.name = name;
}
+ /**
+ * Gets the description.
+ *
+ * @return the description
+ */
public String getDescription() {
return description;
}
+ /**
+ * Sets the description.
+ *
+ * @param description the new description
+ */
public void setDescription(final String description) {
this.description = description;
}
+ /**
+ * Gets the ping time.
+ *
+ * @return the ping time
+ */
public long getPingTime() {
return pingTime;
}
+ /**
+ * Sets the ping time.
+ *
+ * @param pingTime the new ping time
+ */
public void setPingTime(final long pingTime) {
this.pingTime = pingTime;
}
+ /**
+ * Gets the pong time.
+ *
+ * @return the pong time
+ */
public long getPongTime() {
return pongTime;
}
+ /**
+ * Sets the pong time.
+ *
+ * @param pongTime the new pong time
+ */
public void setPongTime(final long pongTime) {
this.pongTime = pongTime;
}
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
@Override
public String toString() {
return "TestPing [name=" + name + ", description=" + description + ", pingTime=" + pingTime + ", pongTime="
+ pongTime + "]";
}
+ /**
+ * Verify.
+ *
+ * @throws ApexEventException the apex event exception
+ */
public void verify() throws ApexEventException {
if (!name.startsWith("Rose")) {
throw new ApexEventException("TestPing is not valid");
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/kafka/KafkaEventProducer.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/KafkaEventProducer.java
index c243b8b07..072d67864 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/kafka/KafkaEventProducer.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/KafkaEventProducer.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.kafka;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.kafka;
import java.util.Properties;
import java.util.concurrent.TimeUnit;
@@ -26,10 +26,12 @@ import java.util.concurrent.TimeUnit;
import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.Producer;
import org.apache.kafka.clients.producer.ProducerRecord;
-import org.onap.policy.apex.apps.uservice.test.adapt.events.EventGenerator;
import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
+import org.onap.policy.apex.testsuites.integration.uservice.adapt.events.EventGenerator;
/**
+ * The Class KafkaEventProducer.
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public class KafkaEventProducer implements Runnable {
@@ -44,6 +46,15 @@ public class KafkaEventProducer implements Runnable {
private boolean sendEventsFlag = false;
private boolean stopFlag = false;
+ /**
+ * Instantiates a new kafka event producer.
+ *
+ * @param topic the topic
+ * @param kafkaServerAddress the kafka server address
+ * @param eventCount the event count
+ * @param xmlEvents the xml events
+ * @param eventInterval the event interval
+ */
public KafkaEventProducer(final String topic, final String kafkaServerAddress, final int eventCount,
final boolean xmlEvents, final long eventInterval) {
this.topic = topic;
@@ -56,6 +67,9 @@ public class KafkaEventProducer implements Runnable {
producerThread.start();
}
+ /* (non-Javadoc)
+ * @see java.lang.Runnable#run()
+ */
@Override
public void run() {
final Properties kafkaProducerProperties = new Properties();
@@ -82,10 +96,18 @@ public class KafkaEventProducer implements Runnable {
producer.close(1000, TimeUnit.MILLISECONDS);
}
+ /**
+ * Send events.
+ */
public void sendEvents() {
sendEventsFlag = true;
}
+ /**
+ * Send events to topic.
+ *
+ * @param producer the producer
+ */
private void sendEventsToTopic(final Producer<String, String> producer) {
System.out.println(KafkaEventProducer.class.getCanonicalName() + ": sending events to Kafka server at "
+ kafkaServerAddress + ", event count " + eventCount + ", xmlEvents " + xmlEvents);
@@ -109,10 +131,18 @@ public class KafkaEventProducer implements Runnable {
System.out.println(KafkaEventProducer.class.getCanonicalName() + ": completed");
}
+ /**
+ * Gets the events sent count.
+ *
+ * @return the events sent count
+ */
public long getEventsSentCount() {
return eventsSentCount;
}
+ /**
+ * Shutdown.
+ */
public void shutdown() {
System.out.println(KafkaEventProducer.class.getCanonicalName() + ": stopping");
@@ -125,6 +155,11 @@ public class KafkaEventProducer implements Runnable {
System.out.println(KafkaEventProducer.class.getCanonicalName() + ": stopped");
}
+ /**
+ * The main method.
+ *
+ * @param args the arguments
+ */
public static void main(final String[] args) {
if (args.length != 5) {
System.err.println("usage KafkaEventProducer topic kafkaServerAddress #events XML|JSON eventInterval");
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/kafka/KafkaEventSubscriber.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/KafkaEventSubscriber.java
index 8bdc56dda..4b6a62e28 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/kafka/KafkaEventSubscriber.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/KafkaEventSubscriber.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.kafka;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.kafka;
import java.util.Arrays;
import java.util.Properties;
@@ -30,6 +30,8 @@ import org.onap.policy.apex.core.infrastructure.messaging.MessagingException;
import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
/**
+ * The Class KafkaEventSubscriber.
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public class KafkaEventSubscriber implements Runnable {
@@ -41,6 +43,13 @@ public class KafkaEventSubscriber implements Runnable {
Thread subscriberThread;
+ /**
+ * Instantiates a new kafka event subscriber.
+ *
+ * @param topic the topic
+ * @param kafkaServerAddress the kafka server address
+ * @throws MessagingException the messaging exception
+ */
public KafkaEventSubscriber(final String topic, final String kafkaServerAddress) throws MessagingException {
this.topic = topic;
this.kafkaServerAddress = kafkaServerAddress;
@@ -61,6 +70,9 @@ public class KafkaEventSubscriber implements Runnable {
subscriberThread.start();
}
+ /* (non-Javadoc)
+ * @see java.lang.Runnable#run()
+ */
@Override
public void run() {
System.out.println(KafkaEventSubscriber.class.getCanonicalName() + ": receiving events from Kafka server at "
@@ -85,10 +97,18 @@ public class KafkaEventSubscriber implements Runnable {
System.out.println(KafkaEventSubscriber.class.getCanonicalName() + ": event reception completed");
}
+ /**
+ * Gets the events received count.
+ *
+ * @return the events received count
+ */
public long getEventsReceivedCount() {
return eventsReceivedCount;
}
+ /**
+ * Shutdown.
+ */
public void shutdown() {
subscriberThread.interrupt();
@@ -101,6 +121,12 @@ public class KafkaEventSubscriber implements Runnable {
}
+ /**
+ * The main method.
+ *
+ * @param args the arguments
+ * @throws MessagingException the messaging exception
+ */
public static void main(final String[] args) throws MessagingException {
if (args.length != 2) {
System.err.println("usage KafkaEventSubscriber topic kafkaServerAddress");
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/kafka/TestKafka2Kafka.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/TestKafka2Kafka.java
index c95498a05..e70a597c2 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/kafka/TestKafka2Kafka.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/TestKafka2Kafka.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.kafka;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.kafka;
import static org.junit.Assert.assertEquals;
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/kafka/TestKafkaXMLEventProducer.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/TestKafkaXmlEventProducer.java
index 80b4aef55..2b16d71d4 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/kafka/TestKafkaXMLEventProducer.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/kafka/TestKafkaXmlEventProducer.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.kafka;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.kafka;
import java.util.Properties;
@@ -29,10 +29,17 @@ import org.onap.policy.apex.plugins.event.protocol.xml.jaxb.XMLApexEvent;
import org.onap.policy.apex.plugins.event.protocol.xml.jaxb.XMLApexEventData;
/**
+ * The Class TestKafkaXmlEventProducer.
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
-public class TestKafkaXMLEventProducer {
+public class TestKafkaXmlEventProducer {
+ /**
+ * The main method.
+ *
+ * @param args the arguments
+ */
public static void main(final String[] args) {
final Properties props = new Properties();
props.put("bootstrap.servers", "localhost:49092");
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/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 dd3f15ab6..d681fd471 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restclient/TestFile2REST.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestFile2Rest.java
@@ -18,11 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.restclient;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.restclient;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import com.google.gson.Gson;
+
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
@@ -44,10 +46,10 @@ import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.service.engine.main.ApexMain;
-import com.google.gson.Gson;
-
-
-public class TestFile2REST {
+/**
+ * The Class TestFile2Rest.
+ */
+public class TestFile2Rest {
private static final String BASE_URI = "http://localhost:32801/TestFile2Rest";
private static HttpServer server;
@@ -57,9 +59,14 @@ public class TestFile2REST {
private final PrintStream stdout = System.out;
private final PrintStream stderr = System.err;
+ /**
+ * Sets the up.
+ *
+ * @throws Exception the exception
+ */
@BeforeClass
public static void setUp() throws Exception {
- final ResourceConfig rc = new ResourceConfig(TestRESTClientEndpoint.class);
+ final ResourceConfig rc = new ResourceConfig(TestRestClientEndpoint.class);
server = GrizzlyHttpServerFactory.createHttpServer(URI.create(BASE_URI), rc);
while (!server.isStarted()) {
@@ -67,23 +74,36 @@ public class TestFile2REST {
}
}
+ /**
+ * Tear down.
+ *
+ * @throws Exception the exception
+ */
@AfterClass
public static void tearDown() throws Exception {
server.shutdown();
}
+ /**
+ * Test file events post.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
public void testFileEventsPost() throws MessagingException, ApexException, IOException {
final Client client = ClientBuilder.newClient();
- final String[] args = {"src/test/resources/prodcons/File2RESTJsonEventPost.json"};
+ final String[] args =
+ { "src/test/resources/prodcons/File2RESTJsonEventPost.json" };
final ApexMain apexMain = new ApexMain(args);
// Wait for the required amount of events to be received or for 10 seconds
for (int i = 0; i < 100; i++) {
ThreadUtilities.sleep(100);
final Response response = client.target("http://localhost:32801/TestFile2Rest/apex/event/Stats")
- .request("application/json").get();
+ .request("application/json").get();
assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
final String responseString = response.readEntity(String.class);
@@ -98,9 +118,17 @@ public class TestFile2REST {
apexMain.shutdown();
}
+ /**
+ * Test file events put.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
public void testFileEventsPut() throws MessagingException, ApexException, IOException {
- final String[] args = {"src/test/resources/prodcons/File2RESTJsonEventPut.json"};
+ final String[] args =
+ { "src/test/resources/prodcons/File2RESTJsonEventPut.json" };
final ApexMain apexMain = new ApexMain(args);
final Client client = ClientBuilder.newClient();
@@ -109,7 +137,7 @@ public class TestFile2REST {
for (int i = 0; i < 100; i++) {
ThreadUtilities.sleep(100);
final Response response = client.target("http://localhost:32801/TestFile2Rest/apex/event/Stats")
- .request("application/json").get();
+ .request("application/json").get();
assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
final String responseString = response.readEntity(String.class);
@@ -124,12 +152,20 @@ public class TestFile2REST {
apexMain.shutdown();
}
+ /**
+ * Test file events no url.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
- public void testFileEventsNoURL() throws MessagingException, ApexException, IOException {
+ public void testFileEventsNoUrl() throws MessagingException, ApexException, IOException {
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);
@@ -143,12 +179,20 @@ public class TestFile2REST {
assertTrue(outString.contains(" no URL has been set for event sending on REST client"));
}
+ /**
+ * Test file events bad url.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
- public void testFileEventsBadURL() throws MessagingException, ApexException, IOException {
+ public void testFileEventsBadUrl() throws MessagingException, ApexException, IOException {
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(200);
@@ -160,15 +204,23 @@ public class TestFile2REST {
System.setErr(stderr);
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"));
}
+ /**
+ * Test file events bad http method.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
- public void testFileEventsBadHTTPMethod() throws MessagingException, ApexException, IOException {
+ public void testFileEventsBadHttpMethod() throws MessagingException, ApexException, IOException {
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);
@@ -180,15 +232,24 @@ public class TestFile2REST {
System.setErr(stderr);
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"));
+ "specified HTTP method of \"DELETE\" is invalid, only HTTP methods \"POST\" and \"PUT\" "
+ + "are supproted for event sending on REST client producer"));
}
+ /**
+ * Test file events bad response.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
public void testFileEventsBadResponse() throws MessagingException, ApexException, IOException {
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(500);
@@ -200,6 +261,6 @@ public class TestFile2REST {
System.setErr(stderr);
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/apps/uservice/test/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 922e03217..ec41de5fb 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restclient/TestREST2File.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestRest2File.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.restclient;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.restclient;
import static org.junit.Assert.assertTrue;
@@ -41,8 +41,10 @@ import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.model.utilities.TextFileUtils;
import org.onap.policy.apex.service.engine.main.ApexMain;
-
-public class TestREST2File {
+/**
+ * The Class TestRest2File.
+ */
+public class TestRest2File {
private static final String BASE_URI = "http://localhost:32801/TestRest2File";
private HttpServer server;
@@ -53,9 +55,14 @@ public class TestREST2File {
private final PrintStream stdout = System.out;
private final PrintStream stderr = System.err;
+ /**
+ * Sets the up.
+ *
+ * @throws Exception the exception
+ */
@Before
public void setUp() throws Exception {
- final ResourceConfig rc = new ResourceConfig(TestRESTClientEndpoint.class);
+ final ResourceConfig rc = new ResourceConfig(TestRestClientEndpoint.class);
server = GrizzlyHttpServerFactory.createHttpServer(URI.create(BASE_URI), rc);
while (!server.isStarted()) {
@@ -63,19 +70,35 @@ public class TestREST2File {
}
}
+ /**
+ * Tear down.
+ *
+ * @throws Exception the exception
+ */
@After
public void tearDown() throws Exception {
server.shutdown();
}
+ /**
+ * Delete temp files.
+ */
@AfterClass
public static void deleteTempFiles() {
new File("src/test/resources/events/EventsOut.json").delete();
}
+ /**
+ * Test rest events in.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
- public void testRESTEventsIn() throws MessagingException, ApexException, IOException {
- final String[] args = {"src/test/resources/prodcons/REST2FileJsonEvent.json"};
+ public void testRestEventsIn() throws MessagingException, ApexException, IOException {
+ final String[] args =
+ { "src/test/resources/prodcons/REST2FileJsonEvent.json" };
final ApexMain apexMain = new ApexMain(args);
@@ -83,16 +106,24 @@ public class TestREST2File {
apexMain.shutdown();
final String outputEventText = TextFileUtils.getTextFileAsString("src/test/resources/events/EventsOut.json");
- assertTrue(outputEventText.contains(
- "04\",\n" + " \"version\": \"0.0.1\",\n" + " \"nameSpace\": \"org.onap.policy.apex.sample.events\""));
+ assertTrue(outputEventText.contains("04\",\n" + " \"version\": \"0.0.1\",\n"
+ + " \"nameSpace\": \"org.onap.policy.apex.sample.events\""));
}
+ /**
+ * Test file empty events.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
public void testFileEmptyEvents() throws MessagingException, ApexException, IOException {
System.setOut(new PrintStream(outContent));
System.setErr(new PrintStream(errContent));
- final String[] args = {"src/test/resources/prodcons/REST2FileJsonEmptyEvents.json"};
+ final String[] args =
+ { "src/test/resources/prodcons/REST2FileJsonEmptyEvents.json" };
final ApexMain apexMain = new ApexMain(args);
ThreadUtilities.sleep(1000);
@@ -104,15 +135,23 @@ public class TestREST2File {
System.setErr(stderr);
assertTrue(outString.contains(
- "received an empty event from URL \"http://localhost:32801/TestRest2File/apex/event/GetEmptyEvent\""));
+ "received an empty event from URL \"http://localhost:32801/TestRest2File/apex/event/GetEmptyEvent\""));
}
+ /**
+ * Test file events no url.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
- public void testFileEventsNoURL() throws MessagingException, ApexException, IOException {
+ public void testFileEventsNoUrl() throws MessagingException, ApexException, IOException {
System.setOut(new PrintStream(outContent));
System.setErr(new PrintStream(errContent));
- final String[] args = {"src/test/resources/prodcons/REST2FileJsonEventNoURL.json"};
+ final String[] args =
+ { "src/test/resources/prodcons/REST2FileJsonEventNoURL.json" };
final ApexMain apexMain = new ApexMain(args);
ThreadUtilities.sleep(1000);
@@ -126,12 +165,20 @@ public class TestREST2File {
assertTrue(outString.contains(" no URL has been set for event sending on REST client"));
}
+ /**
+ * Test file events bad url.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
- public void testFileEventsBadURL() throws MessagingException, ApexException, IOException {
+ public void testFileEventsBadUrl() throws MessagingException, ApexException, IOException {
System.setOut(new PrintStream(outContent));
System.setErr(new PrintStream(errContent));
- final String[] args = {"src/test/resources/prodcons/REST2FileJsonEventBadURL.json"};
+ final String[] args =
+ { "src/test/resources/prodcons/REST2FileJsonEventBadURL.json" };
final ApexMain apexMain = new ApexMain(args);
ThreadUtilities.sleep(1000);
@@ -143,15 +190,23 @@ public class TestREST2File {
System.setErr(stderr);
assertTrue(outString.contains(
- "reception of event from URL \"http://localhost:32801/TestRest2File/apex/event/Bad\" failed with status code 404"));
+ "reception of event from URL \"http://localhost:32801/TestRest2File/apex/event/Bad\" failed with status code 404"));
}
+ /**
+ * Test file events bad http method.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
- public void testFileEventsBadHTTPMethod() throws MessagingException, ApexException, IOException {
+ public void testFileEventsBadHttpMethod() throws MessagingException, ApexException, IOException {
System.setOut(new PrintStream(outContent));
System.setErr(new PrintStream(errContent));
- final String[] args = {"src/test/resources/prodcons/REST2FileJsonEventBadHTTPMethod.json"};
+ final String[] args =
+ { "src/test/resources/prodcons/REST2FileJsonEventBadHTTPMethod.json" };
final ApexMain apexMain = new ApexMain(args);
ThreadUtilities.sleep(1000);
@@ -162,16 +217,24 @@ public class TestREST2File {
System.setOut(stdout);
System.setErr(stderr);
- assertTrue(outString.contains(
- "specified HTTP method of \"POST\" is invalid, only HTTP method \"GET\" is supported for event reception on REST client consumer"));
+ assertTrue(outString.contains("specified HTTP method of \"POST\" is invalid, "
+ + "only HTTP method \"GET\" is supported for event reception on REST client consumer"));
}
+ /**
+ * Test file events bad response.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
public void testFileEventsBadResponse() throws MessagingException, ApexException, IOException {
System.setOut(new PrintStream(outContent));
System.setErr(new PrintStream(errContent));
- final String[] args = {"src/test/resources/prodcons/REST2FileJsonEventBadResponse.json"};
+ final String[] args =
+ { "src/test/resources/prodcons/REST2FileJsonEventBadResponse.json" };
final ApexMain apexMain = new ApexMain(args);
ThreadUtilities.sleep(1000);
@@ -183,6 +246,6 @@ public class TestREST2File {
System.setErr(stderr);
assertTrue(outString.contains(
- "reception of event from URL \"http://localhost:32801/TestRest2File/apex/event/GetEventBadResponse\" failed with status code 400 and message \"\""));
+ "reception of event from URL \"http://localhost:32801/TestRest2File/apex/event/GetEventBadResponse\" failed with status code 400 and message \"\""));
}
}
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restclient/TestRESTClientEndpoint.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestRestClientEndpoint.java
index 79634ebcb..906b20bf2 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restclient/TestRESTClientEndpoint.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restclient/TestRestClientEndpoint.java
@@ -18,11 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.restclient;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.restclient;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import com.google.gson.Gson;
+
import java.util.Map;
import java.util.Random;
@@ -32,17 +34,22 @@ import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;
-import com.google.gson.Gson;
-
-
+/**
+ * The Class TestRestClientEndpoint.
+ */
@Path("/apex")
-public class TestRESTClientEndpoint {
+public class TestRestClientEndpoint {
private static int postMessagesReceived = 0;
private static int putMessagesReceived = 0;
private static int statMessagesReceived = 0;
private static int getMessagesReceived = 0;
+ /**
+ * Service get stats.
+ *
+ * @return the response
+ */
@Path("/event/Stats")
@GET
public Response serviceGetStats() {
@@ -51,6 +58,11 @@ public class TestRESTClientEndpoint {
+ ",\"POST\": " + postMessagesReceived + ",\"PUT\": " + putMessagesReceived + "}").build();
}
+ /**
+ * Service get event.
+ *
+ * @return the response
+ */
@Path("/event/GetEvent")
@GET
public Response serviceGetEvent() {
@@ -69,18 +81,34 @@ public class TestRESTClientEndpoint {
return Response.status(200).entity(eventString).build();
}
+ /**
+ * Service get empty event.
+ *
+ * @return the response
+ */
@Path("/event/GetEmptyEvent")
@GET
public Response serviceGetEmptyEvent() {
return Response.status(200).build();
}
+ /**
+ * Service get event bad response.
+ *
+ * @return the response
+ */
@Path("/event/GetEventBadResponse")
@GET
public Response serviceGetEventBadResponse() {
return Response.status(400).build();
}
+ /**
+ * Service post request.
+ *
+ * @param jsonString the json string
+ * @return the response
+ */
@Path("/event/PostEvent")
@POST
public Response servicePostRequest(final String jsonString) {
@@ -98,12 +126,24 @@ public class TestRESTClientEndpoint {
+ ",\"POST\": , " + postMessagesReceived + ",\"PUT\": " + putMessagesReceived + "}").build();
}
+ /**
+ * Service post request bad response.
+ *
+ * @param jsonString the json string
+ * @return the response
+ */
@Path("/event/PostEventBadResponse")
@POST
public Response servicePostRequestBadResponse(final String jsonString) {
return Response.status(400).build();
}
+ /**
+ * Service put request.
+ *
+ * @param jsonString the json string
+ * @return the response
+ */
@Path("/event/PutEvent")
@PUT
public Response servicePutRequest(final String jsonString) {
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restserver/TestRESTServer.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restserver/TestRestServer.java
index 15928b3c7..59cc2ceea 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restserver/TestRESTServer.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restserver/TestRestServer.java
@@ -18,11 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.restserver;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.restserver;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import com.google.gson.Gson;
+
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
@@ -40,10 +42,10 @@ import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.service.engine.main.ApexMain;
-import com.google.gson.Gson;
-
-
-public class TestRESTServer {
+/**
+ * The Class TestRestServer.
+ */
+public class TestRestServer {
private final ByteArrayOutputStream outContent = new ByteArrayOutputStream();
private final ByteArrayOutputStream errContent = new ByteArrayOutputStream();
@@ -52,16 +54,24 @@ public class TestRESTServer {
private static int eventsSent = 0;
+ /**
+ * Test rest server put.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
- public void testRESTServerPut() throws MessagingException, ApexException, IOException {
- final String[] args = {"src/test/resources/prodcons/RESTServerJsonEvent.json"};
+ public void testRestServerPut() throws MessagingException, ApexException, IOException {
+ final String[] args =
+ { "src/test/resources/prodcons/RESTServerJsonEvent.json" };
final ApexMain apexMain = new ApexMain(args);
final Client client = ClientBuilder.newClient();
for (int i = 0; i < 20; i++) {
final Response response = client.target("http://localhost:23324/apex/FirstConsumer/EventIn")
- .request("application/json").put(Entity.json(getEvent()));
+ .request("application/json").put(Entity.json(getEvent()));
assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
final String responseString = response.readEntity(String.class);
@@ -75,16 +85,24 @@ public class TestRESTServer {
apexMain.shutdown();
}
+ /**
+ * Test rest server post.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
- public void testRESTServerPost() throws MessagingException, ApexException, IOException {
- final String[] args = {"src/test/resources/prodcons/RESTServerJsonEvent.json"};
+ public void testRestServerPost() throws MessagingException, ApexException, IOException {
+ final String[] args =
+ { "src/test/resources/prodcons/RESTServerJsonEvent.json" };
final ApexMain apexMain = new ApexMain(args);
final Client client = ClientBuilder.newClient();
for (int i = 0; i < 20; i++) {
final Response response = client.target("http://localhost:23324/apex/FirstConsumer/EventIn")
- .request("application/json").post(Entity.json(getEvent()));
+ .request("application/json").post(Entity.json(getEvent()));
assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
final String responseString = response.readEntity(String.class);
@@ -98,9 +116,17 @@ public class TestRESTServer {
apexMain.shutdown();
}
+ /**
+ * Test rest server get status.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
- public void testRESTServerGetStatus() throws MessagingException, ApexException, IOException {
- final String[] args = {"src/test/resources/prodcons/RESTServerJsonEvent.json"};
+ public void testRestServerGetStatus() throws MessagingException, ApexException, IOException {
+ final String[] args =
+ { "src/test/resources/prodcons/RESTServerJsonEvent.json" };
final ApexMain apexMain = new ApexMain(args);
final Client client = ClientBuilder.newClient();
@@ -108,39 +134,47 @@ public class TestRESTServer {
// trigger 10 POST & PUT events
for (int i = 0; i < 10; i++) {
final Response postResponse = client.target("http://localhost:23324/apex/FirstConsumer/EventIn")
- .request("application/json").post(Entity.json(getEvent()));
+ .request("application/json").post(Entity.json(getEvent()));
final Response putResponse = client.target("http://localhost:23324/apex/FirstConsumer/EventIn")
- .request("application/json").put(Entity.json(getEvent()));
+ .request("application/json").put(Entity.json(getEvent()));
assertEquals(Response.Status.OK.getStatusCode(), postResponse.getStatus());
assertEquals(Response.Status.OK.getStatusCode(), putResponse.getStatus());
}
- final Response statResponse =
- client.target("http://localhost:23324/apex/FirstConsumer/Status").request("application/json").get();
+ final Response statResponse = client.target("http://localhost:23324/apex/FirstConsumer/Status")
+ .request("application/json").get();
assertEquals(Response.Status.OK.getStatusCode(), statResponse.getStatus());
final String responseString = statResponse.readEntity(String.class);
@SuppressWarnings("unchecked")
final Map<String, Object> jsonMap = new Gson().fromJson(responseString, Map.class);
- assertEquals("[FirstConsumer]", jsonMap.get("INPUTS"));
+ assertEquals("[FirstConsumer", ((String)jsonMap.get("INPUTS")).substring(0, 14));
assertEquals(1.0, jsonMap.get("STAT"));
- assertEquals(10.0, jsonMap.get("POST"));
- assertEquals(10.0, jsonMap.get("PUT"));
+ assertTrue((double)jsonMap.get("POST") >= 10.0);
+ assertTrue((double)jsonMap.get("PUT") >= 10.0);
apexMain.shutdown();
}
+ /**
+ * Test rest server multi inputs.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
- public void testRESTServerMultiInputs() throws MessagingException, ApexException, IOException {
- final String[] args = {"src/test/resources/prodcons/RESTServerJsonEventMultiIn.json"};
+ public void testRestServerMultiInputs() throws MessagingException, ApexException, IOException {
+ final String[] args =
+ { "src/test/resources/prodcons/RESTServerJsonEventMultiIn.json" };
final ApexMain apexMain = new ApexMain(args);
final Client client = ClientBuilder.newClient();
for (int i = 0; i < 20; i++) {
final Response firstResponse = client.target("http://localhost:23324/apex/FirstConsumer/EventIn")
- .request("application/json").post(Entity.json(getEvent()));
+ .request("application/json").post(Entity.json(getEvent()));
assertEquals(Response.Status.OK.getStatusCode(), firstResponse.getStatus());
final String firstResponseString = firstResponse.readEntity(String.class);
@@ -151,7 +185,7 @@ public class TestRESTServer {
assertEquals("Test slogan for External Event0", firstJsonMap.get("TestSlogan"));
final Response secondResponse = client.target("http://localhost:23324/apex/SecondConsumer/EventIn")
- .request("application/json").post(Entity.json(getEvent()));
+ .request("application/json").post(Entity.json(getEvent()));
assertEquals(Response.Status.OK.getStatusCode(), secondResponse.getStatus());
final String secondResponseString = secondResponse.readEntity(String.class);
@@ -165,12 +199,20 @@ public class TestRESTServer {
apexMain.shutdown();
}
+ /**
+ * Test rest server producer standalone.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
- public void testRESTServerProducerStandalone() throws MessagingException, ApexException, IOException {
+ public void testRestServerProducerStandalone() throws MessagingException, ApexException, IOException {
System.setOut(new PrintStream(outContent));
System.setErr(new PrintStream(errContent));
- final String[] args = {"src/test/resources/prodcons/RESTServerJsonEventProducerStandalone.json"};
+ final String[] args =
+ { "src/test/resources/prodcons/RESTServerJsonEventProducerStandalone.json" };
final ApexMain apexMain = new ApexMain(args);
ThreadUtilities.sleep(200);
@@ -181,16 +223,24 @@ public class TestRESTServer {
System.setOut(stdout);
System.setErr(stderr);
- assertTrue(outString
- .contains("the parameters \"host\", \"port\", and \"standalone\" are illegal on REST Server producer"));
+ assertTrue(outString.contains(
+ "the parameters \"host\", \"port\", and \"standalone\" are illegal on REST Server producer"));
}
+ /**
+ * Test rest server producer host.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
- public void testRESTServerProducerHost() throws MessagingException, ApexException, IOException {
+ public void testRestServerProducerHost() throws MessagingException, ApexException, IOException {
System.setOut(new PrintStream(outContent));
System.setErr(new PrintStream(errContent));
- final String[] args = {"src/test/resources/prodcons/RESTServerJsonEventProducerHost.json"};
+ final String[] args =
+ { "src/test/resources/prodcons/RESTServerJsonEventProducerHost.json" };
final ApexMain apexMain = new ApexMain(args);
ThreadUtilities.sleep(200);
@@ -204,12 +254,20 @@ public class TestRESTServer {
assertTrue(outString.contains(" host is specified only in standalone mode"));
}
+ /**
+ * Test rest server producer port.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
- public void testRESTServerProducerPort() throws MessagingException, ApexException, IOException {
+ public void testRestServerProducerPort() throws MessagingException, ApexException, IOException {
System.setOut(new PrintStream(outContent));
System.setErr(new PrintStream(errContent));
- final String[] args = {"src/test/resources/prodcons/RESTServerJsonEventProducerPort.json"};
+ final String[] args =
+ { "src/test/resources/prodcons/RESTServerJsonEventProducerPort.json" };
final ApexMain apexMain = new ApexMain(args);
ThreadUtilities.sleep(200);
@@ -223,12 +281,20 @@ public class TestRESTServer {
assertTrue(outString.contains(" port is specified only in standalone mode"));
}
+ /**
+ * Test rest server consumer standalone no host.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
- public void testRESTServerConsumerStandaloneNoHost() throws MessagingException, ApexException, IOException {
+ public void testRestServerConsumerStandaloneNoHost() throws MessagingException, ApexException, IOException {
System.setOut(new PrintStream(outContent));
System.setErr(new PrintStream(errContent));
- final String[] args = {"src/test/resources/prodcons/RESTServerJsonEventConsumerStandaloneNoHost.json"};
+ final String[] args =
+ { "src/test/resources/prodcons/RESTServerJsonEventConsumerStandaloneNoHost.json" };
final ApexMain apexMain = new ApexMain(args);
ThreadUtilities.sleep(200);
@@ -239,16 +305,24 @@ public class TestRESTServer {
System.setOut(stdout);
System.setErr(stderr);
- assertTrue(outString.contains(
- "the parameters \"host\" and \"port\" must be defined for REST Server consumer (FirstConsumer) in standalone mode"));
+ assertTrue(outString.contains("the parameters \"host\" and \"port\" must be defined for REST Server consumer "
+ + "(FirstConsumer) in standalone mode"));
}
+ /**
+ * Test rest server consumer standalone no port.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
- public void testRESTServerConsumerStandaloneNoPort() throws MessagingException, ApexException, IOException {
+ public void testRestServerConsumerStandaloneNoPort() throws MessagingException, ApexException, IOException {
System.setOut(new PrintStream(outContent));
System.setErr(new PrintStream(errContent));
- final String[] args = {"src/test/resources/prodcons/RESTServerJsonEventConsumerStandaloneNoPort.json"};
+ final String[] args =
+ { "src/test/resources/prodcons/RESTServerJsonEventConsumerStandaloneNoPort.json" };
final ApexMain apexMain = new ApexMain(args);
ThreadUtilities.sleep(200);
@@ -259,16 +333,24 @@ public class TestRESTServer {
System.setOut(stdout);
System.setErr(stderr);
- assertTrue(outString.contains(
- "the parameters \"host\" and \"port\" must be defined for REST Server consumer (FirstConsumer) in standalone mode"));
+ assertTrue(outString.contains("the parameters \"host\" and \"port\" must be defined for REST Server consumer "
+ + "(FirstConsumer) in standalone mode"));
}
+ /**
+ * Test rest server producer not sync.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
- public void testRESTServerProducerNotSync() throws MessagingException, ApexException, IOException {
+ public void testRestServerProducerNotSync() throws MessagingException, ApexException, IOException {
System.setOut(new PrintStream(outContent));
System.setErr(new PrintStream(errContent));
- final String[] args = {"src/test/resources/prodcons/RESTServerJsonEventProducerNotSync.json"};
+ final String[] args =
+ { "src/test/resources/prodcons/RESTServerJsonEventProducerNotSync.json" };
final ApexMain apexMain = new ApexMain(args);
ThreadUtilities.sleep(200);
@@ -279,16 +361,24 @@ public class TestRESTServer {
System.setOut(stdout);
System.setErr(stderr);
- assertTrue(outString.contains(
- "REST Server producer (FirstProducer) must run in synchronous mode with a REST Server consumer"));
+ assertTrue(outString.contains("REST Server producer (FirstProducer) must run in synchronous mode "
+ + "with a REST Server consumer"));
}
+ /**
+ * Test rest server consumer not sync.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
- public void testRESTServerConsumerNotSync() throws MessagingException, ApexException, IOException {
+ public void testRestServerConsumerNotSync() throws MessagingException, ApexException, IOException {
System.setOut(new PrintStream(outContent));
System.setErr(new PrintStream(errContent));
- final String[] args = {"src/test/resources/prodcons/RESTServerJsonEventConsumerNotSync.json"};
+ final String[] args =
+ { "src/test/resources/prodcons/RESTServerJsonEventConsumerNotSync.json" };
final ApexMain apexMain = new ApexMain(args);
ThreadUtilities.sleep(200);
@@ -299,20 +389,29 @@ public class TestRESTServer {
System.setOut(stdout);
System.setErr(stderr);
- assertTrue(outString.contains(
- "peer \"FirstConsumer for peered mode SYNCHRONOUS does not exist or is not defined with the same peered mode"));
+ assertTrue(outString
+ .contains("peer \"FirstConsumer for peered mode SYNCHRONOUS does not exist or is not defined "
+ + "with the same peered mode"));
}
+ /**
+ * Test rest server divide by zero.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
- public void testRESTServerDivideByZero() throws MessagingException, ApexException, IOException {
- final String[] args = {"src/test/resources/prodcons/RESTServerJsonEventDivideByZero.json"};
+ public void testRestServerDivideByZero() throws MessagingException, ApexException, IOException {
+ final String[] args =
+ { "src/test/resources/prodcons/RESTServerJsonEventDivideByZero.json" };
final ApexMain apexMain = new ApexMain(args);
final Client client = ClientBuilder.newClient();
for (int i = 0; i < 20; i++) {
final Response response = client.target("http://localhost:23324/apex/FirstConsumer/EventIn")
- .request("application/json").put(Entity.json(getEvent()));
+ .request("application/json").put(Entity.json(getEvent()));
assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
final String responseString = response.readEntity(String.class);
@@ -327,16 +426,21 @@ public class TestRESTServer {
apexMain.shutdown();
}
+ /**
+ * Gets the event.
+ *
+ * @return the event
+ */
private String getEvent() {
final Random rand = new Random();
final int nextMatchCase = rand.nextInt(4);
final String nextEventName = "Event0" + rand.nextInt(2) + "00";
final String eventString = "{\n" + "\"nameSpace\": \"org.onap.policy.apex.sample.events\",\n" + "\"name\": \""
- + nextEventName + "\",\n" + "\"version\": \"0.0.1\",\n" + "\"source\": \"REST_" + eventsSent++ + "\",\n"
- + "\"target\": \"apex\",\n" + "\"TestSlogan\": \"Test slogan for External Event0\",\n"
- + "\"TestMatchCase\": " + nextMatchCase + ",\n" + "\"TestTimestamp\": " + System.currentTimeMillis()
- + ",\n" + "\"TestTemperature\": 9080.866\n" + "}";
+ + nextEventName + "\",\n" + "\"version\": \"0.0.1\",\n" + "\"source\": \"REST_" + eventsSent++
+ + "\",\n" + "\"target\": \"apex\",\n" + "\"TestSlogan\": \"Test slogan for External Event0\",\n"
+ + "\"TestMatchCase\": " + nextMatchCase + ",\n" + "\"TestTimestamp\": "
+ + System.currentTimeMillis() + ",\n" + "\"TestTemperature\": 9080.866\n" + "}";
return eventString;
}
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restserver/TestRESTServerVPNContext.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restserver/TestRestServerVpnContext.java
index cb52dd50b..1791033e6 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/restserver/TestRESTServerVPNContext.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/restserver/TestRestServerVpnContext.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.restserver;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.restserver;
import static org.junit.Assert.assertEquals;
@@ -37,12 +37,12 @@ import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.service.engine.main.ApexMain;
-public class TestRESTServerVPNContext {
+public class TestRestServerVpnContext {
private static int eventsSent = 0;
@Ignore
@Test
- public void testRESTServerPut() throws MessagingException, ApexException, IOException {
+ public void testRestServerPut() throws MessagingException, ApexException, IOException {
final String[] args = {"src/test/resources/prodcons/RESTServerJsonEventContextJava.json"};
final ApexMain apexMain = new ApexMain(args);
@@ -79,7 +79,7 @@ public class TestRESTServerVPNContext {
@Ignore
@Test
- public void testRESTServerPutAvro() throws MessagingException, ApexException, IOException {
+ public void testRestServerPutAvro() throws MessagingException, ApexException, IOException {
final String[] args = {"src/test/resources/prodcons/RESTServerJsonEventContextAvro.json"};
final ApexMain apexMain = new ApexMain(args);
@@ -123,12 +123,12 @@ public class TestRESTServerVPNContext {
return eventString;
}
- private String setupCustomerContext(final String customerName, final String linkList, final int slaDT,
- final int ytdDT) {
+ private String setupCustomerContext(final String customerName, final String linkList, final int slaDt,
+ final int ytdDt) {
final String eventString = "{\n" + "\"nameSpace\": \"org.onap.policy.apex.domains.vpn.events\",\n"
+ "\"name\": \"VPNCustomerCtxtTriggerEvent\",\n" + "\"version\": \"0.0.1\",\n" + "\"source\": \"REST_"
+ eventsSent++ + "\",\n" + "\"target\": \"apex\",\n" + "\"CustomerName\": \"" + customerName + "\",\n"
- + "\"LinkList\": \"" + linkList + "\",\n" + "\"SlaDT\": \"" + slaDT + "\",\n" + "\"YtdDT\": " + ytdDT
+ + "\"LinkList\": \"" + linkList + "\",\n" + "\"SlaDT\": \"" + slaDt + "\",\n" + "\"YtdDT\": " + ytdDt
+ "\n" + "}";
return eventString;
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/sampletypes/Foo.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/sampletypes/Foo.java
index da075b6a2..2d6ab4629 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/sampletypes/Foo.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/sampletypes/Foo.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.sampletypes;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.sampletypes;
public class Foo {
private String bar;
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/sampletypes/FooMap.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/sampletypes/FooMap.java
index 9adaf6dae..af09e5a3b 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/sampletypes/FooMap.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/sampletypes/FooMap.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.sampletypes;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.sampletypes;
import java.util.LinkedHashMap;
import java.util.Map;
@@ -42,7 +42,7 @@ public class FooMap extends LinkedHashMap<String, String> {
super(initialCapacity);
}
- public FooMap(final Map<? extends String, ? extends String> m) {
- super(m);
+ public FooMap(final Map<? extends String, ? extends String> map) {
+ super(map);
}
}
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/TestWs2WsClient.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/TestWs2WsClient.java
index 52e896438..c2db95860 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/TestWs2WsClient.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/TestWs2WsClient.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.websocket;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.websocket;
import static org.junit.Assert.assertEquals;
@@ -35,18 +35,18 @@ public class TestWs2WsClient {
private static final int EVENT_INTERVAL = 20;
@Test
- public void testJsonWSEvents() throws MessagingException, ApexException {
+ public void testJsonWsEvents() throws MessagingException, ApexException {
final String[] args = {"src/test/resources/prodcons/Ws2WsClientJsonEvent.json"};
- testWSEvents(args, false);
+ testWsEvents(args, false);
}
@Test
- public void testXMLWSEvents() throws MessagingException, ApexException {
+ public void testXmlWsEvents() throws MessagingException, ApexException {
final String[] args = {"src/test/resources/prodcons/Ws2WsClientXMLEvent.json"};
- testWSEvents(args, true);
+ testWsEvents(args, true);
}
- private void testWSEvents(final String[] args, final Boolean xmlEvents) throws MessagingException, ApexException {
+ private void testWsEvents(final String[] args, final Boolean xmlEvents) throws MessagingException, ApexException {
final WebSocketEventSubscriberServer subServer = new WebSocketEventSubscriberServer(42453);
final WebSocketEventProducerServer prodServer =
new WebSocketEventProducerServer(42451, EVENT_COUNT, xmlEvents, EVENT_INTERVAL);
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/TestWs2WsServer.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/TestWs2WsServer.java
index 86f6ee123..34871e3c6 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/TestWs2WsServer.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/TestWs2WsServer.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.websocket;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.websocket;
import static org.junit.Assert.assertEquals;
@@ -28,25 +28,48 @@ import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.service.engine.main.ApexMain;
+/**
+ * The Class TestWs2WsServer.
+ */
public class TestWs2WsServer {
private static final long MAX_TEST_LENGTH = 10000;
private static final int EVENT_COUNT = 100;
private static final int EVENT_INTERVAL = 20;
+ /**
+ * Test json ws events.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ */
@Test
- public void testJsonWSEvents() throws MessagingException, ApexException {
+ public void testJsonWsEvents() throws MessagingException, ApexException {
final String[] args = {"src/test/resources/prodcons/Ws2WsServerJsonEvent.json"};
- testWSEvents(args, false);
+ testWsEvents(args, false);
}
+ /**
+ * Test xml ws events.
+ *
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ */
@Test
- public void testXMLWSEvents() throws MessagingException, ApexException {
+ public void testXmlWsEvents() throws MessagingException, ApexException {
final String[] args = {"src/test/resources/prodcons/Ws2WsServerXMLEvent.json"};
- testWSEvents(args, true);
+ testWsEvents(args, true);
}
- public void testWSEvents(final String[] args, final boolean xmlEvents) throws MessagingException, ApexException {
+ /**
+ * Test ws events.
+ *
+ * @param args the args
+ * @param xmlEvents the xml events
+ * @throws MessagingException the messaging exception
+ * @throws ApexException the apex exception
+ */
+ public void testWsEvents(final String[] args, final boolean xmlEvents) throws MessagingException, ApexException {
final ApexMain apexMain = new ApexMain(args);
final WebSocketEventSubscriberClient subClient = new WebSocketEventSubscriberClient("localhost", 42452);
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventProducerClient.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventProducerClient.java
index fd78ba5c0..84a337362 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventProducerClient.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventProducerClient.java
@@ -18,13 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.websocket;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.websocket;
-import org.onap.policy.apex.apps.uservice.test.adapt.events.EventGenerator;
import org.onap.policy.apex.core.infrastructure.messaging.MessagingException;
import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStringMessageClient;
import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStringMessageListener;
import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
+import org.onap.policy.apex.testsuites.integration.uservice.adapt.events.EventGenerator;
/**
* The Class WebSocketEventProducerClient.
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventProducerServer.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventProducerServer.java
index 53aa0cab4..3e5ff714e 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventProducerServer.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventProducerServer.java
@@ -18,13 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.websocket;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.websocket;
-import org.onap.policy.apex.apps.uservice.test.adapt.events.EventGenerator;
import org.onap.policy.apex.core.infrastructure.messaging.MessagingException;
import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStringMessageListener;
import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStringMessageServer;
import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
+import org.onap.policy.apex.testsuites.integration.uservice.adapt.events.EventGenerator;
/**
* The Class WebSocketEventProducerServer.
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventSubscriberClient.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventSubscriberClient.java
index 27a34a92e..6477a0dc9 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventSubscriberClient.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventSubscriberClient.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.websocket;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.websocket;
import org.onap.policy.apex.core.infrastructure.messaging.MessagingException;
import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStringMessageClient;
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventSubscriberServer.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventSubscriberServer.java
index 854a0e410..92329236f 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/adapt/websocket/WebSocketEventSubscriberServer.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventSubscriberServer.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.adapt.websocket;
+package org.onap.policy.apex.testsuites.integration.uservice.adapt.websocket;
import org.onap.policy.apex.core.infrastructure.messaging.MessagingException;
import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStringMessageListener;
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/context/EventAlbumContextTest.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/context/EventAlbumContextTest.java
index 8f9aa6cee..757a48302 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/context/EventAlbumContextTest.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/context/EventAlbumContextTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.context;
+package org.onap.policy.apex.testsuites.integration.uservice.context;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/engdep/EngDepMessagingTest.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engdep/EngDepMessagingTest.java
index 187a2a316..a306b536e 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/engdep/EngDepMessagingTest.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engdep/EngDepMessagingTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.engdep;
+package org.onap.policy.apex.testsuites.integration.uservice.engdep;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -45,7 +45,7 @@ import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
import org.onap.policy.apex.plugins.executor.mvel.MvelExecutorParameters;
import org.onap.policy.apex.service.engine.event.ApexEvent;
import org.onap.policy.apex.service.parameters.engineservice.EngineServiceParameters;
-import org.onap.policy.apex.test.common.model.SampleDomainModelFactory;
+import org.onap.policy.apex.testsuites.integration.common.model.SampleDomainModelFactory;
import org.onap.policy.common.parameters.ParameterService;
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
@@ -67,15 +67,18 @@ public class EngDepMessagingTest {
private ContextParameters contextParameters;
private EngineServiceParameters engineServiceParameters;
+ /**
+ * Before test.
+ */
@Before
public void beforeTest() {
schemaParameters = new SchemaParameters();
-
+
schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME);
schemaParameters.getSchemaHelperParameterMap().put("JAVA", new JavaSchemaHelperParameters());
- ParameterService.register(schemaParameters);
-
+ ParameterService.register(schemaParameters, true);
+
contextParameters = new ContextParameters();
contextParameters.setName(ContextParameterConstants.MAIN_GROUP_NAME);
@@ -83,23 +86,27 @@ public class EngDepMessagingTest {
contextParameters.getLockManagerParameters().setName(ContextParameterConstants.LOCKING_GROUP_NAME);
contextParameters.getPersistorParameters().setName(ContextParameterConstants.PERSISTENCE_GROUP_NAME);
- ParameterService.register(contextParameters);
+ ParameterService.register(contextParameters, true);
ParameterService.register(contextParameters.getDistributorParameters());
ParameterService.register(contextParameters.getLockManagerParameters());
ParameterService.register(contextParameters.getPersistorParameters());
-
+
engineServiceParameters = new EngineServiceParameters();
engineServiceParameters.setName("EngDepMessagingTest");
engineServiceParameters.setVersion("0.0.1");
engineServiceParameters.setDeploymentPort(58820);
engineServiceParameters.setInstanceCount(3);
engineServiceParameters.setId(100);
- engineServiceParameters.getEngineParameters().getExecutorParameterMap().put("MVEL", new MvelExecutorParameters());
+ engineServiceParameters.getEngineParameters().getExecutorParameterMap().put("MVEL",
+ new MvelExecutorParameters());
ParameterService.register(engineServiceParameters);
ParameterService.register(engineServiceParameters.getEngineParameters());
}
+ /**
+ * After test.
+ */
@After
public void afterTest() {
ParameterService.deregister(engineServiceParameters);
@@ -158,13 +165,13 @@ public class EngDepMessagingTest {
eventDataMap.put("TestTimestamp", testStartTime.getTime());
eventDataMap.put("TestTemperature", 34.5445667);
- final ApexEvent event0 =
- new ApexEvent("Event0000", "0.0.1", "org.onap.policy.apex.domains.sample.events", "apex", "test");
+ final ApexEvent event0 = new ApexEvent("Event0000", "0.0.1", "org.onap.policy.apex.domains.sample.events",
+ "apex", "test");
event0.putAll(eventDataMap);
server.sendEvent(event0);
- final ApexEvent event1 =
- new ApexEvent("Event0100", "0.0.1", "org.onap.policy.apex.domains.sample.events", "apex", "test");
+ final ApexEvent event1 = new ApexEvent("Event0100", "0.0.1", "org.onap.policy.apex.domains.sample.events",
+ "apex", "test");
event1.putAll(eventDataMap);
server.sendEvent(event1);
@@ -215,5 +222,6 @@ public class EngDepMessagingTest {
* @throws Exception the exception
*/
@After
- public void tearDown() throws Exception {}
+ public void tearDown() throws Exception {
+ }
}
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/engdep/EngineTestServer.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engdep/EngineTestServer.java
index 1a8b1d364..9e6ff67ca 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/apps/uservice/test/engdep/EngineTestServer.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engdep/EngineTestServer.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.apps.uservice.test.engdep;
+package org.onap.policy.apex.testsuites.integration.uservice.engdep;
import java.util.Date;
@@ -211,7 +211,7 @@ public class EngineTestServer implements Runnable, EngineServiceEventInterface {
* is registered with a component using the component's {@code addTestApexListener} method. When
* the testApex event occurs, that object's appropriate method is invoked.
*
- * This class listens for events from the Apex engine
+ * <p>This class listens for events from the Apex engine
*
* @see TestApexEvent
*/
diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/policymodels/JMSTestModel.json b/testsuites/integration/integration-uservice-test/src/test/resources/policymodels/JMSTestModel.json
index d85630456..354638a6d 100644
--- a/testsuites/integration/integration-uservice-test/src/test/resources/policymodels/JMSTestModel.json
+++ b/testsuites/integration/integration-uservice-test/src/test/resources/policymodels/JMSTestModel.json
@@ -342,7 +342,7 @@
"taskLogic": {
"key": "TaskLogic",
"logicFlavour": "JAVASCRIPT",
- "logic": "var outFieldType = Java.type(\"org.onap.policy.apex.apps.uservice.test.adapt.jms.TestPing\");\nvar outValue = new outFieldType();\n\nvar inValue = executor.inFields.get(\"TestPing\");\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(\"TestPing\", 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.uservice.adapt.jms.TestPing\");\nvar outValue = new outFieldType();\n\nvar inValue = executor.inFields.get(\"TestPing\");\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(\"TestPing\", outValue)\n\nvar returnValueType = Java.type(\"java.lang.Boolean\");\nvar returnValue = new returnValueType(true);"
}
}
}
@@ -366,7 +366,7 @@
"name": "TestPingIncomingEvent",
"version": "0.0.1"
},
- "nameSpace": "org.onap.policy.apex.apps.uservice.test.adapt.jms",
+ "nameSpace": "org.onap.policy.apex.testsuites.integration.uservice.adapt.jms",
"source": "JMS",
"target": "Apex",
"parameter": {
@@ -396,7 +396,7 @@
"name": "TestPingOutgoingEvent",
"version": "0.0.1"
},
- "nameSpace": "org.onap.policy.apex.apps.uservice.test.adapt.jms",
+ "nameSpace": "org.onap.policy.apex.testsuites.integration.uservice.adapt.jms",
"source": "Apex",
"target": "JMS",
"parameter": {
@@ -446,7 +446,7 @@
"version": "0.0.1"
},
"schemaFlavour": "Java",
- "schemaDefinition": "org.onap.policy.apex.apps.uservice.test.adapt.jms.TestPing"
+ "schemaDefinition": "org.onap.policy.apex.testsuites.integration.uservice.adapt.jms.TestPing"
}
}
]
diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/prodcons/JMS2JMSJsonEvent.json b/testsuites/integration/integration-uservice-test/src/test/resources/prodcons/JMS2JMSJsonEvent.json
index 0d55d8a7d..f8479969b 100644
--- a/testsuites/integration/integration-uservice-test/src/test/resources/prodcons/JMS2JMSJsonEvent.json
+++ b/testsuites/integration/integration-uservice-test/src/test/resources/prodcons/JMS2JMSJsonEvent.json
@@ -20,7 +20,7 @@
"carrierTechnology": "JMS",
"parameterClassName": "org.onap.policy.apex.plugins.event.carrier.jms.JmsCarrierTechnologyParameters",
"parameters": {
- "initialContextFactory": "org.onap.policy.apex.apps.uservice.test.adapt.jms.TestInitialContextFactory",
+ "initialContextFactory": "org.onap.policy.apex.testsuites.integration.uservice.adapt.jms.TestInitialContextFactory",
"connectionFactory": "ConnectionFactory",
"providerURL": "remote://localhost:5445",
"securityPrincipal": "guest",
@@ -41,7 +41,7 @@
"carrierTechnology": "JMS",
"parameterClassName": "org.onap.policy.apex.plugins.event.carrier.jms.JmsCarrierTechnologyParameters",
"parameters": {
- "initialContextFactory": "org.onap.policy.apex.apps.uservice.test.adapt.jms.TestInitialContextFactory",
+ "initialContextFactory": "org.onap.policy.apex.testsuites.integration.uservice.adapt.jms.TestInitialContextFactory",
"connectionFactory": "ConnectionFactory",
"providerURL": "remote://localhost:5445",
"securityPrincipal": "guest",
diff --git a/testsuites/integration/integration-uservice-test/src/test/resources/prodcons/JMS2JMSObjectEvent.json b/testsuites/integration/integration-uservice-test/src/test/resources/prodcons/JMS2JMSObjectEvent.json
index 228f8ec60..8fea3346b 100644
--- a/testsuites/integration/integration-uservice-test/src/test/resources/prodcons/JMS2JMSObjectEvent.json
+++ b/testsuites/integration/integration-uservice-test/src/test/resources/prodcons/JMS2JMSObjectEvent.json
@@ -20,7 +20,7 @@
"carrierTechnology": "JMS",
"parameterClassName": "org.onap.policy.apex.plugins.event.carrier.jms.JmsCarrierTechnologyParameters",
"parameters": {
- "initialContextFactory": "org.onap.policy.apex.apps.uservice.test.adapt.jms.TestInitialContextFactory",
+ "initialContextFactory": "org.onap.policy.apex.testsuites.integration.uservice.adapt.jms.TestInitialContextFactory",
"connectionFactory": "ConnectionFactory",
"providerURL": "remote://localhost:5445",
"securityPrincipal": "guest",
@@ -40,7 +40,7 @@
"carrierTechnology": "JMS",
"parameterClassName": "org.onap.policy.apex.plugins.event.carrier.jms.JmsCarrierTechnologyParameters",
"parameters": {
- "initialContextFactory": "org.onap.policy.apex.apps.uservice.test.adapt.jms.TestInitialContextFactory",
+ "initialContextFactory": "org.onap.policy.apex.testsuites.integration.uservice.adapt.jms.TestInitialContextFactory",
"connectionFactory": "ConnectionFactory",
"providerURL": "remote://localhost:5445",
"securityPrincipal": "guest",
diff --git a/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/service/engine/benchmark/ApexBaseBenchMarkTest.java b/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/engine/benchmark/ApexBaseBenchMarkTest.java
index 43211bc73..fdefd5583 100644
--- a/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/service/engine/benchmark/ApexBaseBenchMarkTest.java
+++ b/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/engine/benchmark/ApexBaseBenchMarkTest.java
@@ -17,7 +17,8 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.service.engine.benchmark;
+
+package org.onap.policy.apex.testsuites.performance.benchmark.engine.benchmark;
import java.util.List;
import java.util.Map;
@@ -39,14 +40,17 @@ import org.onap.policy.apex.plugins.executor.jython.JythonExecutorParameters;
import org.onap.policy.apex.plugins.executor.mvel.MvelExecutorParameters;
import org.onap.policy.apex.service.engine.event.ApexEvent;
import org.onap.policy.apex.service.engine.runtime.ApexEventListener;
-import org.onap.policy.apex.service.engine.runtime.ApexServiceModelUpdateTest;
import org.onap.policy.apex.service.engine.runtime.EngineService;
import org.onap.policy.apex.service.engine.runtime.EngineServiceEventInterface;
import org.onap.policy.apex.service.engine.runtime.impl.EngineServiceImpl;
import org.onap.policy.apex.service.parameters.engineservice.EngineServiceParameters;
+import org.onap.policy.apex.testsuites.performance.benchmark.engine.runtime.ApexServiceModelUpdateTest;
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
+/**
+ * The Class ApexBaseBenchMarkTest.
+ */
public class ApexBaseBenchMarkTest {
private static final long STOP_TIME_OUT = TimeUnit.SECONDS.toMillis(30);
private static final XLogger LOGGER = XLoggerFactory.getXLogger(ApexServiceModelUpdateTest.class);
@@ -59,12 +63,24 @@ public class ApexBaseBenchMarkTest {
private EngineServiceEventInterface engineServiceEventInterface;
+ /**
+ * Instantiates a new apex base bench mark test.
+ *
+ * @param model the model
+ * @param threads the threads
+ * @param listener the listener
+ */
public ApexBaseBenchMarkTest(final String model, final int threads, final ApexEventListener listener) {
this.model = model;
this.threads = threads;
this.listener = listener;
}
+ /**
+ * Sets the up.
+ *
+ * @throws Exception the exception
+ */
public void setUp() throws Exception {
final EngineServiceParameters parameters = new EngineServiceParameters();
parameters.setInstanceCount(threads);
@@ -105,21 +121,41 @@ public class ApexBaseBenchMarkTest {
engineServiceEventInterface = service.getEngineServiceEventInterface();
}
+ /**
+ * Send events.
+ *
+ * @param events the events
+ */
public void sendEvents(final List<ApexEvent> events) {
for (final ApexEvent event : events) {
engineServiceEventInterface.sendEvent(event);
}
}
+ /**
+ * Send event.
+ *
+ * @param event the event
+ */
public void sendEvent(final ApexEvent event) {
engineServiceEventInterface.sendEvent(event);
}
+ /**
+ * Gets the service.
+ *
+ * @return the service
+ */
public EngineService getService() {
return service;
}
+ /**
+ * Destroy.
+ *
+ * @throws Exception the exception
+ */
public void destroy() throws Exception {
if (service != null) {
LOGGER.info("Stopping EngineService ... ");
diff --git a/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/service/engine/benchmark/ApexEngineBenchmark.java b/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/engine/benchmark/ApexEngineBenchmark.java
index d7a4ef800..fa2a9934c 100644
--- a/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/service/engine/benchmark/ApexEngineBenchmark.java
+++ b/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/engine/benchmark/ApexEngineBenchmark.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.service.engine.benchmark;
+package org.onap.policy.apex.testsuites.performance.benchmark.engine.benchmark;
import static org.junit.Assert.assertEquals;
@@ -28,8 +28,8 @@ import org.junit.Before;
import org.junit.Test;
import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
import org.onap.policy.apex.service.engine.event.ApexEvent;
-import org.onap.policy.apex.service.engine.utils.Utils;
-import org.onap.policy.apex.test.common.model.EvalDomainModelFactory;
+import org.onap.policy.apex.testsuites.integration.common.model.EvalDomainModelFactory;
+import org.onap.policy.apex.testsuites.performance.benchmark.engine.utils.Utils;
import org.python.icu.impl.Assert;
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
@@ -49,46 +49,85 @@ public class ApexEngineBenchmark {
private static final long TIME_OUT_IN_MILLISEC = TimeUnit.MINUTES.toMillis(1);
- private String apexECAModelString;
- private String apexOODAModelString;
+ private String apexEcaModelString;
+ private String apexOodaModelString;
+ /**
+ * Sets the up.
+ *
+ * @throws Exception the exception
+ */
@Before
public void setUp() throws Exception {
- apexECAModelString = Utils.getModelString(new EvalDomainModelFactory().getECAPolicyModel());
- apexOODAModelString = Utils.getModelString(new EvalDomainModelFactory().getOODAPolicyModel());
+ apexEcaModelString = Utils.getModelString(new EvalDomainModelFactory().getEcaPolicyModel());
+ apexOodaModelString = Utils.getModelString(new EvalDomainModelFactory().getOodaPolicyModel());
}
+ /**
+ * Test benchmark singleton worker.
+ *
+ * @throws Exception the exception
+ */
@Test
public void testBenchmark_SingletonWorker() throws Exception {
- executeTest(apexECAModelString, 100, 1, 20);
- executeTest(apexOODAModelString, 100, 1, 20);
+ executeTest(apexEcaModelString, 100, 1, 20);
+ executeTest(apexOodaModelString, 100, 1, 20);
}
+ /**
+ * Test benchmark 3 thread worker.
+ *
+ * @throws Exception the exception
+ */
@Test
public void testBenchmark_3ThreadWorker() throws Exception {
- executeTest(apexECAModelString, 1000, 3, 10);
- executeTest(apexOODAModelString, 100, 3, 10);
+ executeTest(apexEcaModelString, 1000, 3, 10);
+ executeTest(apexOodaModelString, 100, 3, 10);
}
+ /**
+ * Test benchmark 10 thread worker.
+ *
+ * @throws Exception the exception
+ */
@Test
public void testBenchmark_10ThreadWorker() throws Exception {
- executeTest(apexECAModelString, 2000, 10, 10);
- executeTest(apexOODAModelString, 2000, 10, 10);
+ executeTest(apexEcaModelString, 2000, 10, 10);
+ executeTest(apexOodaModelString, 2000, 10, 10);
}
+ /**
+ * Test benchmark 50 thread worker.
+ *
+ * @throws Exception the exception
+ */
@Test
public void testBenchmark_50ThreadWorker() throws Exception {
- executeTest(apexECAModelString, 3000, 50, 10);
- executeTest(apexOODAModelString, 3000, 50, 10);
+ executeTest(apexEcaModelString, 3000, 50, 10);
+ executeTest(apexOodaModelString, 3000, 50, 10);
}
+ /**
+ * Test available processors thread worker.
+ *
+ * @throws Exception the exception
+ */
@Test
- public void TestE_AvailableProcessorsThreadWorker() throws Exception {
+ public void testAvailableProcessorsThreadWorker() throws Exception {
final int cores = Runtime.getRuntime().availableProcessors();
- executeTest(apexECAModelString, 3000, cores, 10);
- executeTest(apexOODAModelString, 3000, cores, 10);
+ executeTest(apexEcaModelString, 3000, cores, 10);
+ executeTest(apexOodaModelString, 3000, cores, 10);
}
+ /**
+ * Execute test.
+ *
+ * @param policyModel the policy model
+ * @param eventsCount the events count
+ * @param threads the threads
+ * @param loop the loop
+ * @throws Exception the exception
+ */
private void executeTest(final String policyModel, final int eventsCount, final int threads, final int loop)
throws Exception {
@@ -123,6 +162,13 @@ public class ApexEngineBenchmark {
}
}
+ /**
+ * Send events.
+ *
+ * @param apexBaseBenchMarkTest the apex base bench mark test
+ * @param eventsCount the events count
+ * @throws Exception the exception
+ */
public void sendEvents(final ApexBaseBenchMarkTest apexBaseBenchMarkTest, final int eventsCount) throws Exception {
for (int eventNum = 0; eventNum < eventsCount; eventNum++) {
final long currentTimeMillis = System.currentTimeMillis();
diff --git a/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/service/engine/benchmark/TestApexEventListener.java b/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/engine/benchmark/TestApexEventListener.java
index b2de8f072..2b6c89de7 100644
--- a/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/service/engine/benchmark/TestApexEventListener.java
+++ b/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/engine/benchmark/TestApexEventListener.java
@@ -17,7 +17,8 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.service.engine.benchmark;
+
+package org.onap.policy.apex.testsuites.performance.benchmark.engine.benchmark;
import static org.junit.Assert.assertNull;
@@ -30,6 +31,17 @@ import org.onap.policy.apex.service.engine.runtime.ApexEventListener;
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
+/**
+ * The listener interface for receiving testApexEvent events.
+ * The class that is interested in processing a testApexEvent
+ * event implements this interface, and the object created
+ * with that class is registered with a component using the
+ * component's <code>addTestApexEventListener</code> method. When
+ * the testApexEvent event occurs, that object's appropriate
+ * method is invoked.
+ *
+ * @see TestApexEventEvent
+ */
public class TestApexEventListener implements ApexEventListener {
private static final String SENT_TIMESTAMP = "SentTimestamp";
@@ -39,10 +51,16 @@ public class TestApexEventListener implements ApexEventListener {
private final AtomicLong eventReceived = new AtomicLong();
+ /**
+ * Instantiates a new test apex event listener.
+ */
public TestApexEventListener() {
this.queue = new ConcurrentLinkedQueue<ApexEvent>();
}
+ /* (non-Javadoc)
+ * @see org.onap.policy.apex.service.engine.runtime.ApexEventListener#onApexEventApexEvent)
+ */
@Override
public void onApexEvent(final ApexEvent apexEvent) {
apexEvent.put(RECVD_TIMESTAMP, System.currentTimeMillis());
@@ -50,6 +68,9 @@ public class TestApexEventListener implements ApexEventListener {
queue.add(apexEvent);
}
+ /**
+ * Prints the result.
+ */
public void printResult() {
if (!queue.isEmpty()) {
long maxTimeInMilliSeconds = 0;
@@ -76,15 +97,28 @@ public class TestApexEventListener implements ApexEventListener {
}
}
+ /**
+ * Reset.
+ */
public void reset() {
this.queue = new ConcurrentLinkedQueue<ApexEvent>();
eventReceived.set(0);;
}
+ /**
+ * Gets the queue.
+ *
+ * @return the queue
+ */
public Queue<ApexEvent> getQueue() {
return queue;
}
+ /**
+ * Gets the event received.
+ *
+ * @return the event received
+ */
public long getEventReceived() {
return eventReceived.get();
}
diff --git a/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/service/engine/main/BaseTest.java b/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/engine/main/BaseTest.java
index d38107daf..52bdb056b 100644
--- a/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/service/engine/main/BaseTest.java
+++ b/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/engine/main/BaseTest.java
@@ -17,7 +17,8 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.service.engine.main;
+
+package org.onap.policy.apex.testsuites.performance.benchmark.engine.main;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -29,9 +30,10 @@ import java.util.concurrent.TimeUnit;
import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
import org.onap.policy.apex.model.utilities.TextFileUtils;
+import org.onap.policy.apex.service.engine.main.ApexMain;
public class BaseTest {
- protected final static long TIME_OUT_IN_MS = TimeUnit.SECONDS.toMillis(10);
+ protected static final long TIME_OUT_IN_MS = TimeUnit.SECONDS.toMillis(10);
protected long getFileLength(final String file, final long expectedFileSize) throws IOException {
return getFileLength(10, file, expectedFileSize);
diff --git a/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/service/engine/main/TestAsyncEventMIMO.java b/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/engine/main/TestAsyncEventMimo.java
index 714deba30..195840c6d 100644
--- a/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/service/engine/main/TestAsyncEventMIMO.java
+++ b/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/engine/main/TestAsyncEventMimo.java
@@ -18,17 +18,24 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.service.engine.main;
+package org.onap.policy.apex.testsuites.performance.benchmark.engine.main;
import org.junit.Test;
-public class TestAsyncEventMIMO extends BaseTest {
+public class TestAsyncEventMimo extends BaseTest {
@Test
- public void testJsonFileAsyncMIMO() throws Exception {
- final String[] args = {"-c", "src/test/resources/parameters/File2FileJsonEventAsyncMIMO.json"};
- final String[] outFilePaths = {"src/test/resources/events/EventsOutMulti0.json",
- "src/test/resources/events/EventsOutMulti1.json", "src/test/resources/events/EventsOutMulti2.json"};
+ public void testJsonFileAsyncMimo() throws Exception {
+ final String[] args = {
+ "-c",
+ "src/test/resources/parameters/File2FileJsonEventAsyncMIMO.json"
+ };
+
+ final String[] outFilePaths = {
+ "src/test/resources/events/EventsOutMulti0.json",
+ "src/test/resources/events/EventsOutMulti1.json",
+ "src/test/resources/events/EventsOutMulti2.json"
+ };
testFileEvents(args, outFilePaths, 48956 * 3);
}
diff --git a/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/service/engine/main/TestAsyncEventMISO.java b/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/engine/main/TestAsyncEventMiso.java
index c5e7f4d9c..2e364647b 100644
--- a/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/service/engine/main/TestAsyncEventMISO.java
+++ b/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/engine/main/TestAsyncEventMiso.java
@@ -18,14 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.service.engine.main;
+package org.onap.policy.apex.testsuites.performance.benchmark.engine.main;
import org.junit.Test;
-public class TestAsyncEventMISO extends BaseTest {
+public class TestAsyncEventMiso extends BaseTest {
@Test
- public void testJsonFileAsyncMISO() throws Exception {
+ public void testJsonFileAsyncMiso() throws Exception {
final String[] args = {"-c", "src/test/resources/parameters/File2FileJsonEventAsyncMISO.json"};
testFileEvents(args, new String[] {"src/test/resources/events/EventsOutSingle.json"}, 48956 * 3);
diff --git a/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/service/engine/main/TestAsyncEventSIMO.java b/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/engine/main/TestAsyncEventSimo.java
index 0f570679a..0fb191c49 100644
--- a/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/service/engine/main/TestAsyncEventSIMO.java
+++ b/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/engine/main/TestAsyncEventSimo.java
@@ -18,17 +18,24 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.service.engine.main;
+package org.onap.policy.apex.testsuites.performance.benchmark.engine.main;
import org.junit.Test;
-public class TestAsyncEventSIMO extends BaseTest {
+public class TestAsyncEventSimo extends BaseTest {
@Test
- public void testJsonFileAsyncSIMO() throws Exception {
- final String[] args = {"-c", "src/test/resources/parameters/File2FileJsonEventAsyncSIMO.json"};
- final String[] outFilePaths = {"src/test/resources/events/EventsOutMulti0.json",
- "src/test/resources/events/EventsOutMulti1.json", "src/test/resources/events/EventsOutMulti2.json"};
+ public void testJsonFileAsyncSimo() throws Exception {
+ final String[] args = {
+ "-c",
+ "src/test/resources/parameters/File2FileJsonEventAsyncSIMO.json"
+ };
+
+ final String[] outFilePaths = {
+ "src/test/resources/events/EventsOutMulti0.json",
+ "src/test/resources/events/EventsOutMulti1.json",
+ "src/test/resources/events/EventsOutMulti2.json"
+ };
testFileEvents(args, outFilePaths, 48956);
}
diff --git a/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/service/engine/main/TestAsyncEventSISO.java b/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/engine/main/TestAsyncEventSiso.java
index 4152e20c9..a89e630bc 100644
--- a/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/service/engine/main/TestAsyncEventSISO.java
+++ b/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/engine/main/TestAsyncEventSiso.java
@@ -18,14 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.service.engine.main;
+package org.onap.policy.apex.testsuites.performance.benchmark.engine.main;
import org.junit.Test;
-public class TestAsyncEventSISO extends BaseTest {
+public class TestAsyncEventSiso extends BaseTest {
@Test
- public void testJsonFileAsyncSISO() throws Exception {
+ public void testJsonFileAsyncSiso() throws Exception {
final String[] args = {"-c", "src/test/resources/parameters/File2FileJsonEventAsyncSISO.json"};
testFileEvents(args, new String[] {"src/test/resources/events/EventsOutSingle.json"}, 48956);
diff --git a/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/service/engine/main/TestSyncEventMIMO.java b/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/engine/main/TestSyncEventMimo.java
index ad1a9810a..8b35e5dd8 100644
--- a/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/service/engine/main/TestSyncEventMIMO.java
+++ b/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/engine/main/TestSyncEventMimo.java
@@ -18,17 +18,24 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.service.engine.main;
+package org.onap.policy.apex.testsuites.performance.benchmark.engine.main;
import org.junit.Test;
-public class TestSyncEventMIMO extends BaseTest {
+public class TestSyncEventMimo extends BaseTest {
@Test
- public void testJsonFileAsyncMIMO() throws Exception {
- final String[] args = {"-c", "src/test/resources/parameters/File2FileJsonEventSyncMIMO.json"};
- final String[] outFilePaths = {"src/test/resources/events/EventsOutMulti0.json",
- "src/test/resources/events/EventsOutMulti1.json", "src/test/resources/events/EventsOutMulti2.json"};
+ public void testJsonFileAsyncMimo() throws Exception {
+ final String[] args = {
+ "-c",
+ "src/test/resources/parameters/File2FileJsonEventSyncMIMO.json"
+ };
+
+ final String[] outFilePaths = {
+ "src/test/resources/events/EventsOutMulti0.json",
+ "src/test/resources/events/EventsOutMulti1.json",
+ "src/test/resources/events/EventsOutMulti2.json"
+ };
testFileEvents(args, outFilePaths, 48956 * 3);
}
diff --git a/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/service/engine/main/TestSyncEventSISO.java b/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/engine/main/TestSyncEventSiso.java
index 395c2fe0b..891ad7198 100644
--- a/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/service/engine/main/TestSyncEventSISO.java
+++ b/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/engine/main/TestSyncEventSiso.java
@@ -18,14 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.service.engine.main;
+package org.onap.policy.apex.testsuites.performance.benchmark.engine.main;
import org.junit.Test;
-public class TestSyncEventSISO extends BaseTest {
+public class TestSyncEventSiso extends BaseTest {
@Test
- public void testJsonFileAsyncSISO() throws Exception {
+ public void testJsonFileAsyncSiso() throws Exception {
final String[] args = {"-c", "src/test/resources/parameters/File2FileJsonEventSyncSISO.json"};
testFileEvents(args, new String[] {"src/test/resources/events/EventsOutSingle.json"}, 48956);
diff --git a/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/service/engine/runtime/ApexServiceModelUpdateTest.java b/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/engine/runtime/ApexServiceModelUpdateTest.java
index aa95e73b3..cf930150e 100644
--- a/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/service/engine/runtime/ApexServiceModelUpdateTest.java
+++ b/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/engine/runtime/ApexServiceModelUpdateTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.service.engine.runtime;
+package org.onap.policy.apex.testsuites.performance.benchmark.engine.runtime;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -41,14 +41,16 @@ import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
import org.onap.policy.apex.plugins.executor.mvel.MvelExecutorParameters;
import org.onap.policy.apex.service.engine.event.ApexEvent;
import org.onap.policy.apex.service.engine.event.ApexEventException;
+import org.onap.policy.apex.service.engine.runtime.ApexEventListener;
+import org.onap.policy.apex.service.engine.runtime.EngineService;
+import org.onap.policy.apex.service.engine.runtime.EngineServiceEventInterface;
import org.onap.policy.apex.service.engine.runtime.impl.EngineServiceImpl;
-import org.onap.policy.apex.service.engine.utils.Utils;
import org.onap.policy.apex.service.parameters.engineservice.EngineServiceParameters;
-import org.onap.policy.apex.test.common.model.SampleDomainModelFactory;
+import org.onap.policy.apex.testsuites.integration.common.model.SampleDomainModelFactory;
+import org.onap.policy.apex.testsuites.performance.benchmark.engine.utils.Utils;
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
-
/**
* The Class ApexServiceTest.
*
@@ -70,8 +72,8 @@ public class ApexServiceModelUpdateTest {
/**
* Sets up the test by creating an engine and reading in the test policy.
*
- * @throws ApexException if something goes wron
- * @throws IOException
+ * @throws ApexException if something goes wrong
+ * @throws IOException on IO exceptions
*/
@Before
public void setUp() throws ApexException, IOException {
@@ -119,7 +121,7 @@ public class ApexServiceModelUpdateTest {
} catch (final Exception e) {
e.printStackTrace();
assertEquals("start()<-Machine-1_process-1_engine-1-0:0.0.0,STOPPED, cannot start engine, "
- + "engine has not been initialized, its model is not loaded", e.getMessage());
+ + "engine has not been initialized, its model is not loaded", e.getMessage());
}
}
@@ -186,10 +188,9 @@ public class ApexServiceModelUpdateTest {
fail("model update should fail on incompatible model without force being true");
} catch (final Exception e) {
System.err.println(e.getMessage());
- assertEquals(
- "apex model update failed, supplied model with key \"INCOMPATIBLE:0.0.1\" is not a compatible "
+ assertEquals("apex model update failed, supplied model with key \"INCOMPATIBLE:0.0.1\" is not a compatible "
+ "model update from the existing engine model with key \"SamplePolicyModelMVEL:0.0.1\"",
- e.getMessage());
+ e.getMessage());
}
// Still on old model
@@ -205,10 +206,9 @@ public class ApexServiceModelUpdateTest {
} catch (final Exception e) {
System.err.println(e.getMessage());
e.printStackTrace();
- assertEquals(
- "apex model update failed, supplied model with key \"SamplePolicyModelMVEL:1.0.1\" is not a compatible "
- + "model update from the existing engine model with key \"SamplePolicyModelMVEL:0.0.1\"",
- e.getMessage());
+ assertEquals("apex model update failed, supplied model with key \"SamplePolicyModelMVEL:1.0.1\" is not "
+ + "a compatible model update from the existing engine model with key "
+ + "\"SamplePolicyModelMVEL:0.0.1\"", e.getMessage());
}
// Still on old model
@@ -293,13 +293,13 @@ public class ApexServiceModelUpdateTest {
eventDataMap.put("TestTimestamp", testStartTime.getTime());
eventDataMap.put("TestTemperature", 34.5445667);
- final ApexEvent event =
- new ApexEvent("Event0000", "0.0.1", "org.onap.policy.apex.domains.sample.events", "test", "apex");
+ final ApexEvent event = new ApexEvent("Event0000", "0.0.1", "org.onap.policy.apex.domains.sample.events",
+ "test", "apex");
event.putAll(eventDataMap);
engineServiceEventInterface.sendEvent(event);
- final ApexEvent event2 =
- new ApexEvent("Event0100", "0.0.1", "org.onap.policy.apex.domains.sample.events", "test", "apex");
+ final ApexEvent event2 = new ApexEvent("Event0100", "0.0.1", "org.onap.policy.apex.domains.sample.events",
+ "test", "apex");
event2.putAll(eventDataMap);
engineServiceEventInterface.sendEvent(event2);
@@ -311,10 +311,10 @@ public class ApexServiceModelUpdateTest {
}
/**
- * The listener interface for receiving test events. The class that is interested in processing
- * a test event implements this interface, and the object created with that class is registered
- * with a component using the component's <code>addTestListener</code> method. When the test
- * event occurs, that object's appropriate method is invoked.
+ * The listener interface for receiving test events. The class that is interested in processing a test event
+ * implements this interface, and the object created with that class is registered with a component using the
+ * component's <code>addTestListener</code> method. When the test event occurs, that object's appropriate method is
+ * invoked.
*
* @see TestEvent
*/
@@ -323,8 +323,7 @@ public class ApexServiceModelUpdateTest {
/*
* (non-Javadoc)
*
- * @see
- * org.onap.policy.apex.service.engine.runtime.ApexEventListener#onApexEvent(org.onap.policy
+ * @see org.onap.policy.apex.service.engine.runtime.ApexEventListener#onApexEvent(org.onap.policy
* .apex.service.engine.event.ApexEvent)
*/
@Override
@@ -351,13 +350,13 @@ public class ApexServiceModelUpdateTest {
assertTrue(result.get("TestMatchCase").equals(new Byte((byte) 123)));
assertTrue(result.get("TestTemperature").equals(34.5445667));
assertTrue(((byte) result.get("TestMatchCaseSelected")) >= 0
- && ((byte) result.get("TestMatchCaseSelected") <= 3));
+ && ((byte) result.get("TestMatchCaseSelected") <= 3));
assertTrue(((byte) result.get("TestEstablishCaseSelected")) >= 0
- && ((byte) result.get("TestEstablishCaseSelected") <= 3));
+ && ((byte) result.get("TestEstablishCaseSelected") <= 3));
assertTrue(((byte) result.get("TestDecideCaseSelected")) >= 0
- && ((byte) result.get("TestDecideCaseSelected") <= 3));
- assertTrue(
- ((byte) result.get("TestActCaseSelected")) >= 0 && ((byte) result.get("TestActCaseSelected") <= 3));
+ && ((byte) result.get("TestDecideCaseSelected") <= 3));
+ assertTrue(((byte) result.get("TestActCaseSelected")) >= 0
+ && ((byte) result.get("TestActCaseSelected") <= 3));
}
}
}
diff --git a/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/service/engine/runtime/ApexServiceTest.java b/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/engine/runtime/ApexServiceTest.java
index c178cd9aa..e66d1b791 100644
--- a/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/service/engine/runtime/ApexServiceTest.java
+++ b/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/engine/runtime/ApexServiceTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.service.engine.runtime;
+package org.onap.policy.apex.testsuites.performance.benchmark.engine.runtime;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -38,10 +38,13 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
import org.onap.policy.apex.plugins.executor.mvel.MvelExecutorParameters;
import org.onap.policy.apex.service.engine.event.ApexEvent;
+import org.onap.policy.apex.service.engine.runtime.ApexEventListener;
+import org.onap.policy.apex.service.engine.runtime.EngineService;
+import org.onap.policy.apex.service.engine.runtime.EngineServiceEventInterface;
import org.onap.policy.apex.service.engine.runtime.impl.EngineServiceImpl;
-import org.onap.policy.apex.service.engine.utils.Utils;
import org.onap.policy.apex.service.parameters.engineservice.EngineServiceParameters;
-import org.onap.policy.apex.test.common.model.SampleDomainModelFactory;
+import org.onap.policy.apex.testsuites.integration.common.model.SampleDomainModelFactory;
+import org.onap.policy.apex.testsuites.performance.benchmark.engine.utils.Utils;
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
diff --git a/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/service/engine/utils/Utils.java b/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/engine/utils/Utils.java
index cfc787d64..0d239a8ef 100644
--- a/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/service/engine/utils/Utils.java
+++ b/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/engine/utils/Utils.java
@@ -17,7 +17,8 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.service.engine.utils;
+
+package org.onap.policy.apex.testsuites.performance.benchmark.engine.utils;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -26,10 +27,24 @@ import org.onap.policy.apex.model.basicmodel.handling.ApexModelException;
import org.onap.policy.apex.model.basicmodel.handling.ApexModelWriter;
import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
+/**
+ * The Class Utils.
+ */
public class Utils {
+ /**
+ * Instantiates a new utils.
+ */
private Utils() {}
+ /**
+ * Gets the model string.
+ *
+ * @param ecaPolicyModel the eca policy model
+ * @return the model string
+ * @throws ApexModelException the apex model exception
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
public static String getModelString(final AxPolicyModel ecaPolicyModel) throws ApexModelException, IOException {
try (final ByteArrayOutputStream baOutputStream = new ByteArrayOutputStream()) {
new ApexModelWriter<AxPolicyModel>(AxPolicyModel.class).write(ecaPolicyModel, baOutputStream);
diff --git a/testsuites/performance/performance-context-metrics/src/main/java/org/onap/policy/apex/plugins/context/metrics/ConcurrentContextMetrics.java b/testsuites/performance/performance-context-metrics/src/main/java/org/onap/policy/apex/testsuites/performance/context/metrics/ConcurrentContextMetrics.java
index 3d257f89a..c4e4de480 100644
--- a/testsuites/performance/performance-context-metrics/src/main/java/org/onap/policy/apex/plugins/context/metrics/ConcurrentContextMetrics.java
+++ b/testsuites/performance/performance-context-metrics/src/main/java/org/onap/policy/apex/testsuites/performance/context/metrics/ConcurrentContextMetrics.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.plugins.context.metrics;
+package org.onap.policy.apex.testsuites.performance.context.metrics;
import static org.onap.policy.apex.context.parameters.DistributorParameters.DEFAULT_DISTRIBUTOR_PLUGIN_CLASS;
import static org.onap.policy.apex.context.parameters.LockManagerParameters.DEFAULT_LOCK_MANAGER_PLUGIN_CLASS;
@@ -80,39 +80,41 @@ public class ConcurrentContextMetrics {
*/
public static void main(final String[] args) throws Exception {
if (args.length != NUM_ARGS) {
- System.err.println("Args: " + Arrays.toString(args));
- System.err.println(
- "usage: testLabel jvmCount threadCount threadLoops longArraySize lockType zookeeperAddress zookeeperPort zookeeperDirectory");
+ String errorMessage = "Args: " + Arrays.toString(args)
+ + "\nusage: testLabel jvmCount threadCount threadLoops longArraySize lockType "
+ + "zookeeperAddress zookeeperPort zookeeperDirectory";
+ LOGGER.info(errorMessage);
return;
}
- final ConfigrationProvider configrationProvider =
- new ConfigrationProviderImpl(args[ARG_LABEL], Integer.valueOf(args[ARG_JVM_COUNT]),
- Integer.valueOf(args[ARG_THREAD_COUNT]), Integer.valueOf(args[ARG_ITERATIONS]),
- Integer.valueOf(args[ARG_ARRAY_SIZE]), Integer.valueOf(args[ARG_LOCK_TYPE]));
+ final ConfigrationProvider configrationProvider = new ConfigrationProviderImpl(args[ARG_LABEL],
+ Integer.valueOf(args[ARG_JVM_COUNT]), Integer.valueOf(args[ARG_THREAD_COUNT]),
+ Integer.valueOf(args[ARG_ITERATIONS]), Integer.valueOf(args[ARG_ARRAY_SIZE]),
+ Integer.valueOf(args[ARG_LOCK_TYPE]));
final ConcurrentContextMetrics concurrentContextMetrics = new ConcurrentContextMetrics(configrationProvider,
- args[ARG_ZOOKEEPER_ADDRESS], Integer.valueOf(args[ARG_ZOOKEEPER_PORT]), args[ARG_ZOOKEEPER_DIRECTORY]);
+ args[ARG_ZOOKEEPER_ADDRESS], Integer.valueOf(args[ARG_ZOOKEEPER_PORT]),
+ args[ARG_ZOOKEEPER_DIRECTORY]);
- concurrentContextMetrics.concurrentContextMetricsJVMLocal();
+ concurrentContextMetrics.concurrentContextMetricsJvmLocal();
concurrentContextMetrics.concurrentContextMetricsCurator();
concurrentContextMetrics.concurrentContextMetricsHazelcast();
- concurrentContextMetrics.concurrentContextMetricsHazelcastMultiJVMHazelcastLock();
- concurrentContextMetrics.concurrentContextMetricsInfinispanMultiJVMHazelcastlock();
- concurrentContextMetrics.concurrentContextMetricsInfinispanMultiJVMCuratorLock();
- concurrentContextMetrics.concurrentContextMetricsHazelcastMultiJVMCuratorLock();
+ concurrentContextMetrics.concurrentContextMetricsHazelcastMultiJvmHazelcastLock();
+ concurrentContextMetrics.concurrentContextMetricsInfinispanMultiJvmHazelcastlock();
+ concurrentContextMetrics.concurrentContextMetricsInfinispanMultiJvmCuratorLock();
+ concurrentContextMetrics.concurrentContextMetricsHazelcastMultiJvmCuratorLock();
}
/**
- * The Constructor.
+ * Construct a concurrent context object.
*
- * @param configrationProvider
- * @param zookeeperAddress
- * @param zookeeperPort
- * @param zookeeperDirectory
+ * @param configrationProvider Configuration for the context metrics
+ * @param zookeeperAddress Zookeeper address
+ * @param zookeeperPort Zookeeper port
+ * @param zookeeperDirectory Zookeeper directory
*/
public ConcurrentContextMetrics(final ConfigrationProvider configrationProvider, final String zookeeperAddress,
- final int zookeeperPort, final String zookeeperDirectory) {
+ final int zookeeperPort, final String zookeeperDirectory) {
this.configrationProvider = configrationProvider;
this.zookeeperAddress = zookeeperAddress;
this.zookeeperPort = zookeeperPort;
@@ -126,7 +128,7 @@ public class ConcurrentContextMetrics {
* @throws IOException the IO exception
* @throws ApexException the apex exception
*/
- private void concurrentContextMetricsJVMLocal() throws ApexModelException, IOException, ApexException {
+ private void concurrentContextMetricsJvmLocal() throws IOException, ApexException {
if (configrationProvider.getJvmCount() != 1) {
return;
}
@@ -194,7 +196,7 @@ public class ConcurrentContextMetrics {
* @throws IOException the IO exception
* @throws ApexException the apex exception
*/
- private void concurrentContextMetricsHazelcastMultiJVMHazelcastLock() throws IOException, ApexException {
+ private void concurrentContextMetricsHazelcastMultiJvmHazelcastLock() throws IOException, ApexException {
LOGGER.debug("Running concurrentContextMetricsHazelcastMultiJVMHazelcastLock metrics . . .");
final ContextParameters contextParameters = new ContextParameters();
@@ -212,7 +214,7 @@ public class ConcurrentContextMetrics {
* @throws IOException the IO exception
* @throws ApexException the apex exception
*/
- private void concurrentContextMetricsInfinispanMultiJVMHazelcastlock() throws IOException, ApexException {
+ private void concurrentContextMetricsInfinispanMultiJvmHazelcastlock() throws IOException, ApexException {
LOGGER.debug("Running concurrentContextMetricsInfinispanMultiJVMHazelcastlock metrics . . .");
final ContextParameters contextParameters = new ContextParameters();
@@ -233,15 +235,15 @@ public class ConcurrentContextMetrics {
*
* @throws IOException the IO exception
* @throws ApexException the apex exception
- * @throws InterruptedException
+ * @throws InterruptedException on interrupts
*/
- private void concurrentContextMetricsInfinispanMultiJVMCuratorLock()
- throws IOException, ApexException, InterruptedException {
+ private void concurrentContextMetricsInfinispanMultiJvmCuratorLock()
+ throws IOException, ApexException, InterruptedException {
LOGGER.debug("Running concurrentContextMetricsInfinispanMultiJVMCuratorLock metrics . . .");
- final ZooKeeperServerServiceProvider zooKeeperServerServiceProvider =
- new ZooKeeperServerServiceProvider(zookeeperDirectory, zookeeperAddress, zookeeperPort);
+ final ZooKeeperServerServiceProvider zooKeeperServerServiceProvider = new ZooKeeperServerServiceProvider(
+ zookeeperDirectory, zookeeperAddress, zookeeperPort);
try {
zooKeeperServerServiceProvider.startZookeeperServer();
final ContextParameters contextParameters = new ContextParameters();
@@ -268,14 +270,14 @@ public class ConcurrentContextMetrics {
*
* @throws IOException the IO exception
* @throws ApexException the apex exception
- * @throws InterruptedException
+ * @throws InterruptedException on interrupts
*/
- private void concurrentContextMetricsHazelcastMultiJVMCuratorLock()
- throws IOException, ApexException, InterruptedException {
+ private void concurrentContextMetricsHazelcastMultiJvmCuratorLock()
+ throws IOException, ApexException, InterruptedException {
LOGGER.debug("Running concurrentContextMetricsHazelcastMultiJVMCuratorLock metrics . . .");
- final ZooKeeperServerServiceProvider zooKeeperServerServiceProvider =
- new ZooKeeperServerServiceProvider(zookeeperDirectory, zookeeperAddress, zookeeperPort);
+ final ZooKeeperServerServiceProvider zooKeeperServerServiceProvider = new ZooKeeperServerServiceProvider(
+ zookeeperDirectory, zookeeperAddress, zookeeperPort);
try {
zooKeeperServerServiceProvider.startZookeeperServer();
@@ -318,5 +320,4 @@ public class ConcurrentContextMetrics {
LOGGER.info("Completed {} ...", testName);
}
-
}
diff --git a/testsuites/performance/performance-context-metrics/src/main/java/org/onap/policy/apex/plugins/context/metrics/package-info.java b/testsuites/performance/performance-context-metrics/src/main/java/org/onap/policy/apex/testsuites/performance/context/metrics/package-info.java
index 5e916b6db..9bb84d76b 100644
--- a/testsuites/performance/performance-context-metrics/src/main/java/org/onap/policy/apex/plugins/context/metrics/package-info.java
+++ b/testsuites/performance/performance-context-metrics/src/main/java/org/onap/policy/apex/testsuites/performance/context/metrics/package-info.java
@@ -24,4 +24,4 @@
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
-package org.onap.policy.apex.plugins.context.metrics;
+package org.onap.policy.apex.testsuites.performance.context.metrics;
diff --git a/testsuites/performance/performance-context-metrics/src/test/java/org/onap/policy/apex/plugins/context/metrics/TestMetrics.java b/testsuites/performance/performance-context-metrics/src/test/java/org/onap/policy/apex/testsuites/performance/context/metrics/TestMetrics.java
index 04b756417..6414fa81a 100644
--- a/testsuites/performance/performance-context-metrics/src/test/java/org/onap/policy/apex/plugins/context/metrics/TestMetrics.java
+++ b/testsuites/performance/performance-context-metrics/src/test/java/org/onap/policy/apex/testsuites/performance/context/metrics/TestMetrics.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.policy.apex.plugins.context.metrics;
+package org.onap.policy.apex.testsuites.performance.context.metrics;
import static org.junit.Assert.fail;
@@ -32,10 +32,14 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.onap.policy.apex.context.test.utils.NetworkUtils;
+import org.onap.policy.apex.testsuites.performance.context.metrics.ConcurrentContextMetrics;
import org.onap.policy.common.utils.resources.ResourceUtils;
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
+/**
+ * The Class TestMetrics.
+ */
public class TestMetrics {
// Logger for this class
private static final XLogger LOGGER = XLoggerFactory.getXLogger(TestMetrics.class);
@@ -47,6 +51,11 @@ public class TestMetrics {
@Rule
public final TemporaryFolder folder = new TemporaryFolder();
+ /**
+ * Configure.
+ *
+ * @throws Exception the exception
+ */
@BeforeClass
public static void configure() throws Exception {
System.setProperty(JAVA_NET_PREFER_IPV4_STACK, "true");
@@ -63,8 +72,13 @@ public class TestMetrics {
}
+ /**
+ * Gets the single jvm metrics.
+ *
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
@Test
- public void getSingleJVMMetrics() throws IOException {
+ public void getSingleJvmMetrics() throws IOException {
final File zookeeperDirectory = folder.newFolder("zookeeperDirectory");
final String[] args = {"singleJVMTestNL", "1", "32", "1000", "65536", "0", "localhost", "62181",
zookeeperDirectory.getAbsolutePath()};