aboutsummaryrefslogtreecommitdiffstats
path: root/model/event-model/src/test/java/org
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2022-02-10 12:06:25 +0000
committerliamfallon <liam.fallon@est.tech>2022-02-10 13:48:15 +0000
commit8534756d13531ffec9c2d7b2ffe0a53ee1d3aaef (patch)
treea35f6b3f7766d47900ee6691111acff1418bb747 /model/event-model/src/test/java/org
parent2f2c5465cd23c8c3300a5c3d185806bb3e7d73c1 (diff)
Collapse apex-pdp maven model submodules
This review collapses all the code in six podel submodules into a single model module. There are no code changes, just files moved around. This change reduces the complexity of the code structure and speeds up the build. Issue-ID: POLICY-1820 Change-Id: Ifb644e8ec85ae6d0987378f4616fbc8a8858a9a8 Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'model/event-model/src/test/java/org')
-rw-r--r--model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/EventModelTest.java87
-rw-r--r--model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/EventsTest.java323
-rw-r--r--model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/FieldTest.java134
-rw-r--r--model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/ApexEventModelTest.java279
-rw-r--r--model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/DummyTestApexEventModelCreator.java309
5 files changed, 0 insertions, 1132 deletions
diff --git a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/EventModelTest.java b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/EventModelTest.java
deleted file mode 100644
index cdc5fecf6..000000000
--- a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/EventModelTest.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019-2020 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.model.eventmodel.concepts;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-
-import org.junit.Test;
-import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation;
-import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas;
-
-/**
- * Test event models.
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-public class EventModelTest {
-
- @Test
- public void testEventModel() {
- assertNotNull(new AxEventModel());
- assertNotNull(new AxEventModel(new AxArtifactKey()));
- assertNotNull(
- new AxEventModel(new AxArtifactKey(), new AxContextSchemas(), new AxKeyInformation(), new AxEvents()));
-
- final AxArtifactKey modelKey = new AxArtifactKey("ModelKey", "0.0.1");
- final AxArtifactKey schemasKey = new AxArtifactKey("SchemasKey", "0.0.1");
- final AxArtifactKey eventsKey = new AxArtifactKey("EventsKey", "0.0.1");
- final AxArtifactKey keyInfoKey = new AxArtifactKey("SchemasKey", "0.0.1");
- final AxEventModel model = new AxEventModel(modelKey, new AxContextSchemas(schemasKey),
- new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey));
- model.register();
-
- model.clean();
- assertNotNull(model);
- assertEquals("AxEventModel:(AxEventModel:(key=AxArtifactKey:(nam", model.toString().substring(0, 50));
-
- final AxEventModel clonedModel = new AxEventModel(model);
-
- assertNotEquals(0, model.hashCode());
- // disabling sonar because this code tests the equals() method
- assertEquals(model, model); // NOSONAR
- assertEquals(model, clonedModel);
- assertNotEquals(model, (Object) "Hello");
- assertNotEquals(model, new AxEventModel(new AxArtifactKey()));
- assertNotEquals(model, new AxEventModel(modelKey, new AxContextSchemas(), new AxKeyInformation(keyInfoKey),
- new AxEvents(eventsKey)));
- assertNotEquals(model, new AxEventModel(modelKey, new AxContextSchemas(schemasKey), new AxKeyInformation(),
- new AxEvents(eventsKey)));
- assertNotEquals(model, new AxEventModel(modelKey, new AxContextSchemas(schemasKey),
- new AxKeyInformation(keyInfoKey), new AxEvents()));
- assertEquals(model, new AxEventModel(modelKey, new AxContextSchemas(schemasKey),
- new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey)));
-
- assertEquals(0, model.compareTo(model));
- assertEquals(0, model.compareTo(clonedModel));
- assertNotEquals(0, model.compareTo(new AxArtifactKey()));
- assertNotEquals(0, model.compareTo(new AxEventModel(modelKey, new AxContextSchemas(),
- new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey))));
- assertNotEquals(0, model.compareTo(new AxEventModel(modelKey, new AxContextSchemas(schemasKey),
- new AxKeyInformation(), new AxEvents(eventsKey))));
- assertNotEquals(0, model.compareTo(new AxEventModel(modelKey, new AxContextSchemas(schemasKey),
- new AxKeyInformation(keyInfoKey), new AxEvents())));
- assertEquals(0, model.compareTo(new AxEventModel(modelKey, new AxContextSchemas(schemasKey),
- new AxKeyInformation(keyInfoKey), new AxEvents(eventsKey))));
- }
-}
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
deleted file mode 100644
index 7062fcb3c..000000000
--- a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/EventsTest.java
+++ /dev/null
@@ -1,323 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019-2020,2022 Nordix Foundation.
- * Modifications Copyright (C) 2022 Bell Canada.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * 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.eventmodel.concepts;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.TreeMap;
-import java.util.TreeSet;
-import org.junit.Test;
-import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.policy.apex.model.basicmodel.concepts.AxKey;
-import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
-import org.onap.policy.apex.model.basicmodel.concepts.AxToscaPolicyProcessingStatus;
-import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
-import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
-
-/**
- * Test events.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-public class EventsTest {
-
- @Test
- public void testEvents() {
- final TreeMap<String, AxField> parameterMap = new TreeMap<>();
- final TreeMap<String, AxField> parameterMapEmpty = new TreeMap<>();
-
- assertNotNull(new AxEvent());
- assertNotNull(new AxEvent(new AxArtifactKey()));
- assertNotNull(new AxEvent(new AxArtifactKey(), "namespace"));
- assertNotNull(new AxEvent(new AxArtifactKey(), "namespace", "source", "target"));
- assertNotNull(new AxEvent(new AxArtifactKey(), "namespace", "source", "target"));
- assertNotNull(new AxEvent(new AxArtifactKey(), "namespace", "source", "target", parameterMap, ""));
-
- final AxEvent event = new AxEvent();
-
- final AxArtifactKey eventKey = new AxArtifactKey("EventName", "0.0.1");
- event.setKey(eventKey);
- assertEquals("EventName:0.0.1", event.getKey().getId());
- assertEquals("EventName:0.0.1", event.getKeys().get(0).getId());
-
- event.setNameSpace("namespace");
- assertEquals("namespace", event.getNameSpace());
-
- event.setSource("source");
- assertEquals("source", event.getSource());
-
- event.setTarget("target");
- assertEquals("target", event.getTarget());
-
- event.setParameterMap(parameterMap);
- assertEquals(0, event.getParameterMap().size());
-
- event.setToscaPolicyState(AxToscaPolicyProcessingStatus.ENTRY.name());
- assertEquals(AxToscaPolicyProcessingStatus.ENTRY.name(), event.getToscaPolicyState());
-
- final AxField eventField =
- new AxField(new AxReferenceKey(eventKey, "Field0"), new AxArtifactKey("Field0Schema", "0.0.1"));
- event.getParameterMap().put(eventField.getKey().getLocalName(), eventField);
- 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"));
-
- 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.setKey(eventKey);
- assertEquals("EventName:0.0.1", event.getKey().getId());
- assertEquals("EventName:0.0.1", event.getKeys().get(0).getId());
-
- assertTrue("Field0", event.getFields().contains(eventField));
- assertTrue(event.hasFields(new TreeSet<AxField>(parameterMap.values())));
-
- AxValidationResult result = new AxValidationResult();
- result = event.validate(result);
- assertEquals(AxValidationResult.ValidationResult.VALID, result.getValidationResult());
-
- event.setKey(AxArtifactKey.getNullKey());
- result = new AxValidationResult();
- result = event.validate(result);
- assertEquals(ValidationResult.INVALID, result.getValidationResult());
-
- event.setKey(eventKey);
- result = new AxValidationResult();
- result = event.validate(result);
- assertEquals(ValidationResult.VALID, result.getValidationResult());
-
- event.setNameSpace("");
- result = new AxValidationResult();
- result = event.validate(result);
- assertEquals(ValidationResult.WARNING, result.getValidationResult());
-
- event.setNameSpace("namespace");
- result = new AxValidationResult();
- result = event.validate(result);
- assertEquals(ValidationResult.VALID, result.getValidationResult());
-
- event.setSource("");
- result = new AxValidationResult();
- result = event.validate(result);
- assertEquals(ValidationResult.OBSERVATION, result.getValidationResult());
-
- event.setSource("source");
- result = new AxValidationResult();
- result = event.validate(result);
- assertEquals(ValidationResult.VALID, result.getValidationResult());
-
- event.setTarget("");
- result = new AxValidationResult();
- result = event.validate(result);
- assertEquals(ValidationResult.OBSERVATION, result.getValidationResult());
-
- event.setTarget("target");
- result = new AxValidationResult();
- result = event.validate(result);
- assertEquals(ValidationResult.VALID, result.getValidationResult());
-
- event.getParameterMap().put(AxKey.NULL_KEY_NAME, null);
- result = new AxValidationResult();
- result = event.validate(result);
- assertEquals(ValidationResult.INVALID, result.getValidationResult());
-
- event.getParameterMap().remove(AxKey.NULL_KEY_NAME);
- result = new AxValidationResult();
- result = event.validate(result);
- assertEquals(ValidationResult.VALID, result.getValidationResult());
-
- event.getParameterMap().put("NullField", null);
- result = new AxValidationResult();
- result = event.validate(result);
- assertEquals(ValidationResult.INVALID, result.getValidationResult());
-
- event.getParameterMap().remove("NullField");
- result = new AxValidationResult();
- result = event.validate(result);
- assertEquals(ValidationResult.VALID, result.getValidationResult());
-
- event.getParameterMap().put("NullField", eventField);
- result = new AxValidationResult();
- result = event.validate(result);
- assertEquals(ValidationResult.INVALID, result.getValidationResult());
-
- event.getParameterMap().remove("NullField");
- result = new AxValidationResult();
- result = event.validate(result);
- assertEquals(ValidationResult.VALID, result.getValidationResult());
-
- event.getParameterMap().put("BadParent", eventFieldBadParent);
- result = new AxValidationResult();
- result = event.validate(result);
- assertEquals(ValidationResult.INVALID, result.getValidationResult());
-
- event.getParameterMap().remove("BadParent");
- result = new AxValidationResult();
- result = event.validate(result);
- assertEquals(ValidationResult.VALID, result.getValidationResult());
-
- event.setToscaPolicyState("invalid_enum");
- result = new AxValidationResult();
- result = event.validate(result);
- assertEquals(ValidationResult.INVALID, result.getValidationResult());
- event.setToscaPolicyState(AxToscaPolicyProcessingStatus.ENTRY.name());
-
- event.clean();
- event.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));
-
- assertNotEquals(0, event.hashCode());
-
- // disabling sonar because this code tests the equals() method
- assertEquals(event, event); // NOSONAR
- assertEquals(event, clonedEvent);
- assertNotNull(event);
-
- Object helloObj = "Hello";
- assertNotEquals(event, helloObj);
- assertNotEquals(event, new AxEvent(AxArtifactKey.getNullKey(), "namespace", "source", "target", parameterMap,
- AxToscaPolicyProcessingStatus.ENTRY.name()));
- assertNotEquals(event, new AxEvent(eventKey, "namespace1", "source", "target", parameterMap,
- AxToscaPolicyProcessingStatus.ENTRY.name()));
- assertNotEquals(event, new AxEvent(eventKey, "namespace", "source2", "target", parameterMap,
- AxToscaPolicyProcessingStatus.ENTRY.name()));
- assertNotEquals(event, new AxEvent(eventKey, "namespace", "source", "target3", parameterMap,
- AxToscaPolicyProcessingStatus.ENTRY.name()));
- assertNotEquals(event, new AxEvent(eventKey, "namespace", "source", "target", parameterMapEmpty,
- AxToscaPolicyProcessingStatus.ENTRY.name()));
- assertEquals(event, new AxEvent(eventKey, "namespace", "source", "target", parameterMap,
- AxToscaPolicyProcessingStatus.ENTRY.name()));
-
- assertEquals(0, event.compareTo(event));
- assertEquals(0, event.compareTo(clonedEvent));
- assertNotEquals(0, event.compareTo(new AxArtifactKey()));
- assertNotEquals(0, event.compareTo(null));
- assertNotEquals(0, event.compareTo(new AxEvent(AxArtifactKey.getNullKey(), "namespace", "source", "target",
- parameterMap, AxToscaPolicyProcessingStatus.ENTRY.name())));
- assertNotEquals(0, event.compareTo(new AxEvent(eventKey, "namespace1", "source", "target", parameterMap,
- AxToscaPolicyProcessingStatus.ENTRY.name())));
- assertNotEquals(0, event.compareTo(new AxEvent(eventKey, "namespace", "source2", "target", parameterMap,
- AxToscaPolicyProcessingStatus.ENTRY.name())));
- assertNotEquals(0, event.compareTo(new AxEvent(eventKey, "namespace", "source", "target3", parameterMap,
- AxToscaPolicyProcessingStatus.ENTRY.name())));
- assertNotEquals(0, event.compareTo(new AxEvent(eventKey, "namespace", "source", "target", parameterMapEmpty,
- AxToscaPolicyProcessingStatus.ENTRY.name())));
- assertEquals(0, event.compareTo(new AxEvent(eventKey, "namespace", "source", "target", parameterMap,
- AxToscaPolicyProcessingStatus.ENTRY.name())));
-
- assertNotNull(event.getKeys());
-
- final AxEvents events = new AxEvents();
- result = new AxValidationResult();
- result = events.validate(result);
- assertEquals(ValidationResult.INVALID, result.getValidationResult());
-
- // Invalid, no events in event map
- events.setKey(new AxArtifactKey("EventsKey", "0.0.1"));
- assertEquals("EventsKey:0.0.1", events.getKey().getId());
-
- result = new AxValidationResult();
- result = events.validate(result);
- assertEquals(ValidationResult.INVALID, result.getValidationResult());
-
- events.getEventMap().put(eventKey, event);
- result = new AxValidationResult();
- result = events.validate(result);
- assertEquals(ValidationResult.VALID, result.getValidationResult());
-
- events.getEventMap().put(AxArtifactKey.getNullKey(), null);
- result = new AxValidationResult();
- result = events.validate(result);
- assertEquals(ValidationResult.INVALID, result.getValidationResult());
-
- events.getEventMap().remove(AxArtifactKey.getNullKey());
- result = new AxValidationResult();
- result = events.validate(result);
- assertEquals(ValidationResult.VALID, result.getValidationResult());
-
- events.getEventMap().put(new AxArtifactKey("NullValueKey", "0.0.1"), null);
- result = new AxValidationResult();
- result = events.validate(result);
- assertEquals(ValidationResult.INVALID, result.getValidationResult());
-
- events.getEventMap().remove(new AxArtifactKey("NullValueKey", "0.0.1"));
- result = new AxValidationResult();
- result = events.validate(result);
- assertEquals(ValidationResult.VALID, result.getValidationResult());
-
- events.getEventMap().put(new AxArtifactKey("BadEventKey", "0.0.1"), event);
- result = new AxValidationResult();
- result = events.validate(result);
- assertEquals(ValidationResult.INVALID, result.getValidationResult());
-
- events.getEventMap().remove(new AxArtifactKey("BadEventKey", "0.0.1"));
- result = new AxValidationResult();
- result = events.validate(result);
- assertEquals(ValidationResult.VALID, result.getValidationResult());
-
- events.clean();
- 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));
-
- assertNotEquals(0, events.hashCode());
-
- assertEquals(events, clonedEvents);
- assertNotNull(events);
- assertNotEquals(event, helloObj);
- assertNotEquals(events, new AxEvents(new AxArtifactKey()));
-
- assertEquals(0, events.compareTo(events));
- assertEquals(0, events.compareTo(clonedEvents));
- assertNotEquals(0, events.compareTo(null));
- assertNotEquals(0, events.compareTo(new AxArtifactKey()));
- assertNotEquals(0, events.compareTo(new AxEvents(new AxArtifactKey())));
-
- clonedEvents.get(eventKey).setSource("AnotherSource");
- assertNotEquals(0, events.compareTo(clonedEvents));
-
- assertEquals(events.getKey(), events.getKeys().get(0));
-
- assertEquals("EventName", events.get("EventName").getKey().getName());
- assertEquals("EventName", events.get("EventName", "0.0.1").getKey().getName());
- assertEquals(1, events.getAll("EventName", "0.0.1").size());
- assertEquals(0, events.getAll("NonExistantEventsName").size());
- }
-}
diff --git a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/FieldTest.java b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/FieldTest.java
deleted file mode 100644
index 6ec46dbd5..000000000
--- a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/concepts/FieldTest.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019-2020 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.model.eventmodel.concepts;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-
-import org.junit.Test;
-import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
-import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
-import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
-
-/**
- * Test fields.
- *
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
-public class FieldTest {
-
- @Test
- public void testField() {
- assertNotNull(new AxField());
- assertNotNull(new AxField(new AxReferenceKey()));
- assertNotNull(new AxField(new AxReferenceKey(), new AxArtifactKey()));
- assertNotNull(new AxField(new AxReferenceKey(), new AxArtifactKey(), false));
- assertNotNull(new AxField("LocalName", new AxArtifactKey(), false));
- assertNotNull(new AxField("LocalName", new AxArtifactKey()));
- assertNotNull(new AxField("LocalName", new AxArtifactKey(), false));
-
- assertNotNull(new AxInputField());
- assertNotNull(new AxInputField(new AxReferenceKey()));
- assertNotNull(new AxInputField(new AxReferenceKey(), new AxArtifactKey()));
- assertNotNull(new AxInputField(new AxReferenceKey(), new AxArtifactKey(), true));
- assertNotNull(new AxInputField("LocalName", new AxArtifactKey()));
- assertNotNull(new AxInputField(new AxInputField()));
-
- assertNotNull(new AxOutputField());
- assertNotNull(new AxOutputField(new AxReferenceKey()));
- assertNotNull(new AxOutputField(new AxReferenceKey(), new AxArtifactKey()));
- assertNotNull(new AxOutputField(new AxReferenceKey(), new AxArtifactKey(), false));
- assertNotNull(new AxOutputField("LocalName", new AxArtifactKey()));
- assertNotNull(new AxOutputField(new AxOutputField()));
-
- final AxField field = new AxField();
-
- final AxReferenceKey fieldKey = new AxReferenceKey("FieldName", "0.0.1", "PLN", "LN");
- field.setKey(fieldKey);
- assertEquals("FieldName:0.0.1:PLN:LN", field.getKey().getId());
- assertEquals("FieldName:0.0.1:PLN:LN", field.getKeys().get(0).getId());
-
- final AxArtifactKey schemaKey = new AxArtifactKey("SchemaName", "0.0.1");
- field.setSchema(schemaKey);
- assertEquals("SchemaName:0.0.1", field.getSchema().getId());
-
- assertEquals(false, field.getOptional());
- field.setOptional(true);
- assertEquals(true, field.getOptional());
-
- AxValidationResult result = new AxValidationResult();
- result = field.validate(result);
- assertEquals(AxValidationResult.ValidationResult.VALID, result.getValidationResult());
-
- field.setKey(AxReferenceKey.getNullKey());
- result = new AxValidationResult();
- result = field.validate(result);
- assertEquals(ValidationResult.INVALID, result.getValidationResult());
-
- field.setKey(fieldKey);
- result = new AxValidationResult();
- result = field.validate(result);
- assertEquals(ValidationResult.VALID, result.getValidationResult());
-
- field.setSchema(AxArtifactKey.getNullKey());
- result = new AxValidationResult();
- result = field.validate(result);
- assertEquals(ValidationResult.INVALID, result.getValidationResult());
-
- field.setSchema(schemaKey);
- result = new AxValidationResult();
- result = field.validate(result);
- assertEquals(ValidationResult.VALID, result.getValidationResult());
-
- field.clean();
-
- final AxField clonedField = new AxField(field);
- assertEquals("AxField:(key=AxReferenceKey:(parentKeyName=FieldName,parentKeyVersion=0.0.1,"
- + "parentLocalName=PLN,localName=LN),fieldSchemaKey="
- + "AxArtifactKey:(name=SchemaName,version=0.0.1),optional=true)", clonedField.toString());
-
- assertNotEquals(0, field.hashCode());
- // disabling sonar because this code tests the equals() method
- assertEquals(field, field); // NOSONAR
- assertEquals(field, clonedField);
- assertNotNull(field);
- assertNotEquals(field, (Object) "Hello");
- assertNotEquals(field, new AxField(AxReferenceKey.getNullKey(), AxArtifactKey.getNullKey(), false));
- assertNotEquals(field, new AxField(fieldKey, AxArtifactKey.getNullKey(), false));
- assertNotEquals(field, new AxField(fieldKey, schemaKey, false));
- assertEquals(field, new AxField(fieldKey, schemaKey, true));
-
- assertEquals(0, field.compareTo(field));
- assertEquals(0, field.compareTo(clonedField));
- assertNotEquals(0, field.compareTo(new AxArtifactKey()));
- assertNotEquals(0, field.compareTo(null));
- assertNotEquals(0,
- field.compareTo(new AxField(AxReferenceKey.getNullKey(), AxArtifactKey.getNullKey(), false)));
- assertNotEquals(0, field.compareTo(new AxField(fieldKey, AxArtifactKey.getNullKey(), false)));
- assertNotEquals(0, field.compareTo(new AxField(fieldKey, schemaKey, false)));
- assertEquals(0, field.compareTo(new AxField(fieldKey, schemaKey, true)));
-
- assertNotNull(field.getKeys());
- }
-}
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
deleted file mode 100644
index 21b97c454..000000000
--- a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/ApexEventModelTest.java
+++ /dev/null
@@ -1,279 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * 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.
- * 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.eventmodel.handling;
-
-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.test.TestApexModel;
-import org.onap.policy.apex.model.eventmodel.concepts.AxEventModel;
-
-public class ApexEventModelTest {
- private static final String VALID_MODEL_STRING = "***validation of model successful***";
-
- private static final String OBSERVATION_MODEL_STRING = "\n"
- + "***observations noted during validation of model***\n"
- + "AxArtifactKey:(name=event0,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n"
- + "AxArtifactKey:(name=event0,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n"
- + "AxArtifactKey:(name=event1,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n"
- + "AxArtifactKey:(name=event1,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n"
- + "AxArtifactKey:(name=event2,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n"
- + "AxArtifactKey:(name=event2,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n"
- + "********************************";
-
- private static final String WARNING_MODEL_STRING = "\n" + "***warnings issued during validation of model***\n"
- + "AxArtifactKey:(name=event0,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:WARNING:nameSpace on event is blank\n"
- + "AxArtifactKey:(name=event0,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n"
- + "AxArtifactKey:(name=event0,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n"
- + "AxArtifactKey:(name=event1,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:WARNING:nameSpace on event is blank\n"
- + "AxArtifactKey:(name=event1,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n"
- + "AxArtifactKey:(name=event1,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n"
- + "AxArtifactKey:(name=event2,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:WARNING:nameSpace on event is blank\n"
- + "AxArtifactKey:(name=event2,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n"
- + "AxArtifactKey:(name=event2,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n"
- + "********************************";
-
- private static final String INVALID_MODEL_STRING = "\n" + "***validation of model failed***\n"
- + "AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1):"
- + "org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation:INVALID:"
- + "keyInfoMap may not be empty\n" + "AxArtifactKey:(name=smallEventModel,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:"
- + "key information not found for key AxArtifactKey:(name=smallEventModel,version=0.0.1)\n"
- + "AxArtifactKey:(name=smallEventModel,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:"
- + "key information not found for key AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1)\n"
- + "AxArtifactKey:(name=smallEventModel,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:"
- + "key information not found for key AxArtifactKey:(name=Schemas,version=0.0.1)\n"
- + "AxArtifactKey:(name=smallEventModel,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:"
- + "key information not found for key AxArtifactKey:(name=BigIntType,version=0.0.1)\n"
- + "AxArtifactKey:(name=smallEventModel,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:"
- + "key information not found for key AxArtifactKey:(name=BooleanType,version=0.0.1)\n"
- + "AxArtifactKey:(name=smallEventModel,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:"
- + "key information not found for key AxArtifactKey:(name=IntType,version=0.0.1)\n"
- + "AxArtifactKey:(name=smallEventModel,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:"
- + "key information not found for key AxArtifactKey:(name=MapType,version=0.0.1)\n"
- + "AxArtifactKey:(name=smallEventModel,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:"
- + "key information not found for key AxArtifactKey:(name=SetType,version=0.0.1)\n"
- + "AxArtifactKey:(name=smallEventModel,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:"
- + "key information not found for key AxArtifactKey:(name=StringType,version=0.0.1)\n"
- + "AxArtifactKey:(name=smallEventModel,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:"
- + "key information not found for key AxArtifactKey:(name=smallEventMap,version=0.0.1)\n"
- + "AxArtifactKey:(name=smallEventModel,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:"
- + "key information not found for key AxArtifactKey:(name=event0,version=0.0.1)\n"
- + "AxArtifactKey:(name=smallEventModel,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:"
- + "key information not found for parent key of key AxReferenceKey:"
- + "(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=par0)\n"
- + "AxArtifactKey:(name=smallEventModel,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:"
- + "key information not found for parent key of key AxReferenceKey:"
- + "(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=par1)\n"
- + "AxArtifactKey:(name=smallEventModel,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:"
- + "key information not found for parent key of key AxReferenceKey:"
- + "(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=par2)\n"
- + "AxArtifactKey:(name=smallEventModel,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:"
- + "key information not found for parent key of key AxReferenceKey:"
- + "(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=par3)\n"
- + "AxArtifactKey:(name=smallEventModel,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:"
- + "key information not found for parent key of key AxReferenceKey:"
- + "(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=par4)\n"
- + "AxArtifactKey:(name=smallEventModel,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:"
- + "key information not found for parent key of key AxReferenceKey:"
- + "(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=par5)\n"
- + "AxArtifactKey:(name=smallEventModel,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:"
- + "key information not found for parent key of key AxReferenceKey:"
- + "(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=par6)\n"
- + "AxArtifactKey:(name=smallEventModel,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:"
- + "key information not found for key AxArtifactKey:(name=event1,version=0.0.1)\n"
- + "AxArtifactKey:(name=smallEventModel,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:"
- + "key information not found for parent key of key AxReferenceKey:"
- + "(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=theOnlyPar)\n"
- + "AxArtifactKey:(name=smallEventModel,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:"
- + "duplicate key AxArtifactKey:(name=event1,version=0.0.1) found\n"
- + "AxArtifactKey:(name=smallEventModel,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:"
- + "key information not found for key AxArtifactKey:(name=event1,version=0.0.1)\n"
- + "AxArtifactKey:(name=smallEventModel,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:"
- + "duplicate key AxReferenceKey:(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,"
- + "localName=theOnlyPar) found\n" + "AxArtifactKey:(name=smallEventModel,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:"
- + "key information not found for parent key of key AxReferenceKey:"
- + "(parentKeyName=event0,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=theOnlyPar)\n"
- + "AxArtifactKey:(name=event0,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n"
- + "AxArtifactKey:(name=event0,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n"
- + "AxArtifactKey:(name=event1,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n"
- + "AxArtifactKey:(name=event1,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n"
- + "AxArtifactKey:(name=event1,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:INVALID:"
- + "parent key on parameter field AxReferenceKey:(parentKeyName=event0,parentKeyVersion=0.0.1,"
- + "parentLocalName=NULL,localName=theOnlyPar) does not equal event key\n"
- + "AxArtifactKey:(name=smallEventMap,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEvents:INVALID:"
- + "key on event entry key AxArtifactKey:(name=event2,version=0.0.1) does not equal event value key "
- + "AxArtifactKey:(name=event1,version=0.0.1)\n" + "AxArtifactKey:(name=event1,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n"
- + "AxArtifactKey:(name=event1,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n"
- + "AxArtifactKey:(name=event1,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:INVALID:"
- + "parent key on parameter field AxReferenceKey:(parentKeyName=event0,parentKeyVersion=0.0.1,"
- + "parentLocalName=NULL,localName=theOnlyPar) does not equal event key\n"
- + "********************************";
-
- private static final String INVALID_MODEL_MALSTRUCTURED_STRING = "\n" + "***validation of model failed***\n"
- + "AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1):"
- + "org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation:INVALID:"
- + "keyInfoMap may not be empty\n" + "AxArtifactKey:(name=smallEventModel,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:"
- + "key information not found for key AxArtifactKey:(name=smallEventModel,version=0.0.1)\n"
- + "AxArtifactKey:(name=smallEventModel,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:"
- + "key information not found for key AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1)\n"
- + "AxArtifactKey:(name=smallEventModel,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:"
- + "key information not found for key AxArtifactKey:(name=Schemas,version=0.0.1)\n"
- + "AxArtifactKey:(name=smallEventModel,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:"
- + "key information not found for key AxArtifactKey:(name=SetType,version=0.0.1)\n"
- + "AxArtifactKey:(name=smallEventModel,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:"
- + "key information not found for key AxArtifactKey:(name=smallEventMap,version=0.0.1)\n"
- + "AxArtifactKey:(name=smallEventModel,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:"
- + "key information not found for key AxArtifactKey:(name=event1,version=0.0.1)\n"
- + "AxArtifactKey:(name=smallEventModel,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:"
- + "key information not found for parent key of key AxReferenceKey:"
- + "(parentKeyName=event1,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=theOnlyPar)\n"
- + "AxArtifactKey:(name=smallEventModel,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:"
- + "duplicate key AxArtifactKey:(name=event1,version=0.0.1) found\n"
- + "AxArtifactKey:(name=smallEventModel,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:"
- + "key information not found for key AxArtifactKey:(name=event1,version=0.0.1)\n"
- + "AxArtifactKey:(name=smallEventModel,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:"
- + "duplicate key AxReferenceKey:(parentKeyName=event1,parentKeyVersion=0.0.1,"
- + "parentLocalName=NULL,localName=theOnlyPar) found\n"
- + "AxArtifactKey:(name=smallEventModel,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEventModel:INVALID:"
- + "key information not found for parent key of key AxReferenceKey:"
- + "(parentKeyName=event1,parentKeyVersion=0.0.1,parentLocalName=NULL,localName=theOnlyPar)\n"
- + "AxArtifactKey:(name=event1,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n"
- + "AxArtifactKey:(name=event1,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n"
- + "AxArtifactKey:(name=smallEventMap,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEvents:INVALID:"
- + "key on event entry key AxArtifactKey:(name=event2,version=0.0.1) does not equal event value key "
- + "AxArtifactKey:(name=event1,version=0.0.1)\n" + "AxArtifactKey:(name=event1,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:source on event is blank\n"
- + "AxArtifactKey:(name=event1,version=0.0.1):"
- + "org.onap.policy.apex.model.eventmodel.concepts.AxEvent:OBSERVATION:target on event is blank\n"
- + "********************************";
-
- TestApexModel<AxEventModel> testApexModel;
-
- /**
- * Set up the test.
- *
- * @throws Exception exceptions from the test
- */
- @Before
- public void setup() throws Exception {
- testApexModel = new TestApexModel<AxEventModel>(AxEventModel.class, new DummyTestApexEventModelCreator());
- }
-
- @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/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/DummyTestApexEventModelCreator.java b/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/DummyTestApexEventModelCreator.java
deleted file mode 100644
index 11685a6b4..000000000
--- a/model/event-model/src/test/java/org/onap/policy/apex/model/eventmodel/handling/DummyTestApexEventModelCreator.java
+++ /dev/null
@@ -1,309 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.model.eventmodel.handling;
-
-import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation;
-import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
-import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
-import org.onap.policy.apex.model.basicmodel.test.TestApexModelCreator;
-import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema;
-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.AxEventModel;
-import org.onap.policy.apex.model.eventmodel.concepts.AxEvents;
-import org.onap.policy.apex.model.eventmodel.concepts.AxField;
-
-public class DummyTestApexEventModelCreator implements TestApexModelCreator<AxEventModel> {
-
- @Override
- public AxEventModel getModel() {
- final AxContextSchema axSchema0 =
- new AxContextSchema(new AxArtifactKey("BooleanType", "0.0.1"), "Java", "java.lang.Boolean");
- final AxContextSchema axSchema1 =
- new AxContextSchema(new AxArtifactKey("IntType", "0.0.1"), "Java", "java.lang.Integer");
- final AxContextSchema axSchema2 =
- new AxContextSchema(new AxArtifactKey("StringType", "0.0.1"), "Java", "java.lang.String");
- final AxContextSchema axSchema3 = new AxContextSchema(new AxArtifactKey("KeyType", "0.0.1"), "Java",
- "org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey");
- final AxContextSchema axSchema4 = new AxContextSchema(new AxArtifactKey("MapType", "0.0.1"), "Java",
- "org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation");
- final AxContextSchema axSchema5 =
- new AxContextSchema(new AxArtifactKey("BigIntType", "0.0.1"), "Java", "java.math.BigInteger");
- final AxContextSchema axSchema6 = new AxContextSchema(new AxArtifactKey("ModelType", "0.0.1"), "Java",
- "org.onap.policy.apex.model.basicmodel.concepts.AxModel");
-
- final AxContextSchemas dataTypes = new AxContextSchemas(new AxArtifactKey("Schemas", "0.0.1"));
- dataTypes.getSchemasMap().put(axSchema0.getKey(), axSchema0);
- dataTypes.getSchemasMap().put(axSchema1.getKey(), axSchema1);
- dataTypes.getSchemasMap().put(axSchema2.getKey(), axSchema2);
- dataTypes.getSchemasMap().put(axSchema3.getKey(), axSchema3);
- dataTypes.getSchemasMap().put(axSchema4.getKey(), axSchema4);
- dataTypes.getSchemasMap().put(axSchema5.getKey(), axSchema5);
- dataTypes.getSchemasMap().put(axSchema6.getKey(), axSchema6);
-
- final AxEvents eventMap = new AxEvents(new AxArtifactKey("smallEventMap", "0.0.1"));
-
- final AxEvent event0 = new AxEvent(new AxArtifactKey("event0", "0.0.1"),
- "org.onap.policy.apex.model.eventmodel.events", "Source", "Target");
- event0.getParameterMap().put("par0",
- new AxField(new AxReferenceKey(event0.getKey(), "par0"), axSchema0.getKey()));
- event0.getParameterMap().put("par1",
- new AxField(new AxReferenceKey(event0.getKey(), "par1"), axSchema1.getKey()));
- event0.getParameterMap().put("par2",
- new AxField(new AxReferenceKey(event0.getKey(), "par2"), axSchema2.getKey()));
- event0.getParameterMap().put("par3",
- new AxField(new AxReferenceKey(event0.getKey(), "par3"), axSchema6.getKey()));
- event0.getParameterMap().put("par4",
- new AxField(new AxReferenceKey(event0.getKey(), "par4"), axSchema4.getKey()));
- event0.getParameterMap().put("par5",
- new AxField(new AxReferenceKey(event0.getKey(), "par5"), axSchema5.getKey()));
- event0.getParameterMap().put("par6",
- new AxField(new AxReferenceKey(event0.getKey(), "par6"), axSchema5.getKey()));
- eventMap.getEventMap().put(event0.getKey(), event0);
-
- final AxEvent event1 = new AxEvent(new AxArtifactKey("event1", "0.0.1"),
- "org.onap.policy.apex.model.eventmodel.events", "Source", "Target");
- event1.getParameterMap().put("theOnlyPar",
- new AxField(new AxReferenceKey(event1.getKey(), "theOnlyPar"), axSchema3.getKey()));
- eventMap.getEventMap().put(event1.getKey(), event1);
-
- final AxEvent event2 = new AxEvent(new AxArtifactKey("event2", "0.0.1"),
- "org.onap.policy.apex.model.eventmodel.events", "Source", "Target");
- eventMap.getEventMap().put(event2.getKey(), event2);
-
- final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1"));
-
- final AxEventModel eventModel =
- new AxEventModel(new AxArtifactKey("EventModel", "0.0.1"), dataTypes, keyInformation, eventMap);
- keyInformation.generateKeyInfo(eventModel);
-
- eventModel.validate(new AxValidationResult());
- return eventModel;
- }
-
- @Override
- public AxEventModel getInvalidModel() {
- final AxContextSchema axSchema0 =
- new AxContextSchema(new AxArtifactKey("BooleanType", "0.0.1"), "Java", "java.lang.Zoolean");
- final AxContextSchema axSchema1 =
- new AxContextSchema(new AxArtifactKey("IntType", "0.0.1"), "Java", "java.lang.Integer");
- final AxContextSchema axSchema2 =
- new AxContextSchema(new AxArtifactKey("StringType", "0.0.1"), "Java", "java.lang.String");
- final AxContextSchema axSchema3 =
- new AxContextSchema(new AxArtifactKey("SetType", "0.0.1"), "Java", "java.util.Set");
- final AxContextSchema axSchema4 =
- new AxContextSchema(new AxArtifactKey("MapType", "0.0.1"), "Java", "java.util.Map");
- final AxContextSchema axSchema5 =
- new AxContextSchema(new AxArtifactKey("BigIntType", "0.0.1"), "Java", "java.math.BigInteger");
-
- final AxContextSchemas dataTypes = new AxContextSchemas(new AxArtifactKey("Schemas", "0.0.1"));
- dataTypes.getSchemasMap().put(axSchema0.getKey(), axSchema0);
- dataTypes.getSchemasMap().put(axSchema1.getKey(), axSchema1);
- dataTypes.getSchemasMap().put(axSchema2.getKey(), axSchema2);
- dataTypes.getSchemasMap().put(axSchema3.getKey(), axSchema3);
- dataTypes.getSchemasMap().put(axSchema4.getKey(), axSchema4);
- dataTypes.getSchemasMap().put(axSchema5.getKey(), axSchema5);
-
- final AxEvents eventMap = new AxEvents(new AxArtifactKey("smallEventMap", "0.0.1"));
-
- final AxEvent event0 =
- new AxEvent(new AxArtifactKey("event0", "0.0.1"), "org.onap.policy.apex.model.eventmodel.events");
- event0.getParameterMap().put("par0",
- new AxField(new AxReferenceKey(event0.getKey(), "par0"), axSchema0.getKey()));
- event0.getParameterMap().put("par1",
- new AxField(new AxReferenceKey(event0.getKey(), "par1"), axSchema1.getKey()));
- event0.getParameterMap().put("par2",
- new AxField(new AxReferenceKey(event0.getKey(), "par2"), axSchema2.getKey()));
- event0.getParameterMap().put("par3",
- new AxField(new AxReferenceKey(event0.getKey(), "par3"), axSchema3.getKey()));
- event0.getParameterMap().put("par4",
- new AxField(new AxReferenceKey(event0.getKey(), "par4"), axSchema4.getKey()));
- event0.getParameterMap().put("par5",
- new AxField(new AxReferenceKey(event0.getKey(), "par5"), axSchema5.getKey()));
- event0.getParameterMap().put("par6",
- new AxField(new AxReferenceKey(event0.getKey(), "par6"), axSchema5.getKey()));
- eventMap.getEventMap().put(event0.getKey(), event0);
-
- final AxEvent event1 =
- new AxEvent(new AxArtifactKey("event1", "0.0.1"), "org.onap.policy.apex.model.eventmodel.events");
- event1.getParameterMap().put("theOnlyPar",
- new AxField(new AxReferenceKey(event0.getKey(), "theOnlyPar"), axSchema3.getKey()));
- eventMap.getEventMap().put(event1.getKey(), event1);
-
- final AxEvent event2 =
- new AxEvent(new AxArtifactKey("event2", "0.0.1"), "org.onap.policy.apex.model.eventmodel.events");
- eventMap.getEventMap().put(event2.getKey(), event1);
-
- final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1"));
-
- final AxEventModel eventModel =
- new AxEventModel(new AxArtifactKey("smallEventModel", "0.0.1"), dataTypes, keyInformation, eventMap);
-
- return eventModel;
- }
-
- @Override
- public AxEventModel getMalstructuredModel() {
- final AxContextSchema axSchema3 =
- new AxContextSchema(new AxArtifactKey("SetType", "0.0.1"), "Java", "java.util.Set");
- final AxContextSchemas dataTypes = new AxContextSchemas(new AxArtifactKey("Schemas", "0.0.1"));
- dataTypes.getSchemasMap().put(axSchema3.getKey(), axSchema3);
-
- final AxEvents eventMap = new AxEvents(new AxArtifactKey("smallEventMap", "0.0.1"));
-
- final AxEvent event1 =
- new AxEvent(new AxArtifactKey("event1", "0.0.1"), "org.onap.policy.apex.model.eventmodel.events");
- event1.getParameterMap().put("theOnlyPar",
- new AxField(new AxReferenceKey(event1.getKey(), "theOnlyPar"), axSchema3.getKey()));
- eventMap.getEventMap().put(event1.getKey(), event1);
-
- final AxEvent event2 =
- new AxEvent(new AxArtifactKey("event2", "0.0.1"), "org.onap.policy.apex.model.eventmodel.events");
- eventMap.getEventMap().put(event2.getKey(), event1);
-
- final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1"));
-
- final AxEventModel eventModel =
- new AxEventModel(new AxArtifactKey("smallEventModel", "0.0.1"), dataTypes, keyInformation, eventMap);
-
- eventModel.validate(new AxValidationResult());
-
- return eventModel;
- }
-
- @Override
- public AxEventModel getWarningModel() {
- final AxContextSchema axSchema0 =
- new AxContextSchema(new AxArtifactKey("BooleanType", "0.0.1"), "Java", "java.lang.Boolean");
- final AxContextSchema axSchema1 =
- new AxContextSchema(new AxArtifactKey("IntType", "0.0.1"), "Java", "java.lang.Integer");
- final AxContextSchema axSchema2 =
- new AxContextSchema(new AxArtifactKey("StringType", "0.0.1"), "Java", "java.lang.String");
- final AxContextSchema axSchema3 =
- new AxContextSchema(new AxArtifactKey("SetType", "0.0.1"), "Java", "java.util.Set");
- final AxContextSchema axSchema4 =
- new AxContextSchema(new AxArtifactKey("MapType", "0.0.1"), "Java", "java.util.Map");
- final AxContextSchema axSchema5 =
- new AxContextSchema(new AxArtifactKey("BigIntType", "0.0.1"), "Java", "java.math.BigInteger");
- final AxContextSchemas dataTypes = new AxContextSchemas(new AxArtifactKey("Schemas", "0.0.1"));
- dataTypes.getSchemasMap().put(axSchema0.getKey(), axSchema0);
- dataTypes.getSchemasMap().put(axSchema1.getKey(), axSchema1);
- dataTypes.getSchemasMap().put(axSchema2.getKey(), axSchema2);
- dataTypes.getSchemasMap().put(axSchema3.getKey(), axSchema3);
- dataTypes.getSchemasMap().put(axSchema4.getKey(), axSchema4);
- dataTypes.getSchemasMap().put(axSchema5.getKey(), axSchema5);
-
- final AxEvents eventMap = new AxEvents(new AxArtifactKey("smallEventMap", "0.0.1"));
-
- final AxEvent event0 = new AxEvent(new AxArtifactKey("event0", "0.0.1"), "");
- event0.getParameterMap().put("par0",
- new AxField(new AxReferenceKey(event0.getKey(), "par0"), axSchema0.getKey()));
- event0.getParameterMap().put("par1",
- new AxField(new AxReferenceKey(event0.getKey(), "par1"), axSchema1.getKey()));
- event0.getParameterMap().put("par2",
- new AxField(new AxReferenceKey(event0.getKey(), "par2"), axSchema2.getKey()));
- event0.getParameterMap().put("par3",
- new AxField(new AxReferenceKey(event0.getKey(), "par3"), axSchema3.getKey()));
- event0.getParameterMap().put("par4",
- new AxField(new AxReferenceKey(event0.getKey(), "par4"), axSchema4.getKey()));
- event0.getParameterMap().put("par5",
- new AxField(new AxReferenceKey(event0.getKey(), "par5"), axSchema5.getKey()));
- eventMap.getEventMap().put(event0.getKey(), event0);
-
- final AxEvent event1 = new AxEvent(new AxArtifactKey("event1", "0.0.1"), "");
- event1.getParameterMap().put("theOnlyPar",
- new AxField(new AxReferenceKey(event1.getKey(), "theOnlyPar"), axSchema3.getKey()));
- eventMap.getEventMap().put(event1.getKey(), event1);
-
- final AxEvent event2 = new AxEvent(new AxArtifactKey("event2", "0.0.1"), "");
- eventMap.getEventMap().put(event2.getKey(), event2);
-
- final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1"));
-
- final AxEventModel eventModel =
- new AxEventModel(new AxArtifactKey("smallEventModel", "0.0.1"), dataTypes, keyInformation, eventMap);
- eventModel.getKeyInformation().generateKeyInfo(eventModel);
- eventModel.validate(new AxValidationResult());
-
- return eventModel;
- }
-
- @Override
- public AxEventModel getObservationModel() {
- final AxContextSchema axSchema0 =
- new AxContextSchema(new AxArtifactKey("BooleanType", "0.0.1"), "Java", "java.lang.Boolean");
- final AxContextSchema axSchema1 =
- new AxContextSchema(new AxArtifactKey("IntType", "0.0.1"), "Java", "java.lang.Integer");
- final AxContextSchema axSchema2 =
- new AxContextSchema(new AxArtifactKey("StringType", "0.0.1"), "Java", "java.lang.String");
- final AxContextSchema axSchema3 =
- new AxContextSchema(new AxArtifactKey("SetType", "0.0.1"), "Java", "java.util.Set");
- final AxContextSchema axSchema4 =
- new AxContextSchema(new AxArtifactKey("MapType", "0.0.1"), "Java", "java.util.Map");
- final AxContextSchema axSchema5 =
- new AxContextSchema(new AxArtifactKey("BigIntType", "0.0.1"), "Java", "java.math.BigInteger");
- final AxContextSchemas schemas = new AxContextSchemas(new AxArtifactKey("Schemas", "0.0.1"));
- schemas.getSchemasMap().put(axSchema0.getKey(), axSchema0);
- schemas.getSchemasMap().put(axSchema1.getKey(), axSchema1);
- schemas.getSchemasMap().put(axSchema2.getKey(), axSchema2);
- schemas.getSchemasMap().put(axSchema3.getKey(), axSchema3);
- schemas.getSchemasMap().put(axSchema4.getKey(), axSchema4);
- schemas.getSchemasMap().put(axSchema5.getKey(), axSchema5);
-
- final AxEvents eventMap = new AxEvents(new AxArtifactKey("smallEventMap", "0.0.1"));
-
- final AxEvent event0 =
- new AxEvent(new AxArtifactKey("event0", "0.0.1"), "org.onap.policy.apex.model.eventmodel.events");
- event0.getParameterMap().put("par0",
- new AxField(new AxReferenceKey(event0.getKey(), "par0"), axSchema0.getKey()));
- event0.getParameterMap().put("par1",
- new AxField(new AxReferenceKey(event0.getKey(), "par1"), axSchema1.getKey()));
- event0.getParameterMap().put("par2",
- new AxField(new AxReferenceKey(event0.getKey(), "par2"), axSchema2.getKey()));
- event0.getParameterMap().put("par3",
- new AxField(new AxReferenceKey(event0.getKey(), "par3"), axSchema3.getKey()));
- event0.getParameterMap().put("par4",
- new AxField(new AxReferenceKey(event0.getKey(), "par4"), axSchema4.getKey()));
- event0.getParameterMap().put("par5",
- new AxField(new AxReferenceKey(event0.getKey(), "par5"), axSchema5.getKey()));
- eventMap.getEventMap().put(event0.getKey(), event0);
-
- final AxEvent event1 =
- new AxEvent(new AxArtifactKey("event1", "0.0.1"), "org.onap.policy.apex.model.eventmodel.events");
- event1.getParameterMap().put("theOnlyPar",
- new AxField(new AxReferenceKey(event1.getKey(), "theOnlyPar"), axSchema3.getKey()));
- eventMap.getEventMap().put(event1.getKey(), event1);
-
- final AxEvent event2 =
- new AxEvent(new AxArtifactKey("event2", "0.0.1"), "org.onap.policy.apex.model.eventmodel.events");
- eventMap.getEventMap().put(event2.getKey(), event2);
-
- final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1"));
-
- final AxEventModel eventModel =
- new AxEventModel(new AxArtifactKey("smallEventModel", "0.0.1"), schemas, keyInformation, eventMap);
- eventModel.getKeyInformation().generateKeyInfo(eventModel);
- eventModel.validate(new AxValidationResult());
-
- return eventModel;
- }
-}