summaryrefslogtreecommitdiffstats
path: root/model/context-model/src/test
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@ericsson.com>2018-09-10 17:05:36 +0100
committerliamfallon <liam.fallon@ericsson.com>2018-09-10 17:07:47 +0100
commitd100854291559df1426ea1e64351872ae2d3867b (patch)
tree78baab90111307cd3d2460b2cca37e93a20ac9a3 /model/context-model/src/test
parent8f82d7adcb53b349e14d3b356bda03588a554f95 (diff)
Checkstyle changes for apex model
Fix checkstyle warnings in the apex mode and knock on changes. Issue-ID: POLICY-1034 Change-Id: I10537e4288e9cad5ef18165ed2cdc1d3ab3139c1 Signed-off-by: liamfallon <liam.fallon@ericsson.com>
Diffstat (limited to 'model/context-model/src/test')
-rw-r--r--model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextAlbums.java24
-rw-r--r--model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextModel.java44
-rw-r--r--model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextSchemas.java23
-rw-r--r--model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestApexContextModel.java58
-rw-r--r--model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestContextComparison.java93
-rw-r--r--model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestContextComparisonFactory.java18
6 files changed, 171 insertions, 89 deletions
diff --git a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextAlbums.java b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextAlbums.java
index 839e19835..6ba0b2fa6 100644
--- a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextAlbums.java
+++ b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextAlbums.java
@@ -35,6 +35,8 @@ import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum;
import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbums;
/**
+ * Context album tests.
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public class TestContextAlbums {
@@ -62,7 +64,7 @@ public class TestContextAlbums {
fail("test should throw an exception here");
} catch (final Exception e) {
assertEquals("parameter \"scope\": value \"\", does not match regular expression \"[A-Za-z0-9\\-_]+\"",
- e.getMessage());
+ e.getMessage());
}
album.setScope("NewAlbumScope");
@@ -114,9 +116,9 @@ public class TestContextAlbums {
album.clean();
final AxContextAlbum clonedAlbum = new AxContextAlbum(album);
- assertEquals(
- "AxContextAlbum:(key=AxArtifactKey:(name=NewAlbumName,version=0.0.1),scope=NewAlbumScope,isWritable=true,itemSchema=AxArtifactKey:(name=AlbumSchemaName,version=0.0.1))",
- clonedAlbum.toString());
+ assertEquals("AxContextAlbum:(key=AxArtifactKey:(name=NewAlbumName,version=0.0.1),"
+ + "scope=NewAlbumScope,isWritable=true,itemSchema="
+ + "AxArtifactKey:(name=AlbumSchemaName,version=0.0.1))", clonedAlbum.toString());
assertFalse(album.hashCode() == 0);
@@ -134,13 +136,13 @@ public class TestContextAlbums {
assertEquals(0, album.compareTo(clonedAlbum));
assertNotEquals(0, album.compareTo(null));
assertNotEquals(0, album.compareTo(new AxArtifactKey()));
- assertNotEquals(0,
- album.compareTo(new AxContextAlbum(new AxArtifactKey(), "Scope", false, AxArtifactKey.getNullKey())));
+ assertNotEquals(0, album.compareTo(
+ new AxContextAlbum(new AxArtifactKey(), "Scope", false, AxArtifactKey.getNullKey())));
assertNotEquals(0, album.compareTo(new AxContextAlbum(newKey, "Scope", false, AxArtifactKey.getNullKey())));
+ assertNotEquals(0, album
+ .compareTo(new AxContextAlbum(newKey, "NewAlbumScope", false, AxArtifactKey.getNullKey())));
assertNotEquals(0,
- album.compareTo(new AxContextAlbum(newKey, "NewAlbumScope", false, AxArtifactKey.getNullKey())));
- assertNotEquals(0,
- album.compareTo(new AxContextAlbum(newKey, "NewAlbumScope", true, AxArtifactKey.getNullKey())));
+ album.compareTo(new AxContextAlbum(newKey, "NewAlbumScope", true, AxArtifactKey.getNullKey())));
assertEquals(0, album.compareTo(new AxContextAlbum(newKey, "NewAlbumScope", true, albumSchemaKey)));
final AxContextAlbums albums = new AxContextAlbums();
@@ -182,8 +184,8 @@ public class TestContextAlbums {
albums.clean();
final AxContextAlbums clonedAlbums = new AxContextAlbums(albums);
- assertTrue(clonedAlbums.toString()
- .startsWith("AxContextAlbums:(AxContextAlbums:(key=AxArtifactKey:(name=AlbumsKey,version=0.0.1)"));
+ assertTrue(clonedAlbums.toString().startsWith(
+ "AxContextAlbums:(AxContextAlbums:(key=AxArtifactKey:(name=AlbumsKey,version=0.0.1)"));
assertFalse(albums.hashCode() == 0);
diff --git a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextModel.java b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextModel.java
index 163e50018..290183e5f 100644
--- a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextModel.java
+++ b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextModel.java
@@ -34,6 +34,8 @@ import org.onap.policy.apex.model.contextmodel.concepts.AxContextModel;
import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchemas;
/**
+ * Context model tests.
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public class TestContextModel {
@@ -43,19 +45,21 @@ public class TestContextModel {
assertNotNull(new AxContextModel());
assertNotNull(new AxContextModel(new AxArtifactKey()));
assertNotNull(new AxContextModel(new AxArtifactKey(), new AxContextSchemas(), new AxKeyInformation()));
- assertNotNull(new AxContextModel(new AxArtifactKey(), new AxContextSchemas(), new AxContextAlbums(), new AxKeyInformation()));
-
+ assertNotNull(new AxContextModel(new AxArtifactKey(), new AxContextSchemas(), new AxContextAlbums(),
+ new AxKeyInformation()));
+
final AxArtifactKey modelKey = new AxArtifactKey("ModelKey", "0.0.1");
final AxArtifactKey schemasKey = new AxArtifactKey("SchemasKey", "0.0.1");
final AxArtifactKey albumsKey = new AxArtifactKey("SchemasKey", "0.0.1");
final AxArtifactKey keyInfoKey = new AxArtifactKey("SchemasKey", "0.0.1");
- final AxContextModel model = new AxContextModel(modelKey, new AxContextSchemas(schemasKey), new AxContextAlbums(albumsKey), new AxKeyInformation(keyInfoKey));
+ final AxContextModel model = new AxContextModel(modelKey, new AxContextSchemas(schemasKey),
+ new AxContextAlbums(albumsKey), new AxKeyInformation(keyInfoKey));
model.register();
-
+
model.clean();
assertNotNull(model);
assertEquals("AxContextModel:(AxContextModel:(key=AxArtifactKey:", model.toString().substring(0, 50));
-
+
final AxContextModel clonedModel = new AxContextModel(model);
assertFalse(model.hashCode() == 0);
@@ -64,19 +68,29 @@ public class TestContextModel {
assertTrue(model.equals(clonedModel));
assertFalse(model.equals("Hello"));
assertFalse(model.equals(new AxContextModel(new AxArtifactKey())));
- assertFalse(model.equals(new AxContextModel(new AxArtifactKey(), new AxContextSchemas(), new AxContextAlbums(), new AxKeyInformation())));
- assertFalse(model.equals(new AxContextModel(modelKey, new AxContextSchemas(), new AxContextAlbums(), new AxKeyInformation())));
- assertFalse(model.equals(new AxContextModel(modelKey, new AxContextSchemas(), new AxContextAlbums(), new AxKeyInformation(keyInfoKey))));
- assertFalse(model.equals(new AxContextModel(modelKey, new AxContextSchemas(schemasKey), new AxContextAlbums(), new AxKeyInformation(keyInfoKey))));
- assertTrue(model.equals(new AxContextModel(modelKey, new AxContextSchemas(schemasKey), new AxContextAlbums(albumsKey), new AxKeyInformation(keyInfoKey))));
+ assertFalse(model.equals(new AxContextModel(new AxArtifactKey(), new AxContextSchemas(), new AxContextAlbums(),
+ new AxKeyInformation())));
+ assertFalse(model.equals(new AxContextModel(modelKey, new AxContextSchemas(), new AxContextAlbums(),
+ new AxKeyInformation())));
+ assertFalse(model.equals(new AxContextModel(modelKey, new AxContextSchemas(), new AxContextAlbums(),
+ new AxKeyInformation(keyInfoKey))));
+ assertFalse(model.equals(new AxContextModel(modelKey, new AxContextSchemas(schemasKey), new AxContextAlbums(),
+ new AxKeyInformation(keyInfoKey))));
+ assertTrue(model.equals(new AxContextModel(modelKey, new AxContextSchemas(schemasKey),
+ new AxContextAlbums(albumsKey), new AxKeyInformation(keyInfoKey))));
assertEquals(0, model.compareTo(model));
assertEquals(0, model.compareTo(clonedModel));
assertNotEquals(0, model.compareTo(new AxArtifactKey()));
- assertNotEquals(0, model.compareTo(new AxContextModel(new AxArtifactKey(), new AxContextSchemas(), new AxContextAlbums(), new AxKeyInformation())));
- assertNotEquals(0, model.compareTo(new AxContextModel(modelKey, new AxContextSchemas(), new AxContextAlbums(), new AxKeyInformation())));
- assertNotEquals(0, model.compareTo(new AxContextModel(modelKey, new AxContextSchemas(), new AxContextAlbums(), new AxKeyInformation(keyInfoKey))));
- assertNotEquals(0, model.compareTo(new AxContextModel(modelKey, new AxContextSchemas(schemasKey), new AxContextAlbums(), new AxKeyInformation(keyInfoKey))));
- assertEquals(0, model.compareTo(new AxContextModel(modelKey, new AxContextSchemas(schemasKey), new AxContextAlbums(albumsKey), new AxKeyInformation(keyInfoKey))));
+ assertNotEquals(0, model.compareTo(new AxContextModel(new AxArtifactKey(), new AxContextSchemas(),
+ new AxContextAlbums(), new AxKeyInformation())));
+ assertNotEquals(0, model.compareTo(new AxContextModel(modelKey, new AxContextSchemas(), new AxContextAlbums(),
+ new AxKeyInformation())));
+ assertNotEquals(0, model.compareTo(new AxContextModel(modelKey, new AxContextSchemas(), new AxContextAlbums(),
+ new AxKeyInformation(keyInfoKey))));
+ assertNotEquals(0, model.compareTo(new AxContextModel(modelKey, new AxContextSchemas(schemasKey),
+ new AxContextAlbums(), new AxKeyInformation(keyInfoKey))));
+ assertEquals(0, model.compareTo(new AxContextModel(modelKey, new AxContextSchemas(schemasKey),
+ new AxContextAlbums(albumsKey), new AxKeyInformation(keyInfoKey))));
}
}
diff --git a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextSchemas.java b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextSchemas.java
index 02dfd6fb1..a8dde7781 100644
--- a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextSchemas.java
+++ b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/concepts/TestContextSchemas.java
@@ -35,7 +35,7 @@ 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)
+ * Context schema tests.
*/
public class TestContextSchemas {
@@ -44,8 +44,8 @@ public class TestContextSchemas {
assertNotNull(new AxContextSchema());
assertNotNull(new AxContextSchema(new AxArtifactKey(), "SchemaFlavour", "SchemaDefinition"));
- final AxContextSchema schema =
- new AxContextSchema(new AxArtifactKey("SchemaName", "0.0.1"), "SchemaFlavour", "SchemaDefinition");
+ final AxContextSchema schema = new AxContextSchema(new AxArtifactKey("SchemaName", "0.0.1"), "SchemaFlavour",
+ "SchemaDefinition");
assertNotNull(schema);
final AxArtifactKey newKey = new AxArtifactKey("NewSchemaName", "0.0.1");
@@ -57,9 +57,8 @@ public class TestContextSchemas {
schema.setSchemaFlavour("");
fail("test should throw an exception here");
} catch (final Exception e) {
- assertEquals(
- "parameter \"schemaFlavour\": value \"\", does not match regular expression \"[A-Za-z0-9\\-_]+\"",
- e.getMessage());
+ assertEquals("parameter \"schemaFlavour\": value \"\", "
+ + "does not match regular expression \"[A-Za-z0-9\\-_]+\"", e.getMessage());
}
schema.setSchemaFlavour("NewSchemaFlavour");
@@ -105,16 +104,16 @@ public class TestContextSchemas {
schema.clean();
final AxContextSchema clonedSchema = new AxContextSchema(schema);
- assertEquals(
- "AxContextSchema:(key=AxArtifactKey:(name=NewSchemaName,version=0.0.1),schemaFlavour=NewSchemaFlavour,schemaDefinition=NewSchemaDefinition)",
- clonedSchema.toString());
+ assertEquals("AxContextSchema:(key=AxArtifactKey:(name=NewSchemaName,version=0.0.1),"
+ + "schemaFlavour=NewSchemaFlavour,schemaDefinition=NewSchemaDefinition)",
+ clonedSchema.toString());
assertFalse(schema.hashCode() == 0);
assertTrue(schema.equals(schema));
assertTrue(schema.equals(clonedSchema));
assertFalse(schema.equals(null));
- assertFalse(schema.equals("Hello"));
+ assertFalse(schema.equals((Object) "Hello"));
assertFalse(schema.equals(new AxContextSchema(new AxArtifactKey(), "Flavour", "Def")));
assertFalse(schema.equals(new AxContextSchema(newKey, "Flavour", "Def")));
assertFalse(schema.equals(new AxContextSchema(newKey, "NewSchemaFlavour", "Def")));
@@ -169,14 +168,14 @@ public class TestContextSchemas {
final AxContextSchemas clonedSchemas = new AxContextSchemas(schemas);
assertTrue(clonedSchemas.toString()
- .startsWith("AxContextSchemas:(key=AxArtifactKey:(name=SchemasKey,version=0.0.1),"));
+ .startsWith("AxContextSchemas:(key=AxArtifactKey:(name=SchemasKey,version=0.0.1),"));
assertFalse(schemas.hashCode() == 0);
assertTrue(schemas.equals(schemas));
assertTrue(schemas.equals(clonedSchemas));
assertFalse(schemas.equals(null));
- assertFalse(schemas.equals("Hello"));
+ assertFalse(schemas.equals((Object) "Hello"));
assertFalse(schemas.equals(new AxContextSchemas(new AxArtifactKey())));
assertEquals(0, schemas.compareTo(schemas));
diff --git a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestApexContextModel.java b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestApexContextModel.java
index 10609ec9b..94a36844f 100644
--- a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestApexContextModel.java
+++ b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestApexContextModel.java
@@ -34,10 +34,21 @@ 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;
+/**
+ * Apex context model tests.
+ *
+ * @author liam
+ *
+ */
public class TestApexContextModel {
private Connection connection;
TestApexModel<AxContextModel> testApexModel;
+ /**
+ * Set up tests.
+ *
+ * @throws Exception a testing exception
+ */
@Before
public void setup() throws Exception {
Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance();
@@ -83,17 +94,17 @@ public class TestApexContextModel {
}
@Test
- public void testModelWriteReadXML() throws Exception {
+ public void testModelWriteReadXml() throws Exception {
testApexModel.testApexModelWriteReadXml();
}
@Test
- public void testModelWriteReadJSON() throws Exception {
+ public void testModelWriteReadJson() throws Exception {
testApexModel.testApexModelWriteReadJson();
}
@Test
- public void testModelWriteReadJPA() throws Exception {
+ public void testModelWriteReadJpa() throws Exception {
final DaoParameters DaoParameters = new DaoParameters();
DaoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao");
DaoParameters.setPersistenceUnit("DAOTest");
@@ -104,24 +115,39 @@ 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.policy.apex.model.basicmodel.concepts.AxKeyInfo:OBSERVATION:description is blank\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.policy.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.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"
- + "********************************";
+ + "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.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"
- + "********************************";
+ + "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/TestContextComparison.java b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestContextComparison.java
index 794cfa9f7..65295c13b 100644
--- a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestContextComparison.java
+++ b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestContextComparison.java
@@ -33,6 +33,8 @@ import org.onap.policy.apex.model.contextmodel.handling.ContextComparer;
import org.onap.policy.apex.model.utilities.comparison.KeyedMapDifference;
/**
+ * Test context comparisons.
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public class TestContextComparison {
@@ -42,122 +44,145 @@ public class TestContextComparison {
private AxContextModel shellModel;
private AxContextModel singleEntryModel;
+ /**
+ * Set up tests.
+ */
@Before
public void getContext() {
final TestContextComparisonFactory factory = new TestContextComparisonFactory();
- emptyModel = factory.getEmptyModel();
- fullModel = factory.getFullModel();
+ emptyModel = factory.getEmptyModel();
+ fullModel = factory.getFullModel();
noGlobalContextModel = factory.getNoGlobalContextModel();
- shellModel = factory.getShellModel();
- singleEntryModel = factory.getSingleEntryModel();
+ shellModel = factory.getShellModel();
+ singleEntryModel = factory.getSingleEntryModel();
}
-
+
@Test
public void testEmptyEmpty() {
- final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer().compare(emptyModel.getSchemas(), emptyModel.getSchemas());
+ final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer()
+ .compare(emptyModel.getSchemas(), emptyModel.getSchemas());
assertNotNull(schemaResult);
assertTrue(emptyModel.getSchemas().getSchemasMap().equals(schemaResult.getIdenticalValues()));
- final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer().compare(emptyModel.getAlbums(), emptyModel.getAlbums());
+ final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer()
+ .compare(emptyModel.getAlbums(), emptyModel.getAlbums());
assertNotNull(albumResult);
assertTrue(emptyModel.getAlbums().getAlbumsMap().equals(albumResult.getIdenticalValues()));
}
-
+
@Test
public void testEmptyFull() {
- final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer().compare(emptyModel.getSchemas(), fullModel.getSchemas());
+ final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer()
+ .compare(emptyModel.getSchemas(), fullModel.getSchemas());
assertNotNull(schemaResult);
assertTrue(fullModel.getSchemas().getSchemasMap().equals(schemaResult.getRightOnly()));
- final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer().compare(emptyModel.getAlbums(), fullModel.getAlbums());
+ final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer()
+ .compare(emptyModel.getAlbums(), fullModel.getAlbums());
assertNotNull(albumResult);
assertTrue(fullModel.getAlbums().getAlbumsMap().equals(albumResult.getRightOnly()));
}
-
+
@Test
public void testFullEmpty() {
- final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer().compare(fullModel.getSchemas(), emptyModel.getSchemas());
+ final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer()
+ .compare(fullModel.getSchemas(), emptyModel.getSchemas());
assertNotNull(schemaResult);
assertTrue(fullModel.getSchemas().getSchemasMap().equals(schemaResult.getLeftOnly()));
- final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer().compare(fullModel.getAlbums(), emptyModel.getAlbums());
+ final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer()
+ .compare(fullModel.getAlbums(), emptyModel.getAlbums());
assertNotNull(albumResult);
assertTrue(fullModel.getAlbums().getAlbumsMap().equals(albumResult.getLeftOnly()));
}
-
+
@Test
public void testEmptyNoGlobalContext() {
- final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer().compare(emptyModel.getSchemas(), noGlobalContextModel.getSchemas());
+ final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer()
+ .compare(emptyModel.getSchemas(), noGlobalContextModel.getSchemas());
assertNotNull(schemaResult);
assertTrue(noGlobalContextModel.getSchemas().getSchemasMap().equals(schemaResult.getRightOnly()));
- final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer().compare(emptyModel.getAlbums(), noGlobalContextModel.getAlbums());
+ final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer()
+ .compare(emptyModel.getAlbums(), noGlobalContextModel.getAlbums());
assertNotNull(albumResult);
assertTrue(noGlobalContextModel.getAlbums().getAlbumsMap().equals(albumResult.getRightOnly()));
}
-
+
@Test
public void testNoGlobalContextEmpty() {
- final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer().compare(noGlobalContextModel.getSchemas(), emptyModel.getSchemas());
+ final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer()
+ .compare(noGlobalContextModel.getSchemas(), emptyModel.getSchemas());
assertNotNull(schemaResult);
assertTrue(noGlobalContextModel.getSchemas().getSchemasMap().equals(schemaResult.getLeftOnly()));
- final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer().compare(noGlobalContextModel.getAlbums(), emptyModel.getAlbums());
+ final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer()
+ .compare(noGlobalContextModel.getAlbums(), emptyModel.getAlbums());
assertNotNull(albumResult);
assertTrue(noGlobalContextModel.getAlbums().getAlbumsMap().equals(albumResult.getLeftOnly()));
}
-
+
@Test
public void testEmptyShell() {
- final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer().compare(emptyModel.getSchemas(), shellModel.getSchemas());
+ final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer()
+ .compare(emptyModel.getSchemas(), shellModel.getSchemas());
assertNotNull(schemaResult);
assertTrue(shellModel.getSchemas().getSchemasMap().equals(schemaResult.getRightOnly()));
- final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer().compare(emptyModel.getAlbums(), shellModel.getAlbums());
+ final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer()
+ .compare(emptyModel.getAlbums(), shellModel.getAlbums());
assertNotNull(albumResult);
assertTrue(shellModel.getAlbums().getAlbumsMap().equals(albumResult.getRightOnly()));
}
-
+
@Test
public void testShellEmpty() {
- final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer().compare(shellModel.getSchemas(), emptyModel.getSchemas());
+ final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer()
+ .compare(shellModel.getSchemas(), emptyModel.getSchemas());
assertNotNull(schemaResult);
assertTrue(shellModel.getSchemas().getSchemasMap().equals(schemaResult.getLeftOnly()));
- final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer().compare(shellModel.getAlbums(), emptyModel.getAlbums());
+ final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer()
+ .compare(shellModel.getAlbums(), emptyModel.getAlbums());
assertNotNull(albumResult);
assertTrue(shellModel.getAlbums().getAlbumsMap().equals(albumResult.getLeftOnly()));
}
-
+
@Test
public void testEmptySingleEntry() {
- final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer().compare(emptyModel.getSchemas(), singleEntryModel.getSchemas());
+ final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer()
+ .compare(emptyModel.getSchemas(), singleEntryModel.getSchemas());
assertNotNull(schemaResult);
assertTrue(singleEntryModel.getSchemas().getSchemasMap().equals(schemaResult.getRightOnly()));
- final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer().compare(emptyModel.getAlbums(), singleEntryModel.getAlbums());
+ final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer()
+ .compare(emptyModel.getAlbums(), singleEntryModel.getAlbums());
assertNotNull(albumResult);
assertTrue(singleEntryModel.getAlbums().getAlbumsMap().equals(albumResult.getRightOnly()));
}
-
+
@Test
public void testSingleEntryEmpty() {
- final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer().compare(singleEntryModel.getSchemas(), emptyModel.getSchemas());
+ final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer()
+ .compare(singleEntryModel.getSchemas(), emptyModel.getSchemas());
assertNotNull(schemaResult);
assertTrue(singleEntryModel.getSchemas().getSchemasMap().equals(schemaResult.getLeftOnly()));
- final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer().compare(singleEntryModel.getAlbums(), emptyModel.getAlbums());
+ final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer()
+ .compare(singleEntryModel.getAlbums(), emptyModel.getAlbums());
assertNotNull(albumResult);
assertTrue(singleEntryModel.getAlbums().getAlbumsMap().equals(albumResult.getLeftOnly()));
}
-
+
@Test
public void testFullFull() {
- final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer().compare(fullModel.getSchemas(), fullModel.getSchemas());
+ final KeyedMapDifference<AxArtifactKey, AxContextSchema> schemaResult = new ContextComparer()
+ .compare(fullModel.getSchemas(), fullModel.getSchemas());
assertNotNull(schemaResult);
assertTrue(fullModel.getSchemas().getSchemasMap().equals(schemaResult.getIdenticalValues()));
- final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer().compare(fullModel.getAlbums(), fullModel.getAlbums());
+ final KeyedMapDifference<AxArtifactKey, AxContextAlbum> albumResult = new ContextComparer()
+ .compare(fullModel.getAlbums(), fullModel.getAlbums());
assertNotNull(albumResult);
assertTrue(fullModel.getAlbums().getAlbumsMap().equals(albumResult.getIdenticalValues()));
}
diff --git a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestContextComparisonFactory.java b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestContextComparisonFactory.java
index 2c6f8e172..f7c7a1345 100644
--- a/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestContextComparisonFactory.java
+++ b/model/context-model/src/test/java/org/onap/policy/apex/model/contextmodel/handling/TestContextComparisonFactory.java
@@ -26,12 +26,16 @@ import org.onap.policy.apex.model.contextmodel.concepts.AxContextModel;
import org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema;
/**
- * This class creates sample Policy Models
+ * This class creates sample Policy Models.
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public class TestContextComparisonFactory {
+ /**
+ * Get a full context model.
+ * @return the model
+ */
public AxContextModel getFullModel() {
final AxContextSchema testContextSchema000 =
new AxContextSchema(new AxArtifactKey("TestContextSchema000", "0.0.1"), "JAVA",
@@ -69,6 +73,10 @@ public class TestContextComparisonFactory {
return new AxContextModel(new AxArtifactKey("Context", "0.0.1"));
}
+ /**
+ * Get a skeleton model.
+ * @return The model
+ */
public AxContextModel getShellModel() {
final AxContextSchema testContextSchema000 =
new AxContextSchema(new AxArtifactKey("TestContextSchema000", "0.0.1"), "JAVA",
@@ -88,6 +96,10 @@ public class TestContextComparisonFactory {
return contextModel;
}
+ /**
+ * Get a single entry model.
+ * @return The single entry model
+ */
public AxContextModel getSingleEntryModel() {
final AxContextSchema testContextSchema000 =
new AxContextSchema(new AxArtifactKey("TestContextSchema000", "0.0.1"), "JAVA",
@@ -104,6 +116,10 @@ public class TestContextComparisonFactory {
return contextModel;
}
+ /**
+ * Get a model with no global entries.
+ * @return the model
+ */
public AxContextModel getNoGlobalContextModel() {
final AxContextSchema testContextSchema000 =
new AxContextSchema(new AxArtifactKey("TestContextSchema000", "0.0.1"), "JAVA",