diff options
author | liamfallon <liam.fallon@est.tech> | 2020-09-04 11:03:24 +0100 |
---|---|---|
committer | liamfallon <liam.fallon@est.tech> | 2020-09-04 11:24:29 +0100 |
commit | 25e3f7a0d6cd5e364e4fd69eef310fcdb8a58b55 (patch) | |
tree | 0bf44a0a6a7be18568e368c35f983e18a23fa42b /core/core-protocols/src | |
parent | 508bdbd4d17ebf3726d92553839cc4b3af922250 (diff) |
Remove client code from apex-pdp
Removal of the deployment and monitoring client from the apex-pdp as
the functionality is replaced by the Policy Framework deployment using
PAP and the Policy Framework monitoring GUI.
Code in the engine proper that was used to administer apex-pdp over the
Web Socket port is also removed, as this code was only used by the
apex-pdp legacy GUIs.
Issue-ID: POLICY-2621
Change-Id: Ib9fc4a667a4bc79377bb7b82fae6a2bd520a3e3d
Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'core/core-protocols/src')
25 files changed, 0 insertions, 1655 deletions
diff --git a/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/engdep/EngDepAction.java b/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/engdep/EngDepAction.java deleted file mode 100644 index b46fe59b9..000000000 --- a/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/engdep/EngDepAction.java +++ /dev/null @@ -1,94 +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.engdep; - -import org.onap.policy.apex.core.protocols.Action; - -/** - * Action types the EngDep messaging protocol supports. - * - * @author Sajeevan Achuthan (sajeevan.achuthan@ericsson.com) - */ -public enum EngDepAction implements Action { - /** Action to get information on the running engine service. */ - GET_ENGINE_SERVICE_INFO { - @Override - public String getActionString() { - return "Apex engine service information"; - } - }, - /** Action to update the policy model in an engine service. */ - UPDATE_MODEL { - @Override - public String getActionString() { - return "update model on Apex engine service"; - } - }, - /** Action to start an engine service. */ - START_ENGINE { - @Override - public String getActionString() { - return "starts an Apex engine"; - } - }, - /** Action to stop an engine service. */ - STOP_ENGINE { - @Override - public String getActionString() { - return "stops an Apex engine service"; - } - }, - /** Action to start sending periodic events to an engine service. */ - START_PERIODIC_EVENTS { - @Override - public String getActionString() { - return "starts periodic events on an Apex engine service"; - } - }, - /** Action to stop sending periodic events to an engine service. */ - STOP_PERIODIC_EVENTS { - @Override - public String getActionString() { - return "stops periodic events on an Apex engine service"; - } - }, - /** Action to get the status of an engine in the engine service. */ - GET_ENGINE_STATUS { - @Override - public String getActionString() { - return "gets the status of an Apex engine service"; - } - }, - /** Action to get information on an engine in the engine service. */ - GET_ENGINE_INFO { - @Override - public String getActionString() { - return "gets runtime information an Apex engine service"; - } - }, - /** The response message to all actions. */ - RESPONSE { - @Override - public String getActionString() { - return "response from Apex engine service"; - } - }; -} diff --git a/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/engdep/messages/EngineServiceInfoResponse.java b/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/engdep/messages/EngineServiceInfoResponse.java deleted file mode 100644 index 8c0c9860a..000000000 --- a/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/engdep/messages/EngineServiceInfoResponse.java +++ /dev/null @@ -1,174 +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.engdep.messages; - -import java.util.Arrays; -import java.util.Collection; -import org.onap.policy.apex.core.protocols.Message; -import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; - -/** - * The Class Response is a message that holds the response by an Apex engine to another Actino message sent to that - * engine. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -public class EngineServiceInfoResponse extends Response { - private static final long serialVersionUID = -7895025789667402067L; - - // The engine service key - private AxArtifactKey engineServiceKey; - - // The engines under the control of this engine service - private AxArtifactKey[] engineKeyArray; - - // The engine service key - private AxArtifactKey apexModelKey; - - /** - * Instantiates a new EngineServiceInfoResponse message. - * - * @param targetKey the target key of the entity that asked for the action that triggered this response message - * @param successful the successful if the action in the triggering message worked - * @param responseTo the message to which this message is a response - */ - public EngineServiceInfoResponse(final AxArtifactKey targetKey, final boolean successful, - final Message responseTo) { - super(targetKey, successful, null, responseTo); - } - - /** - * Instantiates a new EngineServiceInfoResponse message. - * - * @param targetKey the target key of the entity that asked for the action that triggered this response message - * @param successful the successful if the action in the triggering message worked - * @param messageData the message data which may indicate specific conditions for the response - * @param responseTo the message to which this message is a response - */ - public EngineServiceInfoResponse(final AxArtifactKey targetKey, final boolean successful, final String messageData, - final Message responseTo) { - super(targetKey, successful, messageData, responseTo); - } - - /** - * Gets the engine service key. - * - * @return the engine service key - */ - public AxArtifactKey getEngineServiceKey() { - return engineServiceKey; - } - - /** - * Sets the engine service key. - * - * @param engineServiceKey the engine service key - */ - public void setEngineServiceKey(final AxArtifactKey engineServiceKey) { - this.engineServiceKey = engineServiceKey; - } - - /** - * Gets the engine key array. - * - * @return the engine key array - */ - public AxArtifactKey[] getEngineKeyArray() { - return engineKeyArray; - } - - /** - * Sets the engine key array. - * - * @param engineKeyCollection the engine key array - */ - public void setEngineKeyArray(final Collection<AxArtifactKey> engineKeyCollection) { - if (engineKeyCollection != null) { - engineKeyArray = engineKeyCollection.toArray(new AxArtifactKey[engineKeyCollection.size()]); - } else { - engineKeyArray = null; - } - } - - /** - * Gets the apex model key. - * - * @return the apex model key - */ - public AxArtifactKey getApexModelKey() { - return apexModelKey; - } - - /** - * Sets the apex model key. - * - * @param apexModelKey the apex model key - */ - public void setApexModelKey(final AxArtifactKey apexModelKey) { - this.apexModelKey = apexModelKey; - } - - /** - * {@inheritDoc}. - */ - @Override - public int hashCode() { - final int prime = 31; - int result = super.hashCode(); - result = prime * result + ((apexModelKey == null) ? 0 : apexModelKey.hashCode()); - result = prime * result + Arrays.hashCode(engineKeyArray); - result = prime * result + ((engineServiceKey == null) ? 0 : engineServiceKey.hashCode()); - return result; - } - - /** - * {@inheritDoc}. - */ - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (!super.equals(obj)) { - return false; - } - - EngineServiceInfoResponse other = (EngineServiceInfoResponse) obj; - if (apexModelKey == null) { - if (other.apexModelKey != null) { - return false; - } - } else if (!apexModelKey.equals(other.apexModelKey)) { - return false; - } - if (!Arrays.equals(engineKeyArray, other.engineKeyArray)) { - return false; - } - if (engineServiceKey == null) { - if (other.engineServiceKey != null) { - return false; - } - } else if (!engineServiceKey.equals(other.engineServiceKey)) { - return false; - } - return true; - } -} diff --git a/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/engdep/messages/GetEngineInfo.java b/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/engdep/messages/GetEngineInfo.java deleted file mode 100644 index 453e037ed..000000000 --- a/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/engdep/messages/GetEngineInfo.java +++ /dev/null @@ -1,61 +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.engdep.messages; - -import org.onap.policy.apex.core.protocols.Message; -import org.onap.policy.apex.core.protocols.engdep.EngDepAction; -import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; - -/** - * The Class GetEngineInfo is a message that requests information on Apex engines and the policies they are running. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -public class GetEngineInfo extends Message { - private static final long serialVersionUID = 5885214410842753037L; - - /** - * Instantiates a new GetEngineInfo message. - * - * @param engineKey the key the engine for which the runtime information is requested - */ - public GetEngineInfo(final AxArtifactKey engineKey) { - this(engineKey, null); - } - - /** - * Instantiates a new GetEngineInfo message. - * - * @param engineKey the key the engine for which the runtime information is requested - * @param messageData the message data that may give specifics on what information to return - */ - public GetEngineInfo(final AxArtifactKey engineKey, final String messageData) { - super(EngDepAction.GET_ENGINE_INFO, engineKey, messageData); - } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - return "GetEngineInfo {" + super.toString() + "}[]"; - } -} diff --git a/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/engdep/messages/GetEngineServiceInfo.java b/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/engdep/messages/GetEngineServiceInfo.java deleted file mode 100644 index 1f44e9ce7..000000000 --- a/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/engdep/messages/GetEngineServiceInfo.java +++ /dev/null @@ -1,61 +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.engdep.messages; - -import org.onap.policy.apex.core.protocols.Message; -import org.onap.policy.apex.core.protocols.engdep.EngDepAction; -import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; - -/** - * The Class GetEngineServiceInfo is a message that requests information on what is in an Apex engine service. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -public class GetEngineServiceInfo extends Message { - private static final long serialVersionUID = 5885214410842753037L; - - /** - * Instantiates a new GetEngineServiceInfo message. - * - * @param nullKey not used, set to null - */ - public GetEngineServiceInfo(final AxArtifactKey nullKey) { - this(nullKey, null); - } - - /** - * Instantiates a new GetEngineServiceInfo message. - * - * @param nullKey not used, set to null - * @param messageData the message data that may give specifics on what information to return - */ - public GetEngineServiceInfo(final AxArtifactKey nullKey, final String messageData) { - super(EngDepAction.GET_ENGINE_SERVICE_INFO, nullKey, messageData); - } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - return "GetEngineServiceInfo {" + super.toString() + "}[]"; - } -} diff --git a/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/engdep/messages/GetEngineStatus.java b/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/engdep/messages/GetEngineStatus.java deleted file mode 100644 index 17846ec2c..000000000 --- a/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/engdep/messages/GetEngineStatus.java +++ /dev/null @@ -1,61 +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.engdep.messages; - -import org.onap.policy.apex.core.protocols.Message; -import org.onap.policy.apex.core.protocols.engdep.EngDepAction; -import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; - -/** - * The Class GetEngineInfo is a message that requests information on Apex engines and the policies they are running. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -public class GetEngineStatus extends Message { - private static final long serialVersionUID = 5885214410842753037L; - - /** - * Instantiates a new GetEngineStatus message. - * - * @param engineKey the key of the engine for which the status information is requested - */ - public GetEngineStatus(final AxArtifactKey engineKey) { - this(engineKey, null); - } - - /** - * Instantiates a new GetEngineStatus message. - * - * @param engineKey the key of the engine for which the status information is requested - * @param messageData the message data that may give specifics on what information to return - */ - public GetEngineStatus(final AxArtifactKey engineKey, final String messageData) { - super(EngDepAction.GET_ENGINE_STATUS, engineKey, messageData); - } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - return "GetEngineStatus {" + super.toString() + "}[]"; - } -} diff --git a/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/engdep/messages/Response.java b/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/engdep/messages/Response.java deleted file mode 100644 index ddd2c8cb9..000000000 --- a/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/engdep/messages/Response.java +++ /dev/null @@ -1,125 +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.engdep.messages; - -import org.onap.policy.apex.core.protocols.Message; -import org.onap.policy.apex.core.protocols.engdep.EngDepAction; -import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; - -/** - * The Class Response is a message that holds the response by an Apex engine to another Actino message sent to that - * engine. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -public class Response extends Message { - private static final long serialVersionUID = -4162385039044294476L; - - private boolean successful = false; - private Message responseTo = null; - - /** - * Instantiates a new Response message. - * - * @param targetKey the target key of the entity that asked for the action that triggered this response message - * @param successful the successful if the action in the triggering message worked - * @param responseTo the message to which this message is a response - */ - public Response(final AxArtifactKey targetKey, final boolean successful, final Message responseTo) { - this(targetKey, successful, null, responseTo); - } - - /** - * Instantiates a new Response message. - * - * @param targetKey the target key of the entity that asked for the action that triggered this response message - * @param successful the successful if the action in the triggering message worked - * @param messageData the message data which may indicate specific conditions for the response - * @param responseTo the message to which this message is a response - */ - public Response(final AxArtifactKey targetKey, final boolean successful, final String messageData, - final Message responseTo) { - super(EngDepAction.RESPONSE, targetKey, messageData); - this.successful = successful; - this.responseTo = responseTo; - } - - /** - * Checks if the action to which this is a response was successful. - * - * @return true, if is successful - */ - public boolean isSuccessful() { - return successful; - } - - /** - * Gets the message to which this message is a response to. - * - * @return the the message to which this message is a response to - */ - public Message getResponseTo() { - return responseTo; - } - - /** - * {@inheritDoc}. - */ - @Override - public int hashCode() { - final int prime = 31; - int result = super.hashCode(); - result = prime * result + ((responseTo == null) ? 0 : responseTo.hashCode()); - result = prime * result + (successful ? 1231 : 1237); - return result; - } - - /** - * {@inheritDoc}. - */ - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (!super.equals(obj)) { - return false; - } - - Response other = (Response) obj; - if (responseTo == null) { - if (other.responseTo != null) { - return false; - } - } else if (!responseTo.equals(other.responseTo)) { - return false; - } - return successful == other.successful; - } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - return "Response {" + super.toString() + "}[successful=" + successful + "]"; - } -} diff --git a/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/engdep/messages/StartEngine.java b/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/engdep/messages/StartEngine.java deleted file mode 100644 index 60c26762b..000000000 --- a/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/engdep/messages/StartEngine.java +++ /dev/null @@ -1,61 +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.engdep.messages; - -import org.onap.policy.apex.core.protocols.Message; -import org.onap.policy.apex.core.protocols.engdep.EngDepAction; -import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; - -/** - * The Class StartEngine is a message that requests that an Apex engine in an engine service be started. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -public class StartEngine extends Message { - private static final long serialVersionUID = 5885214410842753037L; - - /** - * Instantiates a new StartEngine message. - * - * @param engineKey the key of the engine to start - */ - public StartEngine(final AxArtifactKey engineKey) { - this(engineKey, null); - } - - /** - * Instantiates a new StartEngine message. - * - * @param engineKey the key of the engine to start - * @param messageData the message data that may give specifics on what way to start - */ - public StartEngine(final AxArtifactKey engineKey, final String messageData) { - super(EngDepAction.START_ENGINE, engineKey, messageData); - } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - return "StartEngine {" + super.toString() + "}[]"; - } -} diff --git a/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/engdep/messages/StartPeriodicEvents.java b/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/engdep/messages/StartPeriodicEvents.java deleted file mode 100644 index f50a8e23f..000000000 --- a/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/engdep/messages/StartPeriodicEvents.java +++ /dev/null @@ -1,61 +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.engdep.messages; - -import org.onap.policy.apex.core.protocols.Message; -import org.onap.policy.apex.core.protocols.engdep.EngDepAction; -import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; - -/** - * The Class StartEngine is a message that requests that an Apex engine in an engine service be started. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -public class StartPeriodicEvents extends Message { - private static final long serialVersionUID = -9172376034035242135L; - - /** - * Instantiates a new StartPeriodiEvents message. - * - * @param engineKey the key of the engine to start - */ - public StartPeriodicEvents(final AxArtifactKey engineKey) { - this(engineKey, null); - } - - /** - * Instantiates a new StartEngine message. - * - * @param engineKey the key of the engine to start - * @param messageData the message data that may give specifics on what way to start - */ - public StartPeriodicEvents(final AxArtifactKey engineKey, final String messageData) { - super(EngDepAction.START_PERIODIC_EVENTS, engineKey, messageData); - } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - return "StartPeriodicEvents {" + super.toString() + "}[]"; - } -} diff --git a/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/engdep/messages/StopEngine.java b/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/engdep/messages/StopEngine.java deleted file mode 100644 index 844203180..000000000 --- a/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/engdep/messages/StopEngine.java +++ /dev/null @@ -1,61 +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.engdep.messages; - -import org.onap.policy.apex.core.protocols.Message; -import org.onap.policy.apex.core.protocols.engdep.EngDepAction; -import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; - -/** - * The Class StopEngine is a message that requests that an Apex engine in an engine service be stopped. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -public class StopEngine extends Message { - private static final long serialVersionUID = 5885214410842753037L; - - /** - * Instantiates a new StopEngine message. - * - * @param engineKey the key of the engine to stop - */ - public StopEngine(final AxArtifactKey engineKey) { - this(engineKey, null); - } - - /** - * Instantiates a new StopEngine message. - * - * @param engineKey the key of the engine to stop - * @param messageData the message data that may give specifics on what way to stop - */ - public StopEngine(final AxArtifactKey engineKey, final String messageData) { - super(EngDepAction.STOP_ENGINE, engineKey, messageData); - } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - return "StopEngine {" + super.toString() + "}[]"; - } -} diff --git a/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/engdep/messages/StopPeriodicEvents.java b/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/engdep/messages/StopPeriodicEvents.java deleted file mode 100644 index 464c85e89..000000000 --- a/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/engdep/messages/StopPeriodicEvents.java +++ /dev/null @@ -1,61 +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.engdep.messages; - -import org.onap.policy.apex.core.protocols.Message; -import org.onap.policy.apex.core.protocols.engdep.EngDepAction; -import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; - -/** - * The Class StopEngine is a message that requests that an Apex engine in an engine service be stopped. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -public class StopPeriodicEvents extends Message { - private static final long serialVersionUID = -1796422638427413285L; - - /** - * Instantiates a new StopEngine message. - * - * @param engineKey the key of the engine to stop - */ - public StopPeriodicEvents(final AxArtifactKey engineKey) { - this(engineKey, null); - } - - /** - * Instantiates a new StopEngine message. - * - * @param engineKey the key of the engine to stop - * @param messageData the message data that may give specifics on what way to stop - */ - public StopPeriodicEvents(final AxArtifactKey engineKey, final String messageData) { - super(EngDepAction.STOP_PERIODIC_EVENTS, engineKey, messageData); - } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - return "StopPeriodicEvents {" + super.toString() + "}[]"; - } -} diff --git a/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/engdep/messages/UpdateModel.java b/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/engdep/messages/UpdateModel.java deleted file mode 100644 index 741d4736e..000000000 --- a/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/engdep/messages/UpdateModel.java +++ /dev/null @@ -1,129 +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.engdep.messages; - -import org.onap.policy.apex.core.protocols.Message; -import org.onap.policy.apex.core.protocols.engdep.EngDepAction; -import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; - -/** - * The Class UpdateModel is a message that requests an Apex engine to update its model using the data provided in the - * message. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -public class UpdateModel extends Message { - private static final long serialVersionUID = 5885214410842753037L; - - // The reply timeout value for update messages - private static final int UPDATE_MODEL_REPLY_TIMEOUT = 30000; - - // Flags indicating whether conflicts in context should be ignored and whether the model should be forced even if it - // is incompatible - private boolean ignoreConflicts = false; - private boolean forceInstall = false; - - /** - * Instantiates a new update model message. - * - * @param engineServiceKey the key of the engine service in which the model of all engines will be updated - */ - public UpdateModel(final AxArtifactKey engineServiceKey) { - this(engineServiceKey, null, false, false); - } - - /** - * Instantiates a new update model message. - * - * @param engineServiceKey the key of the engine service in which the model of all engines will be updated - * @param messageData the message data that indicates to the Apex engine the manner in which its model should be - * updated - * @param ignoreConflicts true if conflicts between context in polices is to be ignored - * @param force true if the model is to be applied even if it is incompatible with the existing model - */ - public UpdateModel(final AxArtifactKey engineServiceKey, final String messageData, final boolean ignoreConflicts, - final boolean force) { - super(EngDepAction.UPDATE_MODEL, engineServiceKey, messageData); - - this.ignoreConflicts = ignoreConflicts; - this.forceInstall = force; - - // Update messages have a longer timeout - setReplyTimeout(UPDATE_MODEL_REPLY_TIMEOUT); - } - - /** - * Check if context conflicts should be ignored. - * - * @return true if conflicts should be ignored - */ - public boolean isIgnoreConflicts() { - return ignoreConflicts; - } - - /** - * Check if version checks should be overridden. - * - * @return true if version checks should be overridden - */ - public boolean isForceInstall() { - return forceInstall; - } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - return "UpdateModel {" + super.toString() + "}[]"; - } - - /** - * {@inheritDoc}. - */ - @Override - public int hashCode() { - final int prime = 31; - int result = super.hashCode(); - result = prime * result + (forceInstall ? 1231 : 1237); - result = prime * result + (ignoreConflicts ? 1231 : 1237); - return result; - } - - /** - * {@inheritDoc}. - */ - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (!super.equals(obj)) { - return false; - } - - UpdateModel other = (UpdateModel) obj; - if (forceInstall != other.forceInstall) { - return false; - } - return ignoreConflicts == other.ignoreConflicts; - } -} diff --git a/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/engdep/messages/package-info.java b/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/engdep/messages/package-info.java deleted file mode 100644 index 3c9a5e856..000000000 --- a/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/engdep/messages/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========================================================= - */ - -/** - * Provides classes that define the EngDep messages. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ - -package org.onap.policy.apex.core.protocols.engdep.messages; diff --git a/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/engdep/package-info.java b/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/engdep/package-info.java deleted file mode 100644 index 5d8fd7893..000000000 --- a/core/core-protocols/src/main/java/org/onap/policy/apex/core/protocols/engdep/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========================================================= - */ - -/** - * Provides the EngDep protocol for communication between the APEX Engine and Apex deployment. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ - -package org.onap.policy.apex.core.protocols.engdep; diff --git a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/SupportMessageTester.java b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/SupportMessageTester.java index e6f1fa74a..1f8ccabb1 100644 --- a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/SupportMessageTester.java +++ b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/SupportMessageTester.java @@ -26,7 +26,6 @@ import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; import org.junit.Test; -import org.onap.policy.apex.core.protocols.engdep.messages.StartEngine; import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; /** @@ -66,7 +65,6 @@ public class SupportMessageTester { // disabling sonar because this code tests the equals() method assertEquals(dummyMessage, dummyMessage); // NOSONAR assertNotNull(dummyMessage); - assertNotEquals(dummyMessage, (Object) new StartEngine(new AxArtifactKey())); dummyMessage = new DummyMessage(new DummyAction(null), null, null); DummyMessage otherDummyMessage = new DummyMessage(null, null, null); diff --git a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/EngDepActionTest.java b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/EngDepActionTest.java deleted file mode 100644 index 0b75bb584..000000000 --- a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/EngDepActionTest.java +++ /dev/null @@ -1,48 +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========================================================= - */ - -package org.onap.policy.apex.core.protocols.engdep; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; - -/** - * Test the Eng Dep Action class. - * - */ -public class EngDepActionTest { - - @Test - public void test() { - assertEquals("gets runtime information an Apex engine service", EngDepAction.GET_ENGINE_INFO.getActionString()); - assertEquals("Apex engine service information", EngDepAction.GET_ENGINE_SERVICE_INFO.getActionString()); - assertEquals("gets the status of an Apex engine service", EngDepAction.GET_ENGINE_STATUS.getActionString()); - assertEquals("response from Apex engine service", EngDepAction.RESPONSE.getActionString()); - assertEquals("starts an Apex engine", EngDepAction.START_ENGINE.getActionString()); - assertEquals("starts periodic events on an Apex engine service", - EngDepAction.START_PERIODIC_EVENTS.getActionString()); - assertEquals("stops an Apex engine service", EngDepAction.STOP_ENGINE.getActionString()); - assertEquals("stops periodic events on an Apex engine service", - EngDepAction.STOP_PERIODIC_EVENTS.getActionString()); - assertEquals("update model on Apex engine service", EngDepAction.UPDATE_MODEL.getActionString()); - } - -} diff --git a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/EngineServiceInfoResponseTest.java b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/EngineServiceInfoResponseTest.java deleted file mode 100644 index 445f831e6..000000000 --- a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/EngineServiceInfoResponseTest.java +++ /dev/null @@ -1,110 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019-2020 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * 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.engdep.messages; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; - -import java.util.ArrayList; -import java.util.List; -import org.junit.Test; -import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; - -/** - * Test the start engine message. - */ -public class EngineServiceInfoResponseTest { - - @Test - public void test() { - AxArtifactKey targetKey = new AxArtifactKey("Target:0.0.1"); - GetEngineServiceInfo request = new GetEngineServiceInfo(targetKey); - - EngineServiceInfoResponse response = new EngineServiceInfoResponse(targetKey, true, request); - assertNotNull(response); - response = new EngineServiceInfoResponse(targetKey, true, "Response Data", request); - assertNotNull(response); - assertEquals("Response Data", response.getMessageData()); - - AxArtifactKey apexModelKey = new AxArtifactKey("Model:0.0.1"); - response.setApexModelKey(apexModelKey); - assertEquals(apexModelKey, response.getApexModelKey()); - - AxArtifactKey engineServiceKey = new AxArtifactKey("EngineService:0.0.1"); - response.setEngineServiceKey(engineServiceKey);; - assertEquals(engineServiceKey, response.getEngineServiceKey()); - - List<AxArtifactKey> engineKeyArrayList = new ArrayList<>(); - AxArtifactKey engineKey = new AxArtifactKey("Engine:0.0.1"); - engineKeyArrayList.add(engineKey); - response.setEngineKeyArray(engineKeyArrayList); - assertEquals(engineKeyArrayList.get(0), response.getEngineKeyArray()[0]); - - response = new EngineServiceInfoResponse(null, false, null); - assertNotEquals(0, response.hashCode()); - response.setApexModelKey(apexModelKey); - assertNotEquals(0, response.hashCode()); - response.setApexModelKey(null); - response.setEngineServiceKey(engineServiceKey);; - assertNotEquals(0, response.hashCode()); - response.setEngineServiceKey(null); - response.setEngineKeyArray(engineKeyArrayList); - assertNotEquals(0, response.hashCode()); - response.setEngineKeyArray(null); - // disabling sonar because this code tests the equals() method - assertEquals(response, response); // NOSONAR - assertNotNull(response); - assertNotEquals(response, (Object) new StartEngine(new AxArtifactKey())); - - response = new EngineServiceInfoResponse(null, false, null); - EngineServiceInfoResponse otherResponse = new EngineServiceInfoResponse(null, false, null); - - response.setApexModelKey(apexModelKey); - assertNotEquals(response, otherResponse); - otherResponse.setApexModelKey(apexModelKey); - assertEquals(response, otherResponse); - response.setApexModelKey(null); - assertNotEquals(response, otherResponse); - otherResponse.setApexModelKey(null); - assertEquals(response, otherResponse); - - response.setEngineServiceKey(engineServiceKey); - assertNotEquals(response, otherResponse); - otherResponse.setEngineServiceKey(engineServiceKey); - assertEquals(response, otherResponse); - response.setEngineServiceKey(null); - assertNotEquals(response, otherResponse); - otherResponse.setEngineServiceKey(null); - assertEquals(response, otherResponse); - - response.setEngineKeyArray(engineKeyArrayList); - assertNotEquals(response, otherResponse); - otherResponse.setEngineKeyArray(engineKeyArrayList); - assertEquals(response, otherResponse); - response.setEngineKeyArray(null); - assertNotEquals(response, otherResponse); - otherResponse.setEngineKeyArray(null); - assertEquals(response, otherResponse); - - } -} diff --git a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/GetEngineInfoTest.java b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/GetEngineInfoTest.java deleted file mode 100644 index 5bdf4a9ce..000000000 --- a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/GetEngineInfoTest.java +++ /dev/null @@ -1,42 +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========================================================= - */ - -package org.onap.policy.apex.core.protocols.engdep.messages; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import org.junit.Test; -import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; - -/** - * Test the start engine message. - */ -public class GetEngineInfoTest { - - @Test - public void test() { - assertNotNull(new GetEngineInfo(new AxArtifactKey())); - assertNotNull(new GetEngineInfo(new AxArtifactKey(), "Start Engine Data")); - assertEquals("GetEngineInfo {Message [action=GET_ENGINE_INFO, " - + "targetKey=AxArtifactKey:(name=NULL,version=0.0.0), data=null]}[]", - new GetEngineInfo(new AxArtifactKey()).toString()); - } -} diff --git a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/GetEngineServiceInfoTest.java b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/GetEngineServiceInfoTest.java deleted file mode 100644 index 1bf4d6b28..000000000 --- a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/GetEngineServiceInfoTest.java +++ /dev/null @@ -1,42 +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========================================================= - */ - -package org.onap.policy.apex.core.protocols.engdep.messages; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import org.junit.Test; -import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; - -/** - * Test the start engine message. - */ -public class GetEngineServiceInfoTest { - - @Test - public void test() { - assertNotNull(new GetEngineServiceInfo(new AxArtifactKey())); - assertNotNull(new GetEngineServiceInfo(new AxArtifactKey(), "Start Engine Data")); - assertEquals("GetEngineServiceInfo {Message [action=GET_ENGINE_SERVICE_INFO, " - + "targetKey=AxArtifactKey:(name=NULL,version=0.0.0), data=null]}[]", - new GetEngineServiceInfo(new AxArtifactKey()).toString()); - } -} diff --git a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/GetEngineStatusTest.java b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/GetEngineStatusTest.java deleted file mode 100644 index a2a1e6a88..000000000 --- a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/GetEngineStatusTest.java +++ /dev/null @@ -1,56 +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.engdep.messages; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.net.UnknownHostException; -import org.junit.Test; -import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; -import org.slf4j.ext.XLogger; -import org.slf4j.ext.XLoggerFactory; - -/** - * The Class GetExecutionStatusTest. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -public class GetEngineStatusTest { - // Logger for this class - private static final XLogger logger = XLoggerFactory.getXLogger(GetEngineStatusTest.class); - - GetEngineStatus message = null; - - /** - * Test register entity. - * - * @throws UnknownHostException the unknown host exception - */ - @Test - public void testRegisterEntity() throws UnknownHostException { - final AxArtifactKey targetKey = new AxArtifactKey("UpdateModelTest", "0.0.1"); - message = new GetEngineStatus(targetKey); - assertNotNull(message); - logger.debug(message.toString()); - assertTrue((message.toString()).contains("UpdateModelTest")); - } -} diff --git a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/ResponseTest.java b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/ResponseTest.java deleted file mode 100644 index 2ed8ef607..000000000 --- a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/ResponseTest.java +++ /dev/null @@ -1,96 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019-2020 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * 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.engdep.messages; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.net.UnknownHostException; -import org.junit.Test; -import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; -import org.slf4j.ext.XLogger; -import org.slf4j.ext.XLoggerFactory; - -/** - * The Class ResponseTest. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -public class ResponseTest { - // Logger for this class - private static final XLogger logger = XLoggerFactory.getXLogger(ResponseTest.class); - - /** - * Test response. - * - * @throws UnknownHostException the unknown host exception - */ - @Test - public void testResponse() throws UnknownHostException { - final AxArtifactKey responseKey = new AxArtifactKey("ResponseTest", "0.0.1"); - final AxArtifactKey responseToKey = new AxArtifactKey("ResponseTestTo", "0.0.1"); - UpdateModel responseTo = new UpdateModel(responseToKey); - - Response message = new Response(responseKey, false, responseTo); - logger.debug(message.toString()); - assertTrue(message.toString().contains("ResponseTest")); - assertFalse(message.isSuccessful()); - - message = new Response(responseKey, true, responseTo); - logger.debug(message.toString()); - assertTrue(message.toString().contains("ResponseTest")); - assertTrue(message.isSuccessful()); - assertEquals(responseTo, message.getResponseTo()); - - message = new Response(null, false, null); - assertNotEquals(0, message.hashCode()); - message = new Response(responseKey, false, null); - assertNotEquals(0, message.hashCode()); - message = new Response(responseKey, true, null); - assertNotEquals(0, message.hashCode()); - message = new Response(responseKey, true, new UpdateModel(null)); - assertNotEquals(0, message.hashCode()); - // disabling sonar because this code tests the equals() method - assertEquals(message, message); // NOSONAR - assertNotNull(message); - assertNotEquals(message, (Object) new StartEngine(new AxArtifactKey())); - - message = new Response(null, false, responseTo); - Response otherMessage = new Response(null, false, null); - assertNotEquals(message, otherMessage); - otherMessage = new Response(null, false, responseTo); - assertEquals(message, otherMessage); - message = new Response(null, false, null); - assertNotEquals(message, otherMessage); - otherMessage = new Response(null, false, null); - assertEquals(message, (otherMessage)); - - message = new Response(null, false, null); - otherMessage = new Response(null, true, null); - assertNotEquals(message, otherMessage); - otherMessage = new Response(null, false, null); - assertEquals(message, otherMessage); - } -} diff --git a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/StartEngineTest.java b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/StartEngineTest.java deleted file mode 100644 index 037f7580e..000000000 --- a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/StartEngineTest.java +++ /dev/null @@ -1,42 +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========================================================= - */ - -package org.onap.policy.apex.core.protocols.engdep.messages; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import org.junit.Test; -import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; - -/** - * Test the start engine message. - */ -public class StartEngineTest { - - @Test - public void test() { - assertNotNull(new StartEngine(new AxArtifactKey())); - assertNotNull(new StartEngine(new AxArtifactKey(), "Start Engine Data")); - assertEquals("StartEngine {Message [action=START_ENGINE, " - + "targetKey=AxArtifactKey:(name=NULL,version=0.0.0), data=null]}[]", - new StartEngine(new AxArtifactKey()).toString()); - } -} diff --git a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/StartPeriodicEventsTest.java b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/StartPeriodicEventsTest.java deleted file mode 100644 index 2f3efc754..000000000 --- a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/StartPeriodicEventsTest.java +++ /dev/null @@ -1,42 +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========================================================= - */ - -package org.onap.policy.apex.core.protocols.engdep.messages; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import org.junit.Test; -import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; - -/** - * Test the start engine message. - */ -public class StartPeriodicEventsTest { - - @Test - public void test() { - assertNotNull(new StartPeriodicEvents(new AxArtifactKey())); - assertNotNull(new StartPeriodicEvents(new AxArtifactKey(), "Start Periodic Events Data")); - assertEquals("StartPeriodicEvents {Message [action=START_PERIODIC_EVENTS, " - + "targetKey=AxArtifactKey:(name=NULL,version=0.0.0), data=null]}[]", - new StartPeriodicEvents(new AxArtifactKey()).toString()); - } -} diff --git a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/StopEngineTest.java b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/StopEngineTest.java deleted file mode 100644 index a9f8dcb29..000000000 --- a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/StopEngineTest.java +++ /dev/null @@ -1,42 +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========================================================= - */ - -package org.onap.policy.apex.core.protocols.engdep.messages; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import org.junit.Test; -import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; - -/** - * Test the start engine message. - */ -public class StopEngineTest { - - @Test - public void test() { - assertNotNull(new StopEngine(new AxArtifactKey())); - assertNotNull(new StopEngine(new AxArtifactKey(), "Stop Engine Data")); - assertEquals("StopEngine {Message [action=STOP_ENGINE, " - + "targetKey=AxArtifactKey:(name=NULL,version=0.0.0), data=null]}[]", - new StopEngine(new AxArtifactKey()).toString()); - } -} diff --git a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/StopPeriodicEventsTest.java b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/StopPeriodicEventsTest.java deleted file mode 100644 index e174031ef..000000000 --- a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/StopPeriodicEventsTest.java +++ /dev/null @@ -1,42 +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========================================================= - */ - -package org.onap.policy.apex.core.protocols.engdep.messages; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import org.junit.Test; -import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; - -/** - * Test the start engine message. - */ -public class StopPeriodicEventsTest { - - @Test - public void test() { - assertNotNull(new StopPeriodicEvents(new AxArtifactKey())); - assertNotNull(new StopPeriodicEvents(new AxArtifactKey(), "Stop Periodic Events Data")); - assertEquals("StopPeriodicEvents {Message [action=STOP_PERIODIC_EVENTS, " - + "targetKey=AxArtifactKey:(name=NULL,version=0.0.0), data=null]}[]", - new StopPeriodicEvents(new AxArtifactKey()).toString()); - } -} diff --git a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/UpdateModelTest.java b/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/UpdateModelTest.java deleted file mode 100644 index 85feda6d8..000000000 --- a/core/core-protocols/src/test/java/org/onap/policy/apex/core/protocols/engdep/messages/UpdateModelTest.java +++ /dev/null @@ -1,88 +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.engdep.messages; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.net.UnknownHostException; -import org.junit.Test; -import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; -import org.slf4j.ext.XLogger; -import org.slf4j.ext.XLoggerFactory; - -/** - * The Class UpdateModelTest. - * - * @author Liam Fallon (liam.fallon@ericsson.com) - */ -public class UpdateModelTest { - // Logger for this class - private static final XLogger logger = XLoggerFactory.getXLogger(UpdateModelTest.class); - - UpdateModel message = null; - - /** - * Test register entity. - * - * @throws UnknownHostException the unknown host exception - */ - @Test - public void testRegisterEntity() throws UnknownHostException { - assertNotNull(new UpdateModel(new AxArtifactKey())); - final AxArtifactKey targetKey = new AxArtifactKey("UpdateModelTest", "0.0.1"); - message = new UpdateModel(targetKey, new String("Placeholder for Apex model XML"), false, false); - assertNotNull(message); - logger.debug(message.toString()); - assertTrue((message.toString()).contains("Placeholder for Apex model XML")); - assertFalse(message.isIgnoreConflicts()); - assertFalse(message.isForceInstall()); - - message = new UpdateModel(null, null, false, false); - assertNotEquals(0, message.hashCode()); - message = new UpdateModel(null, null, true, false); - assertNotEquals(0, message.hashCode()); - message = new UpdateModel(null, null, true, true); - assertNotEquals(0, message.hashCode()); - message = new UpdateModel(null, null, false, true); - assertNotEquals(0, message.hashCode()); - // disabling sonar because this code tests the equals() method - assertEquals(message, message); // NOSONAR - assertNotNull(message); - assertNotEquals(message, (Object) new StartEngine(new AxArtifactKey())); - - message = new UpdateModel(null, null, false, false); - UpdateModel otherMessage = new UpdateModel(null, null, false, false); - assertEquals(message, otherMessage); - message = new UpdateModel(null, null, true, false); - assertNotEquals(message, otherMessage); - otherMessage = new UpdateModel(null, null, true, false); - assertEquals(message, otherMessage); - message = new UpdateModel(null, null, false, true); - assertNotEquals(message, otherMessage); - otherMessage = new UpdateModel(null, null, false, true); - assertEquals(message, otherMessage); - } -} |