summaryrefslogtreecommitdiffstats
path: root/model/event-model
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2022-02-07 17:56:44 +0000
committerliamfallon <liam.fallon@est.tech>2022-02-08 18:39:03 +0000
commit59b90519eda3b95b0cfc49b6349a591c7d0c78e2 (patch)
tree810e07f7d5cf270582264c40245372f597c713a2 /model/event-model
parentdef44b294fa00bb5470e977eef9a05e5087035f0 (diff)
Remove JAXB and XML, use GSON for JSON
This review converst apex-pdp to use GSON for JSON handling. In order to preserve backward compatibility with the JAXB format of JSON, custom handling of maps was required. Therefore, the policy-common StandardCoder could not be used. There are a lot of small changes, removing annotations from concepts and tweaking of test data. However, this cleans up the code base so it is worth doing. Issue-ID: POLICY-1820 Change-Id: I213fa64f6d7f3f1df8d10f111d9fbedbe80f9fe0 Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'model/event-model')
-rw-r--r--model/event-model/pom.xml27
-rw-r--r--model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvent.java32
-rw-r--r--model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEventModel.java13
-rw-r--r--model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvents.java35
-rw-r--r--model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxField.java18
-rw-r--r--model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxInputField.java8
-rw-r--r--model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxOutputField.java8
-rw-r--r--model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/package-info.java9
-rw-r--r--model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/EventsTest.java58
-rw-r--r--model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/ApexEventModelTest.java5
10 files changed, 47 insertions, 166 deletions
diff --git a/model/event-model/pom.xml b/model/event-model/pom.xml
index 5e5f84885..813ebb8bb 100644
--- a/model/event-model/pom.xml
+++ b/model/event-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.
@@ -36,30 +37,4 @@
<version>${project.version}</version>
</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.eventmodel.concepts.AxEventModel</argument>
- <argument>${project.build.directory}/model/xml/apex-event-model.xsd</argument>
- </arguments>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
</project>
diff --git a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvent.java b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvent.java
index 8128b3d9a..a4c0e9db1 100644
--- a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvent.java
+++ b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvent.java
@@ -23,6 +23,7 @@
package org.onap.policy.apex.model.eventmodel.concepts;
import com.google.common.base.Strings;
+import com.google.gson.annotations.SerializedName;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@@ -31,12 +32,6 @@ import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.TreeSet;
-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.apache.commons.lang3.EnumUtils;
import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
import org.onap.policy.apex.model.basicmodel.concepts.AxConcept;
@@ -69,35 +64,22 @@ import org.onap.policy.common.utils.validation.Assertions;
* is checked to ensure it matches the event parameter key on the event. Finally, the parent key of each parameter is
* checked to ensure it matches the event key.
*/
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlRootElement(name = "apexEvent", namespace = "http://www.onap.org/policy/apex-pdp")
-@XmlType(name = "AxEvent", namespace = "http://www.onap.org/policy/apex-pdp", propOrder =
- { "key", "nameSpace", "source", "target", "parameterMap", "toscaPolicyState"})
-
public class AxEvent extends AxConcept {
private static final long serialVersionUID = -1460388382582984269L;
private static final String WHITESPACE_REGEXP = "\\s+$";
/** The key of the event, unique in the Apex system. */
- @XmlElement(name = "key", required = true)
// CHECKSTYLE:OFF: checkstyle:VisibilityMonitor
protected AxArtifactKey key;
// CHECKSTYLE:ON: checkstyle:VisibilityMonitor
- @XmlElement(required = true)
private String nameSpace;
-
- @XmlElement(required = true)
private String source;
-
- @XmlElement(required = true)
private String target;
- @XmlElement(name = "parameter", required = true)
+ @SerializedName("parameter")
private Map<String, AxField> parameterMap;
-
- @XmlElement(required = false)
private String toscaPolicyState;
/**
@@ -189,14 +171,10 @@ public class AxEvent extends AxConcept {
}
/**
- * When an event is unmarshalled from disk or from the database, the parent key in the reference keys in its
- * parameter map are not set. This method is called by JAXB after unmarshaling and is used to set the parent key of
- * the {@link AxField} instances in the parameter map to be the key of the event that contains them.
- *
- * @param unmarshaler the unmarshaler that is unmarshaling the model
- * @param parent the parent object of this object in the unmarshaler
+ * {@inheritDoc}.
*/
- public void afterUnmarshal(final Unmarshaller unmarshaler, final Object parent) {
+ @Override
+ public void buildReferences() {
for (final AxField parameter : parameterMap.values()) {
parameter.getKey().setParentArtifactKey(key);
}
diff --git a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEventModel.java b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEventModel.java
index bb4307604..b91712c9d 100644
--- a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEventModel.java
+++ b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEventModel.java
@@ -23,11 +23,6 @@
package org.onap.policy.apex.model.eventmodel.concepts;
import java.util.List;
-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;
@@ -46,18 +41,10 @@ import org.onap.policy.common.utils.validation.Assertions;
* <p>Validation runs {@link AxModel} validation on the model. In addition, the {@link AxContextSchemas} and
* {@link AxEvents} validation is run on the context schemas and events in the model.
*/
-
-@XmlRootElement(name = "apexEventModel", namespace = "http://www.onap.org/policy/apex-pdp")
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "AxEventModel", namespace = "http://www.onap.org/policy/apex-pdp", propOrder = { "schemas", "events" })
-
public class AxEventModel extends AxModel {
private static final long serialVersionUID = 8800599637708309945L;
- @XmlElement(name = "schemas", required = true)
private AxContextSchemas schemas;
-
- @XmlElement(name = "events", required = true)
private AxEvents events;
/**
diff --git a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvents.java b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvents.java
index 26275a157..aac1562de 100644
--- a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvents.java
+++ b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvents.java
@@ -27,11 +27,6 @@ import java.util.Map.Entry;
import java.util.NavigableMap;
import java.util.Set;
import java.util.TreeMap;
-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;
@@ -52,17 +47,10 @@ import org.onap.policy.common.utils.validation.Assertions;
* container. Each event 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 event entry is then validated individually.
*/
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "AxEvents", namespace = "http://www.onap.org/policy/apex-pdp", propOrder =
- { "key", "eventMap" })
-
public class AxEvents extends AxConcept implements AxConceptGetter<AxEvent> {
private static final long serialVersionUID = 4290442590545820316L;
- @XmlElement(name = "key", required = true)
private AxArtifactKey key;
-
- @XmlElement(required = true)
private Map<AxArtifactKey, AxEvent> eventMap;
/**
@@ -108,21 +96,6 @@ public class AxEvents extends AxConcept implements AxConceptGetter<AxEvent> {
}
/**
- * When a model is unmarshalled from disk or from the database, the event 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, AxEvent> navigableEventMap = new TreeMap<>();
- navigableEventMap.putAll(eventMap);
- eventMap = navigableEventMap;
- }
-
- /**
* {@inheritDoc}.
*/
@Override
@@ -145,6 +118,14 @@ public class AxEvents extends AxConcept implements AxConceptGetter<AxEvent> {
}
/**
+ * {@inheritDoc}.
+ */
+ @Override
+ public void buildReferences() {
+ eventMap.values().stream().forEach(event -> event.buildReferences());
+ }
+
+ /**
* Sets the key of the event container.
*
* @param key the event container key
diff --git a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxField.java b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxField.java
index 9f98a6253..26511c9d1 100644
--- a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxField.java
+++ b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxField.java
@@ -23,12 +23,6 @@
package org.onap.policy.apex.model.eventmodel.concepts;
import java.util.List;
-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;
@@ -37,7 +31,6 @@ 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.xml.AxReferenceKeyAdapter;
import org.onap.policy.common.utils.validation.Assertions;
/**
@@ -50,11 +43,6 @@ import org.onap.policy.common.utils.validation.Assertions;
*
* <p>Validation checks that the field key and the field schema reference key are not null.
*/
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlRootElement(name = "apexField", namespace = "http://www.onap.org/policy/apex-pdp")
-@XmlType(name = "AxField", namespace = "http://www.onap.org/policy/apex-pdp", propOrder =
- { "key", "fieldSchemaKey", "optional" })
-
public class AxField extends AxConcept {
private static final String KEY_MAY_NOT_BE_NULL = "key may not be null";
private static final String FIELD_SCHEMA_KEY_MAY_NOT_BE_NULL = "fieldSchemaKey may not be null";
@@ -64,14 +52,8 @@ public class AxField extends AxConcept {
private static final int HASH_PRIME_0 = 1231;
private static final int HASH_PRIME_1 = 1237;
- @XmlElement(name = "key", required = true)
- @XmlJavaTypeAdapter(AxReferenceKeyAdapter.class)
private AxReferenceKey key;
-
- @XmlElement(required = true)
private AxArtifactKey fieldSchemaKey;
-
- @XmlElement(required = false)
private boolean optional;
/**
diff --git a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxInputField.java b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxInputField.java
index 2626e8b25..6155c7186 100644
--- a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxInputField.java
+++ b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxInputField.java
@@ -21,20 +21,12 @@
package org.onap.policy.apex.model.eventmodel.concepts;
-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 specializes the {@link AxField} class for use as input fields on events.
*/
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlRootElement(name = "apexInputField", namespace = "http://www.onap.org/policy/apex-pdp")
-@XmlType(name = "AxInputField", namespace = "http://www.onap.org/policy/apex-pdp")
-
public class AxInputField extends AxField {
private static final long serialVersionUID = 2090324845463750391L;
diff --git a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxOutputField.java b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxOutputField.java
index a3e835202..7f3437617 100644
--- a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxOutputField.java
+++ b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxOutputField.java
@@ -21,20 +21,12 @@
package org.onap.policy.apex.model.eventmodel.concepts;
-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 specializes the {@link AxField} class for use as output fields on events.
*/
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlRootElement(name = "apexOutputField", namespace = "http://www.onap.org/policy/apex-pdp")
-@XmlType(name = "AxOutputField", namespace = "http://www.onap.org/policy/apex-pdp")
-
public class AxOutputField extends AxField {
private static final long serialVersionUID = 2090324845463750391L;
diff --git a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/package-info.java b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/package-info.java
index 7b20b3939..414d22d0e 100644
--- a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/package-info.java
+++ b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/package-info.java
@@ -1,6 +1,7 @@
/*-
* ============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.
@@ -23,12 +24,4 @@
*
* @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.eventmodel.concepts;
-
-import javax.xml.bind.annotation.XmlNs;
-import javax.xml.bind.annotation.XmlNsForm;
-import javax.xml.bind.annotation.XmlSchema;
diff --git a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/EventsTest.java b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/EventsTest.java
index 111d27f70..7062fcb3c 100644
--- a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/EventsTest.java
+++ b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/EventsTest.java
@@ -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) 2022 Bell Canada.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -39,6 +39,7 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.Validat
/**
* Test events.
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public class EventsTest {
@@ -78,20 +79,20 @@ public class EventsTest {
assertEquals(AxToscaPolicyProcessingStatus.ENTRY.name(), event.getToscaPolicyState());
final AxField eventField =
- new AxField(new AxReferenceKey(eventKey, "Field0"), new AxArtifactKey("Field0Schema", "0.0.1"));
+ new AxField(new AxReferenceKey(eventKey, "Field0"), new AxArtifactKey("Field0Schema", "0.0.1"));
event.getParameterMap().put(eventField.getKey().getLocalName(), eventField);
assertEquals(1, event.getParameterMap().size());
final AxField eventFieldBadParent =
- new AxField(new AxReferenceKey(new AxArtifactKey("OtherEvent", "0.0.01"), "Field0"),
- new AxArtifactKey("Field0Schema", "0.0.1"));
+ new AxField(new AxReferenceKey(new AxArtifactKey("OtherEvent", "0.0.01"), "Field0"),
+ new AxArtifactKey("Field0Schema", "0.0.1"));
final AxArtifactKey newEventKey = new AxArtifactKey("NewEventName", "0.0.1");
event.setKey(newEventKey);
assertEquals("NewEventName:0.0.1", event.getKey().getId());
assertEquals("NewEventName:0.0.1", event.getKeys().get(0).getId());
assertEquals("NewEventName:0.0.1",
- event.getParameterMap().get("Field0").getKey().getParentArtifactKey().getId());
+ event.getParameterMap().get("Field0").getKey().getParentArtifactKey().getId());
event.setKey(eventKey);
assertEquals("EventName:0.0.1", event.getKey().getId());
assertEquals("EventName:0.0.1", event.getKeys().get(0).getId());
@@ -190,11 +191,13 @@ public class EventsTest {
event.setToscaPolicyState(AxToscaPolicyProcessingStatus.ENTRY.name());
event.clean();
- event.afterUnmarshal(null, null);
+ event.buildReferences();
+ assertNotEquals(AxKey.NULL_KEY_NAME,
+ event.getParameterMap().values().iterator().next().getKey().getParentKeyName());
final AxEvent clonedEvent = new AxEvent(event);
assertEquals("AxEvent:(key=AxArtifactKey:(name=EventName,version=0.0.1),nameSpace=namespace",
- clonedEvent.toString().substring(0, 77));
+ clonedEvent.toString().substring(0, 77));
assertNotEquals(0, event.hashCode());
@@ -202,37 +205,38 @@ public class EventsTest {
assertEquals(event, event); // NOSONAR
assertEquals(event, clonedEvent);
assertNotNull(event);
- assertNotEquals(event, (Object) "Hello");
+
+ Object helloObj = "Hello";
+ assertNotEquals(event, helloObj);
assertNotEquals(event, new AxEvent(AxArtifactKey.getNullKey(), "namespace", "source", "target", parameterMap,
- AxToscaPolicyProcessingStatus.ENTRY.name()));
+ AxToscaPolicyProcessingStatus.ENTRY.name()));
assertNotEquals(event, new AxEvent(eventKey, "namespace1", "source", "target", parameterMap,
- AxToscaPolicyProcessingStatus.ENTRY.name()));
+ AxToscaPolicyProcessingStatus.ENTRY.name()));
assertNotEquals(event, new AxEvent(eventKey, "namespace", "source2", "target", parameterMap,
- AxToscaPolicyProcessingStatus.ENTRY.name()));
+ AxToscaPolicyProcessingStatus.ENTRY.name()));
assertNotEquals(event, new AxEvent(eventKey, "namespace", "source", "target3", parameterMap,
- AxToscaPolicyProcessingStatus.ENTRY.name()));
+ AxToscaPolicyProcessingStatus.ENTRY.name()));
assertNotEquals(event, new AxEvent(eventKey, "namespace", "source", "target", parameterMapEmpty,
- AxToscaPolicyProcessingStatus.ENTRY.name()));
+ AxToscaPolicyProcessingStatus.ENTRY.name()));
assertEquals(event, new AxEvent(eventKey, "namespace", "source", "target", parameterMap,
- AxToscaPolicyProcessingStatus.ENTRY.name()));
+ AxToscaPolicyProcessingStatus.ENTRY.name()));
assertEquals(0, event.compareTo(event));
assertEquals(0, event.compareTo(clonedEvent));
assertNotEquals(0, event.compareTo(new AxArtifactKey()));
assertNotEquals(0, event.compareTo(null));
- assertNotEquals(0, event
- .compareTo(new AxEvent(AxArtifactKey.getNullKey(), "namespace", "source", "target", parameterMap,
- AxToscaPolicyProcessingStatus.ENTRY.name())));
+ assertNotEquals(0, event.compareTo(new AxEvent(AxArtifactKey.getNullKey(), "namespace", "source", "target",
+ parameterMap, AxToscaPolicyProcessingStatus.ENTRY.name())));
assertNotEquals(0, event.compareTo(new AxEvent(eventKey, "namespace1", "source", "target", parameterMap,
- AxToscaPolicyProcessingStatus.ENTRY.name())));
+ AxToscaPolicyProcessingStatus.ENTRY.name())));
assertNotEquals(0, event.compareTo(new AxEvent(eventKey, "namespace", "source2", "target", parameterMap,
- AxToscaPolicyProcessingStatus.ENTRY.name())));
+ AxToscaPolicyProcessingStatus.ENTRY.name())));
assertNotEquals(0, event.compareTo(new AxEvent(eventKey, "namespace", "source", "target3", parameterMap,
- AxToscaPolicyProcessingStatus.ENTRY.name())));
+ AxToscaPolicyProcessingStatus.ENTRY.name())));
assertNotEquals(0, event.compareTo(new AxEvent(eventKey, "namespace", "source", "target", parameterMapEmpty,
- AxToscaPolicyProcessingStatus.ENTRY.name())));
+ AxToscaPolicyProcessingStatus.ENTRY.name())));
assertEquals(0, event.compareTo(new AxEvent(eventKey, "namespace", "source", "target", parameterMap,
- AxToscaPolicyProcessingStatus.ENTRY.name())));
+ AxToscaPolicyProcessingStatus.ENTRY.name())));
assertNotNull(event.getKeys());
@@ -285,17 +289,19 @@ public class EventsTest {
assertEquals(ValidationResult.VALID, result.getValidationResult());
events.clean();
- events.afterUnmarshal(null, null);
+ event.buildReferences();
+ assertNotEquals(AxKey.NULL_KEY_NAME,
+ event.getParameterMap().values().iterator().next().getKey().getParentKeyName());
final AxEvents clonedEvents = new AxEvents(events);
assertEquals("AxEvents:(key=AxArtifactKey:(name=EventsKey,version=0.0.1),e",
- clonedEvents.toString().substring(0, 60));
+ clonedEvents.toString().substring(0, 60));
assertNotEquals(0, events.hashCode());
assertEquals(events, clonedEvents);
assertNotNull(events);
- assertNotEquals(events, (Object) "Hello");
+ assertNotEquals(event, helloObj);
assertNotEquals(events, new AxEvents(new AxArtifactKey()));
assertEquals(0, events.compareTo(events));
@@ -314,4 +320,4 @@ public class EventsTest {
assertEquals(1, events.getAll("EventName", "0.0.1").size());
assertEquals(0, events.getAll("NonExistantEventsName").size());
}
-} \ No newline at end of file
+}
diff --git a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/ApexEventModelTest.java b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/ApexEventModelTest.java
index 5f770d1b3..21b97c454 100644
--- a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/ApexEventModelTest.java
+++ b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/ApexEventModelTest.java
@@ -273,11 +273,6 @@ public class ApexEventModelTest {
}
@Test
- public void testModelWriteReadXml() throws Exception {
- testApexModel.testApexModelWriteReadXml();
- }
-
- @Test
public void testModelWriteReadJson() throws Exception {
testApexModel.testApexModelWriteReadJson();
}