Remove apex-pdp unused core modules 72/127072/1
authorliamfallon <liam.fallon@est.tech>
Fri, 11 Feb 2022 00:43:14 +0000 (00:43 +0000)
committerliamfallon <liam.fallon@est.tech>
Fri, 11 Feb 2022 00:43:18 +0000 (00:43 +0000)
This is the final review in the refactoring of the model code in
apex-pdp.

The core-messaging and core-infrastructure modules are unused in
apex-pdp except for websocket communication. Websocket communication is
also not used in any deployment.

This review:
- removes the core-mesaging module, which had an apex-specific websocket
  implementation, except for the MessageException class, which is moved
  to the base core module
- removes the core-infrastructure module, except for the ThreadUtils
  class, which is moved to the base core module
- removes the websocket event protocol, which used core-messaging but is
  not used in any deployment
- collapses all three "core" submodules into a single module
- Updates dependencies where needed

Issue-ID: POLICY-1820
Change-Id: Ieae30063e99570e61943372d3fa23b77a211462c
Signed-off-by: liamfallon <liam.fallon@est.tech>
162 files changed:
core/core-engine/pom.xml [deleted file]
core/core-infrastructure/pom.xml [deleted file]
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/JavaHandlingException.java [deleted file]
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/classes/ClassUtils.java [deleted file]
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/classes/package-info.java [deleted file]
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleClassBuilder.java [deleted file]
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleClassByteCodeFileObject.java [deleted file]
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleClassCompilationUnit.java [deleted file]
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleClassLoader.java [deleted file]
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleFileManager.java [deleted file]
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/package-info.java [deleted file]
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/package-info.java [deleted file]
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessageHolder.java [deleted file]
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessageListener.java [deleted file]
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessagingService.java [deleted file]
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessagingServiceFactory.java [deleted file]
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/RawMessageHandler.java [deleted file]
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/WebSocketMessageListener.java [deleted file]
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/client/InternalMessageBusClient.java [deleted file]
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/client/MessagingClient.java [deleted file]
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/client/WebSocketClientImpl.java [deleted file]
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/client/package-info.java [deleted file]
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/MessageBlock.java [deleted file]
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/MessageBlockHandler.java [deleted file]
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/RawMessageBlock.java [deleted file]
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/package-info.java [deleted file]
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/package-info.java [deleted file]
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/server/InternalMessageBusServer.java [deleted file]
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/server/MessageServerImpl.java [deleted file]
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/server/WebSocketServerImpl.java [deleted file]
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/server/package-info.java [deleted file]
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/package-info.java [deleted file]
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WsStringMessageClient.java [deleted file]
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WsStringMessageListener.java [deleted file]
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WsStringMessageServer.java [deleted file]
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WsStringMessager.java [deleted file]
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/package-info.java [deleted file]
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/util/MessagingUtils.java [deleted file]
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/util/package-info.java [deleted file]
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/package-info.java [deleted file]
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/xml/XPathReader.java [deleted file]
core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/xml/package-info.java [deleted file]
core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/java/classes/ClassUtilsTest.java [deleted file]
core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/DummyMessageListener.java [deleted file]
core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/EndToEndStringMessagingTest.java [deleted file]
core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/MessagingUtilsTest.java [deleted file]
core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/StringTestServer.java [deleted file]
core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/xml/XPathReaderTest.java [deleted file]
core/core-infrastructure/src/test/resources/logback-test.xml [deleted file]
core/core-infrastructure/src/test/resources/xmlTestFile.xml [deleted file]
core/core-protocols/pom.xml [deleted file]
core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/Action.java [deleted file]
core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/Message.java [deleted file]
core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/package-info.java [deleted file]
core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/DummyAction.java [deleted file]
core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/DummyMessage.java [deleted file]
core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/SupportMessageTest.java [deleted file]
core/core-protocols/src/test/resources/logback-test.xml [deleted file]
core/pom.xml
core/src/main/java/org/onap/policy/apex/core/engine/EngineParameterConstants.java [moved from core/core-engine/src/main/java/org/onap/policy/apex/core/engine/EngineParameterConstants.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/engine/EngineParameters.java [moved from core/core-engine/src/main/java/org/onap/policy/apex/core/engine/EngineParameters.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/engine/ExecutorParameters.java [moved from core/core-engine/src/main/java/org/onap/policy/apex/core/engine/ExecutorParameters.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/engine/TaskParameters.java [moved from core/core-engine/src/main/java/org/onap/policy/apex/core/engine/TaskParameters.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/engine/context/ApexInternalContext.java [moved from core/core-engine/src/main/java/org/onap/policy/apex/core/engine/context/ApexInternalContext.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/engine/context/package-info.java [moved from core/core-engine/src/main/java/org/onap/policy/apex/core/engine/context/package-info.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/engine/engine/ApexEngine.java [moved from core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/ApexEngine.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/engine/engine/EnEventListener.java [moved from core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/EnEventListener.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineConstants.java [moved from core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineConstants.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineFactory.java [moved from core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineFactory.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java [moved from core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/engine/engine/impl/StateMachineHandler.java [moved from core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/StateMachineHandler.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/engine/engine/impl/package-info.java [moved from core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/package-info.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/engine/engine/package-info.java [moved from core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/package-info.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java [moved from core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/engine/event/EnException.java [moved from core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnException.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/engine/event/EnField.java [moved from core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnField.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/engine/event/package-info.java [moved from core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/package-info.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/engine/executor/Executor.java [moved from core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/Executor.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/engine/executor/ExecutorFactory.java [moved from core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/ExecutorFactory.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/engine/executor/StateExecutor.java [moved from core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateExecutor.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutor.java [moved from core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutor.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutor.java [moved from core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutor.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/engine/executor/StateOutput.java [moved from core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateOutput.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/engine/executor/TaskExecutor.java [moved from core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskExecutor.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/engine/executor/TaskSelectExecutor.java [moved from core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskSelectExecutor.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/engine/executor/context/AbstractExecutionContext.java [moved from core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AbstractExecutionContext.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxStateFacade.java [moved from core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxStateFacade.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxTaskFacade.java [moved from core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxTaskFacade.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContext.java [moved from core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContext.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskExecutionContext.java [moved from core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskExecutionContext.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskSelectionExecutionContext.java [moved from core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskSelectionExecutionContext.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/engine/executor/context/package-info.java [moved from core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/package-info.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/engine/executor/exception/StateMachineException.java [moved from core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/exception/StateMachineException.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/engine/executor/exception/StateMachineRuntimeException.java [moved from core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/exception/StateMachineRuntimeException.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/engine/executor/exception/package-info.java [moved from core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/exception/package-info.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/engine/executor/impl/ExecutorFactoryImpl.java [moved from core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/impl/ExecutorFactoryImpl.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/engine/executor/impl/package-info.java [moved from core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/impl/package-info.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/engine/executor/package-info.java [moved from core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/package-info.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/engine/monitoring/EventMonitor.java [moved from core/core-engine/src/main/java/org/onap/policy/apex/core/engine/monitoring/EventMonitor.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/engine/monitoring/package-info.java [moved from core/core-engine/src/main/java/org/onap/policy/apex/core/engine/monitoring/package-info.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/engine/package-info.java [moved from core/core-engine/src/main/java/org/onap/policy/apex/core/engine/package-info.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessagingException.java [moved from core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessagingException.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/infrastructure/threading/ApplicationThreadFactory.java [moved from core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/threading/ApplicationThreadFactory.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/infrastructure/threading/ThreadUtilities.java [moved from core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/threading/ThreadUtilities.java with 100% similarity]
core/src/main/java/org/onap/policy/apex/core/infrastructure/threading/package-info.java [moved from core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/threading/package-info.java with 100% similarity]
core/src/test/java/org/onap/policy/apex/core/engine/EngineParametersTest.java [moved from core/core-engine/src/test/java/org/onap/policy/apex/core/engine/EngineParametersTest.java with 100% similarity]
core/src/test/java/org/onap/policy/apex/core/engine/ExecutorParametersTest.java [moved from core/core-engine/src/test/java/org/onap/policy/apex/core/engine/ExecutorParametersTest.java with 100% similarity]
core/src/test/java/org/onap/policy/apex/core/engine/context/ApexInternalContextTest.java [moved from core/core-engine/src/test/java/org/onap/policy/apex/core/engine/context/ApexInternalContextTest.java with 100% similarity]
core/src/test/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImplTest.java [moved from core/core-engine/src/test/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImplTest.java with 100% similarity]
core/src/test/java/org/onap/policy/apex/core/engine/engine/impl/DummyEnEventListener.java [moved from core/core-engine/src/test/java/org/onap/policy/apex/core/engine/engine/impl/DummyEnEventListener.java with 100% similarity]
core/src/test/java/org/onap/policy/apex/core/engine/engine/impl/DummyListener.java [moved from core/core-engine/src/test/java/org/onap/policy/apex/core/engine/engine/impl/DummyListener.java with 100% similarity]
core/src/test/java/org/onap/policy/apex/core/engine/engine/impl/DummySlowEnEventListener.java [moved from core/core-engine/src/test/java/org/onap/policy/apex/core/engine/engine/impl/DummySlowEnEventListener.java with 100% similarity]
core/src/test/java/org/onap/policy/apex/core/engine/engine/impl/DummySmExecutor.java [moved from core/core-engine/src/test/java/org/onap/policy/apex/core/engine/engine/impl/DummySmExecutor.java with 100% similarity]
core/src/test/java/org/onap/policy/apex/core/engine/event/DummyAxKey.java [moved from core/core-engine/src/test/java/org/onap/policy/apex/core/engine/event/DummyAxKey.java with 100% similarity]
core/src/test/java/org/onap/policy/apex/core/engine/event/EnEventTest.java [moved from core/core-engine/src/test/java/org/onap/policy/apex/core/engine/event/EnEventTest.java with 100% similarity]
core/src/test/java/org/onap/policy/apex/core/engine/event/EnExceptionTest.java [moved from core/core-engine/src/test/java/org/onap/policy/apex/core/engine/event/EnExceptionTest.java with 100% similarity]
core/src/test/java/org/onap/policy/apex/core/engine/event/EnFieldTest.java [moved from core/core-engine/src/test/java/org/onap/policy/apex/core/engine/event/EnFieldTest.java with 100% similarity]
core/src/test/java/org/onap/policy/apex/core/engine/executor/DummyFailingTaskExecutor.java [moved from core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/DummyFailingTaskExecutor.java with 100% similarity]
core/src/test/java/org/onap/policy/apex/core/engine/executor/DummyStateFinalizerExecutor.java [moved from core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/DummyStateFinalizerExecutor.java with 100% similarity]
core/src/test/java/org/onap/policy/apex/core/engine/executor/DummyTaskExecutor.java [moved from core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/DummyTaskExecutor.java with 100% similarity]
core/src/test/java/org/onap/policy/apex/core/engine/executor/DummyTaskSelectExecutor.java [moved from core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/DummyTaskSelectExecutor.java with 100% similarity]
core/src/test/java/org/onap/policy/apex/core/engine/executor/StateExecutorTest.java [moved from core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/StateExecutorTest.java with 100% similarity]
core/src/test/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutorTest.java [moved from core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutorTest.java with 100% similarity]
core/src/test/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutorTest.java [moved from core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutorTest.java with 100% similarity]
core/src/test/java/org/onap/policy/apex/core/engine/executor/TaskExecutorTest.java [moved from core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/TaskExecutorTest.java with 100% similarity]
core/src/test/java/org/onap/policy/apex/core/engine/executor/TaskSelectExecutorTest.java [moved from core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/TaskSelectExecutorTest.java with 100% similarity]
core/src/test/java/org/onap/policy/apex/core/engine/executor/context/AxStateFacadeTest.java [moved from core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/context/AxStateFacadeTest.java with 100% similarity]
core/src/test/java/org/onap/policy/apex/core/engine/executor/context/AxTaskFacadeTest.java [moved from core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/context/AxTaskFacadeTest.java with 100% similarity]
core/src/test/java/org/onap/policy/apex/core/engine/executor/context/DummyContextAlbum.java [moved from core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/context/DummyContextAlbum.java with 100% similarity]
core/src/test/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContextTest.java [moved from core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContextTest.java with 100% similarity]
core/src/test/java/org/onap/policy/apex/core/engine/executor/context/TaskExecutionContextTest.java [moved from core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/context/TaskExecutionContextTest.java with 100% similarity]
core/src/test/java/org/onap/policy/apex/core/engine/executor/context/TaskSelectionExecutionContextTest.java [moved from core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/context/TaskSelectionExecutionContextTest.java with 100% similarity]
core/src/test/java/org/onap/policy/apex/core/engine/executor/exception/StateMachineRuntimeExceptionTest.java [moved from core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/exception/StateMachineRuntimeExceptionTest.java with 100% similarity]
core/src/test/java/org/onap/policy/apex/core/engine/executor/impl/ExceutorFactoryImplTest.java [moved from core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/impl/ExceutorFactoryImplTest.java with 100% similarity]
core/src/test/java/org/onap/policy/apex/core/infrastructure/threading/ThreadingTest.java [moved from core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/threading/ThreadingTest.java with 100% similarity]
examples/examples-aadm/pom.xml
examples/examples-adaptive/pom.xml
examples/examples-myfirstpolicy/pom.xml
examples/examples-pcvs/pom.xml
plugins/plugins-context/plugins-context-locking/plugins-context-locking-hazelcast/pom.xml
plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/pom.xml [deleted file]
plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/ApexWebSocketConsumer.java [deleted file]
plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/ApexWebSocketProducer.java [deleted file]
plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/WebSocketCarrierTechnologyParameters.java [deleted file]
plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/package-info.java [deleted file]
plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/test/java/org/onap/policy/apex/plugins/event/carrier/websocket/ApexWebSocketConsumerTest.java [deleted file]
plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/test/java/org/onap/policy/apex/plugins/event/carrier/websocket/ApexWebSocketProducerTest.java [deleted file]
plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/test/java/org/onap/policy/apex/plugins/event/carrier/websocket/WebSocketCarrierTechnologyParametersTest.java [deleted file]
plugins/plugins-event/plugins-event-carrier/pom.xml
plugins/plugins-executor/pom.xml
services/services-engine/pom.xml
services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexEventUnmarshaller.java
testsuites/integration/integration-common/pom.xml
testsuites/integration/integration-context-test/pom.xml
testsuites/integration/integration-executor-test/pom.xml
testsuites/integration/integration-uservice-test/pom.xml
testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/TestWs2WsClient.java [deleted file]
testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/TestWs2WsServer.java [deleted file]
testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventProducerClient.java [deleted file]
testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventProducerServer.java [deleted file]
testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventSubscriberClient.java [deleted file]
testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventSubscriberServer.java [deleted file]

diff --git a/core/core-engine/pom.xml b/core/core-engine/pom.xml
deleted file mode 100644 (file)
index 597da29..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-<!--
-  ============LICENSE_START=======================================================
-   Copyright (C) 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=========================================================
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.onap.policy.apex-pdp.core</groupId>
-        <artifactId>core</artifactId>
-        <version>2.7.1-SNAPSHOT</version>
-    </parent>
-
-    <artifactId>core-engine</artifactId>
-    <name>${project.artifactId}</name>
-    <description>The Apex policy execution engine</description>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.onap.policy.common</groupId>
-            <artifactId>common-parameters</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.apex-pdp.model</groupId>
-            <artifactId>model</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.apex-pdp.model</groupId>
-            <artifactId>engine-model</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.apex-pdp.context</groupId>
-            <artifactId>context-management</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.apex-pdp.core</groupId>
-            <artifactId>core-infrastructure</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>com.google.guava</groupId>
-            <artifactId>guava</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.mockito</groupId>
-            <artifactId>mockito-all</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.assertj</groupId>
-            <artifactId>assertj-core</artifactId>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
-</project>
diff --git a/core/core-infrastructure/pom.xml b/core/core-infrastructure/pom.xml
deleted file mode 100644 (file)
index 2802b89..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-<!--
-  ============LICENSE_START=======================================================
-   Copyright (C) 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=========================================================
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.onap.policy.apex-pdp.core</groupId>
-        <artifactId>core</artifactId>
-        <version>2.7.1-SNAPSHOT</version>
-    </parent>
-
-    <artifactId>core-infrastructure</artifactId>
-    <name>${project.artifactId}</name>
-    <description>Common non-functional components for Apex</description>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.java-websocket</groupId>
-            <artifactId>Java-WebSocket</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.google.guava</groupId>
-            <artifactId>guava</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.google.code.gson</groupId>
-            <artifactId>gson</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.mockito</groupId>
-            <artifactId>mockito-all</artifactId>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
-</project>
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/JavaHandlingException.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/JavaHandlingException.java
deleted file mode 100644 (file)
index 63bd1c4..0000000
+++ /dev/null
@@ -1,58 +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.core.infrastructure.java;
-
-/**
- * This class will be called if an error occurs in Java handling.
- *
- * @author Liam Fallon
- */
-public class JavaHandlingException extends Exception {
-    private static final long serialVersionUID = -6375859029774312663L;
-
-    /**
-     * Instantiates a new Java handling exception.
-     *
-     * @param message the message
-     */
-    public JavaHandlingException(final String message) {
-        super(message);
-    }
-
-    /**
-     * Instantiates a new Java handling exception.
-     *
-     * @param exception the exception to wrap
-     */
-    public JavaHandlingException(final Exception exception) {
-        super(exception);
-    }
-
-    /**
-     * Instantiates a new Java handling exception.
-     *
-     * @param message the message
-     * @param exception the exception to wrap
-     */
-    public JavaHandlingException(final String message, final Exception exception) {
-        super(message, exception);
-    }
-}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/classes/ClassUtils.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/classes/ClassUtils.java
deleted file mode 100644 (file)
index 49e7d1e..0000000
+++ /dev/null
@@ -1,259 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
- *  Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
- *  Modifications Copyright (C) 2021 Bell Canada. 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.core.infrastructure.java.classes;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.InvocationTargetException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.Arrays;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
-
-/**
- * This class is a utility class used to find Java classes on the class path, in directories, and in Jar files.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class ClassUtils {
-    // Get a reference to the logger
-    private static final XLogger LOGGER = XLoggerFactory.getXLogger(ClassUtils.class);
-
-    // Repeated string constants
-    private static final String CLASS_PATTERN = "\\.class$";
-
-    // The boot directory in Java for predefined JARs
-    private static final String SUN_BOOT_LIBRARY_PATH = "sun.boot.library.path";
-
-    // Token for Classes directory in paths
-    private static final String CLASSES_TOKEN = "/classes/";
-
-    // Token for library fragment in path
-    private static final String LIBRARAY_PATH_TOKEN = "/lib";
-
-    /**
-     * Get the class names of all classes on the class path. WARNING: This is a heavy call, use sparingly
-     *
-     * @return a set of class names for all classes in the class path
-     */
-    public static Set<String> getClassNames() {
-        // The return set of class names
-        final Set<String> classNameSet = new TreeSet<>();
-
-        try {
-            // The library path for predefined classes in Java
-            var sunBootLibraryPathString = System.getProperty(SUN_BOOT_LIBRARY_PATH);
-
-            // Check it exists and has a "lib" in it
-            if (sunBootLibraryPathString != null && sunBootLibraryPathString.contains(LIBRARAY_PATH_TOKEN)) {
-                // Strip any superfluous trailer from path
-                sunBootLibraryPathString = sunBootLibraryPathString.substring(0,
-                        sunBootLibraryPathString.lastIndexOf(LIBRARAY_PATH_TOKEN) + LIBRARAY_PATH_TOKEN.length());
-
-                final var bootLibraryFile = new File(sunBootLibraryPathString);
-                // The set used to hold class names is populated with predefined Java classes
-                classNameSet.addAll(processDir(bootLibraryFile, ""));
-            }
-
-            // Get the entries on the class path
-            URL[] urls = ((URLClassLoader) ClassLoader.getSystemClassLoader()).getURLs();
-
-            // Try get the classes in the bootstrap loader
-            urls = getClassesFromBootstrapLoader(urls);
-
-            // Iterate over the class path entries
-            for (final URL url : urls) {
-                if (url == null || url.getFile() == null) {
-                    continue;
-                }
-                final var urlFile = new File(url.getFile());
-                // Directories may contain ".class" files
-                if (urlFile.isDirectory()) {
-                    classNameSet.addAll(processDir(urlFile, url.getFile()));
-                } else if (url.getFile().endsWith(".jar")) {
-                    // JARs are processed as well
-                    classNameSet.addAll(processJar(urlFile));
-                }
-                // It's a resource or some other non-executable thing
-            }
-        } catch (final Exception e) {
-            LOGGER.warn("could not get the names of Java classes", e);
-        }
-
-        return classNameSet;
-    }
-
-    private static URL[] getClassesFromBootstrapLoader(URL[] urls)
-                    throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
-        try {
-            final Class<?> nullclassloader = Class.forName("sun.misc.Launcher");
-            if (nullclassloader == null) {
-                return urls;
-            }
-
-            var mmethod = nullclassloader.getMethod("getBootstrapClassPath");
-            if (mmethod == null) {
-                return urls;
-            }
-
-            final Object cp = mmethod.invoke(null, (Object[]) null);
-            if (cp == null) {
-                return urls;
-            }
-
-            mmethod = cp.getClass().getMethod("getURLs");
-            if (mmethod == null) {
-                return urls;
-            }
-
-            final URL[] moreurls = (URL[]) (mmethod.invoke(cp, (Object[]) null));
-            if (moreurls == null || moreurls.length == 0) {
-                return urls;
-            }
-
-            if (urls.length == 0) {
-                return moreurls;
-            } else {
-                final URL[] result = Arrays.copyOf(urls, urls.length + moreurls.length);
-                System.arraycopy(moreurls, 0, result, urls.length, moreurls.length);
-                return result;
-            }
-        } catch (final ClassNotFoundException e) {
-            LOGGER.warn("Failed to find default path for JRE libraries", e);
-            return urls;
-        }
-    }
-
-    /**
-     * Find all classes in directories and JARs in those directories.
-     *
-     * @param classDirectory The directory to search for classes
-     * @param rootDir The root directory, to be removed from absolute paths
-     * @return a set of classes which may be empty
-     * @throws Exception on errors processing directories
-     */
-    public static Set<String> processDir(final File classDirectory, final String rootDir) throws Exception {
-        // The return set
-        final TreeSet<String> classNameSet = new TreeSet<>();
-
-        // Iterate over the directory
-        if (classDirectory == null || !classDirectory.isDirectory()) {
-            return classNameSet;
-        }
-        for (final File child : classDirectory.listFiles()) {
-            if (child.isDirectory()) {
-                // Recurse down
-                classNameSet.addAll(processDir(child, rootDir));
-            } else if (child.getName().endsWith(".jar")) {
-                // Process the JAR
-                classNameSet.addAll(processJar(child));
-            } else if (child.getName().endsWith(".class") && !child.getName().contains("$")) {
-                // Process the ".class" file
-                classNameSet.add(
-                        child.getAbsolutePath().replace(rootDir, "").replaceFirst(CLASS_PATTERN, "").replace('/', '.'));
-            }
-        }
-        return classNameSet;
-    }
-
-    /**
-     * Condition the file name as a class name.
-     *
-     * @param fileNameIn The file name to convert to a class name
-     * @return the conditioned class name
-     */
-    public static String processFileName(final String fileNameIn) {
-        String fileName = fileNameIn;
-
-        if (fileName == null) {
-            return null;
-        }
-        final int classesPos = fileName.indexOf(CLASSES_TOKEN);
-
-        if (classesPos != -1) {
-            fileName = fileName.substring(classesPos + CLASSES_TOKEN.length());
-        }
-
-        return fileName.replaceFirst(CLASS_PATTERN, "").replace('/', '.');
-    }
-
-    /**
-     * Read all the class names from a Jar.
-     *
-     * @param jarFile the JAR file
-     * @return a set of class names
-     * @throws IOException on errors processing JARs
-     */
-    public static Set<String> processJar(final File jarFile) throws IOException {
-        // Pass the file as an input stream
-        return processJar(new FileInputStream(jarFile.getAbsolutePath()));
-    }
-
-    /**
-     * Read all the class names from a Jar.
-     *
-     * @param jarInputStream the JAR input stream
-     * @return a set of class names
-     * @throws IOException on errors processing JARs
-     */
-    public static Set<String> processJar(final InputStream jarInputStream) throws IOException {
-        // The return set
-        final TreeSet<String> classPathSet = new TreeSet<>();
-
-        if (jarInputStream == null) {
-            return classPathSet;
-        }
-        // JARs are ZIP files
-        final var zip = new ZipInputStream(jarInputStream);
-
-        // Iterate over each entry in the JAR
-        for (ZipEntry entry = zip.getNextEntry(); entry != null; entry = zip.getNextEntry()) {
-            if (!entry.isDirectory() && entry.getName().endsWith(".class") && !entry.getName().contains("$")) {
-                classPathSet.add(entry.getName().replaceFirst(CLASS_PATTERN, "").replace('/', '.'));
-            }
-        }
-        zip.close();
-        return classPathSet;
-    }
-
-    /**
-     * The main method exercises this class for test purposes.
-     *
-     * @param args the args
-     */
-    public static void main(final String[] args) {
-        for (final String clz : getClassNames()) {
-            LOGGER.info("Found class: {}", clz);
-        }
-    }
-}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/classes/package-info.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/classes/package-info.java
deleted file mode 100644 (file)
index c356580..0000000
+++ /dev/null
@@ -1,27 +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=========================================================
- */
-
-/**
- * Contains support to find Java classes on the class path, in directories and in Jar files.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-
-package org.onap.policy.apex.core.infrastructure.java.classes;
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleClassBuilder.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleClassBuilder.java
deleted file mode 100644 (file)
index 783ac4c..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
- *  Modifications Copyright (C) 2020 Nordix Foundation.
- *  Modifications Copyright (C) 2021 Bell Canada. 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.core.infrastructure.java.compile.singleclass;
-
-import java.util.Arrays;
-import java.util.List;
-import javax.tools.Diagnostic;
-import javax.tools.DiagnosticCollector;
-import javax.tools.JavaCompiler;
-import javax.tools.JavaFileObject;
-import javax.tools.ToolProvider;
-import org.onap.policy.apex.core.infrastructure.java.JavaHandlingException;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
-
-/**
- * The Class SingleClassBuilder is used to compile the Java code for a Java object and to create an instance of the
- * object.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-public class SingleClassBuilder {
-    // Logger for this class
-    private static final XLogger LOGGER = XLoggerFactory.getXLogger(SingleClassBuilder.class);
-
-    // The class name and source code for the class that we are compiling and instantiating
-    private final String className;
-    private final String sourceCode;
-
-    // This specialized JavaFileManager handles class loading for the single Java class
-    private SingleFileManager singleFileManager = null;
-
-    /**
-     * Instantiates a new single class builder.
-     *
-     * @param className the class name
-     * @param sourceCode the source code
-     */
-    public SingleClassBuilder(final String className, final String sourceCode) {
-        // Save the fields of the class
-        this.className = className;
-        this.sourceCode = sourceCode;
-    }
-
-    /**
-     * Compile the single class into byte code.
-     *
-     * @throws JavaHandlingException Thrown on compilation errors or handling errors on the single Java class
-     */
-    public void compile() throws JavaHandlingException {
-        // Get the list of compilation units, there is only one here
-        final List<? extends JavaFileObject> compilationUnits =
-                Arrays.asList(new SingleClassCompilationUnit(className, sourceCode));
-
-        // Allows us to get diagnostics from the compilation
-        final DiagnosticCollector<JavaFileObject> diagnosticListener = new DiagnosticCollector<>();
-
-        // Get the Java compiler
-        final var compiler = ToolProvider.getSystemJavaCompiler();
-
-        // Set up the target file manager and call the compiler
-        singleFileManager = new SingleFileManager(compiler, new SingleClassByteCodeFileObject(className));
-        final JavaCompiler.CompilationTask task =
-                compiler.getTask(null, singleFileManager, diagnosticListener, null, null, compilationUnits);
-
-        // Check if the compilation worked
-        if (Boolean.FALSE.equals(task.call())) {
-            final var builder = new StringBuilder();
-            for (final Diagnostic<? extends JavaFileObject> diagnostic : diagnosticListener.getDiagnostics()) {
-                builder.append("code:");
-                builder.append(diagnostic.getCode());
-                builder.append(", kind:");
-                builder.append(diagnostic.getKind());
-                builder.append(", position:");
-                builder.append(diagnostic.getPosition());
-                builder.append(", start position:");
-                builder.append(diagnostic.getStartPosition());
-                builder.append(", end position:");
-                builder.append(diagnostic.getEndPosition());
-                builder.append(", source:");
-                builder.append(diagnostic.getSource());
-                builder.append(", message:");
-                builder.append(diagnostic.getMessage(null));
-                builder.append("\n");
-            }
-
-            String message = "error compiling Java code for class \"" + className + "\": " + builder.toString();
-            LOGGER.warn(message);
-            throw new JavaHandlingException(message);
-        }
-    }
-
-    /**
-     * Create a new instance of the Java class using its byte code definition.
-     *
-     * @return A new instance of the object
-     * @throws JavaHandlingException on errors creating the object
-     */
-    public Object createObject()
-            throws InstantiationException, IllegalAccessException, ClassNotFoundException, JavaHandlingException {
-        if (singleFileManager == null) {
-            String message = "error instantiating instance for class \"" + className + "\": code may not be compiled";
-            LOGGER.warn(message);
-            throw new JavaHandlingException(message);
-        }
-
-        try {
-            return singleFileManager.getClassLoader(null).findClass(className).getDeclaredConstructor().newInstance();
-        } catch (Exception e) {
-            return new JavaHandlingException("could not create java class", e);
-        }
-
-    }
-}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleClassByteCodeFileObject.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleClassByteCodeFileObject.java
deleted file mode 100644 (file)
index 4a0536e..0000000
+++ /dev/null
@@ -1,84 +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.core.infrastructure.java.compile.singleclass;
-
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URI;
-import javax.tools.SimpleJavaFileObject;
-
-/**
- * The Class SingleClassByteCodeFileObject is a specialization of the {@link SimpleJavaFileObject} class, which is
- * itself an implementation of the {@code JavaFileObject} interface, which provides a file abstraction for tools
- * operating on Java programming language source and class files. The {@link SimpleJavaFileObject} class provides simple
- * implementations for most methods in {@code JavaFileObject}. This class is designed to be sub classed and used as a
- * basis for {@code JavaFileObject} implementations. Subclasses can override the implementation and specification of any
- * method of this class as long as the general contract of {@code JavaFileObject} is obeyed.
- *
- * <p>This class holds the byte code for a single class in memory.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-public class SingleClassByteCodeFileObject extends SimpleJavaFileObject {
-
-    // The ByteArrayOutputStream holds the byte code for the class
-    private ByteArrayOutputStream byteArrayOutputStream;
-
-    /**
-     * Instantiates the byte code for the class in memory.
-     *
-     * @param className the class name is used to compose a URI for the class
-     */
-    public SingleClassByteCodeFileObject(final String className) {
-        super(URI.create("byte:///" + className + ".class"), Kind.CLASS);
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public OutputStream openOutputStream() {
-        // Create the byte array output stream that will hold the byte code for the class, when the class source code is
-        // compiled, this output stream is passed
-        // to the compiler and the byte code for the class is written into the output stream.
-        byteArrayOutputStream = new ByteArrayOutputStream();
-        return byteArrayOutputStream;
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public InputStream openInputStream() {
-        // No input stream for streaming out the byte code
-        return null;
-    }
-
-    /**
-     * Gets the byte code of the class.
-     *
-     * @return the byte code of the class
-     */
-    public byte[] getByteCode() {
-        return byteArrayOutputStream.toByteArray();
-    }
-}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleClassCompilationUnit.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleClassCompilationUnit.java
deleted file mode 100644 (file)
index 34398ed..0000000
+++ /dev/null
@@ -1,76 +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.core.infrastructure.java.compile.singleclass;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URI;
-import javax.tools.SimpleJavaFileObject;
-
-/**
- * The Class SingleClassCompilationUnit is a container for the source code of the single Java class in memory. The class
- * uses a {@link String} to hold the source code.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-public class SingleClassCompilationUnit extends SimpleJavaFileObject {
-
-    private final String source;
-
-    /**
-     * Instantiates a new compilation unit.
-     *
-     * @param className the class name for the source code
-     * @param source the source code for the class
-     */
-    public SingleClassCompilationUnit(final String className, final String source) {
-        // Create a URI for the source code of the class
-        super(URI.create("file:///" + className + ".java"), Kind.SOURCE);
-        this.source = source;
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public CharSequence getCharContent(final boolean ignoreEncodingErrors) {
-        // Return the source code to toe caller, the compiler
-        return source;
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public OutputStream openOutputStream() {
-        throw new IllegalStateException();
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public InputStream openInputStream() {
-        // Return the source code as a stream
-        return new ByteArrayInputStream(source.getBytes());
-    }
-}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleClassLoader.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleClassLoader.java
deleted file mode 100644 (file)
index 55fa498..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
- *  Modifications Copyright (C) 2021 AT&T Intellectual Property. 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.core.infrastructure.java.compile.singleclass;
-
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-
-/**
- * The Class SingleClassLoader is responsible for class loading the single Java class being held in memory.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-@Getter
-@AllArgsConstructor
-public class SingleClassLoader extends ClassLoader {
-    // The byte code of the class held in memory as byte code in a ByteCodeFileObject
-    private final SingleClassByteCodeFileObject fileObject;
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    protected Class<?> findClass(final String className) throws ClassNotFoundException {
-        // Creates a java Class that can be instantiated from the class defined in the byte code in the
-        // ByteCodeFileObejct
-        return defineClass(className, fileObject.getByteCode(), 0, fileObject.getByteCode().length);
-    }
-}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleFileManager.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/SingleFileManager.java
deleted file mode 100644 (file)
index ffa1663..0000000
+++ /dev/null
@@ -1,73 +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.core.infrastructure.java.compile.singleclass;
-
-import java.io.IOException;
-import javax.tools.FileObject;
-import javax.tools.ForwardingJavaFileManager;
-import javax.tools.JavaCompiler;
-import javax.tools.JavaFileObject;
-import javax.tools.StandardJavaFileManager;
-
-/**
- * The Class SingleFileManager is a {@link ForwardingJavaFileManager} which in turn implements {@code JavaFileManager}.
- * A {@code JavaFileManager} handles source files for Java language handling tools. A {@link ForwardingJavaFileManager}
- * is an implementation of {@code JavaFileManager} that forwards the {@code JavaFileManager} methods to a given file
- * manager.
- *
- * <p>This class instantiates and forwards those requests to a {@link StandardJavaFileManager} instance to act as a
- * {@code JavaFileManager} for a Java single file, managing class loading for the class.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-public class SingleFileManager extends ForwardingJavaFileManager<StandardJavaFileManager> {
-    // THe class loader for our single class
-    private final SingleClassLoader singleClassLoader;
-
-    /**
-     * Instantiates a new single file manager.
-     *
-     * @param compiler the compiler we are using
-     * @param byteCodeFileObject the byte code for the compiled class
-     */
-    public SingleFileManager(final JavaCompiler compiler, final SingleClassByteCodeFileObject byteCodeFileObject) {
-        super(compiler.getStandardFileManager(null, null, null));
-        singleClassLoader = new SingleClassLoader(byteCodeFileObject);
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public JavaFileObject getJavaFileForOutput(final Location notUsed, final String className,
-            final JavaFileObject.Kind kind, final FileObject sibling) throws IOException {
-        // Return the JavaFileObject to the compiler so that it can write byte code into it
-        return singleClassLoader.getFileObject();
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public SingleClassLoader getClassLoader(final Location location) {
-        return singleClassLoader;
-    }
-}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/package-info.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/compile/singleclass/package-info.java
deleted file mode 100644 (file)
index 5ae0d4f..0000000
+++ /dev/null
@@ -1,28 +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=========================================================
- */
-
-/**
- * Generates classes from source code by compiling source code and placing the resultant classes on the class path on
- * the fly.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-
-package org.onap.policy.apex.core.infrastructure.java.compile.singleclass;
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/package-info.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/java/package-info.java
deleted file mode 100644 (file)
index 5a8b511..0000000
+++ /dev/null
@@ -1,27 +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=========================================================
- */
-
-/**
- * Allows Java classes to be created by compiling Java source code and generating classes on the fly.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-
-package org.onap.policy.apex.core.infrastructure.java;
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessageHolder.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessageHolder.java
deleted file mode 100644 (file)
index abc5c90..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
- *  Modifications Copyright (C) 2021 AT&T Intellectual Property. 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.core.infrastructure.messaging;
-
-import java.io.Serializable;
-import java.net.InetAddress;
-import java.util.ArrayList;
-import java.util.List;
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
-import lombok.ToString;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
-
-/**
- * The Class MessageHolder holds a set of messages to be sent as a single block of messages in this messaging
- * implementation.
- *
- * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com)
- * @param <M> the generic type of message being handled by a message holder instance
- */
-@Getter
-@ToString
-@EqualsAndHashCode
-public class MessageHolder<M> implements Serializable {
-
-    // Serial ID
-    private static final long serialVersionUID = 1235487535388793719L;
-
-    // Get a reference to the logger
-    private static final XLogger LOGGER = XLoggerFactory.getXLogger(MessageHolder.class);
-
-    // Properties of the message holder
-    private final long creationTime;
-    private final InetAddress senderHostAddress;
-
-    // Sequence of message in the message holder
-    @ToString.Exclude
-    private final List<M> messages;
-
-    /**
-     * Constructor, create the message holder.
-     *
-     * @param senderHostAddress the host address of the sender of the message holder container
-     */
-    public MessageHolder(final InetAddress senderHostAddress) {
-        LOGGER.entry(senderHostAddress);
-        messages = new ArrayList<>();
-        this.senderHostAddress = senderHostAddress;
-        creationTime = System.currentTimeMillis();
-    }
-
-    /**
-     * Adds a message to this message holder.
-     *
-     * @param message the message to add
-     */
-    public void addMessage(final M message) {
-        if (!messages.contains(message)) {
-            messages.add(message);
-        } else {
-            LOGGER.warn("duplicate message {} added to message holder", message);
-        }
-    }
-}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessageListener.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessageListener.java
deleted file mode 100644 (file)
index 0aab650..0000000
+++ /dev/null
@@ -1,47 +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.core.infrastructure.messaging;
-
-import org.onap.policy.apex.core.infrastructure.messaging.impl.ws.messageblock.MessageBlock;
-
-/**
- * The listener interface for receiving message events. The class that is interested in processing a message event
- * implements this interface.
- *
- * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com)
- * @param <M> of message of any given type that is being listened for and handled
- */
-public interface MessageListener<M> {
-
-    /**
-     * This method is called when a message block is received on a web socket and is to be forwarded to a listener.
-     *
-     * @param data the message data containing a message
-     */
-    void onMessage(MessageBlock<M> data);
-
-    /**
-     * This method is called when a string message is received on a web socket and is to be forwarded to a listener.
-     *
-     * @param messageString the message string
-     */
-    void onMessage(String messageString);
-}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessagingService.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessagingService.java
deleted file mode 100644 (file)
index 352e708..0000000
+++ /dev/null
@@ -1,76 +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.core.infrastructure.messaging;
-
-/**
- * The Interface MessagingService specifies the methods that must be implemented by any implementation providing Apex
- * messaging.
- *
- * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com)
- * @param <M> the type of message being passed by an implementation of Apex messaging
- */
-public interface MessagingService<M> {
-
-    /**
-     * Start the messaging connection.
-     */
-    void startConnection();
-
-    /**
-     * Stop the messaging connection.
-     */
-    void stopConnection();
-
-    /**
-     * Checks if the messaging connection is started.
-     *
-     * @return true, if is started
-     */
-    boolean isStarted();
-
-    /**
-     * Send a block of messages on the connection, the messages are contained in the the message holder container.
-     *
-     * @param messageHolder The message holder holding the messages to be sent
-     */
-    void send(MessageHolder<M> messageHolder);
-
-    /**
-     * Send a string message on the connection.
-     *
-     * @param messageString The message string to be sent
-     */
-    void send(String messageString);
-
-    /**
-     * Adds a message listener that will be called when a message is received by this messaging service implementation.
-     *
-     * @param messageListener the message listener
-     */
-    void addMessageListener(MessageListener<M> messageListener);
-
-    /**
-     * Removes the message listener.
-     *
-     * @param messageListener the message listener
-     */
-    void removeMessageListener(MessageListener<M> messageListener);
-}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessagingServiceFactory.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/MessagingServiceFactory.java
deleted file mode 100644 (file)
index 9721258..0000000
+++ /dev/null
@@ -1,58 +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.core.infrastructure.messaging;
-
-import java.net.InetSocketAddress;
-import java.net.URI;
-import org.onap.policy.apex.core.infrastructure.messaging.impl.ws.client.MessagingClient;
-import org.onap.policy.apex.core.infrastructure.messaging.impl.ws.server.MessageServerImpl;
-
-/**
- * A factory class to create a "server" or "client" type Messaging Service.
- *
- * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com)
- * @param <M> the generic type of message to be handled by this messaging service
- */
-public class MessagingServiceFactory<M> {
-
-    /**
-     * Create a web socket server instance and returns to the caller.
-     *
-     * @param address the address of the server machine
-     * @return the messaging service
-     */
-    public MessagingService<M> createServer(final InetSocketAddress address) {
-        return new MessageServerImpl<>(address);
-    }
-
-    /**
-     * Create a web socket client instance and returns to the caller.
-     *
-     * @param uri the URI of the server to connect to
-     * @return an instance of {@link MessagingService}
-     */
-    public MessagingService<M> createClient(final URI uri) {
-        if (uri == null) {
-            throw new IllegalArgumentException("URI cannot be null");
-        }
-        return new MessagingClient<>(uri);
-    }
-}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/RawMessageHandler.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/RawMessageHandler.java
deleted file mode 100644 (file)
index 0cdf76f..0000000
+++ /dev/null
@@ -1,233 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
- *  Modifications Copyright (C) 2019-2020 Nordix Foundation.
- *  Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
- *  Modifications Copyright (C) 2021 Bell Canada. 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.core.infrastructure.messaging.impl.ws;
-
-import com.google.common.eventbus.Subscribe;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.nio.ByteBuffer;
-import java.util.List;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.LinkedBlockingDeque;
-import java.util.concurrent.TimeUnit;
-import org.onap.policy.apex.core.infrastructure.messaging.MessageHolder;
-import org.onap.policy.apex.core.infrastructure.messaging.MessageListener;
-import org.onap.policy.apex.core.infrastructure.messaging.impl.ws.messageblock.MessageBlock;
-import org.onap.policy.apex.core.infrastructure.messaging.impl.ws.messageblock.MessageBlockHandler;
-import org.onap.policy.apex.core.infrastructure.messaging.impl.ws.messageblock.RawMessageBlock;
-import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
-
-/**
- * The Class RawMessageHandler handles raw messages being received on a Java web socket and forwards the messages to the
- * DataHandler instance that has subscribed to the RawMessageHandler instance.
- *
- * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com)
- * @param <M> the generic type of message being received
- */
-public class RawMessageHandler<M> implements WebSocketMessageListener<M>, Runnable {
-    // The logger for this class
-    private static final XLogger LOGGER = XLoggerFactory.getXLogger(RawMessageHandler.class);
-
-    // Repeated string constants
-    private static final String RAW_MESSAGE_LISTENING_INTERRUPTED = "raw message listening has been interrupted";
-
-    // The amount of time to sleep during shutdown for the thread of this message handler to stop
-    private static final int SHUTDOWN_WAIT_TIME = 10;
-
-    // The timeout to wait between queue poll timeouts in milliseconds
-    private static final long QUEUE_POLL_TIMEOUT = 50;
-
-    // A queue that temporarily holds message blocks
-    private final BlockingQueue<MessageBlock<M>> messageBlockQueue = new LinkedBlockingDeque<>();
-
-    // A queue that temporarily holds message blocks
-    private final BlockingQueue<String> stringMessageQueue = new LinkedBlockingDeque<>();
-
-    // Client applications that have subscribed for messages
-    private final MessageBlockHandler<M> dataHandler = new MessageBlockHandler<>("data-processor");
-
-    // The thread that the raw message handler is receiving messages on
-    private Thread thisThread = null;
-
-    /**
-     * This method is called by the class with which this message listener has been registered.
-     *
-     * @param incomingData the data forwarded by the message reception class
-     */
-    @Override
-    @Subscribe
-    public void onMessage(final RawMessageBlock incomingData) {
-        // Sanity check and get incoming data
-        ByteBuffer dataByteBuffer = null;
-        if (incomingData != null && incomingData.getMessage() != null) {
-            dataByteBuffer = incomingData.getMessage();
-        } else {
-            return;
-        }
-
-        // Read the messages from the web socket and place them on the message queue for handling by
-        // the queue
-        // processing thread
-
-        try (final var stream = new ByteArrayInputStream(dataByteBuffer.array());
-                        final var ois = new ObjectInputStream(stream)) {
-            @SuppressWarnings("unchecked")
-            final MessageHolder<M> messageHolder = (MessageHolder<M>) ois.readObject();
-
-            if (LOGGER.isDebugEnabled()) {
-                LOGGER.debug("message {} recieved from the client {} ", messageHolder,
-                                messageHolder == null ? "Apex Engine " : messageHolder.getSenderHostAddress());
-            }
-
-            if (messageHolder != null) {
-                final List<M> messages = messageHolder.getMessages();
-                if (messages != null) {
-                    messageBlockQueue.add(new MessageBlock<>(messages, incomingData.getWebSocket()));
-                }
-            }
-        } catch (final IOException | ClassNotFoundException e) {
-            LOGGER.error("Failed to process message received");
-            LOGGER.catching(e);
-        }
-    }
-
-    /**
-     * This method is called when a string message is received on a web socket and is to be forwarded to a listener.
-     *
-     * @param messageString the message string
-     */
-    @Override
-    @Subscribe
-    public void onMessage(final String messageString) {
-        if (messageString == null) {
-            return;
-        }
-        if (LOGGER.isDebugEnabled()) {
-            LOGGER.debug("message {} recieved from the client {} ", messageString);
-        }
-        stringMessageQueue.add(messageString);
-    }
-
-    /**
-     * This method is called when a message is received on a web socket and is to be forwarded to a listener.
-     *
-     * @param data the message data containing a message
-     */
-    @Override
-    public void onMessage(final MessageBlock<M> data) {
-        throw new UnsupportedOperationException("this operation is not supported");
-    }
-
-    /**
-     * This thread monitors the message queue and processes messages as they appear on the queue.
-     *
-     * @see java.lang.Runnable#run()
-     */
-    @Override
-    public void run() {
-        LOGGER.debug("raw message listening started");
-        thisThread = Thread.currentThread();
-
-        // Run until termination
-        while (thisThread.isAlive() && !thisThread.isInterrupted()) {
-            try {
-                // Read message block messages from the queue and pass it to the data handler
-                MessageBlock<M> messageBlock = null;
-                while ((messageBlock = messageBlockQueue.poll(1, TimeUnit.MILLISECONDS)) != null) {
-                    dataHandler.post(messageBlock);
-                }
-
-                // Read string messages from the queue and pass it to the data handler
-                String stringMessage = null;
-                while ((stringMessage = stringMessageQueue.poll(1, TimeUnit.MILLISECONDS)) != null) {
-                    dataHandler.post(stringMessage);
-                }
-
-                // Wait for new messages
-                Thread.sleep(QUEUE_POLL_TIMEOUT);
-
-            } catch (final InterruptedException e) {
-                // restore the interrupt status
-                Thread.currentThread().interrupt();
-                LOGGER.debug(RAW_MESSAGE_LISTENING_INTERRUPTED);
-                break;
-            }
-        }
-
-        LOGGER.debug("raw message listening stopped");
-    }
-
-    /**
-     * Shutdown the message handler.
-     */
-    public void shutdown() {
-        LOGGER.entry("shutting down raw message listening . . .");
-
-        // Interrupt the message handling thread
-        thisThread.interrupt();
-
-        // Wait for thread shutdown
-        while (thisThread.isAlive()) {
-            ThreadUtilities.sleep(SHUTDOWN_WAIT_TIME);
-        }
-
-        LOGGER.exit("shut down raw message listening");
-    }
-
-    /**
-     * Register a data forwarder to which messages coming in on the web socket will be forwarded.
-     *
-     * @param listener The listener to register
-     */
-    @Override
-    public void registerDataForwarder(final MessageListener<M> listener) {
-        stateCheck(listener);
-        dataHandler.registerMessageHandler(listener);
-    }
-
-    /**
-     * Unregister a data forwarder that was previously registered on the web socket listener.
-     *
-     * @param listener The listener to unregister
-     */
-    @Override
-    public void unRegisterDataForwarder(final MessageListener<M> listener) {
-        stateCheck(listener);
-        dataHandler.unRegisterMessageHandler(listener);
-    }
-
-    /**
-     * Sanity check for the listener and data handler.
-     *
-     * @param listener the listener to check
-     */
-    private void stateCheck(final MessageListener<M> listener) {
-        if (listener == null) {
-            throw new IllegalArgumentException("The listener object cannot be null");
-        }
-    }
-}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/WebSocketMessageListener.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/WebSocketMessageListener.java
deleted file mode 100644 (file)
index 529e887..0000000
+++ /dev/null
@@ -1,58 +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.core.infrastructure.messaging.impl.ws;
-
-import org.onap.policy.apex.core.infrastructure.messaging.MessageListener;
-import org.onap.policy.apex.core.infrastructure.messaging.impl.ws.messageblock.RawMessageBlock;
-
-/**
- * The listener interface for receiving webSocketMessage events. The class that is interested in processing a
- * webSocketMessage event implements this interface, and the object created with that class is registered with a
- * component using the component's addWebSocketMessageListener method. When the webSocketMessage event occurs, that
- * object's appropriate method is invoked.
- *
- * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com)
- * @param <M> the generic type
- * @see RawMessageBlock
- */
-public interface WebSocketMessageListener<M> extends MessageListener<M>, Runnable {
-
-    /**
-     * This method is called by the class with which this message listener has been registered.
-     *
-     * @param incomingData the data forwarded by the message reception class
-     */
-    void onMessage(RawMessageBlock incomingData);
-
-    /**
-     * Register a data forwarder to which messages coming in on the web socket will be forwarded.
-     *
-     * @param listener The listener to register
-     */
-    void registerDataForwarder(MessageListener<M> listener);
-
-    /**
-     * Unregister a data forwarder that was previously registered on the web socket listener.
-     *
-     * @param listener The listener to unregister
-     */
-    void unRegisterDataForwarder(MessageListener<M> listener);
-}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/client/InternalMessageBusClient.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/client/InternalMessageBusClient.java
deleted file mode 100644 (file)
index ad0dbb5..0000000
+++ /dev/null
@@ -1,130 +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.core.infrastructure.messaging.impl.ws.client;
-
-import java.net.URI;
-import java.nio.ByteBuffer;
-import org.onap.policy.apex.core.infrastructure.messaging.MessageListener;
-import org.onap.policy.apex.core.infrastructure.messaging.impl.ws.RawMessageHandler;
-import org.onap.policy.apex.core.infrastructure.messaging.impl.ws.messageblock.MessageBlockHandler;
-import org.onap.policy.apex.core.infrastructure.messaging.impl.ws.messageblock.RawMessageBlock;
-import org.onap.policy.apex.core.infrastructure.threading.ApplicationThreadFactory;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
-
-/**
- * The Class InternalMessageBusClient handles the client side of a web socket and handles the callback mechanism used to
- * receive messages on the web socket.
- *
- * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com)
- * @param <M> the generic type of message being handled
- */
-abstract class InternalMessageBusClient<M> extends WebSocketClientImpl {
-    private static final int THREAD_FACTORY_STACK_SIZE = 256;
-
-    // The logger for this class
-    private static final XLogger LOGGER = XLoggerFactory.getXLogger(InternalMessageBusClient.class);
-
-    // Name of the event bus.
-    private static final String RAW_EVENT_BUS = "Raw-Event-Bus";
-
-    // This instance handles the raw data received from the web socket
-    private final RawMessageHandler<M> rawMessageHandler = new RawMessageHandler<>();
-
-    // The message block handler to which to pass messages coming in on this client
-    private MessageBlockHandler<M> messageBlockHandler = null;
-
-    // The raw message handler uses a thread to process incoming events off a queue, this class owns and controls that
-    // thread. These fields hold the thread and
-    // the thread factory for creating threads.
-    private ApplicationThreadFactory threadFactory =
-            new ApplicationThreadFactory("ws-client-thread", THREAD_FACTORY_STACK_SIZE);
-    private Thread forwarderThread = null;
-
-    /**
-     * Construct the class and start the forwarding thread for received messages.
-     *
-     * @param serverUri the server URI to connect to
-     */
-    InternalMessageBusClient(final URI serverUri) {
-        // Call the super class to create the web socket
-        super(serverUri);
-        LOGGER.entry(serverUri.toString());
-
-        // Create the data handler for forwarding messages
-        messageBlockHandler = new MessageBlockHandler<>(RAW_EVENT_BUS);
-        messageBlockHandler.registerMessageHandler(rawMessageHandler);
-
-        // Create the thread that manages the queue in the data handler
-        forwarderThread = threadFactory.newThread(rawMessageHandler);
-        forwarderThread.start();
-
-        LOGGER.exit();
-    }
-
-    /**
-     * Callback for binary messages received from the remote host.
-     *
-     * @param rawMessage the received raw message
-     * @see org.java_websocket.client.WebSocketClient#onMessage(java.nio.ByteBuffer)
-     */
-    @Override
-    public void onMessage(final ByteBuffer rawMessage) {
-        // Post the message to the data handler for forwarding to its listeners
-        messageBlockHandler.post(new RawMessageBlock(rawMessage, null));
-    }
-
-    /**
-     * Callback for binary messages received from the remote host.
-     *
-     * @param stringMessage the string message
-     * @see org.java_websocket.client.WebSocketClient#onMessage(java.lang.String)
-     */
-    @Override
-    public final void onMessage(final String stringMessage) {
-        messageBlockHandler.post(stringMessage);
-    }
-
-    /**
-     * Register a subscriber class to the raw message handler.
-     *
-     * @param listener a simple class, that listens for the events from Event
-     */
-    public void addMessageListener(final MessageListener<M> listener) {
-        rawMessageHandler.registerDataForwarder(listener);
-    }
-
-    /**
-     * Removes the message listener.
-     *
-     * @param listener the listener
-     */
-    public void removeMessageListener(final MessageListener<M> listener) {
-        rawMessageHandler.unRegisterDataForwarder(listener);
-    }
-
-    /**
-     * Stop the thread handling message forwarding.
-     */
-    protected void stopListener() {
-        rawMessageHandler.shutdown();
-    }
-}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/client/MessagingClient.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/client/MessagingClient.java
deleted file mode 100644 (file)
index 0615837..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
- *  Modifications Copyright (C) 2020 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * 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.core.infrastructure.messaging.impl.ws.client;
-
-import java.net.URI;
-import org.java_websocket.WebSocket;
-import org.onap.policy.apex.core.infrastructure.messaging.MessageHolder;
-import org.onap.policy.apex.core.infrastructure.messaging.MessagingService;
-import org.onap.policy.apex.core.infrastructure.messaging.util.MessagingUtils;
-import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
-
-/**
- * The Class MessagingClient is the class that wraps web socket handling, message sending, and
- * message reception on the client side of a web socket in Apex.
- *
- * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com)
- * @param <M> the generic type
- */
-public class MessagingClient<M> extends InternalMessageBusClient<M> implements MessagingService<M> {
-    // The length of time to wait for a connection to a web socket server before aborting
-    private static final int CONNECTION_TIMEOUT_TIME_MS = 3000;
-
-    // The length of time to wait before checking if a connection to a web socket server has worked
-    // or not
-    private static final int CONNECTION_TRY_INTERVAL_MS = 100;
-
-    /**
-     * Constructor of this class, uses its {@link InternalMessageBusClient} superclass to set up the
-     * web socket and handle incoming message forwarding.
-     *
-     * @param serverUri The URI of the service
-     */
-    public MessagingClient(final URI serverUri) {
-        // Call the super class to create the web socket and set up received message forwarding
-        super(serverUri);
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public void stopConnection() {
-        // Stop message reception in the super class
-        super.stopListener();
-
-        // Close the web socket
-        final WebSocket connection = super.getConnection();
-        if (connection != null && connection.isOpen()) {
-            connection.closeConnection(0, "");
-        }
-        this.close();
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public void startConnection() {
-        // Open the web socket
-        final WebSocket connection = super.getConnection();
-
-        if (connection == null) {
-            throw new IllegalStateException("Could not connect to the server");
-        }
-        if (!connection.isOpen()) {
-            connect();
-        }
-
-        if (!waitforConnection(connection)) {
-            throw new IllegalStateException("Could not connect to the server");
-        }
-    }
-
-    /**
-     * This method waits for the timeout value for the client to connect to the web socket server.
-     *
-     * @param connection the connection to wait on
-     * @return true, if successful
-     */
-    private boolean waitforConnection(final WebSocket connection) {
-        // The total time we have before timeout
-        int timeoutMsCounter = CONNECTION_TIMEOUT_TIME_MS;
-
-        // Check the connection state
-        do {
-            switch (connection.getReadyState()) {
-                case NOT_YET_CONNECTED:
-                case CLOSING:
-                    // Not connected yet so wait for the try interval
-                    ThreadUtilities.sleep(CONNECTION_TRY_INTERVAL_MS);
-                    timeoutMsCounter -= CONNECTION_TRY_INTERVAL_MS;
-                    break;
-                case OPEN:
-                    // Connection is open, happy days
-                    return true;
-                case CLOSED:
-                    // Connection is closed, bah
-                    return false;
-                default:
-                    break;
-            }
-        } while (timeoutMsCounter > 0);
-        // While the timeout value has not expired
-
-        // We have timed out
-        return false;
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public void send(final MessageHolder<M> commands) {
-        // Get the connection and send the message
-        final WebSocket connection = super.getConnection();
-        connection.send(MessagingUtils.serializeObject(commands));
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public void send(final String messageString) {
-        final WebSocket connection = super.getConnection();
-        connection.send(messageString);
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public boolean isStarted() {
-        return getConnection().isOpen();
-    }
-}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/client/WebSocketClientImpl.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/client/WebSocketClientImpl.java
deleted file mode 100644 (file)
index 69609ae..0000000
+++ /dev/null
@@ -1,76 +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.core.infrastructure.messaging.impl.ws.client;
-
-import java.net.URI;
-import org.java_websocket.client.WebSocketClient;
-import org.java_websocket.handshake.ServerHandshake;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
-
-/**
- * This class implements {@link WebSocketClient} specific methods in order to act as a Java Web Socket client.
- *
- * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com)
- */
-abstract class WebSocketClientImpl extends WebSocketClient {
-    // The logger for this class
-    private static final XLogger LOGGER = XLoggerFactory.getXLogger(WebSocketClientImpl.class);
-
-    /**
-     * Constructs a WebSocketClient instance and sets it to the connect to the specified URI. The channel does not
-     * attempt to connect automatically. You must call {@link connect} first to initiate the socket connection.
-     *
-     * @param serverUri the URI of the web socket server to connect to
-     */
-    WebSocketClientImpl(final URI serverUri) {
-        super(serverUri);
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public void onOpen(final ServerHandshake handshakedata) {
-        if (LOGGER.isDebugEnabled()) {
-            LOGGER.debug("Connection opened to server {} --> {}", this.getURI(), handshakedata.getHttpStatusMessage());
-        }
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public void onClose(final int code, final String reason, final boolean remote) {
-        if (LOGGER.isDebugEnabled()) {
-            LOGGER.debug("Connection closed to server {} --> code \"{}\", reason \"{}\"", this.getURI(), code, reason);
-        }
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public void onError(final Exception ex) {
-        LOGGER.info("Failed to make a connection to the server {} ", getURI());
-        LOGGER.catching(ex);
-    }
-}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/client/package-info.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/client/package-info.java
deleted file mode 100644 (file)
index d5344fe..0000000
+++ /dev/null
@@ -1,27 +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=========================================================
- */
-
-/**
- * Provides the client side of messaging over web sockets.
- *
- * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com)
- */
-
-package org.onap.policy.apex.core.infrastructure.messaging.impl.ws.client;
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/MessageBlock.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/MessageBlock.java
deleted file mode 100644 (file)
index 75e82a0..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
- *  Modifications Copyright (C) 2021 AT&T Intellectual Property. 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.core.infrastructure.messaging.impl.ws.messageblock;
-
-import java.util.List;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import org.java_websocket.WebSocket;
-
-/**
- * This class encapsulate messages and the web socket on which they are handled.
- *
- * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com)
- * @param <M> the generic type of message being handled
- */
-@Getter
-@AllArgsConstructor
-public final class MessageBlock<M> {
-
-    // List of Messages received on a web socket
-    private final List<M> messages;
-
-    // The web socket on which the messages are handled
-    private final WebSocket webSocket;
-}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/MessageBlockHandler.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/MessageBlockHandler.java
deleted file mode 100644 (file)
index 0349cb5..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
- *  Modifications Copyright (C) 2021 AT&T Intellectual Property. 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.core.infrastructure.messaging.impl.ws.messageblock;
-
-import com.google.common.eventbus.EventBus;
-import org.onap.policy.apex.core.infrastructure.messaging.MessageListener;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
-
-/**
- * This class is used to pass messages received on a Java web socket to listening application class instances using an
- * event bus.
- *
- * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com)
- * @param <M> the generic type
- */
-public class MessageBlockHandler<M> {
-    // Logger for this class
-    private static final XLogger LOGGER = XLoggerFactory.getXLogger(MessageBlockHandler.class);
-
-    /**
-     * This event bus will forward the events to all of its subscribers.
-     */
-    private EventBus eventBus = null;
-
-    /**
-     * Instantiates a new data handler.
-     *
-     * @param eventBusName the name of the event bus for this message block handler
-     */
-    public MessageBlockHandler(final String eventBusName) {
-        eventBus = new EventBus(eventBusName);
-        LOGGER.trace("message bus {} created ", eventBusName);
-    }
-
-    /**
-     * Post a raw message block on the data handler event bus of this class.
-     *
-     * @param rawMessageBlock the block containing raw messages
-     */
-    public void post(final RawMessageBlock rawMessageBlock) {
-        if (rawMessageBlock.getMessage() != null) {
-            if (LOGGER.isDebugEnabled()) {
-                LOGGER.debug("new raw message recieved from {}", rawMessageBlock.getWebSocket() == null ? "server"
-                        : rawMessageBlock.getWebSocket().getRemoteSocketAddress().getHostName());
-            }
-            eventBus.post(rawMessageBlock);
-        }
-    }
-
-    /**
-     * Post a block of typed messages on the data handler event bus of this class.
-     *
-     * @param messageBlock the block containing typed messages
-     */
-    public void post(final MessageBlock<M> messageBlock) {
-        if (messageBlock.getMessages() != null) {
-            if (LOGGER.isDebugEnabled()) {
-                LOGGER.debug("new data message recieved from {}", messageBlock.getWebSocket() == null ? "server"
-                        : messageBlock.getWebSocket().getRemoteSocketAddress().getHostName());
-            }
-            eventBus.post(messageBlock);
-        }
-    }
-
-    /**
-     * Post a string message on the data handler event bus of this class.
-     *
-     * @param messageString the string message
-     */
-    public void post(final String messageString) {
-        if (messageString != null) {
-            if (LOGGER.isDebugEnabled()) {
-                LOGGER.debug("new string message recieved from server: {}", messageString);
-            }
-            eventBus.post(messageString);
-        }
-    }
-
-    /**
-     * Register a listener to event bus.
-     *
-     * @param listener is an instance of WebSocketMessageListener
-     */
-    public void registerMessageHandler(final MessageListener<M> listener) {
-        LOGGER.entry(listener);
-        if (listener == null) {
-            throw new IllegalArgumentException("listener object cannot be null");
-        }
-        eventBus.register(listener);
-        LOGGER.debug("message listener {} is registered with forwarder", listener);
-        LOGGER.exit();
-    }
-
-    /**
-     * Remove the listener subscribed to the event bus.
-     *
-     * @param listener the listener
-     */
-    public void unRegisterMessageHandler(final MessageListener<M> listener) {
-        if (listener == null) {
-            throw new IllegalArgumentException("listener object cannot be null");
-        }
-        LOGGER.entry(listener);
-        eventBus.unregister(listener);
-        LOGGER.trace(" message listener {} unregistered from forwarder", listener);
-        LOGGER.exit();
-    }
-}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/RawMessageBlock.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/RawMessageBlock.java
deleted file mode 100644 (file)
index e9448ab..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
- *  Modifications Copyright (C) 2021 AT&T Intellectual Property. 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.core.infrastructure.messaging.impl.ws.messageblock;
-
-import java.nio.ByteBuffer;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import org.java_websocket.WebSocket;
-
-/**
- * A container for a raw message block and the connection on which it is handled.
- *
- * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com)
- */
-@Getter
-@AllArgsConstructor
-public final class RawMessageBlock {
-    // The raw message
-    private final ByteBuffer message;
-
-    // The web socket on which the message is handled
-    private final WebSocket webSocket;
-}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/package-info.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/messageblock/package-info.java
deleted file mode 100644 (file)
index c01c88a..0000000
+++ /dev/null
@@ -1,27 +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=========================================================
- */
-
-/**
- * Pass blocks of messages on Web Sockets to clients using an event bus.
- *
- * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com)
- */
-
-package org.onap.policy.apex.core.infrastructure.messaging.impl.ws.messageblock;
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/package-info.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/package-info.java
deleted file mode 100644 (file)
index c881181..0000000
+++ /dev/null
@@ -1,27 +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=========================================================
- */
-
-/**
- * Provides a Web Service implementation of the Messaging interfaces.
- *
- * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com)
- */
-
-package org.onap.policy.apex.core.infrastructure.messaging.impl.ws;
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/server/InternalMessageBusServer.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/server/InternalMessageBusServer.java
deleted file mode 100644 (file)
index 18cdccc..0000000
+++ /dev/null
@@ -1,131 +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.core.infrastructure.messaging.impl.ws.server;
-
-import java.net.InetSocketAddress;
-import java.nio.ByteBuffer;
-import org.java_websocket.WebSocket;
-import org.onap.policy.apex.core.infrastructure.messaging.MessageListener;
-import org.onap.policy.apex.core.infrastructure.messaging.MessagingService;
-import org.onap.policy.apex.core.infrastructure.messaging.impl.ws.RawMessageHandler;
-import org.onap.policy.apex.core.infrastructure.messaging.impl.ws.messageblock.MessageBlockHandler;
-import org.onap.policy.apex.core.infrastructure.messaging.impl.ws.messageblock.RawMessageBlock;
-import org.onap.policy.apex.core.infrastructure.threading.ApplicationThreadFactory;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
-
-/**
- * The Class InternalMessageBusServer handles the server side of a web socket and handles the callback mechanism used to
- * receive messages on the web socket.
- *
- * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com)
- * @param <M> the generic type
- */
-abstract class InternalMessageBusServer<M> extends WebSocketServerImpl implements MessagingService<M> {
-    // Logger for this class
-    private static final XLogger LOGGER = XLoggerFactory.getXLogger(InternalMessageBusServer.class);
-
-    private static final int THREAD_FACTORY_STACK_SIZE = 256;
-
-    // Name of the event bus.
-    private static final String RAW_EVENT_BUS = "Raw-Event-Bus";
-
-    // This instance handles the raw data received from the web socket
-    private final RawMessageHandler<M> rawMessageHandler = new RawMessageHandler<>();
-
-    // The message block handler to which to pass messages coming in on this client
-    private MessageBlockHandler<M> messageBlockHandler = null;
-
-    // The raw message handler uses a thread to process incoming events off a queue, this class owns and controls that
-    // thread. These fields hold the thread and
-    // the thread factory for creating threads.
-    private ApplicationThreadFactory threadFactory =
-            new ApplicationThreadFactory("ws-server-thread", THREAD_FACTORY_STACK_SIZE);
-    private Thread forwarderThread = null;
-
-    /**
-     * Construct the class and start the forwarding thread for received messages.
-     *
-     * @param address the address of the server machine
-     */
-    protected InternalMessageBusServer(final InetSocketAddress address) {
-        // Call the super class to create the web socket
-        super(address);
-        LOGGER.entry(address.getAddress().getHostAddress() + ":" + address.getPort());
-
-        // Create the data handler for forwarding messages
-        messageBlockHandler = new MessageBlockHandler<>(RAW_EVENT_BUS);
-        messageBlockHandler.registerMessageHandler(rawMessageHandler);
-
-        // Create the thread that manages the queue in the data handler
-        forwarderThread = threadFactory.newThread(rawMessageHandler);
-        forwarderThread.start();
-
-        LOGGER.exit();
-    }
-
-    /**
-     * Callback for binary messages received from the remote host.
-     *
-     * @param webSocket the web socket on which the raw message was received
-     * @param rawMessage the received raw message
-     * @see #onMessage(WebSocket, String)
-     */
-    @Override
-    public void onMessage(final WebSocket webSocket, final ByteBuffer rawMessage) {
-        messageBlockHandler.post(new RawMessageBlock(rawMessage, webSocket));
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public void onMessage(final WebSocket webSocket, final String stringMessage) {
-        messageBlockHandler.post(stringMessage);
-    }
-
-    /**
-     * Register a subscriber class to the raw message handler.
-     *
-     * @param subscriber the subscriber
-     */
-    @Override
-    public void addMessageListener(final MessageListener<M> subscriber) {
-        rawMessageHandler.registerDataForwarder(subscriber);
-    }
-
-    /**
-     * Removes the message listener.
-     *
-     * @param subscriber the subscriber
-     */
-    @Override
-    public void removeMessageListener(final MessageListener<M> subscriber) {
-        rawMessageHandler.unRegisterDataForwarder(subscriber);
-    }
-
-    /**
-     * Stop the thread handling message forwarding.
-     */
-    protected void stopListener() {
-        rawMessageHandler.shutdown();
-    }
-}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/server/MessageServerImpl.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/server/MessageServerImpl.java
deleted file mode 100644 (file)
index 27ba46c..0000000
+++ /dev/null
@@ -1,152 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
- *  Modifications Copyright (C) 2020 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * 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.core.infrastructure.messaging.impl.ws.server;
-
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.util.Collection;
-import java.util.concurrent.atomic.AtomicBoolean;
-import org.java_websocket.WebSocket;
-import org.onap.policy.apex.core.infrastructure.messaging.MessageHolder;
-import org.onap.policy.apex.core.infrastructure.messaging.util.MessagingUtils;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
-
-/**
- * A messaging server implementation using web socket.
- *
- * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com)
- * @param <M> the generic type of message being passed
- */
-public class MessageServerImpl<M> extends InternalMessageBusServer<M> {
-    // The logger for this class
-    private static final XLogger LOGGER = XLoggerFactory.getXLogger(MessageServerImpl.class);
-
-    // The Web Socket protocol for URIs and URLs
-    private static final String PROTOCOL = "ws://";
-
-    // URI of this server
-    private final String connectionUri;
-
-    // Indicates if the web socket server is started or not
-    private final AtomicBoolean isStarted = new AtomicBoolean(false);
-
-    /**
-     * Instantiates a new web socket messaging server for Apex.
-     *
-     * @param address the address of the server machine on which to start the server
-     */
-    public MessageServerImpl(final InetSocketAddress address) {
-        // Call the super class to create the web socket and set up received message forwarding
-        super(address);
-        LOGGER.entry(address);
-
-        // Compose the Web Socket URI
-        connectionUri = PROTOCOL + address.getHostString() + ":" + address.getPort();
-        LOGGER.debug("Server connection URI: {}", connectionUri);
-
-        LOGGER.exit();
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public void startConnection() {
-        // Start reception of connections on the web socket
-        start();
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public void stopConnection() {
-        // Stop message listening using our super class
-        stopListener();
-
-        // Stop the web socket server
-        try {
-            // Close all connections on this web socket server
-            for (final WebSocket connection : getConnections()) {
-                connection.closeConnection(0, "");
-            }
-            stop();
-        } catch (final IOException ioe) {
-            LOGGER.catching(ioe);
-        } catch (final InterruptedException e) {
-            // restore the interrupt status
-            Thread.currentThread().interrupt();
-            // This can happen in normal operation so ignore
-        }
-        isStarted.set(false);
-    }
-
-    /**
-     * Return the current connection URI.
-     *
-     * @return connection URI
-     */
-    public String getConnectionUrl() {
-        if (connectionUri == null) {
-            throw new IllegalStateException("URI not set - The server is not started");
-        }
-        return connectionUri;
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public void send(final MessageHolder<M> message) {
-        // Send the incoming message to all clients connected to this web socket
-        final Collection<WebSocket> connections = getConnections();
-        for (final WebSocket webSocket : connections) {
-            webSocket.send(MessagingUtils.serializeObject(message));
-        }
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public void send(final String messageString) {
-        final Collection<WebSocket> connections = getConnections();
-        for (final WebSocket webSocket : connections) {
-            webSocket.send(messageString);
-        }
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public boolean isStarted() {
-        return isStarted.get();
-    }
-
-    @Override
-    public void onStart() {
-        isStarted.set(true);
-        LOGGER.debug("started deployment server on URI: {}", connectionUri);
-    }
-}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/server/WebSocketServerImpl.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/server/WebSocketServerImpl.java
deleted file mode 100644 (file)
index 6eda6e2..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
- *  Modifications Copyright (C) 2020 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * 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.core.infrastructure.messaging.impl.ws.server;
-
-import java.net.InetSocketAddress;
-import org.java_websocket.WebSocket;
-import org.java_websocket.handshake.ClientHandshake;
-import org.java_websocket.server.WebSocketServer;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
-
-/**
- * This class is the web socket server specific implementation for Apex.
- *
- * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com)
- */
-abstract class WebSocketServerImpl extends WebSocketServer {
-    // The logger for this class
-    private static final XLogger LOGGER = XLoggerFactory.getXLogger(MessageServerImpl.class);
-
-    /**
-     * Constructor of this class.
-     *
-     * @param address host address of the local machine.
-     */
-    protected WebSocketServerImpl(final InetSocketAddress address) {
-        super(address);
-        LOGGER.entry(address.getAddress().getHostAddress() + ":" + address.getPort());
-        LOGGER.exit();
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public void onOpen(final WebSocket conn, final ClientHandshake handshake) {
-        LOGGER.entry(conn, handshake);
-        LOGGER.debug("A client connection opened from machine {}.",
-                conn.getRemoteSocketAddress().getAddress().getHostAddress());
-        LOGGER.exit();
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public void onClose(final WebSocket conn, final int code, final String reason, final boolean remote) {
-        LOGGER.entry(conn, code, remote);
-        LOGGER.debug("A client  connection from machine {} closing with code {}.", super.getAddress(), code);
-        LOGGER.exit();
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public void onError(final WebSocket conn, final Exception ex) {
-        // some errors like port binding failed may not be assignable to a specific web socket
-        LOGGER.error("server error occurred", ex);
-    }
-}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/server/package-info.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/impl/ws/server/package-info.java
deleted file mode 100644 (file)
index 0a7235b..0000000
+++ /dev/null
@@ -1,27 +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=========================================================
- */
-
-/**
- * Provides the server side of messaging over web sockets.
- *
- * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com)
- */
-
-package org.onap.policy.apex.core.infrastructure.messaging.impl.ws.server;
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/package-info.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/package-info.java
deleted file mode 100644 (file)
index adb17da..0000000
+++ /dev/null
@@ -1,27 +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=========================================================
- */
-
-/**
- * Provides support for passing messages as POJOs and as strings over Web Sockets.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-
-package org.onap.policy.apex.core.infrastructure.messaging;
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WsStringMessageClient.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WsStringMessageClient.java
deleted file mode 100644 (file)
index edf9ec0..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
- *  Modifications Copyright (C) 2020 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * 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.core.infrastructure.messaging.stringmessaging;
-
-import com.google.common.eventbus.Subscribe;
-import java.net.URI;
-import org.onap.policy.apex.core.infrastructure.messaging.MessageListener;
-import org.onap.policy.apex.core.infrastructure.messaging.MessagingException;
-import org.onap.policy.apex.core.infrastructure.messaging.MessagingService;
-import org.onap.policy.apex.core.infrastructure.messaging.MessagingServiceFactory;
-import org.onap.policy.apex.core.infrastructure.messaging.impl.ws.messageblock.MessageBlock;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
-
-/**
- * This class uses a web socket client to send and receive strings over a web socket.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-public class WsStringMessageClient implements WsStringMessager {
-    private static final XLogger LOGGER = XLoggerFactory.getXLogger(WsStringMessageClient.class);
-
-    // Repeated string constants
-    private static final String MESSAGE_PREAMBLE = "web socket event consumer client to \"";
-
-    // Message service factory and the message service itself
-    private final MessagingServiceFactory<String> factory = new MessagingServiceFactory<>();
-    private MessagingService<String> service = null;
-
-    // The listener to use for reception of strings
-    private WsStringMessageListener wsStringMessageListener;
-
-    // Address of the server
-    private final String host;
-    private final int port;
-    private String uriString;
-
-    /**
-     * Constructor, define the host and port of the server to connect to.
-     *
-     * @param host the host of the server
-     * @param port the port of the server
-     */
-    public WsStringMessageClient(final String host, final int port) {
-        this.host = host;
-        this.port = port;
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public void start(final WsStringMessageListener newWsStringMessageListener) throws MessagingException {
-        this.wsStringMessageListener = newWsStringMessageListener;
-
-        uriString = "ws://" + host + ":" + port;
-        String messagePreamble = MESSAGE_PREAMBLE + uriString + "\" ";
-        LOGGER.entry(messagePreamble + "starting . . .");
-
-        try {
-            service = factory.createClient(new URI(uriString));
-            service.addMessageListener(new WsStringMessageClientListener());
-            service.startConnection();
-        } catch (final Exception e) {
-            String message = messagePreamble + "start failed";
-            LOGGER.warn(message, e);
-            throw new MessagingException(message, e);
-        }
-
-        LOGGER.exit(messagePreamble + "started");
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public void stop() {
-        LOGGER.entry(MESSAGE_PREAMBLE + uriString + "\" stopping . . .");
-        service.stopConnection();
-        LOGGER.exit(MESSAGE_PREAMBLE + uriString + "\" stopped");
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public void sendString(final String stringMessage) {
-        service.send(stringMessage);
-
-        if (LOGGER.isDebugEnabled()) {
-            String message = "message sent to server: " + stringMessage;
-            LOGGER.debug(message);
-        }
-    }
-
-    /**
-     * The Class WSStringMessageClientListener.
-     */
-    private class WsStringMessageClientListener implements MessageListener<String> {
-        /**
-         * {@inheritDoc}.
-         */
-        @Subscribe
-        @Override
-        public void onMessage(final MessageBlock<String> messageBlock) {
-            throw new UnsupportedOperationException("raw messages are not supported on string message clients");
-        }
-
-        /**
-         * {@inheritDoc}.
-         */
-        @Subscribe
-        @Override
-        public void onMessage(final String messageString) {
-            wsStringMessageListener.receiveString(messageString);
-        }
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public boolean isStarted() {
-        return service.isStarted();
-    }
-}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WsStringMessageListener.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WsStringMessageListener.java
deleted file mode 100644 (file)
index fd8a3a3..0000000
+++ /dev/null
@@ -1,37 +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.core.infrastructure.messaging.stringmessaging;
-
-/**
- * This interface is used to call back the owner of a String Web socket message server or client.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-@FunctionalInterface
-public interface WsStringMessageListener {
-
-    /**
-     * Receive a string coming off a web socket.
-     *
-     * @param stringMessage the string message
-     */
-    void receiveString(String stringMessage);
-}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WsStringMessageServer.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WsStringMessageServer.java
deleted file mode 100644 (file)
index 8b6d0c6..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
- *  Modifications Copyright (C) 2019-2020 Nordix Foundation.
- *  Modifications Copyright (C) 2021 Bell Canada. 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.core.infrastructure.messaging.stringmessaging;
-
-import com.google.common.eventbus.Subscribe;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.UnknownHostException;
-import org.onap.policy.apex.core.infrastructure.messaging.MessageListener;
-import org.onap.policy.apex.core.infrastructure.messaging.MessagingException;
-import org.onap.policy.apex.core.infrastructure.messaging.MessagingService;
-import org.onap.policy.apex.core.infrastructure.messaging.MessagingServiceFactory;
-import org.onap.policy.apex.core.infrastructure.messaging.impl.ws.messageblock.MessageBlock;
-import org.onap.policy.apex.core.infrastructure.messaging.util.MessagingUtils;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
-
-/**
- * This class runs a web socket server for sending and receiving of strings over a web socket.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-public class WsStringMessageServer implements WsStringMessager {
-    private static final XLogger LOGGER = XLoggerFactory.getXLogger(WsStringMessageServer.class);
-
-    // Message service factory and the message service itself
-    private final MessagingServiceFactory<String> factory = new MessagingServiceFactory<>();
-    private MessagingService<String> service = null;
-
-    // The listener to use for reception of strings
-    private WsStringMessageListener wsStringMessageListener;
-
-    // Address of the server
-    private final int port;
-
-    /**
-     * Constructor, define the port of the server.
-     *
-     * @param port the port of the server
-     */
-    public WsStringMessageServer(final int port) {
-        this.port = port;
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public void start(final WsStringMessageListener newWsStringMessageListener) throws MessagingException {
-
-        LOGGER.entry("web socket event consumer server starting . . .");
-        if (LOGGER.isDebugEnabled()) {
-            var lanaddress = "unknown";
-            try {
-                lanaddress = MessagingUtils.getLocalHostLanAddress().getHostAddress();
-            } catch (final UnknownHostException ignore) {
-                LOGGER.debug("Failed to find name of local address name", ignore);
-            }
-            LOGGER.debug("web socket string message server LAN address=" + lanaddress);
-            var hostaddress = "unknown";
-            try {
-                hostaddress = InetAddress.getLocalHost().getHostAddress();
-            } catch (final UnknownHostException ignore) {
-                LOGGER.debug("Failed to find name of local address", ignore);
-            }
-            LOGGER.debug("web socket string message server host address=" + hostaddress);
-        }
-
-        this.wsStringMessageListener = newWsStringMessageListener;
-
-        try {
-            service = factory.createServer(new InetSocketAddress(port));
-            service.addMessageListener(new WsStringMessageServerListener());
-            service.startConnection();
-        } catch (final Exception e) {
-            LOGGER.warn("web socket string message server start failed", e);
-            throw new MessagingException("web socket string message start failed", e);
-        }
-
-        LOGGER.exit("web socket string message server started");
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public void stop() {
-        LOGGER.entry("web socket string message server stopping . . .");
-        service.stopConnection();
-        LOGGER.exit("web socket string message server stopped");
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public void sendString(final String stringMessage) {
-        service.send(stringMessage);
-        if (LOGGER.isDebugEnabled()) {
-            LOGGER.debug("server sent message: {}", stringMessage);
-        }
-    }
-
-    /**
-     * The listener for strings coming into the server.
-     */
-    private class WsStringMessageServerListener implements MessageListener<String> {
-
-        /**
-         * {@inheritDoc}.
-         */
-        @Subscribe
-        @Override
-        public void onMessage(final MessageBlock<String> messageBlock) {
-            throw new UnsupportedOperationException("raw messages are not supported on string message clients");
-        }
-
-        /**
-         * {@inheritDoc}.
-         */
-        @Subscribe
-        @Override
-        public void onMessage(final String messageString) {
-            wsStringMessageListener.receiveString(messageString);
-        }
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public boolean isStarted() {
-        return service.isStarted();
-    }
-}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WsStringMessager.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/WsStringMessager.java
deleted file mode 100644 (file)
index c6db1ff..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
- *  Modifications Copyright (C) 2020 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * 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.core.infrastructure.messaging.stringmessaging;
-
-import org.onap.policy.apex.core.infrastructure.messaging.MessagingException;
-
-/**
- * This interface is used to call a String Web socket message server or client to send a string.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-public interface WsStringMessager {
-
-    /**
-     * Start the string message sender.
-     *
-     * @param wsStringMessageListener the listener to use for listening for string messages
-     * @throws MessagingException the messaging exception
-     */
-    void start(WsStringMessageListener wsStringMessageListener) throws MessagingException;
-
-    /**
-     * Stop the string messaging sender.
-     */
-    void stop();
-
-    /**
-     * Send a string on a web socket.
-     *
-     * @param stringMessage the string message to send
-     */
-    void sendString(String stringMessage);
-
-    /**
-     * Check if the string messager is started.
-     */
-    boolean isStarted();
-}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/package-info.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/stringmessaging/package-info.java
deleted file mode 100644 (file)
index a8e679c..0000000
+++ /dev/null
@@ -1,27 +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=========================================================
- */
-
-/**
- * Provides string messaging over Web Sockets.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-
-package org.onap.policy.apex.core.infrastructure.messaging.stringmessaging;
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/util/MessagingUtils.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/util/MessagingUtils.java
deleted file mode 100644 (file)
index 071a6cf..0000000
+++ /dev/null
@@ -1,226 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
- *  Modifications Copyright (C) 2019 Nordix Foundation.
- *  Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
- *  Modifications Copyright (C) 2021 Bell Canada. 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.core.infrastructure.messaging.util;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-import java.net.InetAddress;
-import java.net.NetworkInterface;
-import java.net.Socket;
-import java.net.UnknownHostException;
-import java.util.Enumeration;
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
-
-/**
- * The Class MessagingUtils is a class with static methods used in IPC messaging for finding free ports, translating
- * host names to addresses, serializing objects and flushing object streams.
- *
- * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com)
- */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class MessagingUtils {
-    // The port number of the lowest user port, ports 0-1023 are system ports
-    private static final int LOWEST_USER_PORT = 1024;
-
-    /**
-     * Port number is an unsigned 16-bit integer, so maximum port is 65535.
-     */
-    private static final int MAX_PORT_RANGE = 65535;
-
-    // Logger for this class
-    private static final XLogger LOGGER = XLoggerFactory.getXLogger(MessagingUtils.class);
-
-    /**
-     * This method searches the availability of the port, if the requested port not available, this method will throw an
-     * exception.
-     *
-     * @param port the port to check
-     * @return the port verified as being free
-     * @throws RuntimeException on port allocation errors
-     */
-    public static int checkPort(final int port) {
-        LOGGER.entry("Checking availability of  port {}", port);
-
-        if (isPortAvailable(port)) {
-            LOGGER.debug("Port {} is available ", port);
-            return port;
-        }
-        LOGGER.debug("Port {} is not available", port);
-        throw new IllegalArgumentException("could not allocate requested port: " + port);
-    }
-
-    /**
-     * This method searches the availability of the port, if the requested port not available,this method will increment
-     * the port number and check the availability of that port, this process will continue until it reaches max port
-     * range which is MAX_PORT_RANGE.
-     *
-     * @param port the first port to check
-     * @return the port that was found
-     * @throws RuntimeException on port allocation errors
-     */
-    public static int findPort(final int port) {
-        LOGGER.entry("Checking availability of  port {}", port);
-
-        int availablePort = port;
-
-        while (availablePort <= MAX_PORT_RANGE) {
-            if (isPortAvailable(availablePort)) {
-                LOGGER.debug("Port {} is available ", availablePort);
-                return availablePort;
-            }
-            LOGGER.debug("Port {} is not available", availablePort);
-            availablePort++;
-        }
-        throw new IllegalArgumentException("could not find free available");
-    }
-
-    /**
-     * Check if port is available or not.
-     *
-     * @param port the port to test
-     * @return true if port is available
-     */
-    public static boolean isPortAvailable(final int port) {
-        try (final var socket = new Socket("localhost", port)) {
-            return false;
-        } catch (final IOException ignoredException) {
-            LOGGER.trace("Port {} is available", port, ignoredException);
-            return true;
-        }
-    }
-
-    /**
-     * Returns the local host address.
-     *
-     * @return the local host address
-     * @throws IllegalStateException if the local host's address cannot be found
-     */
-    public static InetAddress getHost() {
-        try {
-            return InetAddress.getLocalHost();
-        } catch (final UnknownHostException e) {
-            throw new IllegalStateException(e.getMessage(), e);
-        }
-    }
-
-    /**
-     * This method searches the availability of the port, if the requested port not available,this method will increment
-     * the port number and check the availability, this process will continue until it find port available.
-     *
-     * @param port the first port to check
-     * @return the port that was found
-     * @throws RuntimeException on port allocation errors
-     */
-    public static int allocateAddress(final int port) {
-        if (port < LOWEST_USER_PORT) {
-            throw new IllegalArgumentException("The port " + port + "  is already in use");
-        }
-        return MessagingUtils.findPort(port);
-    }
-
-    /**
-     * Get an Internet Address for the local host.
-     *
-     * @return an Internet address
-     * @throws UnknownHostException if the address of the local host cannot be found
-     */
-    public static InetAddress getLocalHostLanAddress() throws UnknownHostException {
-        try {
-            InetAddress candidateAddress = null;
-            // Iterate all NICs (network interface cards)...
-            for (final Enumeration<NetworkInterface> ifaces = NetworkInterface.getNetworkInterfaces(); ifaces
-                    .hasMoreElements();) {
-                final NetworkInterface iface = ifaces.nextElement();
-                // Iterate all IP addresses assigned to each card...
-                for (final Enumeration<InetAddress> inetAddrs = iface.getInetAddresses(); inetAddrs
-                        .hasMoreElements();) {
-                    final InetAddress inetAddr = inetAddrs.nextElement();
-                    if (!inetAddr.isLoopbackAddress()) {
-
-                        if (inetAddr.isSiteLocalAddress()) {
-                            // Found non-loopback site-local address. Return it
-                            // immediately...
-                            return inetAddr;
-                        } else if (candidateAddress == null) {
-                            // Found non-loopback address, but not
-                            // necessarily site-local.
-                            // Store it as a candidate to be returned if
-                            // site-local address is not subsequently
-                            // found...
-                            candidateAddress = inetAddr;
-                            // Note that we don't repeatedly assign
-                            // non-loopback non-site-local addresses as
-                            // candidates,
-                            // only the first. For subsequent iterations,
-                            // candidate will be non-null.
-                        }
-                    }
-                }
-            }
-            if (candidateAddress != null) {
-                // We did not find a site-local address, but we found some other
-                // non-loopback address.
-                // Server might have a non-site-local address assigned to its
-                // NIC (or it might be running
-                // IPv6 which deprecates the "site-local" concept).
-                // Return this non-loopback candidate address...
-                return candidateAddress;
-            }
-            // At this point, we did not find a non-loopback address.
-            // Fall back to returning whatever InetAddress.getLocalHost()
-            // returns...
-            final var jdkSuppliedAddress = InetAddress.getLocalHost();
-            if (jdkSuppliedAddress == null) {
-                throw new UnknownHostException("The JDK InetAddress.getLocalHost() method unexpectedly returned null.");
-            }
-            return jdkSuppliedAddress;
-        } catch (final Exception e) {
-            final var unknownHostException =
-                    new UnknownHostException("Failed to determine LAN address: " + e);
-            unknownHostException.initCause(e);
-            throw unknownHostException;
-        }
-    }
-
-    /**
-     * This method serializes the message holder objects.
-     *
-     * @param object the object
-     * @return byte[]
-     */
-    public static byte[] serializeObject(final Object object) {
-        LOGGER.entry(object.getClass().getName());
-        final var bytesOut = new ByteArrayOutputStream();
-        try (var oos = new ObjectOutputStream(bytesOut)) {
-            oos.writeObject(object);
-        } catch (final IOException e) {
-            LOGGER.warn("error on object serialization", e);
-        }
-        return bytesOut.toByteArray();
-    }
-}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/util/package-info.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/messaging/util/package-info.java
deleted file mode 100644 (file)
index ccb12f2..0000000
+++ /dev/null
@@ -1,27 +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=========================================================
- */
-
-/**
- * Contains utility classes for messaging using sockets and web sockets.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-
-package org.onap.policy.apex.core.infrastructure.messaging.util;
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/package-info.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/package-info.java
deleted file mode 100644 (file)
index 8bd0a09..0000000
+++ /dev/null
@@ -1,27 +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=========================================================
- */
-
-/**
- * Provides infrastructure and utility functions for use by other classes and modules in APEX.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-
-package org.onap.policy.apex.core.infrastructure;
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/xml/XPathReader.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/xml/XPathReader.java
deleted file mode 100644 (file)
index 2f863d0..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
- *  Modifications Copyright (C) 2020 Nordix Foundation.
- *  Modifications Copyright (C) 2021 Bell Canada. 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.core.infrastructure.xml;
-
-import java.io.InputStream;
-import javax.xml.XMLConstants;
-import javax.xml.namespace.QName;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.xpath.XPath;
-import javax.xml.xpath.XPathExpressionException;
-import javax.xml.xpath.XPathFactory;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
-import org.w3c.dom.Document;
-
-/**
- * A generic class for applying the XPATH queries on XML files.
- *
- * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com)
- */
-public class XPathReader {
-
-    // Logger for this class
-    private static final XLogger LOGGER = XLoggerFactory.getXLogger(XPathReader.class);
-
-    private String xmlFileName = null;
-    private InputStream xmlStream = null;
-    private Document xmlDocument;
-    private XPath xpath;
-
-    /**
-     * Construct Reader for the file passed in.
-     *
-     * @param xmlFileName the xml file name
-     */
-    public XPathReader(final String xmlFileName) {
-        this.xmlFileName = xmlFileName;
-        init();
-    }
-
-    /**
-     * Construct Reader for the stream passed in.
-     *
-     * @param xmlStream a stream of XML
-     */
-    public XPathReader(final InputStream xmlStream) {
-        this.xmlStream = xmlStream;
-        init();
-    }
-
-    /**
-     * Initialise the x-path reader.
-     */
-    private void init() {
-        try {
-            LOGGER.info("Initializing XPath reader");
-            var df = DocumentBuilderFactory.newInstance();
-            df.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
-            df.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "");
-            df.setAttribute(XMLConstants.ACCESS_EXTERNAL_SCHEMA, "");
-            // Check if this is operating on a file
-            if (xmlFileName != null) {
-                xmlDocument = df.newDocumentBuilder().parse(xmlFileName);
-            } else if (xmlStream != null) {
-                // Check if this is operating on a stream
-                xmlDocument = df.newDocumentBuilder().parse(xmlStream);
-            } else {
-                // We have an error
-                LOGGER.error("XPath reader not initialized with either a file or a stream");
-                return;
-            }
-
-            xpath = XPathFactory.newInstance().newXPath();
-            LOGGER.info("Initialized XPath reader");
-        } catch (final Exception ex) {
-            LOGGER.error("Error parsing XML file/stream from XPath reading, reason :\n" + ex.getMessage(), ex);
-        }
-    }
-
-    /**
-     * Read items from the file using xpath.
-     *
-     * @param expression x-path expression
-     * @param returnType XML node Set
-     * @return last node collected
-     */
-    public Object read(final String expression, final QName returnType) {
-        try {
-            final var xPathExpression = xpath.compile(expression);
-            return xPathExpression.evaluate(xmlDocument, returnType);
-        } catch (final XPathExpressionException ex) {
-            LOGGER.error("Failed to read XML file for XPath processing, reason:\n" + ex.getMessage(), ex);
-            return null;
-        }
-    }
-}
diff --git a/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/xml/package-info.java b/core/core-infrastructure/src/main/java/org/onap/policy/apex/core/infrastructure/xml/package-info.java
deleted file mode 100644 (file)
index 5631bd1..0000000
+++ /dev/null
@@ -1,27 +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=========================================================
- */
-
-/**
- * Provides utility XML classes for use by other classes and modules in APEX.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-
-package org.onap.policy.apex.core.infrastructure.xml;
diff --git a/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/java/classes/ClassUtilsTest.java b/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/java/classes/ClassUtilsTest.java
deleted file mode 100644 (file)
index 060dcce..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (c) 2020 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * 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.core.infrastructure.java.classes;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Set;
-import java.util.TreeSet;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-public class ClassUtilsTest {
-
-    @Test
-    public void testGetClassNames() throws IOException {
-        InputStream input = null;
-        ClassUtils.getClassNames();
-        assertEquals(new TreeSet<>(), ClassUtils.processJar(input));
-    }
-
-    @Test
-    public void testProcessFileName() {
-        assertEquals("testing.txt", ClassUtils.processFileName("testing.txt"));
-        assertNull(ClassUtils.processFileName(null));
-        assertEquals("", ClassUtils.processFileName("/classes/"));
-    }
-
-    @Test
-    public void testProcessDir() throws Exception {
-        File mockFile = Mockito.mock(File.class);
-        Mockito.when(mockFile.isDirectory()).thenReturn(false);
-        assertEquals(new TreeSet<>(), ClassUtils.processDir(mockFile, "Here"));
-        assertEquals(new TreeSet<>(), ClassUtils.processDir(null, "Test"));
-        Mockito.when(mockFile.isDirectory()).thenReturn(true);
-
-        File mockChildFile = Mockito.mock(File.class);
-        File[] files = {mockChildFile};
-        Mockito.when(mockFile.listFiles()).thenReturn(files);
-        Mockito.when(mockChildFile.getName()).thenReturn("test.class");
-        Mockito.when(mockChildFile.getAbsolutePath()).thenReturn("/test/");
-        assertEquals(Set.of(".test."), ClassUtils.processDir(mockFile, "Here"));
-        Mockito.when(mockChildFile.getName()).thenReturn("test.class");
-        assertEquals(Set.of(".test."), ClassUtils.processDir(mockFile, "Here"));
-        Mockito.when(mockChildFile.getName()).thenReturn("$test.class");
-        assertEquals(new TreeSet<>(), ClassUtils.processDir(mockFile, "Here"));
-    }
-
-}
diff --git a/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/DummyMessageListener.java b/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/DummyMessageListener.java
deleted file mode 100644 (file)
index f81394c..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
- *  Modifications Copyright (C) 2021 AT&T Intellectual Property. 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.core.infrastructure.messaging;
-
-import com.google.common.eventbus.Subscribe;
-import org.onap.policy.apex.core.infrastructure.messaging.impl.ws.messageblock.MessageBlock;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
-
-/**
- * The listener interface for receiving testMessage events. The class that is interested in processing a testMessage
- * event implements this interface, and the object created with that class is registered with a component using the
- * component's <code>addTestMessageListener</code> method. When the testMessage event occurs, that object's appropriate
- * method is invoked.
- *
- */
-public abstract class DummyMessageListener implements MessageListener<String> {
-
-    /** The Constant logger. */
-    private static final XLogger logger = XLoggerFactory.getXLogger(DummyMessageListener.class);
-
-    /**
-     * On command.
-     *
-     * @param data the data
-     */
-    public abstract void onCommand(MessageBlock<String> data);
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Subscribe
-    @Override
-    public final void onMessage(final MessageBlock<String> data) {
-        if (data != null) {
-            if (logger.isDebugEnabled()) {
-                logger.debug("{} command recieved from machine {} ", data.getMessages().size(),
-                        data.getWebSocket().getRemoteSocketAddress().getHostString());
-            }
-            onCommand(data);
-        }
-    }
-}
diff --git a/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/EndToEndStringMessagingTest.java b/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/EndToEndStringMessagingTest.java
deleted file mode 100644 (file)
index e5375b7..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
- *  Modifications Copyright (C) 2020 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * 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.core.infrastructure.messaging;
-
-import static org.awaitility.Awaitility.await;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.util.concurrent.TimeUnit;
-import org.junit.Test;
-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.messaging.stringmessaging.WsStringMessageServer;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
-
-/**
- * The Class EndToEndMessagingTest.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-public class EndToEndStringMessagingTest {
-    // Logger for this class
-    private static final XLogger logger = XLoggerFactory.getXLogger(EndToEndStringMessagingTest.class);
-
-    private WsStringMessageServer server;
-    private WsStringMessageClient client;
-
-    private boolean finished = false;
-
-    @Test
-    public void testEndToEndMessaging() throws MessagingException {
-        logger.debug("end to end messaging test starting . . .");
-        server = new WsStringMessageServer(44441);
-        assertNotNull(server);
-        server.start(new WsStringServerMessageListener());
-
-        await().atMost(2, TimeUnit.SECONDS).until(() -> server.isStarted());
-
-        try {
-            client = new WsStringMessageClient("localhost", 44441);
-            assertNotNull(client);
-            client.start(new WsStringClientMessageListener());
-
-            client.sendString("Hello, client here");
-
-            await().atLeast(50, TimeUnit.MILLISECONDS).until(() -> finished);
-
-        } finally {
-            if (client != null) {
-                client.stop();
-            }
-            if (server != null) {
-                server.stop();
-            }
-
-        }
-        logger.debug("end to end messaging test finished");
-    }
-
-    private class WsStringServerMessageListener implements WsStringMessageListener {
-        @Override
-        public void receiveString(final String stringMessage) {
-            logger.debug(stringMessage);
-            assertEquals("Hello, client here", stringMessage);
-            server.sendString("Hello back from server");
-        }
-    }
-
-    private class WsStringClientMessageListener implements WsStringMessageListener {
-        @Override
-        public void receiveString(final String stringMessage) {
-            logger.debug(stringMessage);
-            assertEquals("Hello back from server", stringMessage);
-            finished = true;
-        }
-    }
-}
diff --git a/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/MessagingUtilsTest.java b/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/MessagingUtilsTest.java
deleted file mode 100644 (file)
index 6d5915c..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (c) 2020 Nordix Foundation.
- *  Modifications Copyright (C) 2021 AT&T Intellectual Property. 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.core.infrastructure.messaging;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import org.junit.Test;
-import org.onap.policy.apex.core.infrastructure.messaging.util.MessagingUtils;
-
-public class MessagingUtilsTest {
-
-    @Test
-    public void testCheckPort() throws UnknownHostException, IOException {
-        assertEquals(1, MessagingUtils.checkPort(1));
-        assertEquals(1, MessagingUtils.findPort(1));
-    }
-
-    @Test(expected = IllegalArgumentException.class)
-    public void testIllegalArgumentException() {
-        MessagingUtils.findPort(65536);
-    }
-
-    @Test
-    public void testGetHost() throws UnknownHostException {
-        InetAddress host = InetAddress.getLocalHost();
-        assertEquals(host, MessagingUtils.getHost());
-    }
-
-    @Test
-    public void testValidAllocateAddress() throws UnknownHostException {
-        assertNotNull(MessagingUtils.getLocalHostLanAddress());
-        int allocatedPort = MessagingUtils.allocateAddress(3306);
-        assertTrue(allocatedPort >= 3306 && allocatedPort < 65536);
-    }
-
-    @Test(expected = IllegalArgumentException.class)
-    public void testInvalidAllocateAddress() {
-        MessagingUtils.allocateAddress(1);
-    }
-
-    @Test
-    public void testSerializeObject() {
-        String testString = "Test";
-        MessagingUtils.serializeObject(new Object());
-        assertNotNull(MessagingUtils.serializeObject(testString));
-    }
-}
diff --git a/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/StringTestServer.java b/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/StringTestServer.java
deleted file mode 100644 (file)
index 9cf99fe..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
- *  Modifications Copyright (C) 2020 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * 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.core.infrastructure.messaging;
-
-import static org.junit.Assert.assertNotNull;
-
-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;
-
-/**
- * The Class StringTestServer.
- */
-public class StringTestServer {
-    private WsStringMessageServer server;
-
-    /**
-     * Create a string test server.
-     *
-     * @param port port to use
-     * @param timeToLive time to live
-     * @throws MessagingException exceptions on messages
-     */
-    public StringTestServer(final int port, long timeToLive) throws MessagingException {
-        System.out.println("StringTestServer starting on port " + port + " for " + timeToLive + " seconds . . .");
-        server = new WsStringMessageServer(port);
-        assertNotNull(server);
-        server.start(new WsStringServerMessageListener());
-
-        System.out.println("StringTestServer started on port " + port + " for " + timeToLive + " seconds");
-
-        // convert to milliSeconds
-        ThreadUtilities.sleep(1000 * timeToLive);
-
-        server.stop();
-        System.out.println("StringTestServer completed");
-    }
-
-    /**
-     * The listener interface for receiving WSStringServerMessage events. The class that is interested in processing a
-     * WSStringServerMessage event implements this interface, and the object created with that class is registered with
-     * a component using the component's <code>addWSStringServerMessageListener</code> method. When the
-     * WSStringServerMessage event occurs, that object's appropriate method is invoked.
-     *
-     * @see WSStringServerMessageEvent
-     */
-    private class WsStringServerMessageListener implements WsStringMessageListener {
-
-        /**
-         * {@inheritDoc}.
-         */
-        @Override
-        public void receiveString(final String stringMessage) {
-            System.out.println("Server received string \"" + stringMessage + "\"");
-            server.sendString("Server echoing back the message: \"" + stringMessage + "\"");
-        }
-    }
-
-    /**
-     * 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: StringTestServer port timeToLive");
-            return;
-        }
-
-        int port = 0;
-        try {
-            port = Integer.parseInt(args[0]);
-        } catch (final Exception e) {
-            System.err.println("Usage: StringTestServer port timeToLive");
-            e.printStackTrace();
-            return;
-        }
-
-        long timeToLive = 0;
-        try {
-            timeToLive = Long.parseLong(args[1]);
-        } catch (final Exception e) {
-            System.err.println("Usage: StringTestServer port timeToLive");
-            e.printStackTrace();
-            return;
-        }
-
-        new StringTestServer(port, timeToLive);
-
-    }
-}
diff --git a/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/xml/XPathReaderTest.java b/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/xml/XPathReaderTest.java
deleted file mode 100644 (file)
index a3395ae..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2020 Nordix Foundation
- *  ================================================================================
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  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.core.infrastructure.xml;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import java.io.IOException;
-import java.net.URL;
-import javax.xml.xpath.XPathConstants;
-import org.junit.Test;
-
-public class XPathReaderTest {
-
-    final URL testResource = getClass().getClassLoader().getResource("xmlTestFile.xml");
-
-    @Test
-    public void canConstructWithFromFile() {
-        final XPathReader objectUnderTest = new XPathReader(testResource.getFile());
-        assertNotNull(objectUnderTest);
-    }
-
-    @Test
-    public void canConstructWithStream() throws IOException {
-        final XPathReader objectUnderTest = new XPathReader(testResource.openStream());
-        assertNotNull(objectUnderTest);
-    }
-
-    @Test
-    public void canConstructWithNull() {
-        final XPathReader objectUnderTest = new XPathReader((String) null);
-        assertNotNull(objectUnderTest);
-    }
-
-    @Test
-    public void canConstructWithInvalidFileName() {
-        final XPathReader objectUnderTest = new XPathReader("");
-        assertNotNull(objectUnderTest);
-    }
-
-    @Test
-    public void readReturnsCorrectValueWhenUsingCorrectXpath() throws IOException {
-        final XPathReader objectUnderTest = new XPathReader(testResource.openStream());
-        final String validXPathExpression = "/example/name";
-        final Object result = objectUnderTest.read(validXPathExpression, XPathConstants.STRING);
-        assertEquals("This is my name", result);
-    }
-
-    @Test
-    public void readReturnsNullWhenUsingInvalidXpath() throws IOException {
-        final XPathReader objectUnderTest = new XPathReader(testResource.openStream());
-        final String invalidXPathExpression = "";
-        assertNull(objectUnderTest.read(invalidXPathExpression, XPathConstants.STRING));
-    }
-
-}
diff --git a/core/core-infrastructure/src/test/resources/logback-test.xml b/core/core-infrastructure/src/test/resources/logback-test.xml
deleted file mode 100644 (file)
index c52f2de..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ============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=========================================================
--->
-
-<configuration>
-
-    <contextName>Apex</contextName>
-    <statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" />
-    <property name="LOG_DIR" value="${java.io.tmpdir}/apex_logging/" />
-
-    <!-- USE FOR STD OUT ONLY -->
-    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
-        <encoder>
-            <Pattern>%d %contextName [%t] %level %logger{36} - %msg%n</Pattern>
-        </encoder>
-    </appender>
-
-    <root level="INFO">
-        <appender-ref ref="STDOUT" />
-    </root>
-
-    <logger name="org.infinispan" level="INFO" additivity="false">
-        <appender-ref ref="STDOUT" />
-    </logger>
-
-    <logger name="org.apache.zookeeper.ClientCnxn" level="OFF" additivity="false">
-        <appender-ref ref="STDOUT" />
-    </logger>
-
-    <appender name="FILE" class="ch.qos.logback.core.FileAppender">
-        <file>${LOG_DIR}/apex.log</file>
-        <encoder>
-            <pattern>%d %-5relative [procId=${processId}] [%thread] %-5level
-                %logger{26} - %msg %n %ex{full}</pattern>
-        </encoder>
-    </appender>
-
-    <appender name="CTXT_FILE" class="ch.qos.logback.core.FileAppender">
-        <file>${LOG_DIR}/apex_ctxt.log</file>
-        <encoder>
-            <pattern>%d %-5relative [procId=${processId}] [%thread] %-5level
-                %logger{26} - %msg %n %ex{full}</pattern>
-        </encoder>
-    </appender>
-
-    <logger name="org.onap.policy.apex.core.context.impl.monitoring" level="INFO" additivity="false">
-        <appender-ref ref="CTXT_FILE" />
-    </logger>
-
-    <logger name="org.onap.policy.apex.core.context" level="INFO" additivity="false">
-        <appender-ref ref="STDOUT" />
-    </logger>
-</configuration>
diff --git a/core/core-infrastructure/src/test/resources/xmlTestFile.xml b/core/core-infrastructure/src/test/resources/xmlTestFile.xml
deleted file mode 100644 (file)
index 73359a1..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version='1.0'?>
-<!--
-  ============LICENSE_START=======================================================
-   Copyright (C) 2020 Nordix Foundation.
-  ================================================================================
-  Licensed under the Apache License, Version 2.0 (the "License");
-  you may not use this file except in compliance with the License.
-  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=========================================================
--->
-<example>
-    <name>This is my name</name>
-</example>
diff --git a/core/core-protocols/pom.xml b/core/core-protocols/pom.xml
deleted file mode 100644 (file)
index 2110ace..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-<!--
-  ============LICENSE_START=======================================================
-   Copyright (C) 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=========================================================
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.onap.policy.apex-pdp.core</groupId>
-        <artifactId>core</artifactId>
-        <version>2.7.1-SNAPSHOT</version>
-    </parent>
-
-    <artifactId>core-protocols</artifactId>
-    <name>${project.artifactId}</name>
-    <description>Protocols used to transfer information between components in Apex</description>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.onap.policy.apex-pdp.model</groupId>
-            <artifactId>model</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-    </dependencies>
-</project>
diff --git a/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/Action.java b/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/Action.java
deleted file mode 100644 (file)
index 33679c0..0000000
+++ /dev/null
@@ -1,39 +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.core.protocols;
-
-import java.io.Serializable;
-
-/**
- * This interface is used to enforce a common type on actions in the Apex messasging protocol. Action types the Apex
- * messaging protocol supports implement this interface.
- *
- * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com)
- */
-@FunctionalInterface
-public interface Action extends Serializable {
-    /**
-     * Return a string representation of each action.
-     *
-     * @return the action string
-     */
-    String getActionString();
-}
diff --git a/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/Message.java b/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/Message.java
deleted file mode 100644 (file)
index 005c181..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
- *  Modifications Copyright (C) 2021 AT&T Intellectual Property. 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.core.protocols;
-
-import java.io.Serializable;
-import lombok.AccessLevel;
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
-import lombok.Setter;
-import lombok.ToString;
-import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
-
-/**
- * The Class Message is used to pass protocol messages between Apex components.
- *
- * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com)
- */
-@Getter
-@ToString
-@EqualsAndHashCode
-public abstract class Message implements Serializable {
-
-    // Serialization ID
-    private static final long serialVersionUID = 2271443377544488309L;
-
-    // Default timeout on server side should be used
-    private static final int DEFAULT_REPLY_TIMEOUT = -1;
-
-    // The Action or message type of the message
-    private Action action = null;
-
-    // The artifact key of the artifact to which this message is related
-    @Getter(AccessLevel.NONE)
-    private AxArtifactKey targetKey = null;
-
-    // The data of the message
-    @Setter
-    private String messageData = null;
-
-    // The timeout time for replies in milliseconds
-    @Setter
-    @ToString.Exclude
-    @EqualsAndHashCode.Exclude
-    private int replyTimeout = DEFAULT_REPLY_TIMEOUT;
-
-    /**
-     * Instantiates a new message.
-     *
-     * @param action the action or message type of the message
-     * @param targetKey the artifact key of the artifact to which this message relates
-     */
-    protected Message(final Action action, final AxArtifactKey targetKey) {
-        this(action, targetKey, null);
-    }
-
-    /**
-     * Instantiates a new message.
-     *
-     * @param action the action or message type of the message
-     * @param targetKey the artifact key of the artifact to which this message relates
-     * @param messageData the message data to deliver
-     */
-    protected Message(final Action action, final AxArtifactKey targetKey, final String messageData) {
-        this.action = action;
-        this.targetKey = targetKey;
-        this.messageData = messageData;
-    }
-
-    /**
-     * Append to the message data.
-     *
-     * @param newMessageData the message data
-     */
-    public void appendMessageData(final String newMessageData) {
-        if (this.messageData == null) {
-            this.messageData = newMessageData;
-        } else {
-            this.messageData += newMessageData;
-        }
-    }
-
-    /**
-     * Gets the artifact key of the target of the message.
-     *
-     * @return the target
-     */
-    public final AxArtifactKey getTarget() {
-        return targetKey;
-    }
-
-    /**
-     * Gets the artifact key name of the target of the message.
-     *
-     * @return the target name
-     */
-    public final String getTargetName() {
-        return targetKey.getName();
-    }
-}
diff --git a/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/package-info.java b/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/package-info.java
deleted file mode 100644 (file)
index fceef33..0000000
+++ /dev/null
@@ -1,27 +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=========================================================
- */
-
-/**
- * Contains protocols that are used for communication in APEX.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-
-package org.onap.policy.apex.core.protocols;
diff --git a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/DummyAction.java b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/DummyAction.java
deleted file mode 100644 (file)
index 8760522..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2018 Ericsson. All rights reserved.
- *  Modifications Copyright (C) 2020 Nordix Foundation.
- *  Modifications Copyright (C) 2021 AT&T Intellectual Property. 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.core.protocols;
-
-import lombok.AllArgsConstructor;
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
-import lombok.Setter;
-
-/**
- * Dummy action for testing.
- */
-@Getter
-@Setter
-@EqualsAndHashCode
-@AllArgsConstructor
-public class DummyAction implements Action {
-    private static final long serialVersionUID = 9178856761163651594L;
-
-    private String actionString = "An Action String";
-}
diff --git a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/DummyMessage.java b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/DummyMessage.java
deleted file mode 100644 (file)
index 5e32c00..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2018 Ericsson. All rights reserved.
- *  Modifications Copyright (C) 2020 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * 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.core.protocols;
-
-import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
-
-/**
- * A dummy message class for testing.
- *
- */
-public class DummyMessage extends Message {
-    private static final long serialVersionUID = 8671295165136561708L;
-
-    public DummyMessage(final Action action, final AxArtifactKey targetKey) {
-        super(action, targetKey);
-    }
-
-    public DummyMessage(final Action action, final AxArtifactKey targetKey, final String messageData) {
-        super(action, targetKey, messageData);
-    }
-}
diff --git a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/SupportMessageTest.java b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/SupportMessageTest.java
deleted file mode 100644 (file)
index 8b19059..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2018 Ericsson. All rights reserved.
- *  Modifications Copyright (C) 2020 Nordix Foundation.
- *  Modifications Copyright (C) 2021 AT&T Intellectual Property. 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.core.protocols;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-
-import org.junit.Test;
-import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
-
-/**
- * Test of the abstract Message class.
- */
-public class SupportMessageTest {
-
-    @Test
-    public void testMessage() {
-        assertNotNull(new DummyMessage(new DummyAction(null), new AxArtifactKey()));
-        assertNotNull(new DummyMessage(new DummyAction(null), new AxArtifactKey(), "Message Data"));
-
-        DummyMessage dummyMessage = new DummyMessage(new DummyAction(null), new AxArtifactKey("Target:0.0.1"));
-        assertEquals(new DummyAction(null), dummyMessage.getAction());
-        assertThat(dummyMessage.toString())
-            .startsWith("Message(action=org.onap.policy.apex.core.protocols.DummyAction@")
-            .endsWith("targetKey=AxArtifactKey:(name=Target,version=0.0.1), messageData=null)");
-
-        dummyMessage.setMessageData("Message Data");
-        assertEquals("Message Data", dummyMessage.getMessageData());
-        dummyMessage.appendMessageData("\nMore Message Data");
-        assertEquals("Message Data\nMore Message Data", dummyMessage.getMessageData());
-        dummyMessage.setMessageData(null);
-        dummyMessage.appendMessageData("\nMore Message Data");
-        assertEquals("\nMore Message Data", dummyMessage.getMessageData());
-
-        dummyMessage.setReplyTimeout(123);
-        assertEquals(123, dummyMessage.getReplyTimeout());
-        assertEquals(new AxArtifactKey("Target:0.0.1"), dummyMessage.getTarget());
-        assertEquals("Target", dummyMessage.getTargetName());
-
-        assertNotEquals(0, dummyMessage.hashCode());
-        dummyMessage.setMessageData(null);
-        assertNotEquals(0, dummyMessage.hashCode());
-        dummyMessage = new DummyMessage(null, null, null);
-        assertNotEquals(0, dummyMessage.hashCode());
-
-        // disabling sonar because this code tests the equals() method
-        assertEquals(dummyMessage, dummyMessage); // NOSONAR
-        assertNotNull(dummyMessage);
-
-        dummyMessage = new DummyMessage(new DummyAction(null), null, null);
-        DummyMessage otherDummyMessage = new DummyMessage(null, null, null);
-        assertNotEquals(dummyMessage, otherDummyMessage);
-        otherDummyMessage = new DummyMessage(new DummyAction(null), null, null);
-        assertEquals(dummyMessage, otherDummyMessage);
-        dummyMessage = new DummyMessage(null, null, null);
-        assertNotEquals(dummyMessage, otherDummyMessage);
-        otherDummyMessage = new DummyMessage(null, null, null);
-        assertEquals(dummyMessage, otherDummyMessage);
-
-        dummyMessage = new DummyMessage(null, new AxArtifactKey(), null);
-        otherDummyMessage = new DummyMessage(null, null, null);
-        assertNotEquals(dummyMessage, otherDummyMessage);
-        otherDummyMessage = new DummyMessage(null, new AxArtifactKey(), null);
-        assertEquals(dummyMessage, otherDummyMessage);
-        dummyMessage = new DummyMessage(null, null, null);
-        assertNotEquals(dummyMessage, otherDummyMessage);
-        otherDummyMessage = new DummyMessage(null, null, null);
-        assertEquals(dummyMessage, otherDummyMessage);
-
-        dummyMessage = new DummyMessage(null, null, "Message");
-        otherDummyMessage = new DummyMessage(null, null, null);
-        assertNotEquals(dummyMessage, otherDummyMessage);
-        otherDummyMessage = new DummyMessage(null, null, "Message");
-        assertEquals(dummyMessage, otherDummyMessage);
-        dummyMessage = new DummyMessage(null, null, null);
-        assertNotEquals(dummyMessage, otherDummyMessage);
-        otherDummyMessage = new DummyMessage(null, null, null);
-        assertEquals(dummyMessage, otherDummyMessage);
-    }
-}
diff --git a/core/core-protocols/src/test/resources/logback-test.xml b/core/core-protocols/src/test/resources/logback-test.xml
deleted file mode 100644 (file)
index c52f2de..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ============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=========================================================
--->
-
-<configuration>
-
-    <contextName>Apex</contextName>
-    <statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" />
-    <property name="LOG_DIR" value="${java.io.tmpdir}/apex_logging/" />
-
-    <!-- USE FOR STD OUT ONLY -->
-    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
-        <encoder>
-            <Pattern>%d %contextName [%t] %level %logger{36} - %msg%n</Pattern>
-        </encoder>
-    </appender>
-
-    <root level="INFO">
-        <appender-ref ref="STDOUT" />
-    </root>
-
-    <logger name="org.infinispan" level="INFO" additivity="false">
-        <appender-ref ref="STDOUT" />
-    </logger>
-
-    <logger name="org.apache.zookeeper.ClientCnxn" level="OFF" additivity="false">
-        <appender-ref ref="STDOUT" />
-    </logger>
-
-    <appender name="FILE" class="ch.qos.logback.core.FileAppender">
-        <file>${LOG_DIR}/apex.log</file>
-        <encoder>
-            <pattern>%d %-5relative [procId=${processId}] [%thread] %-5level
-                %logger{26} - %msg %n %ex{full}</pattern>
-        </encoder>
-    </appender>
-
-    <appender name="CTXT_FILE" class="ch.qos.logback.core.FileAppender">
-        <file>${LOG_DIR}/apex_ctxt.log</file>
-        <encoder>
-            <pattern>%d %-5relative [procId=${processId}] [%thread] %-5level
-                %logger{26} - %msg %n %ex{full}</pattern>
-        </encoder>
-    </appender>
-
-    <logger name="org.onap.policy.apex.core.context.impl.monitoring" level="INFO" additivity="false">
-        <appender-ref ref="CTXT_FILE" />
-    </logger>
-
-    <logger name="org.onap.policy.apex.core.context" level="INFO" additivity="false">
-        <appender-ref ref="STDOUT" />
-    </logger>
-</configuration>
index 1335276..f87de94 100644 (file)
@@ -1,7 +1,7 @@
 <!--
   ============LICENSE_START=======================================================
    Copyright (C) 2018 Ericsson. All rights reserved.
-   Modifications Copyright (C) 2020 Nordix Foundation.
+   Modifications Copyright (C) 2020,2022 Nordix Foundation.
   ================================================================================
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
 
     <groupId>org.onap.policy.apex-pdp.core</groupId>
     <artifactId>core</artifactId>
-    <packaging>pom</packaging>
 
     <name>${project.artifactId}</name>
     <description>The main core of Apex, deployment independent.</description>
 
-    <modules>
-        <module>core-infrastructure</module>
-        <module>core-protocols</module>
-        <module>core-engine</module>
-    </modules>
+    <dependencies>
+        <dependency>
+            <groupId>org.onap.policy.common</groupId>
+            <artifactId>common-parameters</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.onap.policy.apex-pdp.model</groupId>
+            <artifactId>model</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.onap.policy.apex-pdp.context</groupId>
+            <artifactId>context-management</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-all</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.assertj</groupId>
+            <artifactId>assertj-core</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
 </project>
index 5e8ba05..9d7fff4 100644 (file)
@@ -1,6 +1,7 @@
 <!--
   ============LICENSE_START=======================================================
    Copyright (C) 2018 Ericsson. All rights reserved.
+   Modifications Copyright (C) 2022 Nordix Foundation.
   ================================================================================
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
         </dependency>
         <dependency>
             <groupId>org.onap.policy.apex-pdp.core</groupId>
-            <artifactId>core-engine</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.apex-pdp.core</groupId>
-            <artifactId>core-infrastructure</artifactId>
+            <artifactId>core</artifactId>
             <version>${project.version}</version>
             <scope>test</scope>
         </dependency>
index 158710a..694ad13 100644 (file)
@@ -1,6 +1,7 @@
 <!--
   ============LICENSE_START=======================================================
    Copyright (C) 2018 Ericsson. All rights reserved.
+   Modifications Copyright (C) 2022 Nordix Foundation.
   ================================================================================
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
@@ -37,7 +38,7 @@
         </dependency>
         <dependency>
             <groupId>org.onap.policy.apex-pdp.core</groupId>
-            <artifactId>core-engine</artifactId>
+            <artifactId>core</artifactId>
             <version>${project.version}</version>
         </dependency>
         <dependency>
index 68dc69a..a4b0d27 100644 (file)
@@ -1,7 +1,7 @@
 <!--
   ============LICENSE_START=======================================================
    Copyright (C) 2018 Ericsson. All rights reserved.
-   Modifications Copyright (C) 2020 Nordix Foundation.
+   Modifications Copyright (C) 2020,2022 Nordix Foundation.
   ================================================================================
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
     </dependency>
     <dependency>
       <groupId>org.onap.policy.apex-pdp.core</groupId>
-      <artifactId>core-engine</artifactId>
-      <version>${project.version}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.onap.policy.apex-pdp.core</groupId>
-      <artifactId>core-infrastructure</artifactId>
+      <artifactId>core</artifactId>
       <version>${project.version}</version>
       <scope>test</scope>
     </dependency>
index b3af036..ed6a226 100644 (file)
@@ -1,7 +1,7 @@
 <!--
   ============LICENSE_START=======================================================
    Copyright (C) 2018 Ericsson. All rights reserved.
-   Modifications Copyright (C) 2020 Nordix Foundation.
+   Modifications Copyright (C) 2020,2022 Nordix Foundation.
   ================================================================================
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
         </dependency>
         <dependency>
             <groupId>org.onap.policy.apex-pdp.core</groupId>
-            <artifactId>core-engine</artifactId>
+            <artifactId>core</artifactId>
             <version>${project.version}</version>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>org.onap.policy.apex-pdp.core</groupId>
-            <artifactId>core-infrastructure</artifactId>
-            <version>${project.version}</version>
-        </dependency>
         <dependency>
             <groupId>org.onap.policy.apex-pdp.auth</groupId>
             <artifactId>cli-editor</artifactId>
index 1e639fe..824ea28 100644 (file)
@@ -1,6 +1,7 @@
 <!--
   ============LICENSE_START=======================================================
    Copyright (C) 2018 Ericsson. All rights reserved.
+   Modifications Copyright (C) 2022 Nordix Foundation.
   ================================================================================
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
             <artifactId>hazelcast</artifactId>
             <version>${version.hazelcast}</version>
         </dependency>
-        <dependency>
-            <groupId>org.onap.policy.apex-pdp.core</groupId>
-            <artifactId>core-infrastructure</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
         <dependency>
             <groupId>org.onap.policy.apex-pdp.plugins.plugins-context.plugins-context-distribution</groupId>
             <artifactId>plugins-context-distribution-hazelcast</artifactId>
@@ -55,4 +50,4 @@
             <scope>test</scope>
         </dependency>
     </dependencies>
-</project>
\ No newline at end of file
+</project>
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/pom.xml b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/pom.xml
deleted file mode 100644 (file)
index d50e25c..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-<!--
-  ============LICENSE_START=======================================================
-   Copyright (C) 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=========================================================
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.onap.policy.apex-pdp.plugins.plugins-event.plugins-event-carrier</groupId>
-        <artifactId>plugins-event-carrier</artifactId>
-        <version>2.7.1-SNAPSHOT</version>
-    </parent>
-
-    <artifactId>plugins-event-carrier-websocket</artifactId>
-    <name>${project.artifactId}</name>
-    <description>[${project.parent.artifactId}] Plugin for handling events being transported over web sockets</description>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.mockito</groupId>
-            <artifactId>mockito-all</artifactId>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
-</project>
\ No newline at end of file
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/ApexWebSocketConsumer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/ApexWebSocketConsumer.java
deleted file mode 100644 (file)
index c776e15..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
- *   *  Modifications Copyright (C) 2020 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.plugins.event.carrier.websocket;
-
-import java.util.Properties;
-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.messaging.stringmessaging.WsStringMessageServer;
-import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStringMessager;
-import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities;
-import org.onap.policy.apex.service.engine.event.ApexEventException;
-import org.onap.policy.apex.service.engine.event.ApexEventReceiver;
-import org.onap.policy.apex.service.engine.event.ApexPluginsEventConsumer;
-import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Concrete implementation an Apex event consumer that receives events using Kafka.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-public class ApexWebSocketConsumer extends ApexPluginsEventConsumer implements WsStringMessageListener {
-    private static final int WEB_SOCKET_WAIT_SLEEP_TIME = 100;
-
-    // Get a reference to the logger
-    private static final Logger LOGGER = LoggerFactory.getLogger(ApexWebSocketConsumer.class);
-
-    // The web socket messager, may be WS a server or a client
-    private WsStringMessager wsStringMessager;
-
-    // The event receiver that will receive events from this consumer
-    private ApexEventReceiver eventReceiver;
-
-    // The number of events read to date
-    private int eventsRead = 0;
-
-    @Override
-    public void init(final String consumerName, final EventHandlerParameters consumerParameters,
-            final ApexEventReceiver incomingEventReceiver) throws ApexEventException {
-        this.eventReceiver = incomingEventReceiver;
-        this.name = consumerName;
-
-        // Check and get the Kafka Properties
-        if (!(consumerParameters.getCarrierTechnologyParameters() instanceof WebSocketCarrierTechnologyParameters)) {
-            LOGGER.warn("specified consumer properties are not applicable to a web socket consumer");
-            throw new ApexEventException("specified consumer properties are not applicable to a web socket consumer");
-        }
-
-        // The Web Socket properties
-        WebSocketCarrierTechnologyParameters webSocketConsumerProperties =
-                (WebSocketCarrierTechnologyParameters) consumerParameters.getCarrierTechnologyParameters();
-
-        // Check if this is a server or a client Web Socket
-        if (webSocketConsumerProperties.isWsClient()) {
-            // Create a WS client
-            wsStringMessager = new WsStringMessageClient(webSocketConsumerProperties.getHost(),
-                    webSocketConsumerProperties.getPort());
-        } else {
-            wsStringMessager = new WsStringMessageServer(webSocketConsumerProperties.getPort());
-        }
-
-        // Start reception of event strings on the web socket
-        try {
-            wsStringMessager.start(this);
-        } catch (final MessagingException e) {
-            LOGGER.warn("could not start web socket consumer", e);
-        }
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public void run() {
-        while (consumerThread.isAlive() && !stopOrderedFlag) {
-            ThreadUtilities.sleep(WEB_SOCKET_WAIT_SLEEP_TIME);
-        }
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public void stop() {
-        if (wsStringMessager != null) {
-            wsStringMessager.stop();
-        }
-        stopOrderedFlag = true;
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public void receiveString(final String eventString) {
-        try {
-            eventReceiver.receiveEvent(new Properties(), eventString);
-            eventsRead++;
-        } catch (final Exception e) {
-            final String errorMessage = "Error sending event " + name + '_' + eventsRead + ", " + e.getMessage()
-                    + ", event:\n" + eventString;
-            LOGGER.warn(errorMessage, e);
-        }
-    }
-}
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/ApexWebSocketProducer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/ApexWebSocketProducer.java
deleted file mode 100644 (file)
index 6256ec4..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
- *  Modifications Copyright (C) 2020 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.plugins.event.carrier.websocket;
-
-import java.util.Properties;
-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.messaging.stringmessaging.WsStringMessageServer;
-import org.onap.policy.apex.core.infrastructure.messaging.stringmessaging.WsStringMessager;
-import org.onap.policy.apex.service.engine.event.ApexEventException;
-import org.onap.policy.apex.service.engine.event.ApexPluginsEventProducer;
-import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Concrete implementation of an Apex event producer that sends events using a web socket.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-public class ApexWebSocketProducer extends ApexPluginsEventProducer implements WsStringMessageListener {
-    // Get a reference to the logger
-    private static final Logger LOGGER = LoggerFactory.getLogger(ApexWebSocketProducer.class);
-
-    // The web socket messager, may be WS a server or a client
-    private WsStringMessager wsStringMessager;
-
-    @Override
-    public void init(final String producerName, final EventHandlerParameters producerParameters)
-            throws ApexEventException {
-        this.name = producerName;
-
-        // Check and get the web socket Properties
-        if (!(producerParameters.getCarrierTechnologyParameters() instanceof WebSocketCarrierTechnologyParameters)) {
-            String message =
-                    "specified producer properties for " + this.name + "are not applicable to a web socket producer";
-            LOGGER.warn(message);
-            throw new ApexEventException("specified producer properties are not applicable to a web socket producer");
-        }
-        // The Web Socket properties
-        WebSocketCarrierTechnologyParameters webSocketProducerProperties =
-                (WebSocketCarrierTechnologyParameters) producerParameters.getCarrierTechnologyParameters();
-
-        // Check if this is a server or a client Web Socket
-        if (webSocketProducerProperties.isWsClient()) {
-            // Create a WS client
-            wsStringMessager = new WsStringMessageClient(webSocketProducerProperties.getHost(),
-                    webSocketProducerProperties.getPort());
-        } else {
-            wsStringMessager = new WsStringMessageServer(webSocketProducerProperties.getPort());
-        }
-
-        // Start reception of event strings on the web socket
-        try {
-            wsStringMessager.start(this);
-        } catch (final MessagingException e) {
-            String message = "could not start web socket producer (" + this.name + ")";
-            LOGGER.warn(message, e);
-        }
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public void sendEvent(final long executionId, final Properties executionProperties, final String eventName,
-            final Object event) {
-        super.sendEvent(executionId, executionProperties, eventName, event);
-
-        wsStringMessager.sendString((String) event);
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public void stop() {
-        if (wsStringMessager != null) {
-            wsStringMessager.stop();
-        }
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public void receiveString(final String messageString) {
-        String message = "received message \"" + messageString + "\" on web socket producer (" + this.name
-                + ") , no messages should be received on a web socket producer";
-        LOGGER.warn(message);
-    }
-}
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/WebSocketCarrierTechnologyParameters.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/WebSocketCarrierTechnologyParameters.java
deleted file mode 100644 (file)
index 89588ec..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
- *  Modifications Copyright (C) 2021 AT&T Intellectual Property. 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.plugins.event.carrier.websocket;
-
-import lombok.Getter;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.policy.apex.service.parameters.carriertechnology.CarrierTechnologyParameters;
-import org.onap.policy.common.parameters.BeanValidationResult;
-import org.onap.policy.common.parameters.ValidationStatus;
-import org.onap.policy.common.parameters.annotations.Max;
-import org.onap.policy.common.parameters.annotations.Min;
-import org.onap.policy.models.base.Validated;
-
-/**
- * Apex parameters for Kafka as an event carrier technology.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-@Getter
-public class WebSocketCarrierTechnologyParameters extends CarrierTechnologyParameters {
-    // @formatter:off
-    private static final int MIN_USER_PORT =  1024;
-    private static final int MAX_USER_PORT = 65535;
-
-    /** The label of this carrier technology. */
-    public static final String WEB_SCOKET_CARRIER_TECHNOLOGY_LABEL = "WEBSOCKET";
-
-    /** The producer plugin class for the web socket carrier technology. */
-    public static final String WEB_SCOKET_EVENT_PRODUCER_PLUGIN_CLASS = ApexWebSocketProducer.class.getName();
-
-    /** The consumer plugin class for the web socket carrier technology. */
-    public static final String KWEB_SCOKET_EVENT_CONSUMER_PLUGIN_CLASS = ApexWebSocketConsumer.class.getName();
-
-    // Default parameter values
-    private static final String DEFAULT_HOST = "localhost";
-    private static final int    DEFAULT_PORT = -1;
-
-    // Web socket parameters
-    private boolean wsClient = true;
-    private String  host     = DEFAULT_HOST;
-    @Min(MIN_USER_PORT)
-    @Max(MAX_USER_PORT)
-    private int     port     = DEFAULT_PORT;
-    // @formatter:on
-
-    /**
-     * Constructor to create a web socket carrier technology parameters instance and register the instance with the
-     * parameter service.
-     */
-    public WebSocketCarrierTechnologyParameters() {
-        super();
-
-        // Set the carrier technology properties for the web socket carrier technology
-        this.setLabel(WEB_SCOKET_CARRIER_TECHNOLOGY_LABEL);
-        this.setEventProducerPluginClass(WEB_SCOKET_EVENT_PRODUCER_PLUGIN_CLASS);
-        this.setEventConsumerPluginClass(KWEB_SCOKET_EVENT_CONSUMER_PLUGIN_CLASS);
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public BeanValidationResult validate() {
-        final BeanValidationResult result = super.validate();
-
-        if (wsClient && StringUtils.isBlank(host)) {
-            result.addResult("host", host, ValidationStatus.INVALID, Validated.IS_BLANK);
-        }
-
-        return result;
-    }
-}
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/package-info.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/main/java/org/onap/policy/apex/plugins/event/carrier/websocket/package-info.java
deleted file mode 100644 (file)
index 9555ea4..0000000
+++ /dev/null
@@ -1,27 +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=========================================================
- */
-
-/**
- * Implements the APEX event carrier technology plugin for web sockets.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-
-package org.onap.policy.apex.plugins.event.carrier.websocket;
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/test/java/org/onap/policy/apex/plugins/event/carrier/websocket/ApexWebSocketConsumerTest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/test/java/org/onap/policy/apex/plugins/event/carrier/websocket/ApexWebSocketConsumerTest.java
deleted file mode 100644 (file)
index 3021b8a..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2019 Samsung. All rights reserved.
- *  Modifications Copyright (C) 2019 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.plugins.event.carrier.websocket;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.mockito.stubbing.Answer;
-import org.onap.policy.apex.service.engine.event.ApexEventException;
-import org.onap.policy.apex.service.engine.event.ApexEventProducer;
-import org.onap.policy.apex.service.engine.event.ApexEventReceiver;
-import org.onap.policy.apex.service.engine.event.PeeredReference;
-import org.onap.policy.apex.service.parameters.carriertechnology.CarrierTechnologyParameters;
-import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters;
-import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerPeeredMode;
-
-public class ApexWebSocketConsumerTest {
-
-    ApexWebSocketConsumer apexWebSocketConsumer = null;
-    EventHandlerParameters consumerParameters = null;
-    ApexEventReceiver incomingEventReceiver = null;
-    ApexEventProducer apexWebSocketProducer = null;
-    WebSocketCarrierTechnologyParameters webSocketCarrierTechnologyParameters = null;
-
-    /**
-     * Set up testing.
-     *
-     * @throws Exception on test set up errors.
-     */
-    @Before
-    public void setUp() throws Exception {
-        apexWebSocketConsumer = new ApexWebSocketConsumer();
-        consumerParameters = new EventHandlerParameters();
-        apexWebSocketProducer = new ApexWebSocketProducer();
-        apexWebSocketConsumer.start();
-    }
-
-    @After
-    public void tearDown() {
-        apexWebSocketConsumer.stop();
-    }
-
-    @Test(expected = ApexEventException.class)
-    public void testInitWithNonWebSocketCarrierTechnologyParameters() throws ApexEventException {
-        consumerParameters.setCarrierTechnologyParameters(new CarrierTechnologyParameters() {});
-        apexWebSocketConsumer.init("TestApexWebSocketConsumer", consumerParameters,
-                incomingEventReceiver);
-    }
-
-    @Test
-    public void testInitWithWebSocketCarrierTechnologyParameters() throws ApexEventException {
-        webSocketCarrierTechnologyParameters = new WebSocketCarrierTechnologyParameters();
-        consumerParameters.setCarrierTechnologyParameters(webSocketCarrierTechnologyParameters);
-        apexWebSocketConsumer.init("TestApexWebSocketConsumer", consumerParameters,
-                incomingEventReceiver);
-        assertEquals("TestApexWebSocketConsumer", apexWebSocketConsumer.getName());
-    }
-
-    @Test
-    public void testGetName() {
-        assertNull(apexWebSocketConsumer.getName());
-    }
-
-    @Test
-    public void testGetPeeredReference() {
-        assertNull(apexWebSocketConsumer.getPeeredReference(EventHandlerPeeredMode.REQUESTOR));
-    }
-
-    @Test
-    public void testSetPeeredReference() {
-        PeeredReference peeredReference = new PeeredReference(EventHandlerPeeredMode.REQUESTOR,
-                apexWebSocketConsumer, apexWebSocketProducer);
-        apexWebSocketConsumer.setPeeredReference(EventHandlerPeeredMode.REQUESTOR, peeredReference);
-        assertNotNull(apexWebSocketConsumer.getPeeredReference(EventHandlerPeeredMode.REQUESTOR));
-    }
-
-    @Test
-    public void testReceiveString() {
-        MockitoAnnotations.initMocks(this);
-        ApexWebSocketConsumer apexWebSocketConsumerMock = Mockito.mock(ApexWebSocketConsumer.class);
-
-        Mockito.doAnswer((Answer<?>) invocation -> {
-            Object[] args = invocation.getArguments();
-            assertEquals("TestRecieveString", args[0]);
-            return null;
-        }).when(apexWebSocketConsumerMock).receiveString("TestRecieveString");
-
-        apexWebSocketConsumerMock.receiveString("TestRecieveString");
-
-    }
-}
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/test/java/org/onap/policy/apex/plugins/event/carrier/websocket/ApexWebSocketProducerTest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/test/java/org/onap/policy/apex/plugins/event/carrier/websocket/ApexWebSocketProducerTest.java
deleted file mode 100644 (file)
index d4b3114..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2019 Samsung. All rights reserved.
- *  Modifications Copyright (C) 2019 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.plugins.event.carrier.websocket;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.mockito.stubbing.Answer;
-import org.onap.policy.apex.service.engine.event.ApexEventConsumer;
-import org.onap.policy.apex.service.engine.event.ApexEventException;
-import org.onap.policy.apex.service.engine.event.ApexEventReceiver;
-import org.onap.policy.apex.service.engine.event.PeeredReference;
-import org.onap.policy.apex.service.engine.event.SynchronousEventCache;
-import org.onap.policy.apex.service.parameters.carriertechnology.CarrierTechnologyParameters;
-import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters;
-import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerPeeredMode;
-
-public class ApexWebSocketProducerTest {
-
-    ApexWebSocketProducer apexWebSocketProducer = null;
-    EventHandlerParameters producerParameters = null;
-    ApexEventReceiver incomingEventReceiver = null;
-    ApexEventConsumer apexWebSocketConsumer = null;
-    WebSocketCarrierTechnologyParameters webSocketCarrierTechnologyParameters = null;
-    SynchronousEventCache synchronousEventCache = null;
-    private static final long DEFAULT_SYNCHRONOUS_EVENT_TIMEOUT = 1000;
-
-    /**
-     * Set up testing.
-     *
-     * @throws Exception on test set up errors.
-     */
-    @Before
-    public void setUp() throws Exception {
-        apexWebSocketConsumer = new ApexWebSocketConsumer();
-        producerParameters = new EventHandlerParameters();
-        apexWebSocketProducer = new ApexWebSocketProducer();
-    }
-
-    @After
-    public void tearDown() {
-        apexWebSocketProducer.stop();
-    }
-
-    @Test(expected = ApexEventException.class)
-    public void testInitWithNonWebSocketCarrierTechnologyParameters() throws ApexEventException {
-        producerParameters.setCarrierTechnologyParameters(new CarrierTechnologyParameters() {});
-        apexWebSocketProducer.init("TestApexWebSocketProducer", producerParameters);
-    }
-
-    @Test
-    public void testInitWithWebSocketCarrierTechnologyParameters() throws ApexEventException {
-        webSocketCarrierTechnologyParameters = new WebSocketCarrierTechnologyParameters();
-        producerParameters.setCarrierTechnologyParameters(webSocketCarrierTechnologyParameters);
-        apexWebSocketProducer.init("TestApexWebSocketProducer", producerParameters);
-        assertEquals("TestApexWebSocketProducer", apexWebSocketProducer.getName());
-    }
-
-    @Test
-    public void testGetName() {
-        assertNull(apexWebSocketProducer.getName());
-    }
-
-    @Test
-    public void testGetPeeredReference() {
-        assertNull(apexWebSocketProducer.getPeeredReference(EventHandlerPeeredMode.REQUESTOR));
-    }
-
-    @Test
-    public void testSetPeeredReference() {
-        PeeredReference peeredReference = new PeeredReference(EventHandlerPeeredMode.REQUESTOR,
-                apexWebSocketConsumer, apexWebSocketProducer);
-        apexWebSocketProducer.setPeeredReference(EventHandlerPeeredMode.REQUESTOR, peeredReference);
-        assertNotNull(apexWebSocketProducer.getPeeredReference(EventHandlerPeeredMode.REQUESTOR));
-    }
-
-    @Test(expected = NullPointerException.class)
-    public void testSendEvent() throws ApexEventException {
-        producerParameters
-                .setCarrierTechnologyParameters(new WebSocketCarrierTechnologyParameters() {});
-        synchronousEventCache = new SynchronousEventCache(EventHandlerPeeredMode.SYNCHRONOUS,
-                apexWebSocketConsumer, apexWebSocketProducer, DEFAULT_SYNCHRONOUS_EVENT_TIMEOUT);
-        apexWebSocketProducer.setPeeredReference(EventHandlerPeeredMode.SYNCHRONOUS,
-                synchronousEventCache);
-        apexWebSocketProducer.sendEvent(1000L, null, "TestApexWebSocketProducer", "apexEvent");
-    }
-
-    @Test
-    public void testReceiveString() {
-        MockitoAnnotations.initMocks(this);
-        ApexWebSocketProducer apexWebSocketProducerMock = Mockito.mock(ApexWebSocketProducer.class);
-
-        Mockito.doAnswer((Answer<?>) invocation -> {
-            Object[] args = invocation.getArguments();
-            assertEquals("TestRecieveString", args[0]);
-            return null;
-        }).when(apexWebSocketProducerMock).receiveString("TestRecieveString");
-
-        apexWebSocketProducerMock.receiveString("TestRecieveString");
-    }
-}
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/test/java/org/onap/policy/apex/plugins/event/carrier/websocket/WebSocketCarrierTechnologyParametersTest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-websocket/src/test/java/org/onap/policy/apex/plugins/event/carrier/websocket/WebSocketCarrierTechnologyParametersTest.java
deleted file mode 100644 (file)
index f318c00..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2019 Samsung. All rights reserved.
- *  Modifications Copyright (C) 2019 Nordix Foundation.
- *  Modifications Copyright (C) 2021 AT&T Intellectual Property. 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.plugins.event.carrier.websocket;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.onap.policy.common.parameters.ValidationResult;
-
-public class WebSocketCarrierTechnologyParametersTest {
-
-    WebSocketCarrierTechnologyParameters webSocketCarrierTechnologyParameters = null;
-    ValidationResult result = null;
-
-    /**
-     * Set up testing.
-     *
-     * @throws Exception on test set up errors.
-     */
-    @Before
-    public void setUp() throws Exception {
-        webSocketCarrierTechnologyParameters = new WebSocketCarrierTechnologyParameters();
-    }
-
-    @Test
-    public void testWebSocketCarrierTechnologyParameters() {
-        assertNotNull(webSocketCarrierTechnologyParameters);
-    }
-
-    @Test
-    public void testValidate() {
-        result = webSocketCarrierTechnologyParameters.validate();
-        assertNotNull(result);
-        assertFalse(result.getStatus().isValid());
-    }
-
-}
index 02e9af6..6949815 100644 (file)
@@ -2,7 +2,7 @@
 <!--
   ============LICENSE_START=======================================================
    Copyright (C) 2018 Ericsson. All rights reserved.
-   Modifications Copyright (C) 2020 Nordix Foundation.
+   Modifications Copyright (C) 2020,2022 Nordix Foundation.
   ================================================================================
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
 
     <modules>
         <module>plugins-event-carrier-kafka</module>
-        <module>plugins-event-carrier-websocket</module>
         <module>plugins-event-carrier-jms</module>
         <module>plugins-event-carrier-restclient</module>
         <module>plugins-event-carrier-restserver</module>
         <module>plugins-event-carrier-restrequestor</module>
         <module>plugins-event-carrier-grpc</module>
   </modules>
-</project>
\ No newline at end of file
+</project>
index daf982d..f2e9633 100644 (file)
@@ -1,6 +1,7 @@
 <!--
   ============LICENSE_START=======================================================
    Copyright (C) 2018 Ericsson. All rights reserved.
+   Modifications Copyright (C) 2022 Nordix Foundation.
   ================================================================================
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
@@ -35,7 +36,7 @@
     <dependencies>
         <dependency>
             <groupId>org.onap.policy.apex-pdp.core</groupId>
-            <artifactId>core-engine</artifactId>
+            <artifactId>core</artifactId>
             <version>${project.version}</version>
         </dependency>
     </dependencies>
@@ -47,4 +48,4 @@
         <!--module>plugins-executor-jython</module-->
         <module>plugins-executor-mvel</module>
     </modules>
-</project>
\ No newline at end of file
+</project>
index e31b09a..80bb359 100644 (file)
@@ -1,7 +1,7 @@
 <!--
   ============LICENSE_START=======================================================
    Copyright (C) 2018 Ericsson. All rights reserved.
-   Copyright (C) 2019-2020 Nordix Foundation.
+   Copyright (C) 2019-2020,2022 Nordix Foundation.
    Modifications Copyright (C) 2021 Bell Canada Intellectual Property. All rights reserved.
   ================================================================================
   Licensed under the Apache License, Version 2.0 (the "License");
         </dependency>
         <dependency>
             <groupId>org.onap.policy.apex-pdp.core</groupId>
-            <artifactId>core-engine</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.apex-pdp.core</groupId>
-            <artifactId>core-infrastructure</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.onap.policy.apex-pdp.core</groupId>
-            <artifactId>core-protocols</artifactId>
+            <artifactId>core</artifactId>
             <version>${project.version}</version>
         </dependency>
         <dependency>
index a5e823e..3d773ba 100644 (file)
@@ -1,7 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
- *  Modifications Copyright (C) 2019-2021 Nordix Foundation.
+ *  Modifications Copyright (C) 2019-2022 Nordix Foundation.
  *  Modifications Copyright (C) 2020-2022 Bell Canada. All rights reserved.
  *  Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
@@ -53,7 +53,6 @@ import org.onap.policy.apex.service.parameters.engineservice.EngineServiceParame
 import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters;
 import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerPeeredMode;
 import org.onap.policy.common.utils.resources.PrometheusUtils;
-import org.onap.policy.models.pdp.concepts.PdpStatus;
 import org.onap.policy.models.pdp.enums.PdpResponseStatus;
 import org.slf4j.ext.XLogger;
 import org.slf4j.ext.XLoggerFactory;
@@ -380,4 +379,4 @@ public class ApexEventUnmarshaller implements ApexEventReceiver, Runnable {
         }
         LOGGER.exit("shut down Apex event unmarshaller");
     }
-}
\ No newline at end of file
+}
index 54736f8..e9972bf 100644 (file)
@@ -1,7 +1,7 @@
 <!--
   ============LICENSE_START=======================================================
    Copyright (C) 2018 Ericsson. All rights reserved.
-   Modifications Copyright (C) 2020 Nordix Foundation.
+   Modifications Copyright (C) 2020,2022 Nordix Foundation.
   ================================================================================
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
@@ -45,7 +45,7 @@
         </dependency>
         <dependency>
             <groupId>org.onap.policy.apex-pdp.core</groupId>
-            <artifactId>core-engine</artifactId>
+            <artifactId>core</artifactId>
             <version>${project.version}</version>
         </dependency>
     </dependencies>
index 3499f20..8aa466d 100644 (file)
@@ -1,7 +1,7 @@
 <!--
   ============LICENSE_START=======================================================
    Copyright (C) 2018 Ericsson. All rights reserved.
-   Modifications Copyright (C) 2019-2020 Nordix Foundation.
+   Modifications Copyright (C) 2019-2020,2022 Nordix Foundation.
   ================================================================================
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
             <groupId>org.onap.policy.common</groupId>
             <artifactId>utils</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.onap.policy.apex-pdp.core</groupId>
-            <artifactId>core-infrastructure</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
         <dependency>
             <groupId>org.onap.policy.apex-pdp.testsuites.integration</groupId>
             <artifactId>integration-common</artifactId>
index 4af8f67..0d2a0cf 100644 (file)
@@ -1,7 +1,7 @@
 <!--
   ============LICENSE_START=======================================================
    Copyright (C) 2018 Ericsson. All rights reserved.
-   Modifications Copyright (C) 2020 Nordix Foundation.
+   Modifications Copyright (C) 2020,2022 Nordix Foundation.
   ================================================================================
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
     <description>[${project.parent.artifactId}] module to run executor tests using various executor script plugins</description>
 
     <dependencies>
-        <dependency>
-            <groupId>org.onap.policy.apex-pdp.core</groupId>
-            <artifactId>core-infrastructure</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
         <dependency>
             <groupId>org.onap.policy.apex-pdp.testsuites.integration</groupId>
             <artifactId>integration-common</artifactId>
index d852ad1..c627c9d 100644 (file)
@@ -45,7 +45,7 @@
         </dependency>
         <dependency>
             <groupId>org.onap.policy.apex-pdp.core</groupId>
-            <artifactId>core-engine</artifactId>
+            <artifactId>core</artifactId>
             <version>${project.version}</version>
         </dependency>
         <dependency>
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/TestWs2WsClient.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/TestWs2WsClient.java
deleted file mode 100644 (file)
index 96f31e9..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
- *  Modifications Copyright (C) 2020 Bell Canada. 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.uservice.adapt.websocket;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.onap.policy.apex.core.infrastructure.messaging.MessagingException;
-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;
-
-public class TestWs2WsClient {
-    private static final long MAX_TEST_LENGTH = 10000;
-
-    private static final int EVENT_COUNT = 100;
-    private static final int EVENT_INTERVAL = 20;
-
-    /**
-     * Clear relative file root environment variable.
-     */
-    @Before
-    public void clearRelativeFileRoot() {
-        System.clearProperty("APEX_RELATIVE_FILE_ROOT");
-    }
-
-    @Test
-    public void testJsonWsEvents() throws MessagingException, ApexException {
-        final String[] args = {"-rfr", "target", "-p", "target/examples/config/SampleDomain/Ws2WsClientJsonEvent.json"};
-        testWsEvents(args, false);
-    }
-
-    @Test
-    public void testXmlWsEvents() throws MessagingException, ApexException {
-        final String[] args = {"-rfr", "target", "-p", "target/examples/config/SampleDomain/Ws2WsClientXMLEvent.json"};
-        testWsEvents(args, true);
-    }
-
-    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);
-
-        final ApexMain apexMain = new ApexMain(args);
-
-        prodServer.sendEvents();
-
-        final long testStartTime = System.currentTimeMillis();
-
-        while (System.currentTimeMillis() < testStartTime + MAX_TEST_LENGTH
-                && subServer.getEventsReceivedCount() < EVENT_COUNT) {
-            ThreadUtilities.sleep(EVENT_INTERVAL);
-        }
-
-        assertEquals(prodServer.getEventsSentCount(), subServer.getEventsReceivedCount());
-
-        apexMain.shutdown();
-        prodServer.shutdown();
-        subServer.shutdown();
-    }
-}
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/TestWs2WsServer.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/TestWs2WsServer.java
deleted file mode 100644 (file)
index 870eb9e..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
- *  Modifications Copyright (C) 2020 Bell Canada. 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.uservice.adapt.websocket;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.onap.policy.apex.core.infrastructure.messaging.MessagingException;
-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;
-
-    /**
-     * Clear relative file root environment variable.
-     */
-    @Before
-    public void clearRelativeFileRoot() {
-        System.clearProperty("APEX_RELATIVE_FILE_ROOT");
-    }
-
-    /**
-     * Test json ws events.
-     *
-     * @throws MessagingException the messaging exception
-     * @throws ApexException the apex exception
-     */
-    @Test
-    public void testJsonWsEvents() throws MessagingException, ApexException {
-        final String[] args = {"-rfr", "target", "-p", "target/examples/config/SampleDomain/Ws2WsServerJsonEvent.json"};
-        testWsEvents(args, false);
-    }
-
-    /**
-     * Test xml ws events.
-     *
-     * @throws MessagingException the messaging exception
-     * @throws ApexException the apex exception
-     */
-    @Test
-    public void testXmlWsEvents() throws MessagingException, ApexException {
-        final String[] args = {"-rfr", "target", "-p", "target/examples/config/SampleDomain/Ws2WsServerXMLEvent.json"};
-        testWsEvents(args, true);
-    }
-
-    /**
-     * 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);
-        final WebSocketEventProducerClient prodClient =
-                new WebSocketEventProducerClient("localhost", 42450, EVENT_COUNT, xmlEvents, EVENT_INTERVAL);
-
-        prodClient.sendEvents();
-
-        final long testStartTime = System.currentTimeMillis();
-
-        while (System.currentTimeMillis() < testStartTime + MAX_TEST_LENGTH
-                && subClient.getEventsReceivedCount() < EVENT_COUNT) {
-            ThreadUtilities.sleep(EVENT_INTERVAL);
-        }
-
-        assertEquals(subClient.getEventsReceivedCount(), prodClient.getEventsSentCount());
-
-        prodClient.shutdown();
-        subClient.shutdown();
-        apexMain.shutdown();
-    }
-}
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventProducerClient.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventProducerClient.java
deleted file mode 100644 (file)
index 6ffdeea..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
- *  Modifications Copyright (C) 2019 Nordix Foundation.
- *  Modifications Copyright (C) 2021 AT&T Intellectual Property. 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.uservice.adapt.websocket;
-
-import lombok.Getter;
-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;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * The Class WebSocketEventProducerClient.
- */
-public class WebSocketEventProducerClient implements WsStringMessageListener {
-    private static final Logger LOGGER = LoggerFactory.getLogger(WebSocketEventProducerClient.class);
-
-    private final String host;
-    private final int port;
-    private final int eventCount;
-    private final boolean xmlEvents;
-    private final long eventInterval;
-    @Getter
-    private long eventsSentCount = 0;
-
-    WsStringMessageClient client;
-
-    /**
-     * Instantiates a new web socket event producer client.
-     *
-     * @param host the host
-     * @param port the port
-     * @param eventCount the event count
-     * @param xmlEvents the xml events
-     * @param eventInterval the event interval
-     * @throws MessagingException the messaging exception
-     */
-    public WebSocketEventProducerClient(final String host, final int port, final int eventCount,
-                    final boolean xmlEvents, final long eventInterval) throws MessagingException {
-        this.host = host;
-        this.port = port;
-        this.eventCount = eventCount;
-        this.xmlEvents = xmlEvents;
-        this.eventInterval = eventInterval;
-
-        client = new WsStringMessageClient(host, port);
-        client.start(this);
-
-        LOGGER.debug("{}: host {}, port {}, event count {}, xmlEvents {}", WebSocketEventProducerClient.class.getName(),
-                        host, port, eventCount, xmlEvents);
-    }
-
-    /**
-     * Send events.
-     */
-    public void sendEvents() {
-        LOGGER.debug("{}: sending events on host {}, port {}, event count {}, xmlEvents {}",
-                        WebSocketEventProducerClient.class.getName(), host, port, eventCount, xmlEvents);
-
-        for (int i = 0; i < eventCount; i++) {
-            LOGGER.debug("{}: waiting {} milliseconds before sending next event",
-                            WebSocketEventProducerClient.class.getName(), eventInterval);
-            ThreadUtilities.sleep(eventInterval);
-
-            String eventString = null;
-            if (xmlEvents) {
-                eventString = EventGenerator.xmlEvent();
-            } else {
-                eventString = EventGenerator.jsonEvent();
-            }
-            client.sendString(eventString);
-            eventsSentCount++;
-            LOGGER.debug("{}:  host {}, port {}, sent event {}", WebSocketEventProducerClient.class.getName(), host,
-                            port, eventString);
-        }
-        LOGGER.debug("{}: completed", WebSocketEventProducerClient.class.getName());
-    }
-
-    /**
-     * Shutdown.
-     */
-    public void shutdown() {
-        client.stop();
-        LOGGER.debug("{}: stopped", WebSocketEventProducerClient.class.getName());
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public void receiveString(final String eventString) {
-        LOGGER.debug("{}:  host {}, port {}, received event {}", WebSocketEventProducerServer.class.getName(), host,
-                        port, eventString);
-    }
-
-    /**
-     * The main method.
-     *
-     * @param args the arguments
-     * @throws MessagingException the messaging exception
-     */
-    public static void main(final String[] args) throws MessagingException {
-        if (args.length != 5) {
-            LOGGER.error("usage WebSocketEventProducerClient host port #events XML|JSON eventInterval");
-            return;
-        }
-
-        int port = 0;
-        try {
-            port = Integer.parseInt(args[1]);
-        } catch (final Exception e) {
-            LOGGER.error("usage WebSocketEventProducerClient host port #events XML|JSON eventInterval");
-            e.printStackTrace();
-            return;
-        }
-
-        int eventCount = 0;
-        try {
-            eventCount = Integer.parseInt(args[2]);
-        } catch (final Exception e) {
-            LOGGER.error("usage WebSocketEventProducerClient host port #events XML|JSON eventInterval");
-            e.printStackTrace();
-            return;
-        }
-
-        long eventInterval = 0;
-        try {
-            eventInterval = Long.parseLong(args[4]);
-        } catch (final Exception e) {
-            LOGGER.error("usage WebSocketEventProducerClient host port #events XML|JSON eventInterval");
-            e.printStackTrace();
-            return;
-        }
-
-        boolean xmlEvents = false;
-        if (args[3].equalsIgnoreCase("XML")) {
-            xmlEvents = true;
-        } else if (!args[3].equalsIgnoreCase("JSON")) {
-            LOGGER.error("usage WebSocketEventProducerClient host port #events XML|JSON eventInterval");
-            return;
-        }
-
-        final WebSocketEventProducerClient client = new WebSocketEventProducerClient(args[0], port, eventCount,
-                        xmlEvents, eventInterval);
-
-        client.sendEvents();
-        client.shutdown();
-    }
-}
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventProducerServer.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventProducerServer.java
deleted file mode 100644 (file)
index 1bdb56e..0000000
+++ /dev/null
@@ -1,167 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
- *  Modifications Copyright (C) 2019 Nordix Foundation.
- *  Modifications Copyright (C) 2021 AT&T Intellectual Property. 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.uservice.adapt.websocket;
-
-import lombok.Getter;
-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;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * The Class WebSocketEventProducerServer.
- */
-public class WebSocketEventProducerServer implements WsStringMessageListener {
-    private static final Logger LOGGER = LoggerFactory.getLogger(WebSocketEventProducerServer.class);
-
-    private final int port;
-    private final int eventCount;
-    private final boolean xmlEvents;
-    private final long eventInterval;
-    @Getter
-    private long eventsSentCount = 0;
-
-    WsStringMessageServer server;
-
-    /**
-     * Instantiates a new web socket event producer server.
-     *
-     * @param port the port
-     * @param eventCount the event count
-     * @param xmlEvents the xml events
-     * @param eventInterval the event interval
-     * @throws MessagingException the messaging exception
-     */
-    public WebSocketEventProducerServer(final int port, final int eventCount, final boolean xmlEvents,
-                    final long eventInterval) throws MessagingException {
-        this.port = port;
-        this.eventCount = eventCount;
-        this.xmlEvents = xmlEvents;
-        this.eventInterval = eventInterval;
-
-        server = new WsStringMessageServer(port);
-        server.start(this);
-
-        LOGGER.debug("{}: port {}, event count {}, xmlEvents {}", WebSocketEventProducerServer.class.getName(), port,
-                        eventCount, xmlEvents);
-    }
-
-    /**
-     * Send events.
-     */
-    public void sendEvents() {
-        LOGGER.debug("{}: sending events on port {}, event count {}, xmlEvents {}",
-                        WebSocketEventProducerServer.class.getName(), port, eventCount, xmlEvents);
-
-        for (int i = 0; i < eventCount; i++) {
-            LOGGER.debug("{}: waiting {} milliseconds before sending next event",
-                            WebSocketEventProducerServer.class.getName(), eventInterval);
-            ThreadUtilities.sleep(eventInterval);
-
-            String eventString = null;
-            if (xmlEvents) {
-                eventString = EventGenerator.xmlEvent();
-            } else {
-                eventString = EventGenerator.jsonEvent();
-            }
-            server.sendString(eventString);
-            eventsSentCount++;
-            LOGGER.debug("{}: port {}, sent event {}", WebSocketEventProducerServer.class.getName(), port, eventString);
-        }
-
-        LOGGER.debug("{}: event sending completed", WebSocketEventProducerServer.class.getName());
-    }
-
-    /**
-     * Shutdown.
-     */
-    public void shutdown() {
-        server.stop();
-        LOGGER.debug("{}: stopped", WebSocketEventProducerServer.class.getName());
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public void receiveString(final String eventString) {
-        LOGGER.debug("{}: port {}, received event {}", WebSocketEventProducerServer.class.getName(), port, eventString);
-    }
-
-    /**
-     * The main method.
-     *
-     * @param args the arguments
-     * @throws MessagingException the messaging exception
-     */
-    public static void main(final String[] args) throws MessagingException {
-        if (args.length != 4) {
-            LOGGER.error("usage WebSocketEventProducerServer port #events XML|JSON eventInterval");
-            return;
-        }
-
-        int port = 0;
-        try {
-            port = Integer.parseInt(args[0]);
-        } catch (final Exception e) {
-            LOGGER.error("usage WebSocketEventProducerServer port #events XML|JSON eventInterval");
-            e.printStackTrace();
-            return;
-        }
-
-        int eventCount = 0;
-        try {
-            eventCount = Integer.parseInt(args[1]);
-        } catch (final Exception e) {
-            LOGGER.error("usage WebSocketEventProducerServer port #events XML|JSON eventInterval");
-            e.printStackTrace();
-            return;
-        }
-
-        long eventInterval = 0;
-        try {
-            eventInterval = Long.parseLong(args[3]);
-        } catch (final Exception e) {
-            LOGGER.error("usage WebSocketEventProducerServer port #events XML|JSON eventInterval");
-            e.printStackTrace();
-            return;
-        }
-
-        boolean xmlEvents = false;
-        if (args[2].equalsIgnoreCase("XML")) {
-            xmlEvents = true;
-        } else if (!args[2].equalsIgnoreCase("JSON")) {
-            LOGGER.error("usage WebSocketEventProducerServer port #events XML|JSON startDelay eventInterval");
-            return;
-        }
-
-        final WebSocketEventProducerServer server = new WebSocketEventProducerServer(port, eventCount, xmlEvents,
-                        eventInterval);
-
-        server.sendEvents();
-        server.shutdown();
-    }
-}
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventSubscriberClient.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventSubscriberClient.java
deleted file mode 100644 (file)
index 23d32e2..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
- *  Modifications Copyright (C) 2019 Nordix Foundation.
- *  Modifications Copyright (C) 2021 AT&T Intellectual Property. 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.uservice.adapt.websocket;
-
-import lombok.Getter;
-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.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * The Class WebSocketEventSubscriberClient.
- */
-public class WebSocketEventSubscriberClient implements WsStringMessageListener {
-    private static final Logger LOGGER = LoggerFactory.getLogger(WebSocketEventSubscriberClient.class);
-
-    private final int port;
-    @Getter
-    private long eventsReceivedCount = 0;
-
-    private final WsStringMessageClient client;
-
-    /**
-     * Instantiates a new web socket event subscriber client.
-     *
-     * @param host the host
-     * @param port the port
-     * @throws MessagingException the messaging exception
-     */
-    public WebSocketEventSubscriberClient(final String host, final int port) throws MessagingException {
-        this.port = port;
-
-        client = new WsStringMessageClient(host, port);
-        client.start(this);
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public void receiveString(final String eventString) {
-        LOGGER.debug("{}: port {}, received event {}", WebSocketEventSubscriberClient.class.getName(), port,
-                        eventString);
-        eventsReceivedCount++;
-    }
-
-    /**
-     * Shutdown.
-     */
-    public void shutdown() {
-        client.stop();
-        LOGGER.debug("{}: stopped", WebSocketEventSubscriberServer.class.getName());
-    }
-
-    /**
-     * 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) {
-            LOGGER.error("usage WebSocketEventSubscriberClient host port");
-            return;
-        }
-
-        int port = 0;
-        try {
-            port = Integer.parseInt(args[0]);
-        } catch (final Exception e) {
-            LOGGER.error("usage WebSocketEventSubscriberClient port");
-            e.printStackTrace();
-            return;
-        }
-
-        new WebSocketEventSubscriberClient(args[0], port);
-    }
-}
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventSubscriberServer.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/adapt/websocket/WebSocketEventSubscriberServer.java
deleted file mode 100644 (file)
index 41291a4..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
- *  Modifications Copyright (C) 2019 Nordix Foundation.
- *  Modifications Copyright (C) 2021 AT&T Intellectual Property. 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.uservice.adapt.websocket;
-
-import lombok.Getter;
-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.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * The Class WebSocketEventSubscriberServer.
- */
-public class WebSocketEventSubscriberServer implements WsStringMessageListener {
-    private static final Logger LOGGER = LoggerFactory.getLogger(WebSocketEventSubscriberServer.class);
-
-    private final int port;
-    @Getter
-    private long eventsReceivedCount = 0;
-
-    private final WsStringMessageServer server;
-
-    /**
-     * Instantiates a new web socket event subscriber server.
-     *
-     * @param port the port
-     * @throws MessagingException the messaging exception
-     */
-    public WebSocketEventSubscriberServer(final int port) throws MessagingException {
-        this.port = port;
-
-        server = new WsStringMessageServer(port);
-        server.start(this);
-
-        LOGGER.debug("{}: port {}, waiting for events", WebSocketEventSubscriberServer.class.getName(), port);
-    }
-
-    /**
-     * {@inheritDoc}.
-     */
-    @Override
-    public void receiveString(final String eventString) {
-        LOGGER.debug("{}: port {}, received event {}", WebSocketEventSubscriberServer.class.getName(), port,
-                        eventString);
-        eventsReceivedCount++;
-    }
-
-    /**
-     * Shutdown.
-     */
-    public void shutdown() {
-        server.stop();
-        LOGGER.debug("{} : stopped", WebSocketEventSubscriberServer.class.getName());
-    }
-
-    /**
-     * The main method.
-     *
-     * @param args the arguments
-     * @throws MessagingException the messaging exception
-     */
-    public static void main(final String[] args) throws MessagingException {
-        if (args.length != 1) {
-            LOGGER.error("usage WebSocketEventSubscriberClient port");
-            return;
-        }
-
-        int port = 0;
-        try {
-            port = Integer.parseInt(args[0]);
-        } catch (final Exception e) {
-            LOGGER.error("usage WebSocketEventSubscriberClient port");
-            e.printStackTrace();
-            return;
-        }
-
-        new WebSocketEventSubscriberServer(port);
-    }
-}