diff options
Diffstat (limited to 'model')
9 files changed, 191 insertions, 60 deletions
diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxToscaPolicyProcessingStatus.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxToscaPolicyProcessingStatus.java new file mode 100644 index 000000000..43c7e7866 --- /dev/null +++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxToscaPolicyProcessingStatus.java @@ -0,0 +1,46 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2022 Bell Canada. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.apex.model.basicmodel.concepts; + +/** + * This enumeration indicates the status of TOSCA policy processing on an APEX event. + */ +public enum AxToscaPolicyProcessingStatus { + + /** Indicates the entrypoint for the processing of a TOSCA Policy. */ + ENTRY(0), + + /** Indicates a successful exit point for a TOSCA Policy. */ + EXIT_SUCCESS(1), + + /** Indicates a failure exit point for a TOSCA Policy. */ + EXIT_FAILURE(2); + + private final int statusCode; + + AxToscaPolicyProcessingStatus(int statusCode) { + this.statusCode = statusCode; + } + + public int getStatusCode() { + return statusCode; + } +}
\ No newline at end of file diff --git a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvent.java b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvent.java index 156b733ef..e3663e702 100644 --- a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvent.java +++ b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvent.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2019-2020 Nordix Foundation. + * Modifications Copyright (C) 2022 Bell Canada. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +22,8 @@ package org.onap.policy.apex.model.eventmodel.concepts; +import com.google.common.base.Strings; +import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.Map.Entry; @@ -40,9 +43,11 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; +import org.apache.commons.lang3.EnumUtils; import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; import org.onap.policy.apex.model.basicmodel.concepts.AxConcept; import org.onap.policy.apex.model.basicmodel.concepts.AxKey; +import org.onap.policy.apex.model.basicmodel.concepts.AxToscaPolicyProcessingStatus; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationMessage; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult; @@ -50,7 +55,7 @@ import org.onap.policy.common.utils.validation.Assertions; /** * This class defines an Apex event. An {@link AxEvent} is used to kick off execution of policies in Apex and is emitted - * by policies when they completer execution. In addition, Apex uses {@link AxEvent} instances internally to pass + * by policies when they complete execution. In addition, Apex uses {@link AxEvent} instances internally to pass * control from one Apex state to the next during execution. * * <p>The {@link AxArtifactKey} of an event uniquely identifies it in an Apex system and the name field in the key is @@ -76,7 +81,7 @@ import org.onap.policy.common.utils.validation.Assertions; @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "apexEvent", namespace = "http://www.onap.org/policy/apex-pdp") @XmlType(name = "AxEvent", namespace = "http://www.onap.org/policy/apex-pdp", propOrder = - { "key", "nameSpace", "source", "target", "parameterMap" }) + { "key", "nameSpace", "source", "target", "parameterMap", "toscaPolicyState"}) public class AxEvent extends AxConcept { private static final long serialVersionUID = -1460388382582984269L; @@ -106,6 +111,10 @@ public class AxEvent extends AxConcept { @XmlElement(name = "parameter", required = true) private Map<String, AxField> parameterMap; + @Column(name = "toscaPolicyState") + @XmlElement(required = false) + private String toscaPolicyState; + /** * The default constructor creates an event with a null artifact key. The event name space, source, and target are * all defined as empty strings and the parameter map is initialized as an empty map. @@ -130,7 +139,7 @@ public class AxEvent extends AxConcept { * @param key the key of the event */ public AxEvent(final AxArtifactKey key) { - this(key, "", "", "", new TreeMap<>()); + this(key, "", "", "", new TreeMap<>(), ""); } /** @@ -141,7 +150,7 @@ public class AxEvent extends AxConcept { * @param nameSpace the name space of the event */ public AxEvent(final AxArtifactKey key, final String nameSpace) { - this(key, nameSpace, "", "", new TreeMap<>()); + this(key, nameSpace, "", "", new TreeMap<>(), ""); } /** @@ -154,7 +163,7 @@ public class AxEvent extends AxConcept { * @param target the target of the event */ public AxEvent(final AxArtifactKey key, final String nameSpace, final String source, final String target) { - this(key, nameSpace, source, target, new TreeMap<>()); + this(key, nameSpace, source, target, new TreeMap<>(), ""); } /** @@ -165,9 +174,10 @@ public class AxEvent extends AxConcept { * @param source the source of the event * @param target the target of the event * @param parameterMap the map of parameters that the event has + * @param toscaPolicyState the TOSCA policy processing status that event is flagged with */ public AxEvent(final AxArtifactKey key, final String nameSpace, final String source, final String target, - final SortedMap<String, AxField> parameterMap) { + final SortedMap<String, AxField> parameterMap, final String toscaPolicyState) { super(); Assertions.argumentNotNull(key, "key may not be null"); Assertions.argumentNotNull(nameSpace, "nameSpace may not be null"); @@ -180,6 +190,7 @@ public class AxEvent extends AxConcept { this.source = source; this.target = target; this.parameterMap = parameterMap; + this.toscaPolicyState = toscaPolicyState; } /** @@ -327,6 +338,24 @@ public class AxEvent extends AxConcept { } /** + * Gets the TOSCA policy processing status from the event. + * + * @return the TOSCA policy processing status + */ + public String getToscaPolicyState() { + return toscaPolicyState; + } + + /** + * Sets the TOSCA policy processing status on the event. + * + * @param toscaPolicyState the TOSCA policy processing status + */ + public void setToscaPolicyState(String toscaPolicyState) { + this.toscaPolicyState = toscaPolicyState; + } + + /** * {@inheritDoc}. */ @Override @@ -363,10 +392,17 @@ public class AxEvent extends AxConcept { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, "value on parameter " + eventParameterEntry.getKey() + " may not be null")); } else { - result = vaidateEventParameters(eventParameterEntry, result); + result = validateEventParameters(eventParameterEntry, result); } } + if (!Strings.isNullOrEmpty(toscaPolicyState) + && !EnumUtils.isValidEnum(AxToscaPolicyProcessingStatus.class, toscaPolicyState)) { + result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, + "toscaPolicyState on event is not a valid enum. Valid values are: " + + Arrays.asList(AxToscaPolicyProcessingStatus.values()))); + } + return result; } @@ -377,7 +413,7 @@ public class AxEvent extends AxConcept { * @param result the validation result to append to * @return The validation result */ - private AxValidationResult vaidateEventParameters(final Entry<String, AxField> eventParameterEntry, + private AxValidationResult validateEventParameters(final Entry<String, AxField> eventParameterEntry, final AxValidationResult result) { if (!eventParameterEntry.getKey().equals(eventParameterEntry.getValue().getKey().getLocalName())) { result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, @@ -424,6 +460,8 @@ public class AxEvent extends AxConcept { builder.append(target); builder.append(",parameter="); builder.append(parameterMap); + builder.append(",toscaPolicyState="); + builder.append(toscaPolicyState); builder.append(")"); return builder.toString(); } @@ -450,6 +488,7 @@ public class AxEvent extends AxConcept { copy.setNameSpace(nameSpace); copy.setSource(source); copy.setTarget(target); + copy.setToscaPolicyState(toscaPolicyState); return copy; } @@ -466,6 +505,7 @@ public class AxEvent extends AxConcept { result = prime * result + source.hashCode(); result = prime * result + target.hashCode(); result = prime * result + parameterMap.hashCode(); + result = prime * result + toscaPolicyState.hashCode(); return result; } @@ -498,6 +538,9 @@ public class AxEvent extends AxConcept { if (!target.equals(other.target)) { return false; } + if (!toscaPolicyState.equals(other.toscaPolicyState)) { + return false; + } return parameterMap.equals(other.parameterMap); } @@ -532,7 +575,10 @@ public class AxEvent extends AxConcept { if (!parameterMap.equals(other.parameterMap)) { return (parameterMap.hashCode() - other.parameterMap.hashCode()); } + if (!toscaPolicyState.equals(other.toscaPolicyState)) { + return toscaPolicyState.compareTo(other.toscaPolicyState); + } return 0; } -} +}
\ No newline at end of file diff --git a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/EventsTest.java b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/EventsTest.java index 21601d770..111d27f70 100644 --- a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/EventsTest.java +++ b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/EventsTest.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2019-2020 Nordix Foundation. + * Modifications Copyright (C) 2022 Bell Canada. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,6 +33,7 @@ import org.junit.Test; import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; import org.onap.policy.apex.model.basicmodel.concepts.AxKey; import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey; +import org.onap.policy.apex.model.basicmodel.concepts.AxToscaPolicyProcessingStatus; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult; @@ -51,7 +53,7 @@ public class EventsTest { assertNotNull(new AxEvent(new AxArtifactKey(), "namespace")); assertNotNull(new AxEvent(new AxArtifactKey(), "namespace", "source", "target")); assertNotNull(new AxEvent(new AxArtifactKey(), "namespace", "source", "target")); - assertNotNull(new AxEvent(new AxArtifactKey(), "namespace", "source", "target", parameterMap)); + assertNotNull(new AxEvent(new AxArtifactKey(), "namespace", "source", "target", parameterMap, "")); final AxEvent event = new AxEvent(); @@ -72,6 +74,9 @@ public class EventsTest { event.setParameterMap(parameterMap); assertEquals(0, event.getParameterMap().size()); + event.setToscaPolicyState(AxToscaPolicyProcessingStatus.ENTRY.name()); + assertEquals(AxToscaPolicyProcessingStatus.ENTRY.name(), event.getToscaPolicyState()); + final AxField eventField = new AxField(new AxReferenceKey(eventKey, "Field0"), new AxArtifactKey("Field0Schema", "0.0.1")); event.getParameterMap().put(eventField.getKey().getLocalName(), eventField); @@ -178,6 +183,12 @@ public class EventsTest { result = event.validate(result); assertEquals(ValidationResult.VALID, result.getValidationResult()); + event.setToscaPolicyState("invalid_enum"); + result = new AxValidationResult(); + result = event.validate(result); + assertEquals(ValidationResult.INVALID, result.getValidationResult()); + event.setToscaPolicyState(AxToscaPolicyProcessingStatus.ENTRY.name()); + event.clean(); event.afterUnmarshal(null, null); @@ -192,25 +203,36 @@ public class EventsTest { assertEquals(event, clonedEvent); assertNotNull(event); assertNotEquals(event, (Object) "Hello"); - assertNotEquals( - event, new AxEvent(AxArtifactKey.getNullKey(), "namespace", "source", "target", parameterMap)); - assertNotEquals(event, new AxEvent(eventKey, "namespace1", "source", "target", parameterMap)); - assertNotEquals(event, new AxEvent(eventKey, "namespace", "source2", "target", parameterMap)); - assertNotEquals(event, new AxEvent(eventKey, "namespace", "source", "target3", parameterMap)); - assertNotEquals(event, new AxEvent(eventKey, "namespace", "source", "target", parameterMapEmpty)); - assertEquals(event, new AxEvent(eventKey, "namespace", "source", "target", parameterMap)); + assertNotEquals(event, new AxEvent(AxArtifactKey.getNullKey(), "namespace", "source", "target", parameterMap, + AxToscaPolicyProcessingStatus.ENTRY.name())); + assertNotEquals(event, new AxEvent(eventKey, "namespace1", "source", "target", parameterMap, + AxToscaPolicyProcessingStatus.ENTRY.name())); + assertNotEquals(event, new AxEvent(eventKey, "namespace", "source2", "target", parameterMap, + AxToscaPolicyProcessingStatus.ENTRY.name())); + assertNotEquals(event, new AxEvent(eventKey, "namespace", "source", "target3", parameterMap, + AxToscaPolicyProcessingStatus.ENTRY.name())); + assertNotEquals(event, new AxEvent(eventKey, "namespace", "source", "target", parameterMapEmpty, + AxToscaPolicyProcessingStatus.ENTRY.name())); + assertEquals(event, new AxEvent(eventKey, "namespace", "source", "target", parameterMap, + AxToscaPolicyProcessingStatus.ENTRY.name())); assertEquals(0, event.compareTo(event)); assertEquals(0, event.compareTo(clonedEvent)); assertNotEquals(0, event.compareTo(new AxArtifactKey())); assertNotEquals(0, event.compareTo(null)); assertNotEquals(0, event - .compareTo(new AxEvent(AxArtifactKey.getNullKey(), "namespace", "source", "target", parameterMap))); - assertNotEquals(0, event.compareTo(new AxEvent(eventKey, "namespace1", "source", "target", parameterMap))); - assertNotEquals(0, event.compareTo(new AxEvent(eventKey, "namespace", "source2", "target", parameterMap))); - assertNotEquals(0, event.compareTo(new AxEvent(eventKey, "namespace", "source", "target3", parameterMap))); - assertNotEquals(0, event.compareTo(new AxEvent(eventKey, "namespace", "source", "target", parameterMapEmpty))); - assertEquals(0, event.compareTo(new AxEvent(eventKey, "namespace", "source", "target", parameterMap))); + .compareTo(new AxEvent(AxArtifactKey.getNullKey(), "namespace", "source", "target", parameterMap, + AxToscaPolicyProcessingStatus.ENTRY.name()))); + assertNotEquals(0, event.compareTo(new AxEvent(eventKey, "namespace1", "source", "target", parameterMap, + AxToscaPolicyProcessingStatus.ENTRY.name()))); + assertNotEquals(0, event.compareTo(new AxEvent(eventKey, "namespace", "source2", "target", parameterMap, + AxToscaPolicyProcessingStatus.ENTRY.name()))); + assertNotEquals(0, event.compareTo(new AxEvent(eventKey, "namespace", "source", "target3", parameterMap, + AxToscaPolicyProcessingStatus.ENTRY.name()))); + assertNotEquals(0, event.compareTo(new AxEvent(eventKey, "namespace", "source", "target", parameterMapEmpty, + AxToscaPolicyProcessingStatus.ENTRY.name()))); + assertEquals(0, event.compareTo(new AxEvent(eventKey, "namespace", "source", "target", parameterMap, + AxToscaPolicyProcessingStatus.ENTRY.name()))); assertNotNull(event.getKeys()); @@ -292,4 +314,4 @@ public class EventsTest { assertEquals(1, events.getAll("EventName", "0.0.1").size()); assertEquals(0, events.getAll("NonExistantEventsName").size()); } -} +}
\ No newline at end of file diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/ApexEditorApi.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/ApexEditorApi.java index fab6ba163..8974d1fa8 100644 --- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/ApexEditorApi.java +++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/ApexEditorApi.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. + * Modifications Copyright (C) 2021-2022 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -205,10 +205,11 @@ public interface ApexEditorApi { * @param target of the event, set to null to use the default value * @param uuid event UUID, set to null to generate a UUID * @param description event description, set to null to generate a description + * @param toscaPolicyState specifies TOSCA policy processing status * @return result of the operation */ ApexApiResult createEvent(final String name, final String version, final String nameSpace, final String source, - final String target, final String uuid, final String description); + final String target, final String uuid, final String description, final String toscaPolicyState); /** * Update an event. @@ -220,10 +221,11 @@ public interface ApexEditorApi { * @param target of the event, set to null to not update * @param uuid event UUID, set to null to not update * @param description event description, set to null to not update + * @param toscaPolicyState specifies TOSCA policy processing status * @return result of the operation */ ApexApiResult updateEvent(final String name, final String version, final String nameSpace, final String source, - final String target, final String uuid, final String description); + final String target, final String uuid, final String description, final String toscaPolicyState); /** * List events. @@ -900,4 +902,4 @@ public interface ApexEditorApi { */ ApexApiResult deletePolicyStateContextRef(final String name, final String version, final String stateName, final String contextAlbumName, final String contextAlbumVersion); -} +}
\ No newline at end of file diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ApexModelImpl.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ApexModelImpl.java index 05976c6ed..cca9d3454 100644 --- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ApexModelImpl.java +++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ApexModelImpl.java @@ -3,7 +3,7 @@ * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2019 Samsung Electronics Co., Ltd. * Modifications Copyright (C) 2019 Nordix Foundation. - * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. + * Modifications Copyright (C) 2022 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -251,8 +251,9 @@ public final class ApexModelImpl implements ApexModel { */ @Override public ApexApiResult createEvent(final String name, final String version, final String nameSpace, - final String source, final String target, final String uuid, final String description) { - return eventFacade.createEvent(name, version, nameSpace, source, target, uuid, description); + final String source, final String target, final String uuid, final String description, + final String toscaPolicyState) { + return eventFacade.createEvent(name, version, nameSpace, source, target, uuid, description, toscaPolicyState); } /** @@ -260,8 +261,9 @@ public final class ApexModelImpl implements ApexModel { */ @Override public ApexApiResult updateEvent(final String name, final String version, final String nameSpace, - final String source, final String target, final String uuid, final String description) { - return eventFacade.updateEvent(name, version, nameSpace, source, target, uuid, description); + final String source, final String target, final String uuid, final String description, + final String toscaPolicyState) { + return eventFacade.updateEvent(name, version, nameSpace, source, target, uuid, description, toscaPolicyState); } /** @@ -892,4 +894,4 @@ public final class ApexModelImpl implements ApexModel { return policyModel; } -} +}
\ No newline at end of file diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/EventFacade.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/EventFacade.java index 0a758407b..f1f939397 100644 --- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/EventFacade.java +++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/EventFacade.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2022 Bell Canada. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -85,10 +86,12 @@ public class EventFacade { * @param target of the event, set to null to use the default value * @param uuid event UUID, set to null to generate a UUID * @param description event description, set to null to generate a description + * @param toscaPolicyState specifies TOSCA policy processing status * @return result of the operation */ public ApexApiResult createEvent(final String name, final String version, final String nameSpace, - final String source, final String target, final String uuid, final String description) { + final String source, final String target, final String uuid, final String description, + final String toscaPolicyState) { try { final AxArtifactKey key = new AxArtifactKey(); key.setName(name); @@ -107,6 +110,9 @@ public class EventFacade { event.setNameSpace((nameSpace != null ? nameSpace : apexProperties.getProperty("DEFAULT_EVENT_NAMESPACE"))); event.setSource((source != null ? source : apexProperties.getProperty("DEFAULT_EVENT_SOURCE"))); event.setTarget((target != null ? target : apexProperties.getProperty("DEFAULT_EVENT_TARGET"))); + if (toscaPolicyState != null) { + event.setToscaPolicyState(toscaPolicyState); + } apexModel.getPolicyModel().getEvents().getEventMap().put(key, event); @@ -130,10 +136,12 @@ public class EventFacade { * @param target of the event, set to null to not update * @param uuid event UUID, set to null to not update * @param description event description, set to null to not update + * @param toscaPolicyState specifies TOSCA policy processing status * @return result of the operation */ public ApexApiResult updateEvent(final String name, final String version, final String nameSpace, - final String source, final String target, final String uuid, final String description) { + final String source, final String target, final String uuid, final String description, + final String toscaPolicyState) { try { final AxEvent event = apexModel.getPolicyModel().getEvents().get(name, version); if (event == null) { @@ -150,6 +158,9 @@ public class EventFacade { if (target != null) { event.setTarget(target); } + if (toscaPolicyState != null) { + event.setToscaPolicyState(toscaPolicyState); + } return keyInformationFacade.updateKeyInformation(name, version, uuid, description); } catch (final Exception e) { @@ -382,4 +393,4 @@ public class EventFacade { return new ApexApiResult(ApexApiResult.Result.FAILED, e); } } -} +}
\ No newline at end of file diff --git a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiEventTest.java b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiEventTest.java index bc46ee3d3..775fcc1d3 100644 --- a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiEventTest.java +++ b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiEventTest.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2022 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,29 +45,29 @@ public class ApexEditorApiEventTest { assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createEvent("MyEvent002", "0.0.2", "My Namespace", "My Source", "my target", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002", null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createEvent("MyEvent012", "0.1.2", "My Namespace", "My Source", "my target", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 012"); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 012", null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createEvent("MyEvent012", "0.1.4", "My Namespace", "My Source", "my target", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 014"); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 014", null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - result = apexModel.createEvent("MyEvent012", null, null, null, null, null, null); + result = apexModel.createEvent("MyEvent012", null, null, null, null, null, null, null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - result = apexModel.createEvent("MyEvent012", null, null, null, null, null, null); + result = apexModel.createEvent("MyEvent012", null, null, null, null, null, null, null); assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); result = apexModel.createEvent("MyEvent002", "0.0.2", "My Namespace", "My Source", "my target", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002", null); assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); result = apexModel.createEvent("@£$%^", "0.2.5", "My Namespace", "My Source", "my target", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002", null); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.deleteEvent("MyEvent012", "0.1.4"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createEvent("MyEvent012", "0.1.4", "My Namespace", "My Source", "my target", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 014"); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 014", null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.validateEvent(null, null); @@ -74,18 +75,19 @@ public class ApexEditorApiEventTest { result = apexModel.updateContextSchema(null, null, null, null, null, null); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); - result = apexModel.updateEvent("MyEvent012", "0.1.2", "Another Namespace", null, "Another target", null, null); + result = apexModel.updateEvent("MyEvent012", "0.1.2", "Another Namespace", null, "Another target", null, null, + null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.updateEvent("MyEvent002", "0.0.2", "My Namespace", "My Source", "my target", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002", null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - result = apexModel.updateEvent("MyEvent012", null, null, null, null, null, null); + result = apexModel.updateEvent("MyEvent012", null, null, null, null, null, null, null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - result = apexModel.updateEvent("MyEvent015", null, null, null, null, null, null); + result = apexModel.updateEvent("MyEvent015", null, null, null, null, null, null, null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); - result = apexModel.updateEvent("MyEvent014", "0.1.5", null, null, null, null, null); + result = apexModel.updateEvent("MyEvent014", "0.1.5", null, null, null, null, null, null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); - result = apexModel.updateEvent("@£$%^^", "0.6.9", null, null, null, null, null); + result = apexModel.updateEvent("@£$%^^", "0.6.9", null, null, null, null, null, null); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.listEvent("@£$%", null); @@ -194,4 +196,4 @@ public class ApexEditorApiEventTest { assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); assertEquals(0, result.getMessages().size()); } -} +}
\ No newline at end of file diff --git a/model/policy-model/src/test/resources/checkFiles/PolicyModelComparisonDifferentVerboseValues.txt b/model/policy-model/src/test/resources/checkFiles/PolicyModelComparisonDifferentVerboseValues.txt index 2138e97f0..77d17f679 100644 --- a/model/policy-model/src/test/resources/checkFiles/PolicyModelComparisonDifferentVerboseValues.txt +++ b/model/policy-model/src/test/resources/checkFiles/PolicyModelComparisonDifferentVerboseValues.txt @@ -16,9 +16,9 @@ left key AxArtifactKey:(name=PolicyModel,version=0.0.1) equals right key AxArtif *** all right keys in left *** all values in left and right are identical *** list of identical entries in left and right -key=AxArtifactKey:(name=inEvent,version=0.0.1),value=AxEvent:(key=AxArtifactKey:(name=inEvent,version=0.0.1),nameSpace=org.onap.policy.apex.model.policymodel.events,source=Source,target=Target,parameter={IEPAR0=AxField:(key=AxReferenceKey:(parentKeyName=inEvent,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=IEPAR0),fieldSchemaKey=AxArtifactKey:(name=eventContextItem0,version=0.0.1),optional=false), IEPAR1=AxField:(key=AxReferenceKey:(parentKeyName=inEvent,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=IEPAR1),fieldSchemaKey=AxArtifactKey:(name=eventContextItem1,version=0.0.1),optional=false)}) -key=AxArtifactKey:(name=outEvent0,version=0.0.1),value=AxEvent:(key=AxArtifactKey:(name=outEvent0,version=0.0.1),nameSpace=org.onap.policy.apex.model.policymodel.events,source=Source,target=Target,parameter={OE0PAR0=AxField:(key=AxReferenceKey:(parentKeyName=outEvent0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=OE0PAR0),fieldSchemaKey=AxArtifactKey:(name=eventContextItem0,version=0.0.1),optional=false), OE0PAR1=AxField:(key=AxReferenceKey:(parentKeyName=outEvent0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=OE0PAR1),fieldSchemaKey=AxArtifactKey:(name=eventContextItem1,version=0.0.1),optional=false), OE1PAR0=AxField:(key=AxReferenceKey:(parentKeyName=outEvent0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=OE1PAR0),fieldSchemaKey=AxArtifactKey:(name=eventContextItem0,version=0.0.1),optional=false), OE1PAR1=AxField:(key=AxReferenceKey:(parentKeyName=outEvent0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=OE1PAR1),fieldSchemaKey=AxArtifactKey:(name=eventContextItem1,version=0.0.1),optional=false)}) -key=AxArtifactKey:(name=outEvent1,version=0.0.1),value=AxEvent:(key=AxArtifactKey:(name=outEvent1,version=0.0.1),nameSpace=org.onap.policy.apex.model.policymodel.events,source=Source,target=Target,parameter={OE1PAR0=AxField:(key=AxReferenceKey:(parentKeyName=outEvent1,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=OE1PAR0),fieldSchemaKey=AxArtifactKey:(name=eventContextItem0,version=0.0.1),optional=false), OE1PAR1=AxField:(key=AxReferenceKey:(parentKeyName=outEvent1,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=OE1PAR1),fieldSchemaKey=AxArtifactKey:(name=eventContextItem1,version=0.0.1),optional=false)}) +key=AxArtifactKey:(name=inEvent,version=0.0.1),value=AxEvent:(key=AxArtifactKey:(name=inEvent,version=0.0.1),nameSpace=org.onap.policy.apex.model.policymodel.events,source=Source,target=Target,parameter={IEPAR0=AxField:(key=AxReferenceKey:(parentKeyName=inEvent,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=IEPAR0),fieldSchemaKey=AxArtifactKey:(name=eventContextItem0,version=0.0.1),optional=false), IEPAR1=AxField:(key=AxReferenceKey:(parentKeyName=inEvent,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=IEPAR1),fieldSchemaKey=AxArtifactKey:(name=eventContextItem1,version=0.0.1),optional=false)},toscaPolicyState=) +key=AxArtifactKey:(name=outEvent0,version=0.0.1),value=AxEvent:(key=AxArtifactKey:(name=outEvent0,version=0.0.1),nameSpace=org.onap.policy.apex.model.policymodel.events,source=Source,target=Target,parameter={OE0PAR0=AxField:(key=AxReferenceKey:(parentKeyName=outEvent0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=OE0PAR0),fieldSchemaKey=AxArtifactKey:(name=eventContextItem0,version=0.0.1),optional=false), OE0PAR1=AxField:(key=AxReferenceKey:(parentKeyName=outEvent0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=OE0PAR1),fieldSchemaKey=AxArtifactKey:(name=eventContextItem1,version=0.0.1),optional=false), OE1PAR0=AxField:(key=AxReferenceKey:(parentKeyName=outEvent0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=OE1PAR0),fieldSchemaKey=AxArtifactKey:(name=eventContextItem0,version=0.0.1),optional=false), OE1PAR1=AxField:(key=AxReferenceKey:(parentKeyName=outEvent0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=OE1PAR1),fieldSchemaKey=AxArtifactKey:(name=eventContextItem1,version=0.0.1),optional=false)},toscaPolicyState=) +key=AxArtifactKey:(name=outEvent1,version=0.0.1),value=AxEvent:(key=AxArtifactKey:(name=outEvent1,version=0.0.1),nameSpace=org.onap.policy.apex.model.policymodel.events,source=Source,target=Target,parameter={OE1PAR0=AxField:(key=AxReferenceKey:(parentKeyName=outEvent1,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=OE1PAR0),fieldSchemaKey=AxArtifactKey:(name=eventContextItem0,version=0.0.1),optional=false), OE1PAR1=AxField:(key=AxReferenceKey:(parentKeyName=outEvent1,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=OE1PAR1),fieldSchemaKey=AxArtifactKey:(name=eventContextItem1,version=0.0.1),optional=false)},toscaPolicyState=) *** context album differences *** left key AxArtifactKey:(name=PolicyModel,version=0.0.1) equals right key AxArtifactKey:(name=PolicyModel,version=0.0.1) *** all left keys in right @@ -67,4 +67,4 @@ key=AxArtifactKey:(name=policies,version=0.0.1),value=AxKeyInfo:(artifactId=AxAr key=AxArtifactKey:(name=policy,version=0.0.1),value=AxKeyInfo:(artifactId=AxArtifactKey:(name=policy,version=0.0.1),uuid=0ce9168c-e6df-414f-9646-6da464b6e015,description=Generated description for concept referred to by key "policy:0.0.1") key=AxArtifactKey:(name=task,version=0.0.1),value=AxKeyInfo:(artifactId=AxArtifactKey:(name=task,version=0.0.1),uuid=0ce9168c-e6df-414f-9646-6da464b6e016,description=Generated description for concept referred to by key "task:0.0.1") key=AxArtifactKey:(name=tasks,version=0.0.1),value=AxKeyInfo:(artifactId=AxArtifactKey:(name=tasks,version=0.0.1),uuid=0ce9168c-e6df-414f-9646-6da464b6e017,description=Generated description for concept referred to by key "tasks:0.0.1") -*********************************** +***********************************
\ No newline at end of file diff --git a/model/policy-model/src/test/resources/checkFiles/PolicyModelComparisonIdenticalVerboseValues.txt b/model/policy-model/src/test/resources/checkFiles/PolicyModelComparisonIdenticalVerboseValues.txt index 0faab1cdb..4e07c5360 100644 --- a/model/policy-model/src/test/resources/checkFiles/PolicyModelComparisonIdenticalVerboseValues.txt +++ b/model/policy-model/src/test/resources/checkFiles/PolicyModelComparisonIdenticalVerboseValues.txt @@ -16,9 +16,9 @@ left key AxArtifactKey:(name=PolicyModel,version=0.0.1) equals right key AxArtif *** all right keys in left *** all values in left and right are identical *** list of identical entries in left and right -key=AxArtifactKey:(name=inEvent,version=0.0.1),value=AxEvent:(key=AxArtifactKey:(name=inEvent,version=0.0.1),nameSpace=org.onap.policy.apex.model.policymodel.events,source=Source,target=Target,parameter={IEPAR0=AxField:(key=AxReferenceKey:(parentKeyName=inEvent,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=IEPAR0),fieldSchemaKey=AxArtifactKey:(name=eventContextItem0,version=0.0.1),optional=false), IEPAR1=AxField:(key=AxReferenceKey:(parentKeyName=inEvent,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=IEPAR1),fieldSchemaKey=AxArtifactKey:(name=eventContextItem1,version=0.0.1),optional=false)}) -key=AxArtifactKey:(name=outEvent0,version=0.0.1),value=AxEvent:(key=AxArtifactKey:(name=outEvent0,version=0.0.1),nameSpace=org.onap.policy.apex.model.policymodel.events,source=Source,target=Target,parameter={OE0PAR0=AxField:(key=AxReferenceKey:(parentKeyName=outEvent0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=OE0PAR0),fieldSchemaKey=AxArtifactKey:(name=eventContextItem0,version=0.0.1),optional=false), OE0PAR1=AxField:(key=AxReferenceKey:(parentKeyName=outEvent0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=OE0PAR1),fieldSchemaKey=AxArtifactKey:(name=eventContextItem1,version=0.0.1),optional=false), OE1PAR0=AxField:(key=AxReferenceKey:(parentKeyName=outEvent0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=OE1PAR0),fieldSchemaKey=AxArtifactKey:(name=eventContextItem0,version=0.0.1),optional=false), OE1PAR1=AxField:(key=AxReferenceKey:(parentKeyName=outEvent0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=OE1PAR1),fieldSchemaKey=AxArtifactKey:(name=eventContextItem1,version=0.0.1),optional=false)}) -key=AxArtifactKey:(name=outEvent1,version=0.0.1),value=AxEvent:(key=AxArtifactKey:(name=outEvent1,version=0.0.1),nameSpace=org.onap.policy.apex.model.policymodel.events,source=Source,target=Target,parameter={OE1PAR0=AxField:(key=AxReferenceKey:(parentKeyName=outEvent1,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=OE1PAR0),fieldSchemaKey=AxArtifactKey:(name=eventContextItem0,version=0.0.1),optional=false), OE1PAR1=AxField:(key=AxReferenceKey:(parentKeyName=outEvent1,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=OE1PAR1),fieldSchemaKey=AxArtifactKey:(name=eventContextItem1,version=0.0.1),optional=false)}) +key=AxArtifactKey:(name=inEvent,version=0.0.1),value=AxEvent:(key=AxArtifactKey:(name=inEvent,version=0.0.1),nameSpace=org.onap.policy.apex.model.policymodel.events,source=Source,target=Target,parameter={IEPAR0=AxField:(key=AxReferenceKey:(parentKeyName=inEvent,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=IEPAR0),fieldSchemaKey=AxArtifactKey:(name=eventContextItem0,version=0.0.1),optional=false), IEPAR1=AxField:(key=AxReferenceKey:(parentKeyName=inEvent,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=IEPAR1),fieldSchemaKey=AxArtifactKey:(name=eventContextItem1,version=0.0.1),optional=false)},toscaPolicyState=) +key=AxArtifactKey:(name=outEvent0,version=0.0.1),value=AxEvent:(key=AxArtifactKey:(name=outEvent0,version=0.0.1),nameSpace=org.onap.policy.apex.model.policymodel.events,source=Source,target=Target,parameter={OE0PAR0=AxField:(key=AxReferenceKey:(parentKeyName=outEvent0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=OE0PAR0),fieldSchemaKey=AxArtifactKey:(name=eventContextItem0,version=0.0.1),optional=false), OE0PAR1=AxField:(key=AxReferenceKey:(parentKeyName=outEvent0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=OE0PAR1),fieldSchemaKey=AxArtifactKey:(name=eventContextItem1,version=0.0.1),optional=false), OE1PAR0=AxField:(key=AxReferenceKey:(parentKeyName=outEvent0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=OE1PAR0),fieldSchemaKey=AxArtifactKey:(name=eventContextItem0,version=0.0.1),optional=false), OE1PAR1=AxField:(key=AxReferenceKey:(parentKeyName=outEvent0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=OE1PAR1),fieldSchemaKey=AxArtifactKey:(name=eventContextItem1,version=0.0.1),optional=false)},toscaPolicyState=) +key=AxArtifactKey:(name=outEvent1,version=0.0.1),value=AxEvent:(key=AxArtifactKey:(name=outEvent1,version=0.0.1),nameSpace=org.onap.policy.apex.model.policymodel.events,source=Source,target=Target,parameter={OE1PAR0=AxField:(key=AxReferenceKey:(parentKeyName=outEvent1,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=OE1PAR0),fieldSchemaKey=AxArtifactKey:(name=eventContextItem0,version=0.0.1),optional=false), OE1PAR1=AxField:(key=AxReferenceKey:(parentKeyName=outEvent1,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=OE1PAR1),fieldSchemaKey=AxArtifactKey:(name=eventContextItem1,version=0.0.1),optional=false)},toscaPolicyState=) *** context album differences *** left key AxArtifactKey:(name=PolicyModel,version=0.0.1) equals right key AxArtifactKey:(name=PolicyModel,version=0.0.1) *** all left keys in right @@ -65,4 +65,4 @@ key=AxArtifactKey:(name=policies,version=0.0.1),value=AxKeyInfo:(artifactId=AxAr key=AxArtifactKey:(name=policy,version=0.0.1),value=AxKeyInfo:(artifactId=AxArtifactKey:(name=policy,version=0.0.1),uuid=0ce9168c-e6df-414f-9646-6da464b6e015,description=Generated description for concept referred to by key "policy:0.0.1") key=AxArtifactKey:(name=task,version=0.0.1),value=AxKeyInfo:(artifactId=AxArtifactKey:(name=task,version=0.0.1),uuid=0ce9168c-e6df-414f-9646-6da464b6e016,description=Generated description for concept referred to by key "task:0.0.1") key=AxArtifactKey:(name=tasks,version=0.0.1),value=AxKeyInfo:(artifactId=AxArtifactKey:(name=tasks,version=0.0.1),uuid=0ce9168c-e6df-414f-9646-6da464b6e017,description=Generated description for concept referred to by key "tasks:0.0.1") -*********************************** +***********************************
\ No newline at end of file |