summaryrefslogtreecommitdiffstats
path: root/model/context-model/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'model/context-model/src/test')
-rw-r--r--model/context-model/src/test/java/org/onap/apex/model/contextmodel/handling/TestApexContextModelCreator.java106
-rw-r--r--model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextAlbums.java (renamed from model/context-model/src/test/java/org/onap/apex/model/contextmodel/concepts/TestContextAlbums.java)12
-rw-r--r--model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextModel.java (renamed from model/context-model/src/test/java/org/onap/apex/model/contextmodel/concepts/TestContextModel.java)12
-rw-r--r--model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextSchemas.java (renamed from model/context-model/src/test/java/org/onap/apex/model/contextmodel/concepts/TestContextSchemas.java)12
-rw-r--r--model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestApexContextModel.java (renamed from model/context-model/src/test/java/org/onap/apex/model/contextmodel/handling/TestApexContextModel.java)40
-rw-r--r--model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestApexContextModelCreator.java123
-rw-r--r--model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestContextComparison.java (renamed from model/context-model/src/test/java/org/onap/apex/model/contextmodel/handling/TestContextComparison.java)12
-rw-r--r--model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestContextComparisonFactory.java (renamed from model/context-model/src/test/java/org/onap/apex/model/contextmodel/handling/TestContextComparisonFactory.java)98
-rw-r--r--model/context-model/src/test/resources/META-INF/persistence.xml26
-rw-r--r--model/context-model/src/test/resources/json/ContextModel.json10
-rw-r--r--model/context-model/src/test/resources/logback-test.xml8
11 files changed, 243 insertions, 216 deletions
diff --git a/model/context-model/src/test/java/org/onap/apex/model/contextmodel/handling/TestApexContextModelCreator.java b/model/context-model/src/test/java/org/onap/apex/model/contextmodel/handling/TestApexContextModelCreator.java
deleted file mode 100644
index b53d8d04d..000000000
--- a/model/context-model/src/test/java/org/onap/apex/model/contextmodel/handling/TestApexContextModelCreator.java
+++ /dev/null
@@ -1,106 +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.apex.model.contextmodel.handling;
-
-import java.util.UUID;
-
-import org.onap.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.apex.model.basicmodel.concepts.AxKeyInfo;
-import org.onap.apex.model.basicmodel.concepts.AxKeyInformation;
-import org.onap.apex.model.basicmodel.test.TestApexModelCreator;
-import org.onap.apex.model.contextmodel.concepts.AxContextAlbum;
-import org.onap.apex.model.contextmodel.concepts.AxContextAlbums;
-import org.onap.apex.model.contextmodel.concepts.AxContextModel;
-import org.onap.apex.model.contextmodel.concepts.AxContextSchema;
-import org.onap.apex.model.contextmodel.concepts.AxContextSchemas;
-
-public class TestApexContextModelCreator implements TestApexModelCreator<AxContextModel> {
-
- @Override
- public AxContextModel getModel() {
- final AxContextSchema schema0 = new AxContextSchema(new AxArtifactKey("StringType", "0.0.1"), "Java", "com.ericsson.apex.concept.TestContextItem000");
- final AxContextSchema schema1 = new AxContextSchema(new AxArtifactKey("MapType", "0.0.1"), "Java", "com.ericsson.apex.concept.TestContextItem00A");
-
- final AxContextSchemas contextSchemas = new AxContextSchemas(new AxArtifactKey("ContextSchemas", "0.0.1"));
- contextSchemas.getSchemasMap().put(schema0.getKey(), schema0);
- contextSchemas.getSchemasMap().put(schema1.getKey(), schema1);
-
- final AxContextAlbum contextAlbum0 = new AxContextAlbum(new AxArtifactKey("contextAlbum0", "0.0.1"), "APPLICATION", true, schema0.getKey());
- final AxContextAlbum contextAlbum1 = new AxContextAlbum(new AxArtifactKey("contextAlbum1", "0.0.1"), "GLOBAL" , false, schema1.getKey());
-
- final AxContextAlbums axContext = new AxContextAlbums(new AxArtifactKey("contextAlbums", "0.0.1"));
- axContext.getAlbumsMap().put(contextAlbum0.getKey(), contextAlbum0);
- axContext.getAlbumsMap().put(contextAlbum1.getKey(), contextAlbum1);
-
- final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1"));
- final AxContextModel contextModel = new AxContextModel(new AxArtifactKey("ContextModel", "0.0.1"), contextSchemas, axContext, keyInformation);
-
- contextModel.setKeyInformation(keyInformation);
- contextModel.getKeyInformation().getKeyInfoMap().put(schema0 .getKey(), new AxKeyInfo(schema0 .getKey(), UUID.fromString("00000000-0000-0000-0000-000000000001"), "axContextSchema0"));
- contextModel.getKeyInformation().getKeyInfoMap().put(schema1 .getKey(), new AxKeyInfo(schema1 .getKey(), UUID.fromString("00000000-0000-0000-0000-000000000002"), "axContextSchema1"));
- contextModel.getKeyInformation().getKeyInfoMap().put(contextSchemas.getKey(), new AxKeyInfo(contextSchemas.getKey(), UUID.fromString("00000000-0000-0000-0000-000000000003"), "ContextSchemas"));
- contextModel.getKeyInformation().getKeyInfoMap().put(contextAlbum0 .getKey(), new AxKeyInfo(contextAlbum0 .getKey(), UUID.fromString("00000000-0000-0000-0000-000000000004"), "contextAlbum0"));
- contextModel.getKeyInformation().getKeyInfoMap().put(contextAlbum1 .getKey(), new AxKeyInfo(contextAlbum1 .getKey(), UUID.fromString("00000000-0000-0000-0000-000000000005"), "contextAlbum1"));
- contextModel.getKeyInformation().getKeyInfoMap().put(axContext .getKey(), new AxKeyInfo(axContext .getKey(), UUID.fromString("00000000-0000-0000-0000-000000000006"), "axContext"));
- contextModel.getKeyInformation().getKeyInfoMap().put(contextModel .getKey(), new AxKeyInfo(contextModel .getKey(), UUID.fromString("00000000-0000-0000-0000-000000000007"), "contextModel"));
- contextModel.getKeyInformation().getKeyInfoMap().put(keyInformation.getKey(), new AxKeyInfo(keyInformation.getKey(), UUID.fromString("00000000-0000-0000-0000-000000000008"), "keyInformation"));
-
- return contextModel;
- }
-
- @Override
- public AxContextModel getInvalidModel() {
- final AxContextModel contextModel = getModel();
-
- contextModel.getAlbums().get(new AxArtifactKey("contextAlbum0", "0.0.1")).setScope("UNDEFINED");
-
- contextModel.getSchemas().get(new AxArtifactKey("StringType", "0.0.1")).setSchema("");
-
- return contextModel;
- }
-
- public AxContextModel getMalstructuredModel() {
- final AxContextModel contextModel = getModel();
-
- contextModel.getAlbums().get(new AxArtifactKey("contextAlbum1", "0.0.1")).setKey(new AxArtifactKey("contextAlbum1", "0.0.2"));;
- contextModel.getSchemas().get(new AxArtifactKey("MapType", "0.0.1")).setKey(new AxArtifactKey("MapType", "0.0.2"));;
-
- return contextModel;
- }
-
- @Override
- public AxContextModel getObservationModel() {
- final AxContextModel contextModel = getModel();
-
- contextModel.getKeyInformation().get("contextAlbum1", "0.0.1").setDescription("");
-
- return contextModel;
- }
-
- @Override
- public AxContextModel getWarningModel() {
- final AxContextModel contextModel = getModel();
-
- contextModel.getKeyInformation().get("contextAlbum1", "0.0.1").setUuid(UUID.fromString("00000000-0000-0000-0000-000000000000"));
-
- return contextModel;
- }
-}
diff --git a/model/context-model/src/test/java/org/onap/apex/model/contextmodel/concepts/TestContextAlbums.java b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextAlbums.java
index 476cda9a3..710c44e5b 100644
--- a/model/context-model/src/test/java/org/onap/apex/model/contextmodel/concepts/TestContextAlbums.java
+++ b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextAlbums.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.contextmodel.concepts;
+package org.onap.policy.apex.model.contextmodel.concepts;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -28,11 +28,11 @@ import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import org.junit.Test;
-import org.onap.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.apex.model.basicmodel.concepts.AxValidationResult;
-import org.onap.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
-import org.onap.apex.model.contextmodel.concepts.AxContextAlbum;
-import org.onap.apex.model.contextmodel.concepts.AxContextAlbums;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+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.contextmodel.concepts.AxContextAlbum;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbums;
/**
* @author Liam Fallon (liam.fallon@ericsson.com)
diff --git a/model/context-model/src/test/java/org/onap/apex/model/contextmodel/concepts/TestContextModel.java b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextModel.java
index cab40f316..163e50018 100644
--- a/model/context-model/src/test/java/org/onap/apex/model/contextmodel/concepts/TestContextModel.java
+++ b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextModel.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.contextmodel.concepts;
+package org.onap.policy.apex.model.contextmodel.concepts;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -27,11 +27,11 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
-import org.onap.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.apex.model.basicmodel.concepts.AxKeyInformation;
-import org.onap.apex.model.contextmodel.concepts.AxContextAlbums;
-import org.onap.apex.model.contextmodel.concepts.AxContextModel;
-import org.onap.apex.model.contextmodel.concepts.AxContextSchemas;
+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.AxContextAlbums;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextModel;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas;
/**
* @author Liam Fallon (liam.fallon@ericsson.com)
diff --git a/model/context-model/src/test/java/org/onap/apex/model/contextmodel/concepts/TestContextSchemas.java b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextSchemas.java
index 1e81c5a95..e9e9564ac 100644
--- a/model/context-model/src/test/java/org/onap/apex/model/contextmodel/concepts/TestContextSchemas.java
+++ b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextSchemas.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.contextmodel.concepts;
+package org.onap.policy.apex.model.contextmodel.concepts;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -28,11 +28,11 @@ import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import org.junit.Test;
-import org.onap.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.apex.model.basicmodel.concepts.AxValidationResult;
-import org.onap.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
-import org.onap.apex.model.contextmodel.concepts.AxContextSchema;
-import org.onap.apex.model.contextmodel.concepts.AxContextSchemas;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+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.contextmodel.concepts.AxContextSchema;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas;
/**
* @author Liam Fallon (liam.fallon@ericsson.com)
diff --git a/model/context-model/src/test/java/org/onap/apex/model/contextmodel/handling/TestApexContextModel.java b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestApexContextModel.java
index 0723a6827..477755ccc 100644
--- a/model/context-model/src/test/java/org/onap/apex/model/contextmodel/handling/TestApexContextModel.java
+++ b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestApexContextModel.java
@@ -5,20 +5,20 @@
* 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.apex.model.contextmodel.handling;
+package org.onap.policy.apex.model.contextmodel.handling;
import static org.junit.Assert.assertTrue;
@@ -29,10 +29,10 @@ import java.sql.DriverManager;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import org.onap.apex.model.basicmodel.concepts.AxValidationResult;
-import org.onap.apex.model.basicmodel.dao.DAOParameters;
-import org.onap.apex.model.basicmodel.test.TestApexModel;
-import org.onap.apex.model.contextmodel.concepts.AxContextModel;
+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.contextmodel.concepts.AxContextModel;
public class TestApexContextModel {
private Connection connection;
@@ -95,7 +95,7 @@ public class TestApexContextModel {
@Test
public void testModelWriteReadJPA() throws Exception {
final DAOParameters daoParameters = new DAOParameters();
- daoParameters.setPluginClass("org.onap.apex.model.basicmodel.dao.impl.DefaultApexDao");
+ daoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao");
daoParameters.setPersistenceUnit("DAOTest");
testApexModel.testApexModelWriteReadJPA(daoParameters);
@@ -103,25 +103,25 @@ public class TestApexContextModel {
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=contextAlbum1,version=0.0.1):org.onap.apex.model.basicmodel.concepts.AxKeyInfo:OBSERVATION:description is blank\n"
- + "********************************";
+ private static final String OBSERVATION_MODEL_STRING = "\n"
+ + "***observations noted during validation of model***\n"
+ + "AxArtifactKey:(name=contextAlbum1,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo:OBSERVATION:description is blank\n"
+ + "********************************";
private static final String WARNING_MODEL_STRING = "\n" + "***warnings issued during validation of model***\n"
- + "AxArtifactKey:(name=contextAlbum1,version=0.0.1):org.onap.apex.model.basicmodel.concepts.AxKeyInfo:WARNING:UUID is a zero UUID: 00000000-0000-0000-0000-000000000000\n"
+ + "AxArtifactKey:(name=contextAlbum1,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo:WARNING:UUID is a zero UUID: 00000000-0000-0000-0000-000000000000\n"
+ "********************************";
private static final String INVALID_MODEL_STRING = "\n" + "***validation of model failed***\n"
- + "AxArtifactKey:(name=StringType,version=0.0.1):org.onap.apex.model.contextmodel.concepts.AxContextSchema:INVALID:no schemaDefinition specified, schemaDefinition may not be blank\n"
- + "AxArtifactKey:(name=contextAlbum0,version=0.0.1):org.onap.apex.model.contextmodel.concepts.AxContextAlbum:INVALID:scope is not defined\n"
+ + "AxArtifactKey:(name=StringType,version=0.0.1):org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema:INVALID:no schemaDefinition specified, schemaDefinition may not be blank\n"
+ + "AxArtifactKey:(name=contextAlbum0,version=0.0.1):org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum:INVALID:scope is not defined\n"
+ "********************************";
private static final String INVALID_MODEL_MALSTRUCTURED_STRING = "\n" + "***validation of model failed***\n"
- + "AxArtifactKey:(name=ContextModel,version=0.0.1):org.onap.apex.model.contextmodel.concepts.AxContextModel:INVALID:key information not found for key AxArtifactKey:(name=contextAlbum1,version=0.0.2)\n"
- + "AxArtifactKey:(name=contextAlbum1,version=0.0.1):org.onap.apex.model.contextmodel.concepts.AxContextModel:WARNING:key not found for key information entry\n"
- + "AxArtifactKey:(name=ContextSchemas,version=0.0.1):org.onap.apex.model.contextmodel.concepts.AxContextSchemas:INVALID:key on schemas entry AxArtifactKey:(name=MapType,version=0.0.1) does not equal entry key AxArtifactKey:(name=MapType,version=0.0.2)\n"
- + "AxArtifactKey:(name=contextAlbums,version=0.0.1):org.onap.apex.model.contextmodel.concepts.AxContextAlbums:INVALID:key on context album entry key AxArtifactKey:(name=contextAlbum1,version=0.0.1) does not equal context album value key AxArtifactKey:(name=contextAlbum1,version=0.0.2)\n"
+ + "AxArtifactKey:(name=ContextModel,version=0.0.1):org.onap.policy.apex.model.contextmodel.concepts.AxContextModel:INVALID:key information not found for key AxArtifactKey:(name=contextAlbum1,version=0.0.2)\n"
+ + "AxArtifactKey:(name=contextAlbum1,version=0.0.1):org.onap.policy.apex.model.contextmodel.concepts.AxContextModel:WARNING:key not found for key information entry\n"
+ + "AxArtifactKey:(name=ContextSchemas,version=0.0.1):org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas:INVALID:key on schemas entry AxArtifactKey:(name=MapType,version=0.0.1) does not equal entry key AxArtifactKey:(name=MapType,version=0.0.2)\n"
+ + "AxArtifactKey:(name=contextAlbums,version=0.0.1):org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbums:INVALID:key on context album entry key AxArtifactKey:(name=contextAlbum1,version=0.0.1) does not equal context album value key AxArtifactKey:(name=contextAlbum1,version=0.0.2)\n"
+ "********************************";
}
diff --git a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestApexContextModelCreator.java b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestApexContextModelCreator.java
new file mode 100644
index 000000000..4e8d8d5a9
--- /dev/null
+++ b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestApexContextModelCreator.java
@@ -0,0 +1,123 @@
+/*-
+ * ============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.contextmodel.handling;
+
+import java.util.UUID;
+
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation;
+import org.onap.policy.apex.model.basicmodel.test.TestApexModelCreator;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbums;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextModel;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas;
+
+public class TestApexContextModelCreator implements TestApexModelCreator<AxContextModel> {
+
+ @Override
+ public AxContextModel getModel() {
+ final AxContextSchema schema0 = new AxContextSchema(new AxArtifactKey("StringType", "0.0.1"), "Java",
+ "org.onap.policy.apex.concept.TestContextItem000");
+ final AxContextSchema schema1 = new AxContextSchema(new AxArtifactKey("MapType", "0.0.1"), "Java",
+ "org.onap.policy.apex.concept.TestContextItem00A");
+
+ final AxContextSchemas contextSchemas = new AxContextSchemas(new AxArtifactKey("ContextSchemas", "0.0.1"));
+ contextSchemas.getSchemasMap().put(schema0.getKey(), schema0);
+ contextSchemas.getSchemasMap().put(schema1.getKey(), schema1);
+
+ final AxContextAlbum contextAlbum0 =
+ new AxContextAlbum(new AxArtifactKey("contextAlbum0", "0.0.1"), "APPLICATION", true, schema0.getKey());
+ final AxContextAlbum contextAlbum1 =
+ new AxContextAlbum(new AxArtifactKey("contextAlbum1", "0.0.1"), "GLOBAL", false, schema1.getKey());
+
+ final AxContextAlbums axContext = new AxContextAlbums(new AxArtifactKey("contextAlbums", "0.0.1"));
+ axContext.getAlbumsMap().put(contextAlbum0.getKey(), contextAlbum0);
+ axContext.getAlbumsMap().put(contextAlbum1.getKey(), contextAlbum1);
+
+ final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1"));
+ final AxContextModel contextModel = new AxContextModel(new AxArtifactKey("ContextModel", "0.0.1"),
+ contextSchemas, axContext, keyInformation);
+
+ contextModel.setKeyInformation(keyInformation);
+ contextModel.getKeyInformation().getKeyInfoMap().put(schema0.getKey(), new AxKeyInfo(schema0.getKey(),
+ UUID.fromString("00000000-0000-0000-0000-000000000001"), "axContextSchema0"));
+ contextModel.getKeyInformation().getKeyInfoMap().put(schema1.getKey(), new AxKeyInfo(schema1.getKey(),
+ UUID.fromString("00000000-0000-0000-0000-000000000002"), "axContextSchema1"));
+ contextModel.getKeyInformation().getKeyInfoMap().put(contextSchemas.getKey(), new AxKeyInfo(
+ contextSchemas.getKey(), UUID.fromString("00000000-0000-0000-0000-000000000003"), "ContextSchemas"));
+ contextModel.getKeyInformation().getKeyInfoMap().put(contextAlbum0.getKey(), new AxKeyInfo(
+ contextAlbum0.getKey(), UUID.fromString("00000000-0000-0000-0000-000000000004"), "contextAlbum0"));
+ contextModel.getKeyInformation().getKeyInfoMap().put(contextAlbum1.getKey(), new AxKeyInfo(
+ contextAlbum1.getKey(), UUID.fromString("00000000-0000-0000-0000-000000000005"), "contextAlbum1"));
+ contextModel.getKeyInformation().getKeyInfoMap().put(axContext.getKey(), new AxKeyInfo(axContext.getKey(),
+ UUID.fromString("00000000-0000-0000-0000-000000000006"), "axContext"));
+ contextModel.getKeyInformation().getKeyInfoMap().put(contextModel.getKey(), new AxKeyInfo(contextModel.getKey(),
+ UUID.fromString("00000000-0000-0000-0000-000000000007"), "contextModel"));
+ contextModel.getKeyInformation().getKeyInfoMap().put(keyInformation.getKey(), new AxKeyInfo(
+ keyInformation.getKey(), UUID.fromString("00000000-0000-0000-0000-000000000008"), "keyInformation"));
+
+ return contextModel;
+ }
+
+ @Override
+ public AxContextModel getInvalidModel() {
+ final AxContextModel contextModel = getModel();
+
+ contextModel.getAlbums().get(new AxArtifactKey("contextAlbum0", "0.0.1")).setScope("UNDEFINED");
+
+ contextModel.getSchemas().get(new AxArtifactKey("StringType", "0.0.1")).setSchema("");
+
+ return contextModel;
+ }
+
+ @Override
+ public AxContextModel getMalstructuredModel() {
+ final AxContextModel contextModel = getModel();
+
+ contextModel.getAlbums().get(new AxArtifactKey("contextAlbum1", "0.0.1"))
+ .setKey(new AxArtifactKey("contextAlbum1", "0.0.2"));;
+ contextModel.getSchemas().get(new AxArtifactKey("MapType", "0.0.1"))
+ .setKey(new AxArtifactKey("MapType", "0.0.2"));;
+
+ return contextModel;
+ }
+
+ @Override
+ public AxContextModel getObservationModel() {
+ final AxContextModel contextModel = getModel();
+
+ contextModel.getKeyInformation().get("contextAlbum1", "0.0.1").setDescription("");
+
+ return contextModel;
+ }
+
+ @Override
+ public AxContextModel getWarningModel() {
+ final AxContextModel contextModel = getModel();
+
+ contextModel.getKeyInformation().get("contextAlbum1", "0.0.1")
+ .setUuid(UUID.fromString("00000000-0000-0000-0000-000000000000"));
+
+ return contextModel;
+ }
+}
diff --git a/model/context-model/src/test/java/org/onap/apex/model/contextmodel/handling/TestContextComparison.java b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestContextComparison.java
index fe87509b9..794cfa9f7 100644
--- a/model/context-model/src/test/java/org/onap/apex/model/contextmodel/handling/TestContextComparison.java
+++ b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestContextComparison.java
@@ -18,18 +18,18 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.apex.model.contextmodel.handling;
+package org.onap.policy.apex.model.contextmodel.handling;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.junit.Test;
-import org.onap.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.apex.model.contextmodel.concepts.AxContextAlbum;
-import org.onap.apex.model.contextmodel.concepts.AxContextModel;
-import org.onap.apex.model.contextmodel.concepts.AxContextSchema;
-import org.onap.apex.model.contextmodel.handling.ContextComparer;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextModel;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema;
+import org.onap.policy.apex.model.contextmodel.handling.ContextComparer;
import org.onap.policy.apex.model.utilities.comparison.KeyedMapDifference;
/**
diff --git a/model/context-model/src/test/java/org/onap/apex/model/contextmodel/handling/TestContextComparisonFactory.java b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestContextComparisonFactory.java
index 1850c222d..2c6f8e172 100644
--- a/model/context-model/src/test/java/org/onap/apex/model/contextmodel/handling/TestContextComparisonFactory.java
+++ b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestContextComparisonFactory.java
@@ -5,48 +5,52 @@
* 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.apex.model.contextmodel.handling;
+package org.onap.policy.apex.model.contextmodel.handling;
-import org.onap.apex.model.basicmodel.concepts.AxArtifactKey;
-import org.onap.apex.model.contextmodel.concepts.AxContextAlbum;
-import org.onap.apex.model.contextmodel.concepts.AxContextModel;
-import org.onap.apex.model.contextmodel.concepts.AxContextSchema;
+import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextModel;
+import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema;
/**
* This class creates sample Policy Models
- *
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public class TestContextComparisonFactory {
public AxContextModel getFullModel() {
- final AxContextSchema testContextSchema000 = new AxContextSchema(new AxArtifactKey("TestContextSchema000", "0.0.1"), "JAVA",
- "com.ericsson.apex.concept.TestContextSchema000");
- final AxContextSchema testContextSchema00A = new AxContextSchema(new AxArtifactKey("TestContextSchema00A", "0.0.1"), "JAVA",
- "com.ericsson.apex.concept.TestContextSchema00A");
- final AxContextSchema testContextSchema00C = new AxContextSchema(new AxArtifactKey("TestContextSchema00C", "0.0.1"), "JAVA",
- "com.ericsson.apex.concept.TestContextSchema00C");
-
- final AxContextAlbum externalContextAlbum = new AxContextAlbum(new AxArtifactKey("ExternalContextAlbum", "0.0.1"), "EXTERNAL", false,
- testContextSchema000.getKey());
- final AxContextAlbum globalContextAlbum = new AxContextAlbum(new AxArtifactKey("GlobalContextAlbum", "0.0.1"), "GLOBAL", true, testContextSchema00A.getKey());
- final AxContextAlbum policy0ContextAlbum = new AxContextAlbum(new AxArtifactKey("Policy0ContextAlbum", "0.0.1"), "APPLICATION", true,
- testContextSchema00C.getKey());
- final AxContextAlbum policy1ContextAlbum = new AxContextAlbum(new AxArtifactKey("Policy1ContextAlbum ", "0.0.1"), "APPLICATION", true,
- testContextSchema00C.getKey());
+ final AxContextSchema testContextSchema000 =
+ new AxContextSchema(new AxArtifactKey("TestContextSchema000", "0.0.1"), "JAVA",
+ "org.onap.policy.apex.concept.TestContextSchema000");
+ final AxContextSchema testContextSchema00A =
+ new AxContextSchema(new AxArtifactKey("TestContextSchema00A", "0.0.1"), "JAVA",
+ "org.onap.policy.apex.concept.TestContextSchema00A");
+ final AxContextSchema testContextSchema00C =
+ new AxContextSchema(new AxArtifactKey("TestContextSchema00C", "0.0.1"), "JAVA",
+ "org.onap.policy.apex.concept.TestContextSchema00C");
+
+ final AxContextAlbum externalContextAlbum = new AxContextAlbum(
+ new AxArtifactKey("ExternalContextAlbum", "0.0.1"), "EXTERNAL", false, testContextSchema000.getKey());
+ final AxContextAlbum globalContextAlbum = new AxContextAlbum(new AxArtifactKey("GlobalContextAlbum", "0.0.1"),
+ "GLOBAL", true, testContextSchema00A.getKey());
+ final AxContextAlbum policy0ContextAlbum = new AxContextAlbum(new AxArtifactKey("Policy0ContextAlbum", "0.0.1"),
+ "APPLICATION", true, testContextSchema00C.getKey());
+ final AxContextAlbum policy1ContextAlbum = new AxContextAlbum(
+ new AxArtifactKey("Policy1ContextAlbum ", "0.0.1"), "APPLICATION", true, testContextSchema00C.getKey());
final AxContextModel contextModel = new AxContextModel(new AxArtifactKey("ContextModel", "0.0.1"));
contextModel.getSchemas().getSchemasMap().put(testContextSchema000.getKey(), testContextSchema000);
@@ -66,12 +70,15 @@ public class TestContextComparisonFactory {
}
public AxContextModel getShellModel() {
- final AxContextSchema testContextSchema000 = new AxContextSchema(new AxArtifactKey("TestContextSchema000", "0.0.1"), "JAVA",
- "com.ericsson.apex.concept.TestContextSchema000");
- final AxContextSchema testContextSchema00A = new AxContextSchema(new AxArtifactKey("TestContextSchema00A", "0.0.1"), "JAVA",
- "com.ericsson.apex.concept.TestContextSchema00A");
- final AxContextSchema testContextSchema00C = new AxContextSchema(new AxArtifactKey("TestContextSchema00C", "0.0.1"), "JAVA",
- "com.ericsson.apex.concept.TestContextSchema00C");
+ final AxContextSchema testContextSchema000 =
+ new AxContextSchema(new AxArtifactKey("TestContextSchema000", "0.0.1"), "JAVA",
+ "org.onap.policy.apex.concept.TestContextSchema000");
+ final AxContextSchema testContextSchema00A =
+ new AxContextSchema(new AxArtifactKey("TestContextSchema00A", "0.0.1"), "JAVA",
+ "org.onap.policy.apex.concept.TestContextSchema00A");
+ final AxContextSchema testContextSchema00C =
+ new AxContextSchema(new AxArtifactKey("TestContextSchema00C", "0.0.1"), "JAVA",
+ "org.onap.policy.apex.concept.TestContextSchema00C");
final AxContextModel contextModel = new AxContextModel(new AxArtifactKey("ContextModel", "0.0.1"));
contextModel.getSchemas().getSchemasMap().put(testContextSchema000.getKey(), testContextSchema000);
@@ -82,11 +89,12 @@ public class TestContextComparisonFactory {
}
public AxContextModel getSingleEntryModel() {
- final AxContextSchema testContextSchema000 = new AxContextSchema(new AxArtifactKey("TestContextSchema000", "0.0.1"), "JAVA",
- "com.ericsson.apex.concept.TestContextSchema000");
+ final AxContextSchema testContextSchema000 =
+ new AxContextSchema(new AxArtifactKey("TestContextSchema000", "0.0.1"), "JAVA",
+ "org.onap.policy.apex.concept.TestContextSchema000");
- final AxContextAlbum policy1ContextAlbum = new AxContextAlbum(new AxArtifactKey("Policy1ContextAlbum ", "0.0.1"), "APPLICATION", true,
- testContextSchema000.getKey());
+ final AxContextAlbum policy1ContextAlbum = new AxContextAlbum(
+ new AxArtifactKey("Policy1ContextAlbum ", "0.0.1"), "APPLICATION", true, testContextSchema000.getKey());
final AxContextModel contextModel = new AxContextModel(new AxArtifactKey("ContextModel", "0.0.1"));
contextModel.getSchemas().getSchemasMap().put(testContextSchema000.getKey(), testContextSchema000);
@@ -97,17 +105,19 @@ public class TestContextComparisonFactory {
}
public AxContextModel getNoGlobalContextModel() {
- final AxContextSchema testContextSchema000 = new AxContextSchema(new AxArtifactKey("TestContextSchema000", "0.0.1"), "JAVA",
- "com.ericsson.apex.concept.TestContextSchema000");
- final AxContextSchema testContextSchema00C = new AxContextSchema(new AxArtifactKey("TestContextSchema00C", "0.0.1"), "JAVA",
- "com.ericsson.apex.concept.TestContextSchema00C");
-
- final AxContextAlbum externalContextAlbum = new AxContextAlbum(new AxArtifactKey("ExternalContextAlbum", "0.0.1"), "EXTERNAL", false,
- testContextSchema000.getKey());
- final AxContextAlbum policy0ContextAlbum = new AxContextAlbum(new AxArtifactKey("Policy0ContextAlbum", "0.0.1"), "APPLICATION", true,
- testContextSchema00C.getKey());
- final AxContextAlbum policy1ContextAlbum = new AxContextAlbum(new AxArtifactKey("Policy1ContextAlbum ", "0.0.1"), "APPLICATION", true,
- testContextSchema00C.getKey());
+ final AxContextSchema testContextSchema000 =
+ new AxContextSchema(new AxArtifactKey("TestContextSchema000", "0.0.1"), "JAVA",
+ "org.onap.policy.apex.concept.TestContextSchema000");
+ final AxContextSchema testContextSchema00C =
+ new AxContextSchema(new AxArtifactKey("TestContextSchema00C", "0.0.1"), "JAVA",
+ "org.onap.policy.apex.concept.TestContextSchema00C");
+
+ final AxContextAlbum externalContextAlbum = new AxContextAlbum(
+ new AxArtifactKey("ExternalContextAlbum", "0.0.1"), "EXTERNAL", false, testContextSchema000.getKey());
+ final AxContextAlbum policy0ContextAlbum = new AxContextAlbum(new AxArtifactKey("Policy0ContextAlbum", "0.0.1"),
+ "APPLICATION", true, testContextSchema00C.getKey());
+ final AxContextAlbum policy1ContextAlbum = new AxContextAlbum(
+ new AxArtifactKey("Policy1ContextAlbum ", "0.0.1"), "APPLICATION", true, testContextSchema00C.getKey());
final AxContextModel contextModel = new AxContextModel(new AxArtifactKey("ContextModel", "0.0.1"));
contextModel.getSchemas().getSchemasMap().put(testContextSchema000.getKey(), testContextSchema000);
diff --git a/model/context-model/src/test/resources/META-INF/persistence.xml b/model/context-model/src/test/resources/META-INF/persistence.xml
index d9203b4be..ec9357851 100644
--- a/model/context-model/src/test/resources/META-INF/persistence.xml
+++ b/model/context-model/src/test/resources/META-INF/persistence.xml
@@ -23,19 +23,19 @@
<persistence-unit name="DAOTest" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
- <class>org.onap.apex.model.basicmodel.dao.converters.CDATAConditioner</class>
- <class>org.onap.apex.model.basicmodel.dao.converters.UUID2String</class>
- <class>org.onap.apex.model.basicmodel.concepts.AxArtifactKey</class>
- <class>org.onap.apex.model.basicmodel.concepts.AxConcept</class>
- <class>org.onap.apex.model.basicmodel.concepts.AxKeyInfo</class>
- <class>org.onap.apex.model.basicmodel.concepts.AxKeyInformation</class>
- <class>org.onap.apex.model.basicmodel.concepts.AxModel</class>
- <class>org.onap.apex.model.basicmodel.concepts.TestEntity</class>
- <class>org.onap.apex.model.contextmodel.concepts.AxContextSchema</class>
- <class>org.onap.apex.model.contextmodel.concepts.AxContextSchemas</class>
- <class>org.onap.apex.model.contextmodel.concepts.AxContextAlbum</class>
- <class>org.onap.apex.model.contextmodel.concepts.AxContextAlbums</class>
- <class>org.onap.apex.model.contextmodel.concepts.AxContextModel</class>
+ <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>
<properties>
<property name="javax.persistence.jdbc.url" value="jdbc:derby:memory:apex_test" />
diff --git a/model/context-model/src/test/resources/json/ContextModel.json b/model/context-model/src/test/resources/json/ContextModel.json
index cbaabc63b..2c93ef1c2 100644
--- a/model/context-model/src/test/resources/json/ContextModel.json
+++ b/model/context-model/src/test/resources/json/ContextModel.json
@@ -85,7 +85,7 @@
"name" : "StringType",
"version" : "0.0.1"
},
- "javaType" : "com.ericsson.apex.core.contextmodel.concepts.TestContextItem000"
+ "javaType" : "org.onap.policy.apex.core.contextmodel.concepts.TestContextItem000"
},
"isWritable" : true,
"valueString" : ""
@@ -96,7 +96,7 @@
"name" : "MapType",
"version" : "0.0.1"
},
- "javaType" : "com.ericsson.apex.core.contextmodel.concepts.TestContextItem00A"
+ "javaType" : "org.onap.policy.apex.core.contextmodel.concepts.TestContextItem00A"
},
"isWritable" : true,
"valueString" : ""
@@ -107,7 +107,7 @@
"name" : "StringType",
"version" : "0.0.1"
},
- "javaType" : "com.ericsson.apex.core.contextmodel.concepts.TestContextItem000"
+ "javaType" : "org.onap.policy.apex.core.contextmodel.concepts.TestContextItem000"
},
"isWritable" : true,
"valueString" : ""
@@ -118,7 +118,7 @@
"name" : "MapType",
"version" : "0.0.1"
},
- "javaType" : "com.ericsson.apex.core.contextmodel.concepts.TestContextItem00A"
+ "javaType" : "org.onap.policy.apex.core.contextmodel.concepts.TestContextItem00A"
},
"isWritable" : true,
"valueString" : ""
@@ -141,7 +141,7 @@
"name" : "MapType",
"version" : "0.0.1"
},
- "javaType" : "com.ericsson.apex.core.contextmodel.concepts.TestContextItem00A"
+ "javaType" : "org.onap.policy.apex.core.contextmodel.concepts.TestContextItem00A"
},
"isWritable" : true
},
diff --git a/model/context-model/src/test/resources/logback-test.xml b/model/context-model/src/test/resources/logback-test.xml
index 07bc02591..628f02397 100644
--- a/model/context-model/src/test/resources/logback-test.xml
+++ b/model/context-model/src/test/resources/logback-test.xml
@@ -40,7 +40,7 @@
<appender-ref ref="STDOUT" />
</logger>
- <logger name="com.ericsson.apex.core.contextmodel" level="TRACE" additivity="false">
+ <logger name="org.onap.policy.apex.core.contextmodel" level="TRACE" additivity="false">
<appender-ref ref="STDOUT" />
</logger>
@@ -48,7 +48,7 @@
<appender-ref ref="STDOUT" />
</logger>
- <logger name="com.ericsson.apex.core" level="TRACE" additivity="false">
+ <logger name="org.onap.policy.apex.core" level="TRACE" additivity="false">
<appender-ref ref="STDOUT" />
</logger>
@@ -68,11 +68,11 @@
</encoder>
</appender>
- <logger name="com.ericsson.apex.core.context.impl.monitoring" level="TRACE" additivity="false">
+ <logger name="org.onap.policy.apex.core.context.impl.monitoring" level="TRACE" additivity="false">
<appender-ref ref="CTXT_FILE" />
</logger>
- <logger name="com.ericsson.apex.core.context" level="INFO" additivity="false">
+ <logger name="org.onap.policy.apex.core.context" level="INFO" additivity="false">
<appender-ref ref="STDOUT" />
</logger>
</configuration>