diff options
author | liamfallon <liam.fallon@est.tech> | 2022-02-11 00:43:14 +0000 |
---|---|---|
committer | liamfallon <liam.fallon@est.tech> | 2022-02-11 00:43:18 +0000 |
commit | f0fd964e343fe5a9cc2044d417fadf6cdd1ef0d1 (patch) | |
tree | c316685cbee53330570bcbf0509bc327ad118196 /core/core-protocols | |
parent | 8534756d13531ffec9c2d7b2ffe0a53ee1d3aaef (diff) |
Remove apex-pdp unused core modules
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>
Diffstat (limited to 'core/core-protocols')
8 files changed, 0 insertions, 476 deletions
diff --git a/core/core-protocols/pom.xml b/core/core-protocols/pom.xml deleted file mode 100644 index 2110acede..000000000 --- a/core/core-protocols/pom.xml +++ /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 index 33679c0e1..000000000 --- a/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/Action.java +++ /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 index 005c181a0..000000000 --- a/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/Message.java +++ /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 index fceef33e2..000000000 --- a/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/package-info.java +++ /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 index 876052296..000000000 --- a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/DummyAction.java +++ /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 index 5e32c00e4..000000000 --- a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/DummyMessage.java +++ /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 index 8b19059b5..000000000 --- a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/SupportMessageTest.java +++ /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 index c52f2ded6..000000000 --- a/core/core-protocols/src/test/resources/logback-test.xml +++ /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> |