summaryrefslogtreecommitdiffstats
path: root/model/policy-model
diff options
context:
space:
mode:
Diffstat (limited to 'model/policy-model')
-rw-r--r--model/policy-model/pom.xml27
-rw-r--r--model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxLogic.java42
-rw-r--r--model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicies.java81
-rw-r--r--model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicy.java140
-rw-r--r--model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicyModel.java127
-rw-r--r--model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxState.java129
-rw-r--r--model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateFinalizerLogic.java27
-rw-r--r--model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateOutput.java47
-rw-r--r--model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateTaskOutputType.java14
-rw-r--r--model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateTaskReference.java39
-rw-r--r--model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTask.java74
-rw-r--r--model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTaskLogic.java27
-rw-r--r--model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTaskParameter.java25
-rw-r--r--model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTaskSelectionLogic.java27
-rw-r--r--model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTasks.java74
-rw-r--r--model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/package-info.java17
-rw-r--r--model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/EmptyAlbumsAdapter.java91
-rw-r--r--model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/PoliciesTest.java13
-rw-r--r--model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/StateTest.java10
-rw-r--r--model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TasksTest.java11
-rw-r--r--model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/ApexPolicyModelTest.java111
-rw-r--r--model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelComparerTest.java56
-rw-r--r--model/policy-model/src/test/resources/META-INF/persistence.xml67
-rw-r--r--model/policy-model/src/test/resources/checkFiles/PolicyModelComparisonDifferentTerseKeys.txt3
-rw-r--r--model/policy-model/src/test/resources/checkFiles/PolicyModelComparisonDifferentTerseValues.txt2
-rw-r--r--model/policy-model/src/test/resources/checkFiles/PolicyModelComparisonDifferentVerboseKeys.txt7
-rw-r--r--model/policy-model/src/test/resources/checkFiles/PolicyModelComparisonDifferentVerboseValues.txt16
27 files changed, 308 insertions, 996 deletions
diff --git a/model/policy-model/pom.xml b/model/policy-model/pom.xml
index 3fbf8b1dc..cde0fa83c 100644
--- a/model/policy-model/pom.xml
+++ b/model/policy-model/pom.xml
@@ -1,6 +1,7 @@
<!--
============LICENSE_START=======================================================
Copyright (C) 2018 Ericsson. All rights reserved.
+ Modifications Copyright (C) 2022 Nordix Foundation.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -50,30 +51,4 @@
<scope>test</scope>
</dependency>
</dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>exec-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>generate-xml-schema</id>
- <phase>process-classes</phase>
- <goals>
- <goal>java</goal>
- </goals>
- <configuration>
- <mainClass>org.onap.policy.apex.model.basicmodel.handling.ApexSchemaGenerator</mainClass>
- <classpathScope>compile</classpathScope>
- <arguments>
- <argument>org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel</argument>
- <argument>${project.build.directory}/model/xml/apex-policy-model.xsd</argument>
- </arguments>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
</project>
diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxLogic.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxLogic.java
index 442e54b1f..0564d5854 100644
--- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxLogic.java
+++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxLogic.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019-2020 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2020,2022 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,27 +22,12 @@
package org.onap.policy.apex.model.policymodel.concepts;
import java.util.List;
-import javax.persistence.Column;
-import javax.persistence.Convert;
-import javax.persistence.EmbeddedId;
-import javax.persistence.Entity;
-import javax.persistence.Inheritance;
-import javax.persistence.InheritanceType;
-import javax.persistence.Table;
-import javax.xml.bind.annotation.XmlAccessType;
-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 javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
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.AxReferenceKey;
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;
-import org.onap.policy.apex.model.basicmodel.dao.converters.CDataConditioner;
-import org.onap.policy.apex.model.basicmodel.xml.AxReferenceKeyAdapter;
import org.onap.policy.common.utils.validation.Assertions;
/**
@@ -57,16 +42,6 @@ import org.onap.policy.common.utils.validation.Assertions;
* <p>Validation checks that the logic key is valid, that the logic flavour is defined and is valid when checked against
* the {@code LOGIC_FLAVOUR_REGEXP} regular expression, and that the specified logic string is not null or blank.
*/
-
-@Entity
-@Table(name = "AxLogic")
-@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
-
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlRootElement(name = "apexLogic", namespace = "http://www.onap.org/policy/apex-pdp")
-@XmlType(name = "AxLogic", namespace = "http://www.onap.org/policy/apex-pdp", propOrder =
- { "key", "logicFlavour", "logic" })
-
public class AxLogic extends AxConcept {
private static final long serialVersionUID = -4260562004005697328L;
@@ -86,19 +61,8 @@ public class AxLogic extends AxConcept {
/** The maximum permissible size of a logic definition. */
public static final int MAX_LOGIC_SIZE = 32672; // The maximum size supported by Apache Derby
- @EmbeddedId()
- @XmlElement(name = "key", required = true)
- @XmlJavaTypeAdapter(AxReferenceKeyAdapter.class)
private AxReferenceKey key;
-
- @Column(name = LOGIC_FLAVOUR_TOKEN)
- @XmlElement(required = true)
private String logicFlavour;
-
- @Column(name = "logic", length = MAX_LOGIC_SIZE)
- @Convert(converter = CDataConditioner.class)
- @XmlJavaTypeAdapter(value = CDataConditioner.class)
- @XmlElement(required = true)
private String logic;
/**
@@ -361,9 +325,7 @@ public class AxLogic extends AxConcept {
if (!logicFlavour.equals(other.logicFlavour)) {
return false;
}
- final String thislogic = CDataConditioner.clean(logic).replace("\n", "");
- final String otherlogic = CDataConditioner.clean(other.logic).replace("\n", "");
- return thislogic.equals(otherlogic);
+ return logic.equals(other.logic);
}
/**
diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicies.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicies.java
index 922cc247a..bb30f46cf 100644
--- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicies.java
+++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicies.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019-2020 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2020,2022 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,18 +27,6 @@ import java.util.Map.Entry;
import java.util.NavigableMap;
import java.util.Set;
import java.util.TreeMap;
-import javax.persistence.CascadeType;
-import javax.persistence.EmbeddedId;
-import javax.persistence.Entity;
-import javax.persistence.JoinColumn;
-import javax.persistence.JoinTable;
-import javax.persistence.ManyToMany;
-import javax.persistence.Table;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
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.AxConceptGetter;
@@ -59,30 +47,11 @@ import org.onap.policy.common.utils.validation.Assertions;
* container. Each policy entry is checked to ensure that its key and value are not null and that the key matches the
* key in the map value. Each policy entry is then validated individually.
*/
-@Entity
-@Table(name = "AxPolicies")
-
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "AxPolicies", namespace = "http://www.onap.org/policy/apex-pdp", propOrder =
- { "key", "policyMap" })
-
public class AxPolicies extends AxConcept implements AxConceptGetter<AxPolicy> {
private static final long serialVersionUID = 4290442590545820316L;
- @EmbeddedId
- @XmlElement(name = "key", required = true)
private AxArtifactKey key;
-
- // @formatter:off
- @ManyToMany(cascade = CascadeType.ALL)
- @JoinTable(
- joinColumns = {@JoinColumn(name = "policyMapName", referencedColumnName = "name"),
- @JoinColumn(name = "policyMapVersion", referencedColumnName = "version")},
- inverseJoinColumns = {@JoinColumn(name = "policyName", referencedColumnName = "name"),
- @JoinColumn(name = "policyVersion", referencedColumnName = "version")})
- @XmlElement(required = true)
private Map<AxArtifactKey, AxPolicy> policyMap;
- // @formatter:on
/**
* The Default Constructor creates a {@link AxPolicies} object with a null artifact key and creates an empty event
@@ -114,7 +83,7 @@ public class AxPolicies extends AxConcept implements AxConceptGetter<AxPolicy> {
/**
* This Constructor creates a policy container with all of its fields defined.
*
- * @param key the policy container key
+ * @param key the policy container key
* @param policyMap the policies to be stored in the policy container
*/
public AxPolicies(final AxArtifactKey key, final Map<AxArtifactKey, AxPolicy> policyMap) {
@@ -128,22 +97,6 @@ public class AxPolicies extends AxConcept implements AxConceptGetter<AxPolicy> {
}
/**
- * When a model is unmarshalled from disk or from the database, the policy map is returned as a raw hash map. This
- * method is called by JAXB after unmarshaling and is used to convert the hash map to a {@link NavigableMap} so that
- * it will work with the {@link AxConceptGetter} interface.
- *
- * @param unmarshaler the unmarshaler that is unmarshaling the model
- * @param parent the parent object of this object in the unmarshaler
- */
- public void afterUnmarshal(final Unmarshaller unmarshaler, final Object parent) {
- // The map must be navigable to allow name and version searching, unmarshaling returns a
- // hash map
- final NavigableMap<AxArtifactKey, AxPolicy> navigablePolicyMap = new TreeMap<>();
- navigablePolicyMap.putAll(policyMap);
- policyMap = navigablePolicyMap;
- }
-
- /**
* {@inheritDoc}.
*/
@Override
@@ -166,6 +119,18 @@ public class AxPolicies extends AxConcept implements AxConceptGetter<AxPolicy> {
}
/**
+ * {@inheritDoc}.
+ */
+ @Override
+ public void buildReferences() {
+ policyMap.entrySet().stream().forEach(policyEntry -> {
+ policyEntry.getValue().setKey(policyEntry.getKey());
+ policyEntry.getValue().buildReferences();
+ }
+ );
+ }
+
+ /**
* Sets the key of the policy container.
*
* @param key the policy container key
@@ -204,23 +169,23 @@ public class AxPolicies extends AxConcept implements AxConceptGetter<AxPolicy> {
if (key.equals(AxArtifactKey.getNullKey())) {
result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "key is a null key"));
+ "key is a null key"));
}
result = key.validate(result);
if (policyMap.size() == 0) {
result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "policyMap may not be empty"));
+ "policyMap may not be empty"));
} else {
for (final Entry<AxArtifactKey, AxPolicy> policyEntry : policyMap.entrySet()) {
final AxArtifactKey entryKey = policyEntry.getKey();
if (entryKey.equals(AxArtifactKey.getNullKey())) {
result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "key on policy entry " + entryKey + " may not be the null key"));
+ "key on policy entry " + entryKey + " may not be the null key"));
} else if (policyEntry.getValue() == null) {
result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "value on policy entry " + entryKey + " may not be null"));
+ "value on policy entry " + entryKey + " may not be null"));
} else {
validate(result, policyEntry, entryKey);
result = policyEntry.getValue().validate(result);
@@ -232,11 +197,11 @@ public class AxPolicies extends AxConcept implements AxConceptGetter<AxPolicy> {
}
private void validate(final AxValidationResult result, final Entry<AxArtifactKey, AxPolicy> policyEntry,
- final AxArtifactKey entryKey) {
+ final AxArtifactKey entryKey) {
if (!entryKey.equals(policyEntry.getValue().getKey())) {
result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "key on policy entry key " + entryKey + " does not equal policy value key "
- + policyEntry.getValue().getKey()));
+ "key on policy entry key " + entryKey + " does not equal policy value key "
+ + policyEntry.getValue().getKey()));
}
}
@@ -373,7 +338,7 @@ public class AxPolicies extends AxConcept implements AxConceptGetter<AxPolicy> {
@Override
public AxPolicy get(final String conceptKeyName, final String conceptKeyVersion) {
return new AxConceptGetterImpl<>((NavigableMap<AxArtifactKey, AxPolicy>) policyMap).get(conceptKeyName,
- conceptKeyVersion);
+ conceptKeyVersion);
}
/**
@@ -390,6 +355,6 @@ public class AxPolicies extends AxConcept implements AxConceptGetter<AxPolicy> {
@Override
public Set<AxPolicy> getAll(final String conceptKeyName, final String conceptKeyVersion) {
return new AxConceptGetterImpl<>((NavigableMap<AxArtifactKey, AxPolicy>) policyMap).getAll(conceptKeyName,
- conceptKeyVersion);
+ conceptKeyVersion);
}
}
diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicy.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicy.java
index 4baba0029..a47afe4d6 100644
--- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicy.java
+++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicy.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019-2020 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2020,2022 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,25 +21,13 @@
package org.onap.policy.apex.model.policymodel.concepts;
+import com.google.gson.annotations.SerializedName;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.EmbeddedId;
-import javax.persistence.Entity;
-import javax.persistence.JoinColumn;
-import javax.persistence.JoinTable;
-import javax.persistence.OneToMany;
-import javax.persistence.Table;
-import javax.xml.bind.annotation.XmlAccessType;
-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.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;
@@ -68,48 +56,42 @@ import org.slf4j.ext.XLoggerFactory;
* <p>The template of a policy is a string that can be used by policy editors to store meta information on the policy
* that can be used at design time. The policy template string is not used during policy execution.
*
- * <p>During validation of a policy, the validation checks listed below are executed: <ol> <li>The policy key must not
- * be a null key <li>The policy key must be valid <li>If the policy template is not set, an observation is issued <li>At
- * least one state must be defined <li>Keys and values must all be defined, that is not null <li>The key on each entry
- * in the state map must match the key in the entry's value <li>The parent key of each state in the state map of a
- * policy must be the key of that policy <li>Each state must itself be valid, see validation in {@link AxState} <li>The
- * next state of the state output of each state must be defined as a state in the policy <li>The first state of a policy
- * must be set <li>The first state of a policy must be defined in the policy <li>If a state is defined but is not used
- * in a policy,a warning is issued <li>The state tree of the policy must be valid, see validation in {@link AxStateTree}
+ * <p>During validation of a policy, the validation checks listed below are executed:
+ * <ol>
+ * <li>The policy key must not
+ * be a null key
+ * <li>The policy key must be valid
+ * <li>If the policy template is not set, an observation is issued
+ * <li>At
+ * least one state must be defined
+ * <li>Keys and values must all be defined, that is not null
+ * <li>The key on each entry
+ * in the state map must match the key in the entry's value
+ * <li>The parent key of each state in the state map of a
+ * policy must be the key of that policy
+ * <li>Each state must itself be valid, see validation in {@link AxState}
+ * <li>The
+ * next state of the state output of each state must be defined as a state in the policy
+ * <li>The first state of a policy
+ * must be set
+ * <li>The first state of a policy must be defined in the policy
+ * <li>If a state is defined but is not used
+ * in a policy,a warning is issued
+ * <li>The state tree of the policy must be valid, see validation in {@link AxStateTree}
* </ol>
*/
-
-@Entity
-@Table(name = "AxPolicy")
-@XmlRootElement(name = "apexPolicy", namespace = "http://www.onap.org/policy/apex-pdp")
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "AxPolicy", namespace = "http://www.onap.org/policy/apex-pdp", propOrder =
- { "key", "template", "stateMap", "firstState" })
-
public class AxPolicy extends AxConcept {
private static final long serialVersionUID = -1775614096390365941L;
// Logger for this class
private static final XLogger LOGGER = XLoggerFactory.getXLogger(AxPolicy.class);
- @EmbeddedId
- @XmlElement(name = "policyKey", required = true)
+ @SerializedName("policyKey")
private AxArtifactKey key;
-
- @Column(name = "template")
- @XmlElement(required = true)
private String template;
- // @formatter:off
- @OneToMany(cascade = CascadeType.ALL)
- @JoinTable(joinColumns = {@JoinColumn(name = "parentKeyName", referencedColumnName = "name"),
- @JoinColumn(name = "parentKeyVersion", referencedColumnName = "version")})
- @XmlElement(name = "state", required = true)
+ @SerializedName("state")
private Map<String, AxState> stateMap;
- // @formatter:on
-
- @Column(name = "firstState")
- @XmlElement(required = true)
private String firstState;
/**
@@ -134,15 +116,18 @@ public class AxPolicy extends AxConcept {
* @param key the key of the policy
*/
public AxPolicy(final AxArtifactKey key) {
- this(key, "", new TreeMap<>(), "");
+ this(key,
+ "",
+ new TreeMap<>(),
+ "");
}
/**
* This Constructor creates a policy with the given key and all its fields defined.
*
- * @param key the key of the policy
- * @param template the policy template for policy editor metadata
- * @param stateMap the state map containing the states of the policy
+ * @param key the key of the policy
+ * @param template the policy template for policy editor metadata
+ * @param stateMap the state map containing the states of the policy
* @param firstState the first state that will execute on this policy
*/
public AxPolicy(final AxArtifactKey key, final String template, final Map<String, AxState> stateMap,
@@ -190,6 +175,20 @@ public class AxPolicy extends AxConcept {
}
/**
+ * {@inheritDoc}.
+ */
+ @Override
+ public void buildReferences() {
+ stateMap.entrySet().stream().forEach(stateEntry -> {
+ if (!stateEntry.getValue().getKey().getLocalName().equals(AxKey.NULL_KEY_NAME)) {
+ stateEntry.getValue().getKey().setParentArtifactKey(key);
+ }
+ stateEntry.getValue().buildReferences();
+ }
+ );
+ }
+
+ /**
* Sets the key of the policy.
*
* @param key the key of the policy
@@ -264,20 +263,21 @@ public class AxPolicy extends AxConcept {
AxValidationResult result = resultIn;
if (key.equals(AxArtifactKey.getNullKey())) {
- result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "key is a null key"));
+ result.addValidationMessage(
+ new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key"));
}
result = key.validate(result);
if (template.trim().length() == 0) {
result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.OBSERVATION,
- "a policy template has not been specified"));
+ "a policy template has not been specified"));
}
if (stateMap.size() == 0) {
- result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "stateMap may not be empty"));
+ result.addValidationMessage(
+ new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
+ "stateMap may not be empty"));
} else {
for (final Entry<String, AxState> stateEntry : stateMap.entrySet()) {
result = validateStateEntry(stateEntry, result);
@@ -293,11 +293,11 @@ public class AxPolicy extends AxConcept {
// We only check the unused states on models validated this far
if (firstState.trim().length() == 0) {
result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "no first state specified, first state may not be blank"));
+ "no first state specified, first state may not be blank"));
} else {
if (!stateMap.containsKey(firstState)) {
result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "first state not found in stateMap"));
+ "first state not found in stateMap"));
} else {
validateStateTree(result);
}
@@ -310,43 +310,42 @@ public class AxPolicy extends AxConcept {
* Validate a state entry.
*
* @param stateEntry the state entry to validate
- * @param result The validation result to append to
+ * @param result The validation result to append to
* @return The result of the validation
*/
- private AxValidationResult validateStateEntry(final Entry<String, AxState> stateEntry, AxValidationResult result) {
+ private AxValidationResult validateStateEntry(final Entry<String, AxState> stateEntry, AxValidationResult
+ result) {
if (stateEntry.getKey() == null || stateEntry.getKey().equals(AxKey.NULL_KEY_NAME)) {
result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "key on state entry key " + stateEntry.getKey() + " may not be the null key"));
+ "key on state entry key " + stateEntry.getKey() + " may not be the null key"));
return result;
}
if (stateEntry.getValue() == null) {
result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "value on state entry value " + stateEntry.getKey() + " may not be null"));
+ "value on state entry value " + stateEntry.getKey() + " may not be null"));
return result;
}
if (!stateEntry.getKey().equals(stateEntry.getValue().getKey().getLocalName())) {
result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "key on state entry key " + stateEntry.getKey()
- + " does not equal state entry value local name "
- + stateEntry.getValue().getKey().getLocalName()));
+ "key on state entry key " + stateEntry.getKey() + " does not equal state entry value local name "
+ + stateEntry.getValue().getKey().getLocalName()));
}
if (!stateEntry.getValue().getKey().getParentArtifactKey().equals(key)) {
result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "parent key on state entry key " + stateEntry.getValue().getKey()
- + " does not equal policy key"));
+ "parent key on state entry key " + stateEntry.getValue().getKey() + " does not equal policy key"));
}
result = stateEntry.getValue().validate(result);
for (final AxStateOutput stateOutput : stateEntry.getValue().getStateOutputs().values()) {
if (!stateOutput.getNextState().equals(AxReferenceKey.getNullKey())
- && !stateMap.containsKey(stateOutput.getNextState().getLocalName())) {
- result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- " nextState of state " + stateEntry.getKey() + " not found in StateMap: "
- + stateOutput.getNextState().getId()));
+ && !stateMap.containsKey(stateOutput.getNextState().getLocalName())) {
+ result.addValidationMessage(
+ new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, " nextState of state "
+ + stateEntry.getKey() + " not found in StateMap: " + stateOutput.getNextState().getId()));
}
}
@@ -371,12 +370,11 @@ public class AxPolicy extends AxConcept {
for (final AxState unreferencedState : unreferencedStateSet) {
result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.WARNING,
- "state " + unreferencedState.getKey()
- + " is not referenced in the policy execution tree"));
+ "state " + unreferencedState.getKey() + " is not referenced in the policy execution tree"));
}
} catch (PolicyRuntimeException pre) {
AxValidationMessage validationMessage = new AxValidationMessage(key, this.getClass(),
- ValidationResult.WARNING, "state tree in policy is invalid");
+ ValidationResult.WARNING, "state tree in policy is invalid");
LOGGER.trace(validationMessage.getMessage(), pre);
result.addValidationMessage(validationMessage);
}
diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicyModel.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicyModel.java
index aec144a46..e119536fb 100644
--- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicyModel.java
+++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicyModel.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019,2022 Nordix Foundation.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
* ================================================================================
@@ -25,19 +25,6 @@ package org.onap.policy.apex.model.policymodel.concepts;
import java.util.List;
import java.util.Map.Entry;
-import javax.persistence.CascadeType;
-import javax.persistence.Entity;
-import javax.persistence.JoinColumn;
-import javax.persistence.OneToOne;
-import javax.persistence.Table;
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.bind.annotation.XmlAccessType;
-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 javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
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;
@@ -46,7 +33,6 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxModel;
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;
-import org.onap.policy.apex.model.basicmodel.handling.KeyInfoMarshalFilter;
import org.onap.policy.apex.model.basicmodel.service.ModelService;
import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum;
import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbums;
@@ -55,7 +41,6 @@ import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas;
import org.onap.policy.apex.model.eventmodel.concepts.AxEvent;
import org.onap.policy.apex.model.eventmodel.concepts.AxEvents;
import org.onap.policy.apex.model.eventmodel.concepts.AxField;
-import org.onap.policy.apex.model.policymodel.handling.EmptyAlbumsAdapter;
import org.onap.policy.common.utils.validation.Assertions;
/**
@@ -103,51 +88,24 @@ import org.onap.policy.common.utils.validation.Assertions;
* <li>All events referred to on direct state outputs must exist
* </ol>
*/
-@Entity
-@Table(name = "AxPolicyModel")
-
-@XmlRootElement(name = "apexPolicyModel", namespace = "http://www.onap.org/policy/apex-pdp")
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "AxPolicyModel", namespace = "http://www.onap.org/policy/apex-pdp",
- propOrder = {"policies", "tasks", "events", "albums", "schemas"})
-
public class AxPolicyModel extends AxModel {
+ // @formatter:off
+ private static final String SCHEMAS_TOKEN = "_Schemas";
+ private static final String KEY_INFO_TOKEN = "_KeyInfo";
+ private static final String EVENTS_TOKEN = "_Events";
+ private static final String ALBUMS_TOKEN = "_Albums";
+ private static final String TASKS_TOKEN = "_Tasks";
+ private static final String POLICIESS_TOKEN = "_Policies";
+
private static final String DOES_NOT_EXIST = " does not exist";
private static final long serialVersionUID = 8800599637708309945L;
- // @formatter:off
- @OneToOne(cascade = CascadeType.ALL)
- @JoinColumn(name = "policiesName", referencedColumnName = "name")
- @JoinColumn(name = "policiesVersion", referencedColumnName = "version")
- @XmlElement(name = "policies", required = true)
private AxPolicies policies;
-
- @OneToOne(cascade = CascadeType.ALL)
- @JoinColumn(name = "tasksName", referencedColumnName = "name")
- @JoinColumn(name = "tasksVersion", referencedColumnName = "version")
- @XmlElement(name = "tasks", required = true)
private AxTasks tasks;
-
- @OneToOne(cascade = CascadeType.ALL)
- @JoinColumn(name = "eventsName", referencedColumnName = "name")
- @JoinColumn(name = "eventsVersion", referencedColumnName = "version")
- @XmlElement(name = "events", required = true)
private AxEvents events;
-
- @OneToOne(cascade = CascadeType.ALL)
- @JoinColumn(name = "albumsName", referencedColumnName = "name")
- @JoinColumn(name = "albumsVersion", referencedColumnName = "version")
- @XmlElement(name = "albums", required = false)
- @XmlJavaTypeAdapter(EmptyAlbumsAdapter.class)
private AxContextAlbums albums;
-
- @OneToOne(cascade = CascadeType.ALL)
- @JoinColumn(name = "schemasName", referencedColumnName = "name")
- @JoinColumn(name = "schemasVersion", referencedColumnName = "version")
- @XmlElement(name = "schemas", required = true)
private AxContextSchemas schemas;
- // @formatter:on
/**
* The Default Constructor creates a policy model with a null key and empty containers for
@@ -173,12 +131,13 @@ public class AxPolicyModel extends AxModel {
* @param key the key
*/
public AxPolicyModel(final AxArtifactKey key) {
- this(key, new AxContextSchemas(new AxArtifactKey(key.getName() + "_Schemas", key.getVersion())),
- new AxKeyInformation(new AxArtifactKey(key.getName() + "_KeyInfo", key.getVersion())),
- new AxEvents(new AxArtifactKey(key.getName() + "_Events", key.getVersion())),
- new AxContextAlbums(new AxArtifactKey(key.getName() + "_Albums", key.getVersion())),
- new AxTasks(new AxArtifactKey(key.getName() + "_Tasks", key.getVersion())),
- new AxPolicies(new AxArtifactKey(key.getName() + "_Policies", key.getVersion())));
+ this(key,
+ new AxContextSchemas(new AxArtifactKey(key.getName() + SCHEMAS_TOKEN, key.getVersion())),
+ new AxKeyInformation(new AxArtifactKey(key.getName() + KEY_INFO_TOKEN, key.getVersion())),
+ new AxEvents(new AxArtifactKey(key.getName() + EVENTS_TOKEN, key.getVersion())),
+ new AxContextAlbums(new AxArtifactKey(key.getName() + ALBUMS_TOKEN, key.getVersion())),
+ new AxTasks(new AxArtifactKey(key.getName() + TASKS_TOKEN, key.getVersion())),
+ new AxPolicies(new AxArtifactKey(key.getName() + POLICIESS_TOKEN, key.getVersion())));
}
/**
@@ -193,7 +152,7 @@ public class AxPolicyModel extends AxModel {
* @param policies the policy container for the policy model
*/
public AxPolicyModel(final AxArtifactKey key, final AxContextSchemas schemas, final AxKeyInformation keyInformation,
- final AxEvents events, final AxContextAlbums albums, final AxTasks tasks, final AxPolicies policies) {
+ final AxEvents events, final AxContextAlbums albums, final AxTasks tasks, final AxPolicies policies) {
super(key, keyInformation);
Assertions.argumentNotNull(schemas, "schemas may not be null");
Assertions.argumentNotNull(events, "events may not be null");
@@ -359,7 +318,7 @@ public class AxPolicyModel extends AxModel {
validateEventKeys(result);
validateContextAlbumKeys(result);
- result = validateAllTaskKeys(result);
+ validateAllTaskKeys(result);
validatePolicyKeys(result);
return result;
@@ -409,7 +368,7 @@ public class AxPolicyModel extends AxModel {
*/
private AxValidationResult validateAllTaskKeys(AxValidationResult result) {
for (final AxTask task : tasks.getAll(null)) {
- result = validateTaskKeys(task, result);
+ validateTaskKeys(task, result);
}
return result;
}
@@ -521,7 +480,7 @@ public class AxPolicyModel extends AxModel {
* @param result the validation result to append to
*/
private void validateEventTaskFieldCompatibilityOnStateOutput(final AxState state, final AxTask task,
- final AxStateOutput stateOutput, AxValidationResult result) {
+ final AxStateOutput stateOutput, AxValidationResult result) {
if (stateOutput == null) {
result.addValidationMessage(new AxValidationMessage(state.getKey(), this.getClass(),
ValidationResult.INVALID, "state output on task reference for task " + task.getId() + " is null"));
@@ -537,38 +496,26 @@ public class AxPolicyModel extends AxModel {
}
/**
- * When a model is unmarshalled from disk or from the database, if the albums field was missing a blank
- * with a null key was added. This method is called by JAXB after unmarshalling and is
+ * When a model is deserialized, if the albums field was missing a blank
+ * with a null key was added. This method is called by JAXB after deserializing and is
* used to insert an appropriate key
- *
- * @param unmarshaller the unmarshaller that is unmarshalling the model
- * @param parent the parent object of this object in the unmarshaller
*/
- public void afterUnmarshal(final Unmarshaller unmarshaller, final Object parent) {
- new EmptyAlbumsAdapter().doAfterUnmarshal(this);
- }
-
- /**
- * When a model is marshalled from disk or database, if the albums field is empty/null, then the albums field
- * is not emitted. If the (empty) albums field is not emitted then it's keyinfo should also be suppressed
- * This method is called by JAXB before marshaling and is used to insert the appropriate filters
- *
- * @param marshaller the marshaller that is marshaller the model
- * @throws Exception if there is a problem with the marshalling
- */
- public void beforeMarshal(final Marshaller marshaller) throws Exception {
- EmptyAlbumsAdapter albumsfilter = new EmptyAlbumsAdapter();
- marshaller.setAdapter(EmptyAlbumsAdapter.class, albumsfilter);
- //get/create the keyinfofilter
- KeyInfoMarshalFilter keyinfoFilter = marshaller.getAdapter(KeyInfoMarshalFilter.class);
- if (keyinfoFilter == null) {
- keyinfoFilter = new KeyInfoMarshalFilter();
- }
- //if the albumsfilter would filter out this model's albums add the album's key to the keyinfofilter
- if (albumsfilter.marshal(this.albums) == null && this.albums != null) {
- keyinfoFilter.addFilterKey(this.albums.getKey());
+ @Override
+ public void buildReferences() {
+ getSchemas().buildReferences();
+ getEvents().buildReferences();
+ getAlbums().buildReferences();
+ getTasks().buildReferences();
+ getPolicies().buildReferences();
+ getKeyInformation().buildReferences();
+
+ AxArtifactKey nullAlbumskey = new AxArtifactKey(AxKey.NULL_KEY_NAME + ALBUMS_TOKEN, AxKey.NULL_KEY_VERSION);
+
+ if (AxArtifactKey.getNullKey().equals(getAlbums().getKey())
+ || nullAlbumskey.equals(getAlbums().getKey())) {
+ getAlbums().setKey(new AxArtifactKey(getKey().getName() + ALBUMS_TOKEN, getKey().getVersion()));
+ getKeyInformation().generateKeyInfo(getAlbums());
}
- marshaller.setAdapter(keyinfoFilter);
}
/**
diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxState.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxState.java
index 78a96a1f2..ae8efbff4 100644
--- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxState.java
+++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxState.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2018 Samsung Electronics Co., Ltd.
- * Modifications Copyright (C) 2019-2021 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2022 Nordix Foundation.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,31 +23,13 @@
package org.onap.policy.apex.model.policymodel.concepts;
+import com.google.gson.annotations.SerializedName;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
-import javax.persistence.AttributeOverride;
-import javax.persistence.CascadeType;
-import javax.persistence.CollectionTable;
-import javax.persistence.Column;
-import javax.persistence.ElementCollection;
-import javax.persistence.Embedded;
-import javax.persistence.EmbeddedId;
-import javax.persistence.Entity;
-import javax.persistence.JoinColumn;
-import javax.persistence.JoinTable;
-import javax.persistence.ManyToMany;
-import javax.persistence.OneToOne;
-import javax.persistence.Table;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.bind.annotation.XmlAccessType;
-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.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;
@@ -119,101 +101,28 @@ import org.onap.policy.common.utils.validation.Assertions;
* <li>Each State Finalizer logic instance in a state must be valid, see validation in {@link AxStateFinalizerLogic}
* </ol>
*/
-
-@Entity
-@Table(name = "AxState")
-
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlRootElement(name = "apexState", namespace = "http://www.onap.org/policy/apex-pdp")
-@XmlType(name = "AxState", namespace = "http://www.onap.org/policy/apex-pdp", propOrder =
- { "key", "trigger", "stateOutputs", "contextAlbumReferenceSet", "taskSelectionLogic", "stateFinalizerLogicMap",
- "defaultTask", "taskReferenceMap" })
-
public class AxState extends AxConcept {
private static final String DOES_NOT_EQUAL_STATE_KEY = " does not equal state key";
private static final long serialVersionUID = 8041771382337655535L;
- @EmbeddedId
- @XmlElement(name = "stateKey", required = true)
+
+
+ @SerializedName("stateKey")
private AxReferenceKey key;
- // @formatter:off
- @Embedded
- @AttributeOverride(name = "name", column = @Column(name = "inTriggerName"))
- @AttributeOverride(name = "version", column = @Column(name = "inTriggerVersion"))
- @Column(name = "trigger")
- @XmlElement(required = true)
private AxArtifactKey trigger;
-
- @ManyToMany(cascade = CascadeType.ALL)
- @JoinTable(
- joinColumns = {@JoinColumn(name = "soParentKeyName", referencedColumnName = "parentKeyName"),
- @JoinColumn(name = "soParentKeyVersion", referencedColumnName = "parentKeyVersion"),
- @JoinColumn(name = "soParentLocalName", referencedColumnName = "parentLocalName"),
- @JoinColumn(name = "soLocalName", referencedColumnName = "localName")},
- inverseJoinColumns = {@JoinColumn(name = "stateParentKeyName", referencedColumnName = "parentKeyName"),
- @JoinColumn(name = "stateParentKeyVersion", referencedColumnName = "parentKeyVersion"),
- @JoinColumn(name = "stateParentLocalName", referencedColumnName = "parentLocalName"),
- @JoinColumn(name = "stateLocalName", referencedColumnName = "localName")})
- @XmlElement(name = "stateOutputs", required = true)
private Map<String, AxStateOutput> stateOutputs;
- @ElementCollection
- @CollectionTable(joinColumns = {@JoinColumn(name = "stateParentKeyName", referencedColumnName = "parentKeyName"),
- @JoinColumn(name = "stateParentKeyVersion", referencedColumnName = "parentKeyVersion"),
- @JoinColumn(name = "stateParentLocalName", referencedColumnName = "parentLocalName"),
- @JoinColumn(name = "stateLocalName", referencedColumnName = "localName")})
- @XmlElement(name = "contextAlbumReference")
+ @SerializedName("contextAlbumReference")
private Set<AxArtifactKey> contextAlbumReferenceSet;
- @OneToOne
- @JoinTable(name = "STATE_TSL_JT",
- joinColumns = {
- @JoinColumn(name = "tslParentKeyName", referencedColumnName = "parentKeyName", updatable = false,
- insertable = false),
- @JoinColumn(name = "tslParentKeyVersion", referencedColumnName = "parentKeyVersion",
- updatable = false, insertable = false),
- @JoinColumn(name = "tslParentLocalName ", referencedColumnName = "parentLocalName",
- updatable = false, insertable = false),
- @JoinColumn(name = "tslLocalName", referencedColumnName = "localName", updatable = false,
- insertable = false)})
- @XmlElement(required = true)
private AxTaskSelectionLogic taskSelectionLogic;
-
- @ManyToMany(cascade = CascadeType.ALL)
- @JoinTable(
- joinColumns = {@JoinColumn(name = "sflParentKeyName", referencedColumnName = "parentKeyName"),
- @JoinColumn(name = "sflParentKeyVersion", referencedColumnName = "parentKeyVersion"),
- @JoinColumn(name = "sflParentLocalName", referencedColumnName = "parentLocalName"),
- @JoinColumn(name = "sflLocalName", referencedColumnName = "localName")},
- inverseJoinColumns = {@JoinColumn(name = "stateParentKeyName", referencedColumnName = "parentKeyName"),
- @JoinColumn(name = "stateParentKeyVersion", referencedColumnName = "parentKeyVersion"),
- @JoinColumn(name = "stateParentLocalName", referencedColumnName = "parentLocalName"),
- @JoinColumn(name = "stateLocalName", referencedColumnName = "localName")})
- @XmlElement(name = "stateFinalizerLogicMap", required = true)
private Map<String, AxStateFinalizerLogic> stateFinalizerLogicMap;
-
- @Embedded
- @AttributeOverride(name = "name", column = @Column(name = "defaultTaskName"))
- @AttributeOverride(name = "version", column = @Column(name = "defaultTaskVersion"))
- @Column(name = "defaultTask")
- @XmlElement(required = true)
private AxArtifactKey defaultTask;
- @ManyToMany(cascade = CascadeType.ALL)
- @JoinTable(
- joinColumns = {@JoinColumn(name = "trmParentKeyName", referencedColumnName = "parentKeyName"),
- @JoinColumn(name = "trmParentKeyVersion", referencedColumnName = "parentKeyVersion"),
- @JoinColumn(name = "trmParentLocalName", referencedColumnName = "parentLocalName"),
- @JoinColumn(name = "trmLocalName", referencedColumnName = "localName")},
- inverseJoinColumns = {@JoinColumn(name = "stateParentKeyName", referencedColumnName = "parentKeyName"),
- @JoinColumn(name = "stateParentKeyVersion", referencedColumnName = "parentKeyVersion"),
- @JoinColumn(name = "stateParentLocalName", referencedColumnName = "parentLocalName"),
- @JoinColumn(name = "stateLocalName", referencedColumnName = "localName")})
- @XmlElement(name = "taskReferences", required = true)
+ @SerializedName("taskReferences")
private Map<AxArtifactKey, AxStateTaskReference> taskReferenceMap;
- // @formatter:on
/**
* The Default Constructor creates a state with a null reference key and with default values for all other fields.
@@ -283,29 +192,19 @@ public class AxState extends AxConcept {
// CHECKSTYLE:ON: checkstyle:parameterNumber
/**
- * When a state is unmarshalled from disk or from the database, the parent of contained objects is not defined. This
- * method is called by JAXB after unmarshaling and is used to set the parent keys of all
+ * When a state is deserialized from disk or from the database, the parent of contained objects is not defined. This
+ * method is called by JAXB after deserialized and is used to set the parent keys of all
* {@link AxTaskSelectionLogic}, {@link AxStateOutput}, and {@link AxStateFinalizerLogic} instance in the state.
- *
- * @param unmarshaler the unmarshaler that is unmarshaling the model
- * @param parent the parent object of this object in the unmarshaler
*/
- public void afterUnmarshal(final Unmarshaller unmarshaler, final Object parent) {
+ @Override
+ public void buildReferences() {
if (!taskSelectionLogic.getKey().getLocalName().equals(AxKey.NULL_KEY_NAME)) {
taskSelectionLogic.getKey().setParentReferenceKey(key);
}
- for (final Entry<String, AxStateOutput> soEntry : stateOutputs.entrySet()) {
- soEntry.getValue().getKey().setParentReferenceKey(key);
- }
-
- for (final Entry<String, AxStateFinalizerLogic> sflEntry : stateFinalizerLogicMap.entrySet()) {
- sflEntry.getValue().getKey().setParentReferenceKey(key);
- }
-
- for (final Entry<AxArtifactKey, AxStateTaskReference> trEntry : taskReferenceMap.entrySet()) {
- trEntry.getValue().getKey().setParentReferenceKey(key);
- }
+ stateOutputs.values().stream().forEach(output -> output.getKey().setParentReferenceKey(key));
+ stateFinalizerLogicMap.values().stream().forEach(output -> output.getKey().setParentReferenceKey(key));
+ taskReferenceMap.values().stream().forEach(output -> output.getKey().setParentReferenceKey(key));
}
/**
diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateFinalizerLogic.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateFinalizerLogic.java
index 0b5d9751e..31ffedea8 100644
--- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateFinalizerLogic.java
+++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateFinalizerLogic.java
@@ -1,55 +1,40 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2022 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* 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.policymodel.concepts;
-import javax.persistence.Entity;
-import javax.persistence.Inheritance;
-import javax.persistence.InheritanceType;
-import javax.persistence.Table;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
/**
* This class holds State Finalizer Logic for {@link AxState} states in Apex. It is a specialization
* of the {@link AxLogic} class, so that State Finalizer Logic in Apex states can be strongly typed.
- *
+ *
* <p>State Finalizer Logic is used to select the output {@link AxStateOutput} that a state will use.
* The logic uses fields emitted by the executed {@link AxTask} task and information from the
* context albums available on a state to decide what state output {@link AxStateOutput} to select
* in a given context. State Finalizer Logic must marshal the output fields from the task onto the
* output event in whatever manner is appropriate for the domain being handled.
- *
+ *
* <p>Validation uses standard Apex Logic validation, see validation in {@link AxLogic}.
*/
-@Entity
-@Table(name = "AxStateFinalizerLogic")
-@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
-
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlRootElement(name = "apexStateFinalizerLogic", namespace = "http://www.onap.org/policy/apex-pdp")
-@XmlType(name = "AxStateFinalizerLogic", namespace = "http://www.onap.org/policy/apex-pdp")
-
public class AxStateFinalizerLogic extends AxLogic {
private static final long serialVersionUID = 2090324845463750391L;
diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateOutput.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateOutput.java
index 59433dccd..7d4695290 100644
--- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateOutput.java
+++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateOutput.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019,2022 Nordix Foundation.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
* ================================================================================
@@ -23,22 +23,9 @@
package org.onap.policy.apex.model.policymodel.concepts;
+import com.google.gson.annotations.SerializedName;
import java.util.List;
import java.util.Set;
-import javax.persistence.AttributeOverride;
-import javax.persistence.CollectionTable;
-import javax.persistence.Column;
-import javax.persistence.ElementCollection;
-import javax.persistence.Embedded;
-import javax.persistence.EmbeddedId;
-import javax.persistence.Entity;
-import javax.persistence.JoinColumn;
-import javax.persistence.Table;
-import javax.xml.bind.annotation.XmlAccessType;
-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 lombok.Getter;
import lombok.NonNull;
import lombok.Setter;
@@ -69,48 +56,20 @@ import org.onap.policy.common.utils.validation.Assertions;
* <li>The next state key must be valid, see validation in {@link AxReferenceKey}
* </ol>
*/
-
-@Entity
-@Table(name = "AxStateOutput")
-
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlRootElement(name = "apexStateOutput", namespace = "http://www.onap.org/policy/apex-pdp")
-@XmlType(name = "AxStateOutput", namespace = "http://www.onap.org/policy/apex-pdp",
- propOrder = {"key", "outgoingEvent", "outgoingEventSet", "nextState"})
@Getter
@Setter
public class AxStateOutput extends AxConcept {
private static final long serialVersionUID = 8041771382337655535L;
- @EmbeddedId
- @XmlElement(name = "key", required = true)
@NonNull
private AxReferenceKey key;
- // @formatter:off
- @Embedded
- @AttributeOverride(name = "name", column = @Column(name = "outgoingEventName"))
- @AttributeOverride(name = "version", column = @Column(name = "outgoingEventVersion"))
- @Column(name = "outgoingEvent")
- @XmlElement(required = true)
@NonNull
private AxArtifactKey outgoingEvent;
- @ElementCollection
- @CollectionTable(joinColumns = {@JoinColumn(name = "stateParentKeyName", referencedColumnName = "parentKeyName"),
- @JoinColumn(name = "stateParentKeyVersion", referencedColumnName = "parentKeyVersion"),
- @JoinColumn(name = "stateParentLocalName", referencedColumnName = "parentLocalName"),
- @JoinColumn(name = "stateLocalName", referencedColumnName = "localName")})
- @XmlElement(name = "outgoingEventReference", required = false)
+ @SerializedName("outgoingEventReference")
private Set<AxArtifactKey> outgoingEventSet;
- @Embedded
- @AttributeOverride(name = "parentKeyName", column = @Column(name = "nextStateParentKeyName"))
- @AttributeOverride(name = "parentKeyVersion", column = @Column(name = "nextStateParentKeyVersion"))
- @AttributeOverride(name = "parentLocalName", column = @Column(name = "nextStateParentLocalName"))
- @AttributeOverride(name = "localName", column = @Column(name = "nextStateLocalName"))
- @Column(name = "nextState")
- @XmlElement(required = true)
@NonNull
private AxReferenceKey nextState;
// @formatter:on
diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateTaskOutputType.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateTaskOutputType.java
index 741eb8833..171747c0c 100644
--- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateTaskOutputType.java
+++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateTaskOutputType.java
@@ -1,37 +1,31 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2022 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* 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.policymodel.concepts;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlType;
-
/**
* This enumeration defines the type of state output selection that is defined for a task in a
* state. The {@link AxStateTaskReference} instance for each task uses this enumeration to decide
* what type of output selection to use when a task has completed execution.
*/
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "AxStateTaskOutputType", namespace = "http://www.onap.org/policy/apex-pdp")
-
public enum AxStateTaskOutputType {
/** The state output selection for the task has not been defined. */
UNDEFINED,
diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateTaskReference.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateTaskReference.java
index c98e38fbf..748eca92d 100644
--- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateTaskReference.java
+++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateTaskReference.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019,2022 Nordix Foundation.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,18 +23,6 @@
package org.onap.policy.apex.model.policymodel.concepts;
import java.util.List;
-import javax.persistence.AttributeOverride;
-import javax.persistence.Column;
-import javax.persistence.Embedded;
-import javax.persistence.EmbeddedId;
-import javax.persistence.Entity;
-import javax.persistence.Enumerated;
-import javax.persistence.Table;
-import javax.xml.bind.annotation.XmlAccessType;
-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.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;
@@ -68,37 +56,12 @@ import org.onap.policy.common.utils.validation.Assertions;
* {@link AxReferenceKey}
* </ol>
*/
-
-@Entity
-@Table(name = "AxStateTaskReference")
-
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlRootElement(name = "apexStateTaskReference", namespace = "http://www.onap.org/policy/apex-pdp")
-@XmlType(name = "AxStateTaskReference", namespace = "http://www.onap.org/policy/apex-pdp",
- propOrder = {"key", "outputType", "output"})
-
public class AxStateTaskReference extends AxConcept {
private static final long serialVersionUID = 8041771382337655535L;
- @EmbeddedId
- @XmlElement(name = "key", required = true)
private AxReferenceKey key;
-
- @Enumerated
- @Column(name = "outputType")
- @XmlElement(required = true)
private AxStateTaskOutputType outputType;
-
- // @formatter:off
- @Embedded
- @AttributeOverride(name = "parentKeyName", column = @Column(name = "outputParentKeyName"))
- @AttributeOverride(name = "parentKeyVersion", column = @Column(name = "outputParentKeyVersion"))
- @AttributeOverride(name = "parentLocalName", column = @Column(name = "outputParentLocalName"))
- @AttributeOverride(name = "localName", column = @Column(name = "outputLocalName"))
- @Column(name = "output")
- @XmlElement(required = true)
private AxReferenceKey output;
- // @formatter:on
/**
* The Default Constructor creates a state task reference with a null reference key, an
diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTask.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTask.java
index 7eba99af0..c8b6baf4b 100644
--- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTask.java
+++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTask.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019-2021 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2022 Nordix Foundation.
* Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,28 +22,13 @@
package org.onap.policy.apex.model.policymodel.concepts;
+import com.google.gson.annotations.SerializedName;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
-import javax.persistence.CascadeType;
-import javax.persistence.CollectionTable;
-import javax.persistence.ElementCollection;
-import javax.persistence.EmbeddedId;
-import javax.persistence.Entity;
-import javax.persistence.JoinColumn;
-import javax.persistence.JoinTable;
-import javax.persistence.OneToMany;
-import javax.persistence.OneToOne;
-import javax.persistence.Table;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.bind.annotation.XmlAccessType;
-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 lombok.Getter;
import lombok.NonNull;
import lombok.Setter;
@@ -81,17 +66,6 @@ import org.onap.policy.common.utils.validation.Assertions;
* <li>The task logic must be valid, see validation in {@link AxTaskLogic}
* </ol>
*/
-
-@Entity
-@Table(name = "AxTask")
-
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlRootElement(name = "apexTask", namespace = "http://www.onap.org/policy/apex-pdp")
-@XmlType(
- name = "AxTask",
- namespace = "http://www.onap.org/policy/apex-pdp",
- propOrder = {"key", "inputEvent", "outputEvents", "taskParameters",
- "contextAlbumReferenceSet", "taskLogic"})
@Getter
@Setter
public class AxTask extends AxConcept {
@@ -99,42 +73,17 @@ public class AxTask extends AxConcept {
private static final long serialVersionUID = 5374237330697362762L;
- @EmbeddedId
- @XmlElement(name = "key", required = true)
@NonNull
private AxArtifactKey key;
- @OneToOne(cascade = CascadeType.ALL)
- @JoinTable(
- name = "INPUT_EVENT_JT",
- joinColumns = {@JoinColumn(name = "inEventTaskName", referencedColumnName = "name", updatable = false),
- @JoinColumn(name = "inEventTaskVersion", referencedColumnName = "version", updatable = false)})
- @XmlElement(name = "inputEvent", required = false)
private AxEvent inputEvent;
-
- @OneToMany(cascade = CascadeType.ALL)
- @JoinTable(
- name = "OUTPUT_EVENT_JT",
- joinColumns = {@JoinColumn(name = "outEventTaskName", referencedColumnName = "name", updatable = false),
- @JoinColumn(name = "outEventTaskVersion", referencedColumnName = "version", updatable = false)})
- @XmlElement(name = "outputEvents", required = false)
private Map<String, AxEvent> outputEvents;
-
- @OneToMany(cascade = CascadeType.ALL)
- @XmlElement(name = "taskParameters", required = true)
private Map<String, AxTaskParameter> taskParameters;
- // @formatter:off
- @ElementCollection
- @CollectionTable(joinColumns = {@JoinColumn(name = "contextAlbumName", referencedColumnName = "name"),
- @JoinColumn(name = "contextAlbumVersion", referencedColumnName = "version")})
- @XmlElement(name = "contextAlbumReference")
+ @SerializedName("contextAlbumReference")
@NonNull
private Set<AxArtifactKey> contextAlbumReferenceSet;
- // @formatter:on
- @OneToOne(cascade = CascadeType.ALL)
- @XmlElement(required = true)
@NonNull
private AxTaskLogic taskLogic;
@@ -194,18 +143,17 @@ public class AxTask extends AxConcept {
}
/**
- * When a task is unmarshalled from disk or from the database, the parent of contained objects
- * is not defined. This method is called by JAXB after unmarshaling and is used to set the
+ * When a task is deserialized from disk or from the database, the parent of contained objects
+ * is not defined. This method is called by JAXB after deserialization and is used to set the
* parent keys of all {@link AxTaskParameter} instance in the task.
- *
- * @param unmarshaler the unmarshaler that is unmarshaling the model
- * @param parent the parent object of this object in the unmarshaler
*/
- public void afterUnmarshal(final Unmarshaller unmarshaler, final Object parent) {
- taskLogic.getKey().setParentArtifactKey(key);
- for (final AxTaskParameter parameter : taskParameters.values()) {
- parameter.getKey().setParentArtifactKey(key);
+ @Override
+ public void buildReferences() {
+ if (!taskLogic.getKey().getLocalName().equals(AxKey.NULL_KEY_NAME)) {
+ taskLogic.getKey().setParentArtifactKey(key);
}
+
+ taskParameters.values().stream().forEach(parameter -> parameter.getKey().setParentArtifactKey(key));
}
/**
diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTaskLogic.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTaskLogic.java
index 70b19ec48..8665d9e3e 100644
--- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTaskLogic.java
+++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTaskLogic.java
@@ -1,54 +1,39 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2022 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* 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.policymodel.concepts;
-import javax.persistence.Entity;
-import javax.persistence.Inheritance;
-import javax.persistence.InheritanceType;
-import javax.persistence.Table;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
/**
* This class holds Task Logic for {@link AxTask} tasks in Apex. It is a specialization of the
* {@link AxLogic} class, so that Task Logic in Apex states can be strongly typed.
- *
+ *
* <p>Task Logic is used to execute tasks {@link AxTask} in Apex. The logic uses fields on the incoming
* trigger event and information from the context albums available on a task to get context during
* execution. The task logic populates the output fields of the task.
- *
+ *
* <p>Validation uses standard Apex Logic validation, see validation in {@link AxLogic}.
*/
-@Entity
-@Table(name = "AxTaskLogic")
-@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
-
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlRootElement(name = "apexLogic", namespace = "http://www.onap.org/policy/apex-pdp")
-@XmlType(name = "AxTaskLogic", namespace = "http://www.onap.org/policy/apex-pdp")
-
public class AxTaskLogic extends AxLogic {
private static final long serialVersionUID = 2090324845463750391L;
diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTaskParameter.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTaskParameter.java
index 47c62e6ae..a468ec499 100644
--- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTaskParameter.java
+++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTaskParameter.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019,2022 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,15 +22,6 @@
package org.onap.policy.apex.model.policymodel.concepts;
import java.util.List;
-import javax.persistence.Column;
-import javax.persistence.EmbeddedId;
-import javax.persistence.Entity;
-import javax.persistence.Table;
-import javax.xml.bind.annotation.XmlAccessType;
-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.onap.policy.apex.model.basicmodel.concepts.AxConcept;
import org.onap.policy.apex.model.basicmodel.concepts.AxKey;
import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
@@ -46,24 +37,10 @@ import org.onap.policy.common.utils.validation.Assertions;
* a default value. If the task parameter is not set in a configuration file, the task uses its
* default value.
*/
-
-@Entity
-@Table(name = "AxTaskParameter")
-
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlRootElement(name = "apexTaskParameter", namespace = "http://www.onap.org/policy/apex-pdp")
-@XmlType(name = "AxTaskParameter", namespace = "http://www.onap.org/policy/apex-pdp",
- propOrder = {"key", "defaultValue"})
-
public class AxTaskParameter extends AxConcept {
private static final long serialVersionUID = 7351688156934099977L;
- @EmbeddedId
- @XmlElement(name = "key", required = true)
private AxReferenceKey key;
-
- @Column(name = "defaultValue")
- @XmlElement
private String defaultValue;
/**
diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTaskSelectionLogic.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTaskSelectionLogic.java
index 5d6441a4d..b9cfd802d 100644
--- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTaskSelectionLogic.java
+++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTaskSelectionLogic.java
@@ -1,53 +1,38 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2022 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* 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.policymodel.concepts;
-import javax.persistence.Entity;
-import javax.persistence.Inheritance;
-import javax.persistence.InheritanceType;
-import javax.persistence.Table;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
/**
* This class holds Task Selection Logic for {@link AxState} states in Apex. It is a specialization
* of the {@link AxLogic} class, so that Task Selection Logic in Apex states can be strongly typed.
- *
+ *
* <p>Task Selection Logic is used to select the task {@link AxTask} that a state will execute. The
* logic uses fields on the incoming trigger event and information from the context albums available
* on a state to decide what task {@link AxTask} to select for execution in a given context.
- *
+ *
* <p>Validation uses standard Apex Logic validation, see validation in {@link AxLogic}.
*/
-@Entity
-@Table(name = "AxTaskSelectionLogic")
-@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
-
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlRootElement(name = "apexTaskSelectionLogic", namespace = "http://www.onap.org/policy/apex-pdp")
-@XmlType(name = "AxTaskSelectionLogic", namespace = "http://www.onap.org/policy/apex-pdp")
-
public class AxTaskSelectionLogic extends AxLogic {
private static final long serialVersionUID = 2090324845463750391L;
diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTasks.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTasks.java
index 73012d8bc..f9ccafd54 100644
--- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTasks.java
+++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTasks.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019-2020 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2020,2022 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,18 +27,6 @@ import java.util.Map.Entry;
import java.util.NavigableMap;
import java.util.Set;
import java.util.TreeMap;
-import javax.persistence.CascadeType;
-import javax.persistence.EmbeddedId;
-import javax.persistence.Entity;
-import javax.persistence.JoinColumn;
-import javax.persistence.JoinTable;
-import javax.persistence.ManyToMany;
-import javax.persistence.Table;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
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.AxConceptGetter;
@@ -59,28 +47,11 @@ import org.onap.policy.common.utils.validation.Assertions;
* in the container. Each task entry is checked to ensure that its key and value are not null and
* that the key matches the key in the map value. Each task entry is then validated individually.
*/
-@Entity
-@Table(name = "AxTasks")
-
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "AxTasks", namespace = "http://www.onap.org/policy/apex-pdp", propOrder = {"key", "taskMap"})
public class AxTasks extends AxConcept implements AxConceptGetter<AxTask> {
private static final long serialVersionUID = 4290442590545820316L;
- @EmbeddedId
- @XmlElement(name = "key", required = true)
private AxArtifactKey key;
-
- // @formatter:off
- @ManyToMany(cascade = CascadeType.ALL)
- @JoinTable(
- joinColumns = {@JoinColumn(name = "taskMapName", referencedColumnName = "name"),
- @JoinColumn(name = "taskMapVersion", referencedColumnName = "version")},
- inverseJoinColumns = {@JoinColumn(name = "taskName", referencedColumnName = "name"),
- @JoinColumn(name = "taskVersion", referencedColumnName = "version")})
- @XmlElement(required = true)
private Map<AxArtifactKey, AxTask> taskMap;
- // @formatter:on
/**
* The Default Constructor creates a {@link AxTasks} object with a null artifact key and creates
@@ -112,7 +83,7 @@ public class AxTasks extends AxConcept implements AxConceptGetter<AxTask> {
/**
* This Constructor creates a task container with all of its fields defined.
*
- * @param key the task container key
+ * @param key the task container key
* @param taskMap the tasks to be stored in the task container
*/
public AxTasks(final AxArtifactKey key, final Map<AxArtifactKey, AxTask> taskMap) {
@@ -126,23 +97,6 @@ public class AxTasks extends AxConcept implements AxConceptGetter<AxTask> {
}
/**
- * When a model is unmarshalled from disk or from the database, the task map is returned as a
- * raw hash map. This method is called by JAXB after unmarshaling and is used to convert the
- * hash map to a {@link NavigableMap} so that it will work with the {@link AxConceptGetter}
- * interface.
- *
- * @param unmarshaler the unmarshaler that is unmarshaling the model
- * @param parent the parent object of this object in the unmarshaler
- */
- public void afterUnmarshal(final Unmarshaller unmarshaler, final Object parent) {
- // The map must be navigable to allow name and version searching, unmarshaling returns a
- // hash map
- final NavigableMap<AxArtifactKey, AxTask> navigableTaskMap = new TreeMap<>();
- navigableTaskMap.putAll(taskMap);
- taskMap = navigableTaskMap;
- }
-
- /**
* {@inheritDoc}.
*/
@Override
@@ -165,6 +119,14 @@ public class AxTasks extends AxConcept implements AxConceptGetter<AxTask> {
}
/**
+ * {@inheritDoc}.
+ */
+ @Override
+ public void buildReferences() {
+ taskMap.values().stream().forEach(task -> task.buildReferences());
+ }
+
+ /**
* Sets the task container key.
*
* @param key the task container key
@@ -203,27 +165,27 @@ public class AxTasks extends AxConcept implements AxConceptGetter<AxTask> {
if (key.equals(AxArtifactKey.getNullKey())) {
result.addValidationMessage(
- new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key"));
+ new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key"));
}
result = key.validate(result);
if (taskMap.size() == 0) {
result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "taskMap may not be empty"));
+ "taskMap may not be empty"));
} else {
for (final Entry<AxArtifactKey, AxTask> taskEntry : taskMap.entrySet()) {
if (taskEntry.getKey().equals(AxArtifactKey.getNullKey())) {
result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "key on task entry " + taskEntry.getKey() + " may not be the null key"));
+ "key on task entry " + taskEntry.getKey() + " may not be the null key"));
} else if (taskEntry.getValue() == null) {
result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "value on task entry " + taskEntry.getKey() + " may not be null"));
+ "value on task entry " + taskEntry.getKey() + " may not be null"));
} else {
if (!taskEntry.getKey().equals(taskEntry.getValue().getKey())) {
result.addValidationMessage(new AxValidationMessage(key, this.getClass(),
- ValidationResult.INVALID, "key on task entry key " + taskEntry.getKey()
- + " does not equal task value key " + taskEntry.getValue().getKey()));
+ ValidationResult.INVALID, "key on task entry key " + taskEntry.getKey()
+ + " does not equal task value key " + taskEntry.getValue().getKey()));
}
result = taskEntry.getValue().validate(result);
@@ -367,7 +329,7 @@ public class AxTasks extends AxConcept implements AxConceptGetter<AxTask> {
@Override
public AxTask get(final String conceptKeyName, final String conceptKeyVersion) {
return new AxConceptGetterImpl<>((NavigableMap<AxArtifactKey, AxTask>) taskMap).get(conceptKeyName,
- conceptKeyVersion);
+ conceptKeyVersion);
}
/**
@@ -384,6 +346,6 @@ public class AxTasks extends AxConcept implements AxConceptGetter<AxTask> {
@Override
public Set<AxTask> getAll(final String conceptKeyName, final String conceptKeyVersion) {
return new AxConceptGetterImpl<>((NavigableMap<AxArtifactKey, AxTask>) taskMap).getAll(conceptKeyName,
- conceptKeyVersion);
+ conceptKeyVersion);
}
}
diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/package-info.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/package-info.java
index cc15a6af5..acf0e8221 100644
--- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/package-info.java
+++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/package-info.java
@@ -1,19 +1,20 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2022 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* 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=========================================================
*/
@@ -21,15 +22,7 @@
/**
* Contains the concepts required to specify policies and tasks in APEX. It defines the main Apex
* concepts of policies and tasks.
- *
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
-
-@XmlSchema(namespace = "http://www.onap.org/policy/apex-pdp", elementFormDefault = XmlNsForm.QUALIFIED,
- xmlns = {@XmlNs(namespaceURI = "http://www.onap.org/policy/apex-pdp", prefix = "")})
-
package org.onap.policy.apex.model.policymodel.concepts;
-
-import javax.xml.bind.annotation.XmlNs;
-import javax.xml.bind.annotation.XmlNsForm;
-import javax.xml.bind.annotation.XmlSchema;
diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/EmptyAlbumsAdapter.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/EmptyAlbumsAdapter.java
deleted file mode 100644
index aa19edf0b..000000000
--- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/handling/EmptyAlbumsAdapter.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.model.policymodel.handling;
-
-import javax.xml.bind.annotation.adapters.XmlAdapter;
-import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbums;
-import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
-
-/**
- * This class makes the albums field optional in marshaled Policy Models.
- * Empty albums are not marshaled to JSON/XML.
- * When unmarshaled, if no albums value is present then a new empty albums entry is created.
- *
- * @author John Keeney (john.keeney@ericsson.com)
- */
-public class EmptyAlbumsAdapter extends XmlAdapter<AxContextAlbums, AxContextAlbums> {
-
-
- /**
- * Decide whether to marshall a context albums entry. Non-empty context albums are always marshalled.
- * Empty albums are filtered.
- *
- * @param albums the albums entry
- * @return the albums entry, or null if empty
- * @throws Exception if there is a problem with the marshalling
- * @see javax.xml.bind.annotation.adapters.XmlAdapter#marshal(Object)
- */
- @Override
- public AxContextAlbums marshal(AxContextAlbums albums) throws Exception {
- if ((albums == null) || (albums.getAlbumsMap() == null) || (albums.getAlbumsMap().isEmpty())) {
- return null;
- } else {
- return albums;
- }
- }
-
- /**
- * Decide whether to unmarshall a context albums entry - Always.
- *
- * @param val the albums entry
- * @return the albums entry
- * @throws Exception if there is a problem with the unmarshalling
- * @see javax.xml.bind.annotation.adapters.XmlAdapter#unmarshal(Object)
- */
- @Override
- public AxContextAlbums unmarshal(AxContextAlbums val) throws Exception {
- return val;
- }
-
- /**
- * After unmarshalling has completed the model's context albums entry may be null/empty or default.
- * If so the key for the albums entry should updated to a sensible value and additional keyinfo
- * information should then be added for that key
- *
- * @param policyModel the policy model containing the possibly empty context albums entry
- * @see javax.xml.bind.annotation.adapters.XmlAdapter#unmarshal(Object)
- */
- public void doAfterUnmarshal(AxPolicyModel policyModel) {
- AxArtifactKey nullkey = new AxArtifactKey();
- AxArtifactKey blanknullalbumskey =
- new AxArtifactKey(nullkey.getKey().getName() + "_Albums", nullkey.getKey().getVersion());
- AxArtifactKey thisalbumskey = policyModel.getAlbums().getKey();
- AxArtifactKey thismodelkey = policyModel.getKey();
- AxContextAlbums thismodelalbums = policyModel.getAlbums();
-
- if (nullkey.equals(thisalbumskey) || blanknullalbumskey.equals(thisalbumskey)) {
- thismodelalbums.setKey(new AxArtifactKey(thismodelkey.getName() + "_Albums", thismodelkey.getVersion()));
- policyModel.getKeyInformation().generateKeyInfo(thismodelalbums);
- }
- }
-
-}
diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/PoliciesTest.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/PoliciesTest.java
index e724a4663..526f5a628 100644
--- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/PoliciesTest.java
+++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/PoliciesTest.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019-2020 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2020,2022 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -190,9 +190,9 @@ public class PoliciesTest {
final AxState clonedState = new AxState(policyPN.getStateMap().get("state"));
clonedState.getKey().setLocalName("ClonedState");
- clonedState.afterUnmarshal(null, null);
savedStateMap.put(clonedState.getKey().getLocalName(), clonedState);
+ policyPN.buildReferences();
result = new AxValidationResult();
result = policyPN.validate(result);
assertEquals(ValidationResult.WARNING, result.getValidationResult());
@@ -213,7 +213,9 @@ public class PoliciesTest {
assertEquals(policyPN, policyPN); // NOSONAR
assertEquals(policyPN, clonedPolicy);
assertNotNull(policyPN);
- assertNotEquals(policyPN, (Object) "Hello");
+
+ Object helloObj = "Hello";
+ assertNotEquals(policyPN, helloObj);
assertNotEquals(policyPN,
new AxPolicy(AxArtifactKey.getNullKey(), savedTemplate, savedStateMap, savedFirstState));
assertNotEquals(policyPN, new AxPolicy(savedPolicyKey, "SomeTemplate", savedStateMap, savedFirstState));
@@ -287,7 +289,6 @@ public class PoliciesTest {
assertEquals(ValidationResult.VALID, result.getValidationResult());
policies.clean();
- policies.afterUnmarshal(null, null);
final AxPolicies clonedPolicies = new AxPolicies(policies);
assertEquals("AxPolicies:(key=AxArtifactKey:(name=PoliciesKey,version=0.0.",
@@ -298,7 +299,7 @@ public class PoliciesTest {
assertEquals(policies, policies); // NOSONAR
assertEquals(policies, clonedPolicies);
assertNotNull(policies);
- assertNotEquals(policies, (Object) "Hello");
+ assertNotEquals(policyPN, helloObj);
assertNotEquals(policies, new AxPolicies(new AxArtifactKey()));
assertEquals(0, policies.compareTo(policies));
@@ -324,7 +325,6 @@ public class PoliciesTest {
final AxState secondState = new AxState(policyPN.getStateMap().get("state"));
secondState.getKey().setLocalName("SecondState");
- secondState.afterUnmarshal(null, null);
policyPN.getStateMap().put("SecondState", secondState);
policyPN.getStateMap().get("state").getStateOutputs().get("stateOutput0").setNextState(secondState.getKey());
@@ -344,7 +344,6 @@ public class PoliciesTest {
final AxState thirdState = new AxState(policyPN.getStateMap().get("state"));
thirdState.getKey().setLocalName("ThirdState");
- thirdState.afterUnmarshal(null, null);
policyPN.getStateMap().put("ThirdState", thirdState);
policyPN.getStateMap().get("SecondState").getStateOutputs().get("stateOutput0")
.setNextState(thirdState.getKey());
diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/StateTest.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/StateTest.java
index 95a91325a..7fbe78078 100644
--- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/StateTest.java
+++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/StateTest.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2020 Nordix Foundation
+ * Modifications Copyright (C) 2020,2022 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -147,10 +147,10 @@ public class StateTest {
state.setTaskReferences(trMap);
assertEquals(trMap, state.getTaskReferences());
- state.afterUnmarshal(null, null);
+ state.buildReferences();
assertEquals(state.getKey(), state.getKeys().get(0));
state.getTaskSelectionLogic().getKey().setLocalName(AxKey.NULL_KEY_NAME);
- state.afterUnmarshal(null, null);
+ state.buildReferences();
assertEquals(state.getKey(), state.getKeys().get(0));
final Set<String> stateSet = state.getNextStateSet();
@@ -387,7 +387,9 @@ public class StateTest {
assertEquals(state, state); // NOSONAR
assertEquals(state, clonedState);
assertNotNull(state);
- assertNotEquals(state, (Object) "Hello");
+
+ Object helloObj = "Hello";
+ assertNotEquals(state, helloObj);
assertNotEquals(state, new AxState(new AxStateParamsBuilder().key(new AxReferenceKey()).trigger(triggerKey)
.stateOutputs(soMap).contextAlbumReferenceSet(ctxtSet).taskSelectionLogic(tsl)
.stateFinalizerLogicMap(sflMap).defaultTask(defTaskKey).taskReferenceMap(trMap)));
diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TasksTest.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TasksTest.java
index 89dc9a048..9c7866c85 100644
--- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TasksTest.java
+++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/concepts/TasksTest.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019-2020 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2020,2022 Nordix Foundation.
* Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -85,7 +85,7 @@ public class TasksTest {
assertEquals("TaskName:0.0.1", task.getKey().getId());
assertEquals("TaskName:0.0.1", task.getKeys().get(0).getId());
- task.afterUnmarshal(null, null);
+ task.buildReferences();
assertEquals(1, task.getTaskParameters().size());
AxValidationResult result = new AxValidationResult();
@@ -154,7 +154,9 @@ public class TasksTest {
assertEquals(task, task); // NOSONAR
assertEquals(task, clonedTask);
assertNotNull(task);
- assertNotEquals(task, (Object) "Hello");
+
+ Object helloObj = "Hello";
+ assertNotEquals(task, helloObj);
assertNotEquals(task, new AxTask(new AxArtifactKey(), tpMap, ctxtSet, tl));
assertEquals(task, new AxTask(taskKey, tpMap, ctxtSet, tl));
assertNotEquals(task, new AxTask(taskKey, tpEmptyMap, ctxtSet, tl));
@@ -224,7 +226,6 @@ public class TasksTest {
assertEquals(ValidationResult.VALID, result.getValidationResult());
tasks.clean();
- tasks.afterUnmarshal(null, null);
final AxTasks clonedTasks = new AxTasks(tasks);
assertEquals("AxTasks:(key=AxArtifactKey:(name=TasksKey,version=0.0.1),tas",
@@ -236,7 +237,7 @@ public class TasksTest {
assertEquals(tasks, tasks); // NOSONAR
assertEquals(tasks, clonedTasks);
assertNotNull(tasks);
- assertNotEquals(tasks, (Object) "Hello");
+ assertNotEquals(tasks, helloObj);
assertNotEquals(tasks, new AxTasks(new AxArtifactKey()));
assertEquals(0, tasks.compareTo(tasks));
diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/ApexPolicyModelTest.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/ApexPolicyModelTest.java
index 3e3051021..48e4f87f9 100644
--- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/ApexPolicyModelTest.java
+++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/ApexPolicyModelTest.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2020 Nordix Foundation.
+ * Modifications Copyright (C) 2020,2022 Nordix Foundation.
* Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -27,72 +27,10 @@ import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Test;
import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
-import org.onap.policy.apex.model.basicmodel.dao.DaoParameters;
import org.onap.policy.apex.model.basicmodel.test.TestApexModel;
import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
public class ApexPolicyModelTest {
- TestApexModel<AxPolicyModel> testApexModel;
-
- /**
- * Set up the policy model tests.
- *
- * @throws Exception on setup errors
- */
- @Before
- public void setup() throws Exception {
- testApexModel = new TestApexModel<AxPolicyModel>(AxPolicyModel.class, new SupportApexPolicyModelCreator());
- }
-
- @Test
- public void testModelValid() throws Exception {
- final AxValidationResult result = testApexModel.testApexModelValid();
- assertEquals(VALID_MODEL_STRING, result.toString());
- }
-
- @Test
- public void testApexModelVaidateObservation() throws Exception {
- final AxValidationResult result = testApexModel.testApexModelVaidateObservation();
- assertEquals(OBSERVATION_MODEL_STRING, result.toString());
- }
-
- @Test
- public void testApexModelVaidateWarning() throws Exception {
- final AxValidationResult result = testApexModel.testApexModelVaidateWarning();
- assertEquals(WARNING_MODEL_STRING, result.toString());
- }
-
- @Test
- public void testModelVaidateInvalidModel() throws Exception {
- final AxValidationResult result = testApexModel.testApexModelVaidateInvalidModel();
- assertEquals(INVALID_MODEL_STRING, result.toString());
- }
-
- @Test
- public void testModelVaidateMalstructured() throws Exception {
- final AxValidationResult result = testApexModel.testApexModelVaidateMalstructured();
- assertEquals(INVALID_MODEL_MALSTRUCTURED_STRING, result.toString());
- }
-
- @Test
- public void testModelWriteReadXml() throws Exception {
- testApexModel.testApexModelWriteReadXml();
- }
-
- @Test
- public void testModelWriteReadJson() throws Exception {
- testApexModel.testApexModelWriteReadJson();
- }
-
- @Test
- public void testModelWriteReadJpa() throws Exception {
- final DaoParameters DaoParameters = new DaoParameters();
- DaoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao");
- DaoParameters.setPersistenceUnit("DAOTest");
-
- testApexModel.testApexModelWriteReadJpa(DaoParameters);
- }
-
private static final String VALID_MODEL_STRING = "***validation of model successful***";
private static final String OBSERVATION_MODEL_STRING = "\n"
@@ -150,4 +88,51 @@ public class ApexPolicyModelTest {
+ "AxArtifactKey:(name=policyModel_Policies,version=0.0.1)"
+ ":org.onap.policy.apex.model.policymodel.concepts.AxPolicies:INVALID:policyMap may not be empty\n"
+ "********************************";
+
+ TestApexModel<AxPolicyModel> testApexModel;
+
+ /**
+ * Set up the policy model tests.
+ *
+ * @throws Exception on setup errors
+ */
+ @Before
+ public void setup() throws Exception {
+ testApexModel = new TestApexModel<AxPolicyModel>(AxPolicyModel.class, new SupportApexPolicyModelCreator());
+ }
+
+ @Test
+ public void testModelValid() throws Exception {
+ final AxValidationResult result = testApexModel.testApexModelValid();
+ assertEquals(VALID_MODEL_STRING, result.toString());
+ }
+
+ @Test
+ public void testApexModelVaidateObservation() throws Exception {
+ final AxValidationResult result = testApexModel.testApexModelVaidateObservation();
+ assertEquals(OBSERVATION_MODEL_STRING, result.toString());
+ }
+
+ @Test
+ public void testApexModelVaidateWarning() throws Exception {
+ final AxValidationResult result = testApexModel.testApexModelVaidateWarning();
+ assertEquals(WARNING_MODEL_STRING, result.toString());
+ }
+
+ @Test
+ public void testModelVaidateInvalidModel() throws Exception {
+ final AxValidationResult result = testApexModel.testApexModelVaidateInvalidModel();
+ assertEquals(INVALID_MODEL_STRING, result.toString());
+ }
+
+ @Test
+ public void testModelVaidateMalstructured() throws Exception {
+ final AxValidationResult result = testApexModel.testApexModelVaidateMalstructured();
+ assertEquals(INVALID_MODEL_MALSTRUCTURED_STRING, result.toString());
+ }
+
+ @Test
+ public void testModelWriteReadJson() throws Exception {
+ testApexModel.testApexModelWriteReadJson();
+ }
}
diff --git a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelComparerTest.java b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelComparerTest.java
index 0a1e80a20..691880d6b 100644
--- a/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelComparerTest.java
+++ b/model/policy-model/src/test/java/org/onap/policy/apex/model/policymodel/handling/PolicyModelComparerTest.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2020 Nordix Foundation.
+ * Modifications Copyright (C) 2020,2022 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -43,66 +43,58 @@ public class PolicyModelComparerTest {
String resultString = policyModelComparer.asString(false, false);
String checkString = TextFileUtils
- .getTextFileAsString("src/test/resources/checkFiles/PolicyModelComparisonIdenticalVerboseValues.txt");
- assertEquals(resultString.trim().replaceAll("\\s+", ""),
- checkString.trim().replaceAll("\\s+", ""));
+ .getTextFileAsString("src/test/resources/checkFiles/PolicyModelComparisonIdenticalVerboseValues.txt");
+ assertEquals(resultString.trim().replaceAll("\\s+", ""), checkString.trim().replaceAll("\\s+", ""));
resultString = policyModelComparer.asString(false, true);
checkString = TextFileUtils
- .getTextFileAsString("src/test/resources/checkFiles/PolicyModelComparisonIdenticalVerboseKeys.txt");
- assertEquals(checkString.trim().replaceAll("\\s+", ""),
- resultString.trim().replaceAll("\\s+", ""));
+ .getTextFileAsString("src/test/resources/checkFiles/PolicyModelComparisonIdenticalVerboseKeys.txt");
+ assertEquals(checkString.trim().replaceAll("\\s+", ""), resultString.trim().replaceAll("\\s+", ""));
resultString = policyModelComparer.asString(true, false);
- checkString = TextFileUtils
- .getTextFileAsString("src/test/resources/checkFiles/PolicyModelComparisonIdenticalTerse.txt");
- assertEquals(checkString.trim().replaceAll("\\s+", ""),
- resultString.trim().replaceAll("\\s+", ""));
+ checkString =
+ TextFileUtils.getTextFileAsString("src/test/resources/checkFiles/PolicyModelComparisonIdenticalTerse.txt");
+ assertEquals(checkString.trim().replaceAll("\\s+", ""), resultString.trim().replaceAll("\\s+", ""));
resultString = policyModelComparer.asString(true, true);
- checkString = TextFileUtils
- .getTextFileAsString("src/test/resources/checkFiles/PolicyModelComparisonIdenticalTerse.txt");
- assertEquals(checkString.trim().replaceAll("\\s+", ""),
- resultString.trim().replaceAll("\\s+", ""));
+ checkString =
+ TextFileUtils.getTextFileAsString("src/test/resources/checkFiles/PolicyModelComparisonIdenticalTerse.txt");
+ assertEquals(checkString.trim().replaceAll("\\s+", ""), resultString.trim().replaceAll("\\s+", ""));
final AxKeyInfo leftOnlyKeyInfo = new AxKeyInfo(new AxArtifactKey("LeftOnlyKeyInfo", "0.0.1"),
- UUID.fromString("ce9168c-e6df-414f-9646-6da464b6f000"), "Left only key info");
+ UUID.fromString("ce9168c-e6df-414f-9646-6da464b6f000"), "Left only key info");
final AxKeyInfo rightOnlyKeyInfo = new AxKeyInfo(new AxArtifactKey("RightOnlyKeyInfo", "0.0.1"),
- UUID.fromString("ce9168c-e6df-414f-9646-6da464b6f001"), "Right only key info");
+ UUID.fromString("ce9168c-e6df-414f-9646-6da464b6f001"), "Right only key info");
leftApexModel.getKeyInformation().getKeyInfoMap().put(leftOnlyKeyInfo.getKey(), leftOnlyKeyInfo);
rightApexModel.getKeyInformation().getKeyInfoMap().put(rightOnlyKeyInfo.getKey(), rightOnlyKeyInfo);
leftApexModel.getKeyInformation().getKeyInfoMap().get(new AxArtifactKey("inEvent", "0.0.1"))
- .setDescription("Left InEvent Description");
+ .setDescription("Left InEvent Description");
rightApexModel.getKeyInformation().getKeyInfoMap().get(new AxArtifactKey("inEvent", "0.0.1"))
- .setDescription("Right InEvent Description");
+ .setDescription("Right InEvent Description");
policyModelComparer = new PolicyModelComparer(leftApexModel, rightApexModel);
resultString = policyModelComparer.asString(false, false);
checkString = TextFileUtils
- .getTextFileAsString("src/test/resources/checkFiles/PolicyModelComparisonDifferentVerboseValues.txt");
- assertEquals(resultString.trim().replaceAll("\\s+", ""),
- checkString.trim().replaceAll("\\s+", ""));
+ .getTextFileAsString("src/test/resources/checkFiles/PolicyModelComparisonDifferentVerboseValues.txt");
+ assertEquals(resultString.trim().replaceAll("\\s+", ""), checkString.trim().replaceAll("\\s+", ""));
resultString = policyModelComparer.asString(false, true);
checkString = TextFileUtils
- .getTextFileAsString("src/test/resources/checkFiles/PolicyModelComparisonDifferentVerboseKeys.txt");
- assertEquals(checkString.trim().replaceAll("\\s+", ""),
- resultString.trim().replaceAll("\\s+", ""));
+ .getTextFileAsString("src/test/resources/checkFiles/PolicyModelComparisonDifferentVerboseKeys.txt");
+ assertEquals(checkString.trim().replaceAll("\\s+", ""), resultString.trim().replaceAll("\\s+", ""));
resultString = policyModelComparer.asString(true, false);
checkString = TextFileUtils
- .getTextFileAsString("src/test/resources/checkFiles/PolicyModelComparisonDifferentTerseValues.txt");
- assertEquals(checkString.trim().replaceAll("\\s+", ""),
- resultString.trim().replaceAll("\\s+", ""));
+ .getTextFileAsString("src/test/resources/checkFiles/PolicyModelComparisonDifferentTerseValues.txt");
+ assertEquals(checkString.trim().replaceAll("\\s+", ""), resultString.trim().replaceAll("\\s+", ""));
resultString = policyModelComparer.asString(true, true);
checkString = TextFileUtils
- .getTextFileAsString("src/test/resources/checkFiles/PolicyModelComparisonDifferentTerseKeys.txt");
- assertEquals(checkString.trim().replaceAll("\\s+", ""),
- resultString.trim().replaceAll("\\s+", ""));
+ .getTextFileAsString("src/test/resources/checkFiles/PolicyModelComparisonDifferentTerseKeys.txt");
+ assertEquals(checkString.trim().replaceAll("\\s+", ""), resultString.trim().replaceAll("\\s+", ""));
assertNotNull(policyModelComparer.getContextAlbumComparisonResult());
assertNotNull(policyModelComparer.getContextAlbumKeyDifference());
@@ -121,6 +113,6 @@ public class PolicyModelComparerTest {
assertNotNull(new PolicyComparer().compare(leftApexModel.getPolicies(), rightApexModel.getPolicies()));
assertEquals("****** policy map differences ******\n*** context s",
- policyModelComparer.toString().substring(0, 50));
+ policyModelComparer.toString().substring(0, 50));
}
}
diff --git a/model/policy-model/src/test/resources/META-INF/persistence.xml b/model/policy-model/src/test/resources/META-INF/persistence.xml
deleted file mode 100644
index 0eee729a1..000000000
--- a/model/policy-model/src/test/resources/META-INF/persistence.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ============LICENSE_START=======================================================
- Copyright (C) 2016-2018 Ericsson. All rights reserved.
- ================================================================================
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
- SPDX-License-Identifier: Apache-2.0
- ============LICENSE_END=========================================================
--->
-
-<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">
- <persistence-unit name="DAOTest" transaction-type="RESOURCE_LOCAL">
- <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
-
- <class>org.onap.policy.apex.model.basicmodel.dao.converters.CDataConditioner</class>
- <class>org.onap.policy.apex.model.basicmodel.dao.converters.Uuid2String</class>
- <class>org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey</class>
- <class>org.onap.policy.apex.model.basicmodel.concepts.AxConcept</class>
- <class>org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo</class>
- <class>org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation</class>
- <class>org.onap.policy.apex.model.basicmodel.concepts.AxModel</class>
- <class>org.onap.policy.apex.model.basicmodel.concepts.TestEntity</class>
- <class>org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema</class>
- <class>org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas</class>
- <class>org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum</class>
- <class>org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbums</class>
- <class>org.onap.policy.apex.model.contextmodel.concepts.AxContextModel</class>
- <class>org.onap.policy.apex.model.eventmodel.concepts.AxField</class>
- <class>org.onap.policy.apex.model.eventmodel.concepts.AxInputField</class>
- <class>org.onap.policy.apex.model.eventmodel.concepts.AxOutputField</class>
- <class>org.onap.policy.apex.model.eventmodel.concepts.AxEvent</class>
- <class>org.onap.policy.apex.model.eventmodel.concepts.AxEvents</class>
- <class>org.onap.policy.apex.model.eventmodel.concepts.AxEventModel</class>
- <class>org.onap.policy.apex.model.policymodel.concepts.AxLogic</class>
- <class>org.onap.policy.apex.model.policymodel.concepts.AxTaskParameter</class>
- <class>org.onap.policy.apex.model.policymodel.concepts.AxTaskLogic</class>
- <class>org.onap.policy.apex.model.policymodel.concepts.AxTask</class>
- <class>org.onap.policy.apex.model.policymodel.concepts.AxTasks</class>
- <class>org.onap.policy.apex.model.policymodel.concepts.AxTaskSelectionLogic</class>
- <class>org.onap.policy.apex.model.policymodel.concepts.AxStateFinalizerLogic</class>
- <class>org.onap.policy.apex.model.policymodel.concepts.AxStateOutput</class>
- <class>org.onap.policy.apex.model.policymodel.concepts.AxStateTaskReference</class>
- <class>org.onap.policy.apex.model.policymodel.concepts.AxState</class>
- <class>org.onap.policy.apex.model.policymodel.concepts.AxPolicy</class>
- <class>org.onap.policy.apex.model.policymodel.concepts.AxPolicies</class>
- <class>org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel</class>
-
- <properties>
- <property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:testdb" />
- <property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
- <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
- <property name="eclipselink.ddl-generation.output-mode" value="database" />
- <property name="eclipselink.logging.level" value="INFO" />
- </properties>
- </persistence-unit>
-</persistence>
diff --git a/model/policy-model/src/test/resources/checkFiles/PolicyModelComparisonDifferentTerseKeys.txt b/model/policy-model/src/test/resources/checkFiles/PolicyModelComparisonDifferentTerseKeys.txt
index 57b790222..4d00394b7 100644
--- a/model/policy-model/src/test/resources/checkFiles/PolicyModelComparisonDifferentTerseKeys.txt
+++ b/model/policy-model/src/test/resources/checkFiles/PolicyModelComparisonDifferentTerseKeys.txt
@@ -9,7 +9,4 @@
key=AxArtifactKey:(name=LeftOnlyKeyInfo,version=0.0.1)
*** list of keys on right only
key=AxArtifactKey:(name=RightOnlyKeyInfo,version=0.0.1)
-*** list of differing entries between left and right
-key=AxArtifactKey:(name=inEvent,version=0.0.1)
***********************************
-
diff --git a/model/policy-model/src/test/resources/checkFiles/PolicyModelComparisonDifferentTerseValues.txt b/model/policy-model/src/test/resources/checkFiles/PolicyModelComparisonDifferentTerseValues.txt
index e3ba6dc7c..82fecd990 100644
--- a/model/policy-model/src/test/resources/checkFiles/PolicyModelComparisonDifferentTerseValues.txt
+++ b/model/policy-model/src/test/resources/checkFiles/PolicyModelComparisonDifferentTerseValues.txt
@@ -9,6 +9,4 @@
key=AxArtifactKey:(name=LeftOnlyKeyInfo,version=0.0.1),value=AxKeyInfo:(artifactId=AxArtifactKey:(name=LeftOnlyKeyInfo,version=0.0.1),uuid=0ce9168c-e6df-414f-9646-6da464b6f000,description=Left only key info)
*** list of keys on right only
key=AxArtifactKey:(name=RightOnlyKeyInfo,version=0.0.1),value=AxKeyInfo:(artifactId=AxArtifactKey:(name=RightOnlyKeyInfo,version=0.0.1),uuid=0ce9168c-e6df-414f-9646-6da464b6f001,description=Right only key info)
-*** list of differing entries between left and right
-key=AxArtifactKey:(name=inEvent,version=0.0.1),values={AxKeyInfo:(artifactId=AxArtifactKey:(name=inEvent,version=0.0.1),uuid=0ce9168c-e6df-414f-9646-6da464b6e011,description=Left InEvent Description)AxKeyInfo:(artifactId=AxArtifactKey:(name=inEvent,version=0.0.1),uuid=0ce9168c-e6df-414f-9646-6da464b6e011,description=Right InEvent Description),}
***********************************
diff --git a/model/policy-model/src/test/resources/checkFiles/PolicyModelComparisonDifferentVerboseKeys.txt b/model/policy-model/src/test/resources/checkFiles/PolicyModelComparisonDifferentVerboseKeys.txt
index 926a8d764..38623c32a 100644
--- a/model/policy-model/src/test/resources/checkFiles/PolicyModelComparisonDifferentVerboseKeys.txt
+++ b/model/policy-model/src/test/resources/checkFiles/PolicyModelComparisonDifferentVerboseKeys.txt
@@ -47,8 +47,7 @@ left key AxArtifactKey:(name=PolicyModel,version=0.0.1) equals right key AxArtif
key=AxArtifactKey:(name=LeftOnlyKeyInfo,version=0.0.1)
*** list of keys on right only
key=AxArtifactKey:(name=RightOnlyKeyInfo,version=0.0.1)
-*** list of differing entries between left and right
-key=AxArtifactKey:(name=inEvent,version=0.0.1)
+*** all values in left and right are identical
*** list of identical entries in left and right
key=AxArtifactKey:(name=ContextSchemas,version=0.0.1)
key=AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1)
@@ -61,11 +60,11 @@ key=AxArtifactKey:(name=contextAlbum1,version=0.0.1)
key=AxArtifactKey:(name=eventContextItem0,version=0.0.1)
key=AxArtifactKey:(name=eventContextItem1,version=0.0.1)
key=AxArtifactKey:(name=events,version=0.0.1)
+key=AxArtifactKey:(name=inEvent,version=0.0.1)
key=AxArtifactKey:(name=outEvent0,version=0.0.1)
key=AxArtifactKey:(name=outEvent1,version=0.0.1)
key=AxArtifactKey:(name=policies,version=0.0.1)
key=AxArtifactKey:(name=policy,version=0.0.1)
key=AxArtifactKey:(name=task,version=0.0.1)
key=AxArtifactKey:(name=tasks,version=0.0.1)
-***********************************
-
+*********************************** \ 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 77d17f679..53cadd979 100644
--- a/model/policy-model/src/test/resources/checkFiles/PolicyModelComparisonDifferentVerboseValues.txt
+++ b/model/policy-model/src/test/resources/checkFiles/PolicyModelComparisonDifferentVerboseValues.txt
@@ -6,10 +6,10 @@ 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=MapType,version=0.0.1),value=AxContextSchema(key=AxArtifactKey:(name=MapType,version=0.0.1),schemaFlavour=Java,schemaDefinition=org.onap.policy.apex.model.policymodel.concepts.TestContextItem00A)
-key=AxArtifactKey:(name=StringType,version=0.0.1),value=AxContextSchema(key=AxArtifactKey:(name=StringType,version=0.0.1),schemaFlavour=Java,schemaDefinition=org.onap.policy.apex.model.policymodel.concepts.TestContextItem000)
-key=AxArtifactKey:(name=eventContextItem0,version=0.0.1),value=AxContextSchema(key=AxArtifactKey:(name=eventContextItem0,version=0.0.1),schemaFlavour=Java,schemaDefinition=java.lang.String)
-key=AxArtifactKey:(name=eventContextItem1,version=0.0.1),value=AxContextSchema(key=AxArtifactKey:(name=eventContextItem1,version=0.0.1),schemaFlavour=Java,schemaDefinition=java.lang.Long)
+key=AxArtifactKey:(name=MapType,version=0.0.1),value=AxContextSchema(key=AxArtifactKey:(name=MapType,version=0.0.1), schemaFlavour=Java, schemaDefinition=org.onap.policy.apex.model.policymodel.concepts.TestContextItem00A)
+key=AxArtifactKey:(name=StringType,version=0.0.1),value=AxContextSchema(key=AxArtifactKey:(name=StringType,version=0.0.1), schemaFlavour=Java, schemaDefinition=org.onap.policy.apex.model.policymodel.concepts.TestContextItem000)
+key=AxArtifactKey:(name=eventContextItem0,version=0.0.1),value=AxContextSchema(key=AxArtifactKey:(name=eventContextItem0,version=0.0.1), schemaFlavour=Java, schemaDefinition=java.lang.String)
+key=AxArtifactKey:(name=eventContextItem1,version=0.0.1),value=AxContextSchema(key=AxArtifactKey:(name=eventContextItem1,version=0.0.1), schemaFlavour=Java, schemaDefinition=java.lang.Long)
*** event 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
@@ -25,8 +25,8 @@ 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=contextAlbum0,version=0.0.1),value=AxContextAlbum(key=AxArtifactKey:(name=contextAlbum0,version=0.0.1),scope=APPLICATION,isWritable=true,itemSchema=AxArtifactKey:(name=MapType,version=0.0.1))
-key=AxArtifactKey:(name=contextAlbum1,version=0.0.1),value=AxContextAlbum(key=AxArtifactKey:(name=contextAlbum1,version=0.0.1),scope=GLOBAL,isWritable=false,itemSchema=AxArtifactKey:(name=StringType,version=0.0.1))
+key=AxArtifactKey:(name=contextAlbum0,version=0.0.1),value=AxContextAlbum(key=AxArtifactKey:(name=contextAlbum0,version=0.0.1), scope=APPLICATION, isWritable=true, itemSchema=AxArtifactKey:(name=MapType,version=0.0.1))
+key=AxArtifactKey:(name=contextAlbum1,version=0.0.1),value=AxContextAlbum(key=AxArtifactKey:(name=contextAlbum1,version=0.0.1), scope=GLOBAL, isWritable=false, itemSchema=AxArtifactKey:(name=StringType,version=0.0.1))
*** task 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
@@ -47,8 +47,7 @@ left key AxArtifactKey:(name=PolicyModel,version=0.0.1) equals right key AxArtif
key=AxArtifactKey:(name=LeftOnlyKeyInfo,version=0.0.1),value=AxKeyInfo:(artifactId=AxArtifactKey:(name=LeftOnlyKeyInfo,version=0.0.1),uuid=0ce9168c-e6df-414f-9646-6da464b6f000,description=Left only key info)
*** list of keys on right only
key=AxArtifactKey:(name=RightOnlyKeyInfo,version=0.0.1),value=AxKeyInfo:(artifactId=AxArtifactKey:(name=RightOnlyKeyInfo,version=0.0.1),uuid=0ce9168c-e6df-414f-9646-6da464b6f001,description=Right only key info)
-*** list of differing entries between left and right
-key=AxArtifactKey:(name=inEvent,version=0.0.1),values={AxKeyInfo:(artifactId=AxArtifactKey:(name=inEvent,version=0.0.1),uuid=0ce9168c-e6df-414f-9646-6da464b6e011,description=Left InEvent Description)AxKeyInfo:(artifactId=AxArtifactKey:(name=inEvent,version=0.0.1),uuid=0ce9168c-e6df-414f-9646-6da464b6e011,description=Right InEvent Description),}
+*** all values in left and right are identical
*** list of identical entries in left and right
key=AxArtifactKey:(name=ContextSchemas,version=0.0.1),value=AxKeyInfo:(artifactId=AxArtifactKey:(name=ContextSchemas,version=0.0.1),uuid=0ce9168c-e6df-414f-9646-6da464b6e000,description=Generated description for concept referred to by key "ContextSchemas:0.0.1")
key=AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1),value=AxKeyInfo:(artifactId=AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1),uuid=0ce9168c-e6df-414f-9646-6da464b6e001,description=Generated description for concept referred to by key "KeyInfoMapKey:0.0.1")
@@ -61,6 +60,7 @@ key=AxArtifactKey:(name=contextAlbum1,version=0.0.1),value=AxKeyInfo:(artifactId
key=AxArtifactKey:(name=eventContextItem0,version=0.0.1),value=AxKeyInfo:(artifactId=AxArtifactKey:(name=eventContextItem0,version=0.0.1),uuid=0ce9168c-e6df-414f-9646-6da464b6e008,description=Generated description for concept referred to by key "eventContextItem0:0.0.1")
key=AxArtifactKey:(name=eventContextItem1,version=0.0.1),value=AxKeyInfo:(artifactId=AxArtifactKey:(name=eventContextItem1,version=0.0.1),uuid=0ce9168c-e6df-414f-9646-6da464b6e009,description=Generated description for concept referred to by key "eventContextItem1:0.0.1")
key=AxArtifactKey:(name=events,version=0.0.1),value=AxKeyInfo:(artifactId=AxArtifactKey:(name=events,version=0.0.1),uuid=0ce9168c-e6df-414f-9646-6da464b6e010,description=Generated description for concept referred to by key "events:0.0.1")
+key=AxArtifactKey:(name=inEvent,version=0.0.1),value=AxKeyInfo:(artifactId=AxArtifactKey:(name=inEvent,version=0.0.1),uuid=0ce9168c-e6df-414f-9646-6da464b6e011,description=Left InEvent Description)
key=AxArtifactKey:(name=outEvent0,version=0.0.1),value=AxKeyInfo:(artifactId=AxArtifactKey:(name=outEvent0,version=0.0.1),uuid=0ce9168c-e6df-414f-9646-6da464b6e012,description=Generated description for concept referred to by key "outEvent0:0.0.1")
key=AxArtifactKey:(name=outEvent1,version=0.0.1),value=AxKeyInfo:(artifactId=AxArtifactKey:(name=outEvent1,version=0.0.1),uuid=0ce9168c-e6df-414f-9646-6da464b6e013,description=Generated description for concept referred to by key "outEvent1:0.0.1")
key=AxArtifactKey:(name=policies,version=0.0.1),value=AxKeyInfo:(artifactId=AxArtifactKey:(name=policies,version=0.0.1),uuid=0ce9168c-e6df-414f-9646-6da464b6e014,description=Generated description for concept referred to by key "policies:0.0.1")