diff options
author | Jim Hahn <jrh3@att.com> | 2019-05-08 14:33:57 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2019-05-08 16:24:35 -0400 |
commit | 10b21aae2bde224ab7f91f4b5ab1b89369c8fd1c (patch) | |
tree | 0417099e379e8be69f90221e8fd066fc40def62b /controlloop/common/model-impl/events/src | |
parent | 01841878936986bc80a974977ccdeaceaf7f9a78 (diff) |
Add payload to vFW policy yaml
Added new "streams" payload to vFW policy yaml files.
Removed references to pg-streams.
Also deleted directories that were moved to policy/models.
Also removed references to trafficgenerator.
Updated licenses.
Removed some trailing whitespace.
Change-Id: I6becaa573628eee677f0959fadf86f9a9f032f88
Issue-ID: POLICY-1752
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'controlloop/common/model-impl/events/src')
28 files changed, 0 insertions, 2362 deletions
diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEvent.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEvent.java deleted file mode 100644 index 944bef754..000000000 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEvent.java +++ /dev/null @@ -1,192 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2017-2018 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.controlloop; - -import com.google.gson.annotations.SerializedName; -import java.io.Serializable; -import java.util.UUID; - -public abstract class ControlLoopEvent implements Serializable { - - private static final long serialVersionUID = 2391252138583119195L; - - @SerializedName("closedLoopControlName") - private String closedLoopControlName; - - @SerializedName("version") - private String version = "1.0.2"; - - @SerializedName("requestID") - private UUID requestId; - - @SerializedName("closedLoopEventClient") - private String closedLoopEventClient; - - @SerializedName("target_type") - private ControlLoopTargetType targetType; - - @SerializedName("target") - private String target; - - @SerializedName("from") - private String from; - - @SerializedName("policyScope") - private String policyScope; - - @SerializedName("policyName") - private String policyName; - - @SerializedName("policyVersion") - private String policyVersion; - - @SerializedName("closedLoopEventStatus") - private ControlLoopEventStatus closedLoopEventStatus; - - @SerializedName("payload") - private String payload; - - public ControlLoopEvent() { - - } - - /** - * Construct an instace from an existing instance. - * - * @param event the existing instance - */ - public ControlLoopEvent(ControlLoopEvent event) { - if (event == null) { - return; - } - this.closedLoopControlName = event.closedLoopControlName; - this.requestId = event.requestId; - this.closedLoopEventClient = event.closedLoopEventClient; - this.targetType = event.targetType; - this.target = event.target; - this.from = event.from; - this.policyScope = event.policyScope; - this.policyName = event.policyName; - this.policyVersion = event.policyVersion; - this.closedLoopEventStatus = event.closedLoopEventStatus; - this.payload = event.payload; - } - - public boolean isEventStatusValid() { - return this.closedLoopEventStatus != null; - } - - public String getClosedLoopControlName() { - return closedLoopControlName; - } - - public void setClosedLoopControlName(String closedLoopControlName) { - this.closedLoopControlName = closedLoopControlName; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public UUID getRequestId() { - return requestId; - } - - public void setRequestId(UUID requestId) { - this.requestId = requestId; - } - - public String getClosedLoopEventClient() { - return closedLoopEventClient; - } - - public void setClosedLoopEventClient(String closedLoopEventClient) { - this.closedLoopEventClient = closedLoopEventClient; - } - - public ControlLoopTargetType getTargetType() { - return targetType; - } - - public void setTargetType(ControlLoopTargetType targetType) { - this.targetType = targetType; - } - - public String getTarget() { - return target; - } - - public void setTarget(String target) { - this.target = target; - } - - public String getFrom() { - return from; - } - - public void setFrom(String from) { - this.from = from; - } - - public String getPolicyScope() { - return policyScope; - } - - public void setPolicyScope(String policyScope) { - this.policyScope = policyScope; - } - - public String getPolicyName() { - return policyName; - } - - public void setPolicyName(String policyName) { - this.policyName = policyName; - } - - public String getPolicyVersion() { - return policyVersion; - } - - public void setPolicyVersion(String policyVersion) { - this.policyVersion = policyVersion; - } - - public ControlLoopEventStatus getClosedLoopEventStatus() { - return closedLoopEventStatus; - } - - public void setClosedLoopEventStatus(ControlLoopEventStatus closedLoopEventStatus) { - this.closedLoopEventStatus = closedLoopEventStatus; - } - - public String getPayload() { - return payload; - } - - public void setPayload(String payload) { - this.payload = payload; - } -} diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEventStatus.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEventStatus.java deleted file mode 100644 index f439e70ab..000000000 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopEventStatus.java +++ /dev/null @@ -1,59 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2017-2018 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.controlloop; - -public enum ControlLoopEventStatus { - ONSET("ONSET"), ABATED("ABATED"); - - private String status; - - private ControlLoopEventStatus(String status) { - this.status = status; - } - - @Override - public String toString() { - return this.status; - } - - /** - * Convert a String status to a ControlLoopEventStatus. - * - * @param status the String status - * @return the ControlLoopEventStatus - */ - public static ControlLoopEventStatus toStatus(String status) { - if (ONSET.status.equalsIgnoreCase(status)) { - return ONSET; - } - if (ABATED.status.equalsIgnoreCase(status)) { - return ABATED; - } - // - // In case DCAE uses the old abatement - // - if ("abatement".equalsIgnoreCase(status)) { - return ABATED; - } - return null; - } - -} diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopNotification.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopNotification.java deleted file mode 100644 index 8c670fe9e..000000000 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopNotification.java +++ /dev/null @@ -1,190 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2017-2018 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.controlloop; - -import java.io.Serializable; -import java.time.ZoneOffset; -import java.time.ZonedDateTime; -import java.util.LinkedList; -import java.util.List; -import java.util.UUID; - -public abstract class ControlLoopNotification implements Serializable { - - private static final long serialVersionUID = 7538596984567127915L; - - private String closedLoopControlName; - private String version = "1.0.2"; - private UUID requestId; - private String closedLoopEventClient; - private ControlLoopTargetType targetType; - private String target; - private String from; - private String policyScope; - private String policyName; - private String policyVersion; - private ControlLoopNotificationType notification; - private String message; - private ZonedDateTime notificationTime = ZonedDateTime.now(ZoneOffset.UTC); - private Integer opsClTimer; - private List<ControlLoopOperation> history = new LinkedList<>(); - - public ControlLoopNotification() { - - } - - /** - * Construct an instance. - * - * @param event the event - */ - public ControlLoopNotification(ControlLoopEvent event) { - if (event == null) { - return; - } - - this.setClosedLoopControlName(event.getClosedLoopControlName()); - this.setRequestId(event.getRequestId()); - this.setClosedLoopEventClient(event.getClosedLoopEventClient()); - this.setTargetType(event.getTargetType()); - this.setTarget(event.getTarget()); - } - - public String getClosedLoopControlName() { - return closedLoopControlName; - } - - public void setClosedLoopControlName(String closedLoopControlName) { - this.closedLoopControlName = closedLoopControlName; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public UUID getRequestId() { - return requestId; - } - - public void setRequestId(UUID requestId) { - this.requestId = requestId; - } - - public String getClosedLoopEventClient() { - return closedLoopEventClient; - } - - public void setClosedLoopEventClient(String closedLoopEventClient) { - this.closedLoopEventClient = closedLoopEventClient; - } - - public ControlLoopTargetType getTargetType() { - return targetType; - } - - public void setTargetType(ControlLoopTargetType targetType) { - this.targetType = targetType; - } - - public String getTarget() { - return target; - } - - public void setTarget(String target) { - this.target = target; - } - - public String getFrom() { - return from; - } - - public void setFrom(String from) { - this.from = from; - } - - public String getPolicyScope() { - return policyScope; - } - - public void setPolicyScope(String policyScope) { - this.policyScope = policyScope; - } - - public String getPolicyName() { - return policyName; - } - - public void setPolicyName(String policyName) { - this.policyName = policyName; - } - - public String getPolicyVersion() { - return policyVersion; - } - - public void setPolicyVersion(String policyVersion) { - this.policyVersion = policyVersion; - } - - public ControlLoopNotificationType getNotification() { - return notification; - } - - public void setNotification(ControlLoopNotificationType notification) { - this.notification = notification; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public ZonedDateTime getNotificationTime() { - return notificationTime; - } - - public void setNotificationTime(ZonedDateTime notificationTime) { - this.notificationTime = notificationTime; - } - - public Integer getOpsClTimer() { - return opsClTimer; - } - - public void setOpsClTimer(Integer opsClTimer) { - this.opsClTimer = opsClTimer; - } - - public List<ControlLoopOperation> getHistory() { - return history; - } - - public void setHistory(List<ControlLoopOperation> history) { - this.history = history; - } -} diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopNotificationType.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopNotificationType.java deleted file mode 100644 index 9f5a41d39..000000000 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopNotificationType.java +++ /dev/null @@ -1,73 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2017-2018 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.controlloop; - -public enum ControlLoopNotificationType { - ACTIVE("ACTIVE"), REJECTED("REJECTED"), OPERATION("OPERATION"), OPERATION_SUCCESS( - "OPERATION: SUCCESS"), OPERATION_FAILURE("OPERATION: FAILURE"), FINAL_FAILURE( - "FINAL: FAILURE"), FINAL_SUCCESS("FINAL: SUCCESS"), FINAL_OPENLOOP("FINAL: OPENLOOP"); - - private String type; - - private ControlLoopNotificationType(String type) { - this.type = type; - } - - @Override - public String toString() { - return this.type; - } - - /** - * Convert a String type to a ControlLoopNotificationType. - * - * @param type the String type - * @return the ControlLoopNotificationType - */ - public static ControlLoopNotificationType toType(String type) { - if (ACTIVE.toString().equals(type)) { - return ACTIVE; - } - if (REJECTED.toString().equals(type)) { - return REJECTED; - } - if (OPERATION.toString().equals(type)) { - return OPERATION; - } - if (OPERATION_SUCCESS.toString().equals(type)) { - return OPERATION_SUCCESS; - } - if (OPERATION_FAILURE.toString().equals(type)) { - return OPERATION_FAILURE; - } - if (FINAL_FAILURE.toString().equals(type)) { - return FINAL_FAILURE; - } - if (FINAL_SUCCESS.toString().equals(type)) { - return FINAL_SUCCESS; - } - if (FINAL_OPENLOOP.toString().equals(type)) { - return FINAL_OPENLOOP; - } - return null; - } - -} diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopOperation.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopOperation.java deleted file mode 100644 index 3ef731687..000000000 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopOperation.java +++ /dev/null @@ -1,229 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2017-2018 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.controlloop; - -import java.io.Serializable; -import java.time.Instant; - -public class ControlLoopOperation implements Serializable { - - private static final long serialVersionUID = 8662706581293017099L; - - private String actor; - private String operation; - private String target; - private Instant start = Instant.now(); - private Instant end; - private String subRequestId; - private String outcome; - private String message; - - public ControlLoopOperation() { - - } - - /** - * Construct an instance from an existing instance. - * - * @param op the existing instance - */ - public ControlLoopOperation(ControlLoopOperation op) { - if (op == null) { - return; - } - - this.actor = op.actor; - this.operation = op.operation; - this.target = op.target; - this.start = op.start; - this.end = op.end; - this.subRequestId = op.subRequestId; - this.outcome = op.outcome; - this.message = op.message; - } - - public String toMessage() { - return "actor=" + actor + ",operation=" + operation + ",target=" + target + ",subRequestId=" + subRequestId; - } - - public String toHistory() { - return "actor=" + actor + ",operation=" + operation + ",target=" + target + ",start=" + start + ",end=" + end - + ",subRequestId=" + subRequestId + ",outcome=" + outcome + ",message=" + message; - } - - public String getActor() { - return actor; - } - - public void setActor(String actor) { - this.actor = actor; - } - - public String getOperation() { - return operation; - } - - public void setOperation(String operation) { - this.operation = operation; - } - - public String getTarget() { - return target; - } - - public void setTarget(String target) { - this.target = target; - } - - public Instant getStart() { - return start; - } - - public void setStart(Instant start) { - this.start = start; - } - - public Instant getEnd() { - return end; - } - - public void setEnd(Instant end) { - this.end = end; - } - - public String getSubRequestId() { - return subRequestId; - } - - public void setSubRequestId(String subRequestId) { - this.subRequestId = subRequestId; - } - - public String getOutcome() { - return outcome; - } - - public void setOutcome(String outcome) { - this.outcome = outcome; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - @Override - public String toString() { - return "ControlLoopOperation [actor=" + actor + ", operation=" + operation + ", target=" + target + ", start=" - + start + ", end=" + end + ", subRequestId=" + subRequestId + ", outcome=" + outcome + ", message=" - + message + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((actor == null) ? 0 : actor.hashCode()); - result = prime * result + ((end == null) ? 0 : end.hashCode()); - result = prime * result + ((message == null) ? 0 : message.hashCode()); - result = prime * result + ((operation == null) ? 0 : operation.hashCode()); - result = prime * result + ((outcome == null) ? 0 : outcome.hashCode()); - result = prime * result + ((start == null) ? 0 : start.hashCode()); - result = prime * result + ((subRequestId == null) ? 0 : subRequestId.hashCode()); - result = prime * result + ((target == null) ? 0 : target.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - ControlLoopOperation other = (ControlLoopOperation) obj; - if (actor == null) { - if (other.actor != null) { - return false; - } - } else if (!actor.equals(other.actor)) { - return false; - } - if (end == null) { - if (other.end != null) { - return false; - } - } else if (!end.equals(other.end)) { - return false; - } - if (message == null) { - if (other.message != null) { - return false; - } - } else if (!message.equals(other.message)) { - return false; - } - if (operation == null) { - if (other.operation != null) { - return false; - } - } else if (!operation.equals(other.operation)) { - return false; - } - if (outcome == null) { - if (other.outcome != null) { - return false; - } - } else if (!outcome.equals(other.outcome)) { - return false; - } - if (start == null) { - if (other.start != null) { - return false; - } - } else if (!start.equals(other.start)) { - return false; - } - if (subRequestId == null) { - if (other.subRequestId != null) { - return false; - } - } else if (!subRequestId.equals(other.subRequestId)) { - return false; - } - if (target == null) { - if (other.target != null) { - return false; - } - } else if (!target.equals(other.target)) { - return false; - } - return true; - } - -} diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopOperationWrapper.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopOperationWrapper.java deleted file mode 100644 index 0bdc5cace..000000000 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopOperationWrapper.java +++ /dev/null @@ -1,54 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2017-2018 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.controlloop; - -import java.util.UUID; - -public class ControlLoopOperationWrapper { - - private UUID requestId; - private ControlLoopOperation operation; - - public ControlLoopOperationWrapper() { - - } - - public ControlLoopOperationWrapper(UUID requestId, ControlLoopOperation operation) { - this.requestId = requestId; - this.operation = operation; - } - - public UUID getRequestId() { - return requestId; - } - - public void setRequestId(UUID requestId) { - this.requestId = requestId; - } - - public ControlLoopOperation getOperation() { - return operation; - } - - public void setOperation(ControlLoopOperation operation) { - this.operation = operation; - } -} diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopResponse.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopResponse.java deleted file mode 100644 index 483aaacfa..000000000 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopResponse.java +++ /dev/null @@ -1,142 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2019 Wipro Limited 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.controlloop; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import java.util.UUID; - -public class ControlLoopResponse implements Serializable { - - private static final long serialVersionUID = 2391252138583119195L; - - @SerializedName("closedLoopControlName") - private String closedLoopControlName; - - @SerializedName("version") - private String version = "1.0.0"; - - @SerializedName("requestID") - private UUID requestId; - - @SerializedName("target") - private String target; - - @SerializedName("from") - private String from; - - @SerializedName("policyName") - private String policyName; - - @SerializedName("policyVersion") - private String policyVersion; - - @SerializedName("payload") - private String payload; - - public ControlLoopResponse() { - - } - - /** - * Construct an instace from an existing instance. - * - * @param response - * the existing instance - */ - public ControlLoopResponse(ControlLoopResponse response) { - if (response == null) { - return; - } - this.closedLoopControlName = response.closedLoopControlName; - this.requestId = response.requestId; - this.target = response.target; - this.from = response.from; - this.policyName = response.policyName; - this.policyVersion = response.policyVersion; - this.payload = response.payload; - } - - public String getClosedLoopControlName() { - return closedLoopControlName; - } - - public void setClosedLoopControlName(String closedLoopControlName) { - this.closedLoopControlName = closedLoopControlName; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public UUID getRequestId() { - return requestId; - } - - public void setRequestId(UUID requestId) { - this.requestId = requestId; - } - - public String getTarget() { - return target; - } - - public void setTarget(String target) { - this.target = target; - } - - public String getFrom() { - return from; - } - - public void setFrom(String from) { - this.from = from; - } - - public String getPolicyName() { - return policyName; - } - - public void setPolicyName(String policyName) { - this.policyName = policyName; - } - - public String getPolicyVersion() { - return policyVersion; - } - - public void setPolicyVersion(String policyVersion) { - this.policyVersion = policyVersion; - } - - public String getPayload() { - return payload; - } - - public void setPayload(String payload) { - this.payload = payload; - } -} diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopTargetType.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopTargetType.java deleted file mode 100644 index 4782654fc..000000000 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopTargetType.java +++ /dev/null @@ -1,59 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2017-2018 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.controlloop; - -public enum ControlLoopTargetType { - VM("VM"), VF("VF"), VFC("VFC"), VNF("VNF"); - - private String type; - - private ControlLoopTargetType(String type) { - this.type = type; - } - - @Override - public String toString() { - return this.type; - } - - /** - * Convert a String type to a ControlLoopTargetType. - * - * @param type the String type - * @return the ControlLoopTargetType - */ - public static ControlLoopTargetType toType(String type) { - if (VM.toString().equals(type)) { - return VM; - } - if (VF.toString().equals(type)) { - return VF; - } - if (VFC.toString().equals(type)) { - return VFC; - } - if (VNF.toString().equals(type)) { - return VNF; - } - - return null; - } -} diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopEvent.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopEvent.java deleted file mode 100644 index 9cb85ae7f..000000000 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2017-2018 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.controlloop; - -public class PhysicalControlLoopEvent extends ControlLoopEvent { - private static final long serialVersionUID = -7282930271094849487L; - - public PhysicalControlLoopEvent() {} - - /** - * Construct an instance from an existing instance. - * - * @param event the existing instance - */ - public PhysicalControlLoopEvent(PhysicalControlLoopEvent event) { - super(event); - } -} diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopNotification.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopNotification.java deleted file mode 100644 index 0b5db3a1f..000000000 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/PhysicalControlLoopNotification.java +++ /dev/null @@ -1,37 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2017-2018 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.controlloop; - -public class PhysicalControlLoopNotification extends ControlLoopNotification { - private static final long serialVersionUID = 8105197217140032892L; - - public PhysicalControlLoopNotification() {} - - /** - * Construct an instance from an existing instance. - * - * @param event the existing instance - */ - public PhysicalControlLoopNotification(PhysicalControlLoopEvent event) { - super(event); - } - -} diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopEvent.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopEvent.java deleted file mode 100644 index b5ae50ac8..000000000 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopEvent.java +++ /dev/null @@ -1,85 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2017-2018 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.controlloop; - -import com.google.gson.annotations.SerializedName; - -import java.time.Instant; -import java.util.HashMap; -import java.util.Map; - -public class VirtualControlLoopEvent extends ControlLoopEvent { - - private static final long serialVersionUID = -5752405682246066226L; - - @SerializedName("closedLoopAlarmStart") - private Instant closedLoopAlarmStart; - - @SerializedName("closedLoopAlarmEnd") - private Instant closedLoopAlarmEnd; - - @SerializedName("AAI") - private Map<String, String> aai = new HashMap<>(); - - public VirtualControlLoopEvent() {} - - - /** - * Construct an instance from an existing instance. - * - * @param event the existing instance - */ - public VirtualControlLoopEvent(VirtualControlLoopEvent event) { - super(event); - if (event == null) { - return; - } - if (event.aai != null) { - this.aai = new HashMap<>(event.aai); - } - this.closedLoopAlarmStart = event.closedLoopAlarmStart; - this.closedLoopAlarmEnd = event.closedLoopAlarmEnd; - } - - public Instant getClosedLoopAlarmStart() { - return closedLoopAlarmStart; - } - - public void setClosedLoopAlarmStart(Instant closedLoopAlarmStart) { - this.closedLoopAlarmStart = closedLoopAlarmStart; - } - - public Instant getClosedLoopAlarmEnd() { - return closedLoopAlarmEnd; - } - - public void setClosedLoopAlarmEnd(Instant closedLoopAlarmEnd) { - this.closedLoopAlarmEnd = closedLoopAlarmEnd; - } - - public Map<String, String> getAai() { - return aai; - } - - public void setAai(Map<String, String> aai) { - this.aai = aai; - } -} diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopNotification.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopNotification.java deleted file mode 100644 index 71a901505..000000000 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/VirtualControlLoopNotification.java +++ /dev/null @@ -1,84 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2017-2018 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.controlloop; - -import com.google.gson.annotations.SerializedName; - -import java.time.Instant; -import java.util.HashMap; -import java.util.Map; - -public class VirtualControlLoopNotification extends ControlLoopNotification { - - private static final long serialVersionUID = 5354756047932144017L; - - @SerializedName("AAI") - private Map<String, String> aai = new HashMap<>(); - - @SerializedName("closedLoopAlarmStart") - private Instant closedLoopAlarmStart; - - @SerializedName("closedLoopAlarmEnd") - private Instant closedLoopAlarmEnd; - - public VirtualControlLoopNotification() {} - - /** - * Construct an instance. - * - * @param event the event - */ - public VirtualControlLoopNotification(VirtualControlLoopEvent event) { - super(event); - if (event == null) { - return; - } - if (event.getAai() != null) { - this.setAai(new HashMap<>(event.getAai())); - } - this.closedLoopAlarmStart = event.getClosedLoopAlarmStart(); - this.closedLoopAlarmEnd = event.getClosedLoopAlarmEnd(); - } - - public Map<String, String> getAai() { - return aai; - } - - public void setAai(Map<String, String> aai) { - this.aai = aai; - } - - public Instant getClosedLoopAlarmStart() { - return closedLoopAlarmStart; - } - - public void setClosedLoopAlarmStart(Instant closedLoopAlarmStart) { - this.closedLoopAlarmStart = closedLoopAlarmStart; - } - - public Instant getClosedLoopAlarmEnd() { - return closedLoopAlarmEnd; - } - - public void setClosedLoopAlarmEnd(Instant closedLoopAlarmEnd) { - this.closedLoopAlarmEnd = closedLoopAlarmEnd; - } -} diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/params/ControlLoopParams.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/params/ControlLoopParams.java deleted file mode 100644 index ab93f5e9b..000000000 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/params/ControlLoopParams.java +++ /dev/null @@ -1,92 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * AppcLcmActorServiceProvider - * ================================================================================ - * Copyright (C) 2018 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.controlloop.params; - -import java.io.Serializable; - -public class ControlLoopParams implements Serializable { - - private static final long serialVersionUID = 970755684770982776L; - - private String closedLoopControlName; - private String controlLoopYaml; - private String policyName; - private String policyScope; - private String policyVersion; - - public ControlLoopParams() { - super(); - } - - /** - * Construct an instance from an existing instance. - * - * @param params the existing instance - */ - public ControlLoopParams(ControlLoopParams params) { - this.closedLoopControlName = params.closedLoopControlName; - this.controlLoopYaml = params.controlLoopYaml; - this.policyName = params.policyName; - this.policyScope = params.policyScope; - this.policyVersion = params.policyVersion; - } - - public String getClosedLoopControlName() { - return closedLoopControlName; - } - - public void setClosedLoopControlName(String closedLoopControlName) { - this.closedLoopControlName = closedLoopControlName; - } - - public String getControlLoopYaml() { - return controlLoopYaml; - } - - public void setControlLoopYaml(String controlLoopYaml) { - this.controlLoopYaml = controlLoopYaml; - } - - public String getPolicyName() { - return policyName; - } - - public void setPolicyName(String policyName) { - this.policyName = policyName; - } - - public String getPolicyScope() { - return policyScope; - } - - public void setPolicyScope(String policyScope) { - this.policyScope = policyScope; - } - - public String getPolicyVersion() { - return policyVersion; - } - - public void setPolicyVersion(String policyVersion) { - this.policyVersion = policyVersion; - } - -} diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/util/Serialization.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/util/Serialization.java deleted file mode 100644 index 4bbab7a50..000000000 --- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/util/Serialization.java +++ /dev/null @@ -1,125 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2017-2018 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.controlloop.util; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonPrimitive; -import com.google.gson.JsonSerializationContext; -import com.google.gson.JsonSerializer; - -import java.lang.reflect.Type; -import java.time.Instant; -import java.time.ZonedDateTime; -import java.time.format.DateTimeFormatter; - -import org.onap.policy.controlloop.ControlLoopNotificationType; -import org.onap.policy.controlloop.ControlLoopTargetType; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public final class Serialization { - public static final Gson gson = - new GsonBuilder().disableHtmlEscaping().registerTypeAdapter(ZonedDateTime.class, new GsonUtcAdapter()) - .registerTypeAdapter(Instant.class, new GsonInstantAdapter()) - .registerTypeAdapter(ControlLoopNotificationType.class, new NotificationTypeAdapter()) - .registerTypeAdapter(ControlLoopTargetType.class, new TargetTypeAdapter()).create(); - - - public static final Gson gsonPretty = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting() - .registerTypeAdapter(ZonedDateTime.class, new GsonUtcAdapter()) - .registerTypeAdapter(Instant.class, new GsonInstantAdapter()) - .registerTypeAdapter(ControlLoopNotificationType.class, new NotificationTypeAdapter()) - .registerTypeAdapter(ControlLoopTargetType.class, new TargetTypeAdapter()).create(); - - public static final Gson gsonJunit = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting() - .registerTypeAdapter(ZonedDateTime.class, new GsonUtcAdapter()) - .registerTypeAdapter(Instant.class, new GsonInstantAdapter()) - .registerTypeAdapter(ControlLoopTargetType.class, new TargetTypeAdapter()).create(); - - private Serialization() {} - - public static class NotificationTypeAdapter - implements JsonSerializer<ControlLoopNotificationType>, JsonDeserializer<ControlLoopNotificationType> { - @Override - public JsonElement serialize(ControlLoopNotificationType src, Type typeOfSrc, - JsonSerializationContext context) { - return new JsonPrimitive(src.toString()); - } - - @Override - public ControlLoopNotificationType deserialize(JsonElement json, Type typeOfT, - JsonDeserializationContext context) { - return ControlLoopNotificationType.toType(json.getAsString()); - } - } - - public static class TargetTypeAdapter - implements JsonSerializer<ControlLoopTargetType>, JsonDeserializer<ControlLoopTargetType> { - @Override - public JsonElement serialize(ControlLoopTargetType src, Type typeOfSrc, JsonSerializationContext context) { - return new JsonPrimitive(src.toString()); - } - - @Override - public ControlLoopTargetType deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) { - return ControlLoopTargetType.toType(json.getAsString()); - } - } - - public static class GsonUtcAdapter implements JsonSerializer<ZonedDateTime>, JsonDeserializer<ZonedDateTime> { - private static final Logger logger = LoggerFactory.getLogger(GsonUtcAdapter.class); - public static final DateTimeFormatter format = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSSSSxxx"); - - @Override - public ZonedDateTime deserialize(JsonElement element, Type type, JsonDeserializationContext context) { - try { - return ZonedDateTime.parse(element.getAsString(), format); - } catch (Exception e) { - logger.error(e.getMessage(), e); - } - return null; - } - - @Override - public JsonElement serialize(ZonedDateTime datetime, Type type, JsonSerializationContext context) { - return new JsonPrimitive(datetime.format(format)); - } - } - - public static class GsonInstantAdapter implements JsonSerializer<Instant>, JsonDeserializer<Instant> { - - @Override - public Instant deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) { - return Instant.ofEpochMilli(json.getAsLong()); - } - - @Override - public JsonElement serialize(Instant src, Type typeOfSrc, JsonSerializationContext context) { - return new JsonPrimitive(src.toEpochMilli()); - } - - } - -} diff --git a/controlloop/common/model-impl/events/src/main/resources/definitions.yaml b/controlloop/common/model-impl/events/src/main/resources/definitions.yaml deleted file mode 100644 index e7f147300..000000000 --- a/controlloop/common/model-impl/events/src/main/resources/definitions.yaml +++ /dev/null @@ -1,127 +0,0 @@ -# Copyright 2018 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. -AAI: - type: object - properties: - AICVServerSelfLink: - type: string - VNF_NAME: - type: string - AICVMID: - type: string - AICTenantID: - type: string - LOC_ID: - type: string - in_maint: - type: boolean - AICIdentity: - type: string - Prov_status: - type: string - OAM_IPV4: - type: string - is_closed_loop_disabled: - type: boolean - VM_NAME: - type: string - OAM_IPV6: - type: string - required: - - AICVServerSelfLink - - AICIdentity - - is_closed_loop_disabled -ControlLoop: - type: object - description: Common fields for control loop events and notifications - properties: - closedLoopControlName: - type: string - description: A UNIQUE string identifying the Closed Loop ID this event is for. There are no semantics behind this string. - serviceInstance: - $ref: '../../../../sdc/src/main/resources/definitions.yaml#/serviceInstance' - resourceInstance: - $ref: '../../../../sdc/src/main/resources/definitions.yaml#/resourceInstance' - requestID: - type: string - description: This is required via ONAP Platform Logging Requirements. - pattern: /[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}/ - triggerID: - type: string - description: ID that maps back to Highland Park. Concatenation between eventID and firstEPOCH. - triggerSourceName: - type: string - description: pulled from eventSourceName of trigger H.P. alarm. The contents of this field should also be contained in the AAI Json sub-tag (see below). - closedLoopAlarmStart: - type: string - description: firstEpoch. UTC Timestamp when this event was detected by DCAE. Conform to ONAP Logging requirements. - closedLoopAlarmEnd: - type: string - description: lastEpoch. UTC Timestamp when this event was detected as cleared by DCAE. Conform to ONAP Logging requirements. - closedLoopEventClient: - type: string - description: Open DCAE sub-system that detected the event and published this event message. - target: - type: string - description: The target entity that is being administered. This could be VM_NAME, VNF_NAME, etc. This should map to a field name in the AAI sub-tag shown below. - AAI: - $ref: '#/AAI' - from: - type: string - policyScope: - type: string - policyName: - type: string - policyVersion: - type: string - required: - - closedLoopControlName - - requestID - - triggerID - - triggerSourceName - - closedLoopAlarmStart - - closedLoopEventClient - - target - - AAI - - from - - policyScope - - policyName - - policyVersion -Event: - allOf: - - $ref: '#/ControlLoop' - - properties: - closedLoopEventStatus: - type: string - description: The status for the event within Open DCAE. A value of “ONSET” indicates the event has been encountered. “ABATED” indicates the event has been abated. - valid_values: - - ONSET - - ABATEMENT - - required: - - closedLoopEventStatus -Notification: - - $ref: '#/ControlLoop' - - properties: - notification: - type: string - notificationTime: - type: string - message: - type: string - OPS_CL_timer: - type: int - - required: - - notification - - notificationTime - - OPS_CL_timer diff --git a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopEventStatusTest.java b/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopEventStatusTest.java deleted file mode 100644 index b4944fc42..000000000 --- a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopEventStatusTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2018 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.controlloop; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; - -import org.junit.Test; - -public class ControlLoopEventStatusTest { - - @Test - public void test() { - ControlLoopEventStatus status = ControlLoopEventStatus.ABATED; - assertEquals(ControlLoopEventStatus.ABATED, ControlLoopEventStatus.toStatus(status.toString())); - assertNotEquals(ControlLoopEventStatus.ONSET, ControlLoopEventStatus.toStatus(status.toString())); - - status = ControlLoopEventStatus.ONSET; - assertEquals(ControlLoopEventStatus.ONSET, ControlLoopEventStatus.toStatus(status.toString())); - assertNotEquals(ControlLoopEventStatus.ABATED, ControlLoopEventStatus.toStatus(status.toString())); - assertEquals(ControlLoopEventStatus.ABATED, ControlLoopEventStatus.toStatus("abatement")); - } -} diff --git a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopEventTest.java b/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopEventTest.java deleted file mode 100644 index 9da12aaab..000000000 --- a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopEventTest.java +++ /dev/null @@ -1,96 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2018 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.controlloop; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -import java.util.UUID; -import org.junit.Test; - -public class ControlLoopEventTest { - - private class TestControlLoopEvent extends ControlLoopEvent { - private static final long serialVersionUID = 1L; - - public TestControlLoopEvent() { - super(); - } - - public TestControlLoopEvent(ControlLoopEvent event) { - super(event); - } - } - - @Test - public void test() { - ControlLoopEvent event = new TestControlLoopEvent(); - - assertEquals("1.0.2", event.getVersion()); - - event = new TestControlLoopEvent(null); - assertEquals("1.0.2", event.getVersion()); - - event.setClosedLoopControlName("name"); - assertEquals("name", event.getClosedLoopControlName()); - - event.setClosedLoopEventClient("client"); - assertEquals("client", event.getClosedLoopEventClient()); - - event.setClosedLoopEventStatus(ControlLoopEventStatus.ONSET); - assertEquals(ControlLoopEventStatus.ONSET, event.getClosedLoopEventStatus()); - - event.setFrom("from"); - assertEquals("from", event.getFrom()); - - event.setPayload("payload"); - assertEquals("payload", event.getPayload()); - - event.setPolicyName("policyname"); - assertEquals("policyname", event.getPolicyName()); - - event.setPolicyScope("scope"); - assertEquals("scope", event.getPolicyScope()); - - event.setPolicyVersion("1"); - assertEquals("1", event.getPolicyVersion()); - - UUID id = UUID.randomUUID(); - event.setRequestId(id); - assertEquals(id, event.getRequestId()); - - event.setTarget("target"); - assertEquals("target", event.getTarget()); - - event.setTargetType(ControlLoopTargetType.VF); - assertEquals(ControlLoopTargetType.VF, event.getTargetType()); - - event.setVersion("foo"); - assertEquals("foo", event.getVersion()); - - ControlLoopEvent event2 = new TestControlLoopEvent(event); - assertTrue(event2.isEventStatusValid()); - - event2.setClosedLoopEventStatus(null); - assertFalse(event2.isEventStatusValid()); - } -} diff --git a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopNotificationTest.java b/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopNotificationTest.java deleted file mode 100644 index de03cc265..000000000 --- a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopNotificationTest.java +++ /dev/null @@ -1,117 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2018 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.controlloop; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.time.ZoneOffset; -import java.time.ZonedDateTime; -import java.util.Collections; -import java.util.UUID; -import org.junit.Test; -import org.onap.policy.controlloop.util.Serialization; - -public class ControlLoopNotificationTest { - - private class TestControlLoopNotification extends ControlLoopNotification { - private static final long serialVersionUID = 1L; - - public TestControlLoopNotification() { - super(); - } - - public TestControlLoopNotification(ControlLoopEvent event) { - super(event); - } - } - - @Test - public void test() { - ControlLoopNotification notification = new TestControlLoopNotification(); - - assertEquals("1.0.2", notification.getVersion()); - - notification.setClosedLoopControlName("name"); - assertEquals("name", notification.getClosedLoopControlName()); - - notification.setClosedLoopEventClient("client"); - assertEquals("client", notification.getClosedLoopEventClient()); - - notification.setFrom("from"); - assertEquals("from", notification.getFrom()); - - notification.setHistory(Collections.emptyList()); - assertTrue(notification.getHistory().size() == 0); - - notification.setMessage("message"); - assertEquals("message", notification.getMessage()); - - notification.setNotification(ControlLoopNotificationType.ACTIVE); - assertEquals(ControlLoopNotificationType.ACTIVE, notification.getNotification()); - - ZonedDateTime time = ZonedDateTime.now(ZoneOffset.UTC); - notification.setNotificationTime(time); - assertEquals(time, notification.getNotificationTime()); - - notification.setOpsClTimer(Integer.valueOf(1000)); - assertEquals(Integer.valueOf(1000), notification.getOpsClTimer()); - - notification.setPolicyName("name"); - assertEquals("name", notification.getPolicyName()); - - notification.setPolicyScope("scope"); - assertEquals("scope", notification.getPolicyScope()); - - notification.setPolicyVersion("1"); - assertEquals("1", notification.getPolicyVersion()); - - UUID id = UUID.randomUUID(); - notification.setRequestId(id); - assertEquals(id, notification.getRequestId()); - - notification.setTarget("target"); - assertEquals("target", notification.getTarget()); - - notification.setTargetType(ControlLoopTargetType.VFC); - assertEquals(ControlLoopTargetType.VFC, notification.getTargetType()); - - VirtualControlLoopEvent event = new VirtualControlLoopEvent(); - event.setClosedLoopControlName("controlloop"); - - TestControlLoopNotification notification2 = new TestControlLoopNotification(event); - assertEquals("controlloop", notification2.getClosedLoopControlName()); - - notification2.setVersion("1"); - assertEquals("1", notification2.getVersion()); - - String json = Serialization.gsonPretty.toJson(notification); - - TestControlLoopNotification notification3 = Serialization.gson.fromJson(json, - TestControlLoopNotification.class); - - // - // There is no equals for the class - chose not to create one - // - assertEquals(notification.getRequestId(), notification3.getRequestId()); - - } -} diff --git a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopNotificationTypeTest.java b/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopNotificationTypeTest.java deleted file mode 100644 index 63103ac8f..000000000 --- a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopNotificationTypeTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2018 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.controlloop; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -import org.junit.Test; - -public class ControlLoopNotificationTypeTest { - - @Test - public void test() { - - assertEquals(ControlLoopNotificationType.ACTIVE, ControlLoopNotificationType.toType("ACTIVE")); - assertEquals(ControlLoopNotificationType.REJECTED, ControlLoopNotificationType.toType("REJECTED")); - assertEquals(ControlLoopNotificationType.OPERATION, ControlLoopNotificationType.toType("OPERATION")); - assertEquals(ControlLoopNotificationType.OPERATION_SUCCESS, - ControlLoopNotificationType.toType("OPERATION: SUCCESS")); - assertEquals(ControlLoopNotificationType.OPERATION_FAILURE, - ControlLoopNotificationType.toType("OPERATION: FAILURE")); - assertEquals(ControlLoopNotificationType.FINAL_FAILURE, - ControlLoopNotificationType.toType("FINAL: FAILURE")); - assertEquals(ControlLoopNotificationType.FINAL_SUCCESS, - ControlLoopNotificationType.toType("FINAL: SUCCESS")); - assertEquals(ControlLoopNotificationType.FINAL_OPENLOOP, - ControlLoopNotificationType.toType("FINAL: OPENLOOP")); - - assertNull(ControlLoopNotificationType.toType("foo")); - } -} diff --git a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopOperationTest.java b/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopOperationTest.java deleted file mode 100644 index 6c6a83e85..000000000 --- a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopOperationTest.java +++ /dev/null @@ -1,89 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2018 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.controlloop; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.time.Instant; -import org.junit.Test; - -public class ControlLoopOperationTest { - - @Test - public void test() { - ControlLoopOperation operation = new ControlLoopOperation(); - - assertEquals(operation, operation); - assertNotEquals(operation, new String()); - assertNotEquals(operation, null); - - assertTrue(operation.hashCode() != 0); - assertTrue(operation.toString().startsWith("ControlLoopOperation")); - - assertNotNull(operation); - - operation.setActor("actor"); - assertEquals("actor", operation.getActor()); - - operation.setOperation("operation"); - assertEquals("operation", operation.getOperation()); - - Instant now = Instant.now(); - operation.setStart(now); - assertEquals(now, operation.getStart()); - operation.setEnd(now); - assertEquals(now, operation.getEnd()); - - operation.setMessage("message"); - assertEquals("message", operation.getMessage()); - - operation.setOutcome("outcome"); - assertEquals("outcome", operation.getOutcome()); - - operation.setSubRequestId("1"); - assertEquals("1", operation.getSubRequestId()); - - operation.setTarget("target"); - assertEquals("target", operation.getTarget()); - - assertTrue(operation.hashCode() != 0); - - ControlLoopOperation operation2 = new ControlLoopOperation(operation); - assertEquals(now, operation2.getEnd()); - - assertEquals(operation, operation2); - - operation2.setActor("foo"); - assertNotEquals(operation, operation2); - - operation = new ControlLoopOperation(null); - assertNotNull(operation.getStart()); - - assertNotEquals(operation, operation2); - - assertTrue(operation.toMessage().startsWith("actor=")); - assertTrue(operation.toHistory().startsWith("actor=")); - - } -} diff --git a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopOperationWrapperTest.java b/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopOperationWrapperTest.java deleted file mode 100644 index 8d25c8eac..000000000 --- a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopOperationWrapperTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2018 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.controlloop; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import java.util.UUID; -import org.junit.Test; - -public class ControlLoopOperationWrapperTest { - - @Test - public void test() { - ControlLoopOperationWrapper wrapper = new ControlLoopOperationWrapper(); - - assertNotNull(wrapper); - - ControlLoopOperation operation = new ControlLoopOperation(); - wrapper.setOperation(operation); - UUID id = UUID.randomUUID(); - wrapper.setRequestId(id); - - ControlLoopOperationWrapper wrapper2 = new ControlLoopOperationWrapper(wrapper.getRequestId(), - wrapper.getOperation()); - - assertEquals(operation, wrapper2.getOperation()); - assertEquals(id, wrapper2.getRequestId()); - - - } -} diff --git a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopResponseTest.java b/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopResponseTest.java deleted file mode 100644 index 3bab0aef4..000000000 --- a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopResponseTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2019 Wipro Limited 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.controlloop; - -import static org.junit.Assert.assertEquals; - -import java.util.UUID; -import org.junit.Test; - -public class ControlLoopResponseTest { - - @Test - public void test() { - ControlLoopResponse rsp = new ControlLoopResponse(); - - assertEquals("1.0.0", rsp.getVersion()); - - rsp = new ControlLoopResponse(null); - assertEquals("1.0.0", rsp.getVersion()); - - rsp.setClosedLoopControlName("name"); - assertEquals("name", rsp.getClosedLoopControlName()); - - rsp.setFrom("from"); - assertEquals("from", rsp.getFrom()); - - rsp.setPayload("payload"); - assertEquals("payload", rsp.getPayload()); - - rsp.setPolicyName("policyname"); - assertEquals("policyname", rsp.getPolicyName()); - - rsp.setPolicyVersion("1"); - assertEquals("1", rsp.getPolicyVersion()); - - UUID id = UUID.randomUUID(); - rsp.setRequestId(id); - assertEquals(id, rsp.getRequestId()); - - rsp.setTarget("target"); - assertEquals("target", rsp.getTarget()); - - rsp.setVersion("foo"); - assertEquals("foo", rsp.getVersion()); - - } -} diff --git a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopTargetTypeTest.java b/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopTargetTypeTest.java deleted file mode 100644 index 1afd1f674..000000000 --- a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/ControlLoopTargetTypeTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2018 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.controlloop; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -import org.junit.Test; - -public class ControlLoopTargetTypeTest { - - @Test - public void test() { - assertEquals(ControlLoopTargetType.VM, ControlLoopTargetType.toType("VM")); - assertEquals(ControlLoopTargetType.VF, ControlLoopTargetType.toType("VF")); - assertEquals(ControlLoopTargetType.VFC, ControlLoopTargetType.toType("VFC")); - assertEquals(ControlLoopTargetType.VNF, ControlLoopTargetType.toType("VNF")); - - assertNull(ControlLoopTargetType.toType("foo")); - } -} diff --git a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/PhysicalControlLoopEventTest.java b/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/PhysicalControlLoopEventTest.java deleted file mode 100644 index b0f08e15b..000000000 --- a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/PhysicalControlLoopEventTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2018 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.controlloop; - -import static org.junit.Assert.assertNotNull; - -import org.junit.Test; - -public class PhysicalControlLoopEventTest { - - @Test - public void test() { - PhysicalControlLoopEvent event = new PhysicalControlLoopEvent(); - assertNotNull(event); - - PhysicalControlLoopEvent event2 = new PhysicalControlLoopEvent(event); - assertNotNull(event2); - } -} diff --git a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/PhysicalControlLoopNotificationTest.java b/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/PhysicalControlLoopNotificationTest.java deleted file mode 100644 index e10707bc1..000000000 --- a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/PhysicalControlLoopNotificationTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2018 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.controlloop; - -import static org.junit.Assert.assertNotNull; - -import org.junit.Test; - -public class PhysicalControlLoopNotificationTest { - - @Test - public void test() { - PhysicalControlLoopNotification notification = new PhysicalControlLoopNotification(); - assertNotNull(notification); - - PhysicalControlLoopNotification notification2 = new PhysicalControlLoopNotification( - new PhysicalControlLoopEvent()); - assertNotNull(notification2); - } -} diff --git a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/VirtualControlLoopEventTest.java b/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/VirtualControlLoopEventTest.java deleted file mode 100644 index 49837d191..000000000 --- a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/VirtualControlLoopEventTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2018 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.controlloop; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - -import java.time.Instant; -import org.junit.Test; - -public class VirtualControlLoopEventTest { - - @Test - public void test() { - VirtualControlLoopEvent event = new VirtualControlLoopEvent(); - - assertNotNull(event); - assertNotNull(event.getAai()); - - Instant now = Instant.now(); - event.setClosedLoopAlarmStart(now); - event.setClosedLoopAlarmEnd(now); - - VirtualControlLoopEvent event2 = new VirtualControlLoopEvent(event); - assertEquals(now, event2.getClosedLoopAlarmStart()); - - event = new VirtualControlLoopEvent(null); - assertNull(event.getClosedLoopAlarmStart()); - } -} diff --git a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/VirtualControlLoopNotificationTest.java b/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/VirtualControlLoopNotificationTest.java deleted file mode 100644 index 9adfebea2..000000000 --- a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/VirtualControlLoopNotificationTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2018 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.controlloop; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.time.Instant; -import java.util.Collections; -import org.junit.Test; - -public class VirtualControlLoopNotificationTest { - - @Test - public void test() { - VirtualControlLoopNotification notification = new VirtualControlLoopNotification(); - assertNotNull(notification); - - notification.setAai(Collections.emptyMap()); - assertTrue(notification.getAai().isEmpty()); - - Instant now = Instant.now(); - notification.setClosedLoopAlarmStart(now); - - notification.setClosedLoopAlarmEnd(now); - - VirtualControlLoopEvent event = new VirtualControlLoopEvent(); - - Instant later = Instant.now(); - event.setAai(Collections.emptyMap()); - event.setClosedLoopAlarmStart(later); - event.setClosedLoopAlarmEnd(later); - - notification = new VirtualControlLoopNotification(event); - assertEquals(later, notification.getClosedLoopAlarmStart()); - assertEquals(later, notification.getClosedLoopAlarmEnd()); - - } -} diff --git a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/params/ControlLoopParamsTest.java b/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/params/ControlLoopParamsTest.java deleted file mode 100644 index 065345a1a..000000000 --- a/controlloop/common/model-impl/events/src/test/java/org/onap/policy/controlloop/params/ControlLoopParamsTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * controlloop - * ================================================================================ - * Copyright (C) 2018 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.controlloop.params; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; - -public class ControlLoopParamsTest { - - @Test - public void test() { - ControlLoopParams params = new ControlLoopParams(); - assertNotNull(params); - - params.setClosedLoopControlName("name"); - params.setControlLoopYaml("yaml"); - params.setPolicyName("name"); - params.setPolicyScope("scope"); - params.setPolicyVersion("1"); - - ControlLoopParams params2 = new ControlLoopParams(params); - - assertTrue(params2.getClosedLoopControlName().equals("name")); - assertTrue(params2.getControlLoopYaml().equals("yaml")); - assertTrue(params2.getPolicyName().equals("name")); - assertTrue(params2.getPolicyScope().equals("scope")); - assertTrue(params2.getPolicyVersion().equals("1")); - - } -} |