aboutsummaryrefslogtreecommitdiffstats
path: root/model/basic-model/src/test/java
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@ericsson.com>2018-09-04 17:24:15 +0100
committerliamfallon <liam.fallon@ericsson.com>2018-09-04 17:25:22 +0100
commit87be30582d1db37bee7c6b456c0c5c3ca9584963 (patch)
tree28806c5866fc5d07c89a06014d7c7d2705772b4f /model/basic-model/src/test/java
parentf32508381ce0b555fc14978cbaa458aa4e2d91c5 (diff)
Fix checkstyle issues in apex model basic
CHeckstyle issues in apex model basic and knock on changes in other apex modules. Issue-ID: POLICY-1034 Change-Id: I65823f5e2e344526abc74b0812877113acb056ec Signed-off-by: liamfallon <liam.fallon@ericsson.com>
Diffstat (limited to 'model/basic-model/src/test/java')
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyTest.java150
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestAxKeyInfo.java38
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestAxReferenceKey.java40
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestEntity.java63
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestExceptions.java30
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestKeyUse.java (renamed from model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/testKeyUse.java)6
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestValidation.java53
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/dao/EntityTest.java42
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/dao/TestDaoMisc.java27
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/AxModelWithReferences.java25
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexBasicModel.java66
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexBasicModelConcepts.java12
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexBasicModelCreator.java42
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexTestModelCreator0.java3
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexTestModelCreator1.java14
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexTestModelCreator2.java3
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestBasicModelTest.java33
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestConceptGetter.java139
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestExceptions.java3
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelFileWriter.java22
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelReader.java13
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelSaver.java18
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelStringWriter.java27
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelWriter.java7
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestSchemaGenerator.java5
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/service/TestModelService.java22
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/xml/TestAxReferenceKeyAdapter.java11
27 files changed, 465 insertions, 449 deletions
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyTest.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyTest.java
index 6ac46b14e..ea09cc69d 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyTest.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyTest.java
@@ -29,91 +29,99 @@ import static org.junit.Assert.fail;
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.AxKey.Compatibility;
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.AxKey.Compatibility;
-/**
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
public class AxKeyTest {
@Test
public void testArtifactKey() {
- AxArtifactKey aKey0 = new AxArtifactKey();
- AxArtifactKey aKey1 = new AxArtifactKey("name", "0.0.1");
- AxArtifactKey aKey2 = new AxArtifactKey(aKey1);
- AxArtifactKey aKey3 = new AxArtifactKey(aKey1.getID());
- AxArtifactKey aKey4 = new AxArtifactKey(aKey1);
- AxArtifactKey aKey5 = new AxArtifactKey(aKey1);
- AxArtifactKey aKey6 = new AxArtifactKey(aKey1);
-
try {
new AxArtifactKey("some bad key id");
fail("This test should throw an exception");
+ } catch (IllegalArgumentException e) {
+ assertEquals("parameter \"id\": value \"some bad key id\", "
+ + "does not match regular expression \"[A-Za-z0-9\\-_\\.]+:[0-9].[0-9].[0-9]\"",
+ e.getMessage());
}
- catch (IllegalArgumentException e) {
- assertEquals("parameter \"id\": value \"some bad key id\", does not match regular expression \"[A-Za-z0-9\\-_\\.]+:[0-9].[0-9].[0-9]\"", e.getMessage());
- }
-
- assertEquals(AxArtifactKey.getNullKey(), aKey0);
- assertEquals(aKey1, aKey2);
- assertEquals(aKey1, aKey3);
-
- assertEquals(aKey2, aKey1.getKey());
- assertEquals(1, aKey1.getKeys().size());
-
- aKey0.setName("zero");
- aKey0.setVersion("0.0.2");
- aKey3.setVersion("0.0.2");
- aKey4.setVersion("0.1.2");
- aKey5.setVersion("1.2.2");
- aKey6.setVersion("3");
-
- assertEquals(Compatibility.DIFFERENT, aKey0.getCompatibility(new AxReferenceKey()));
- assertEquals(Compatibility.DIFFERENT, aKey0.getCompatibility(aKey1));
- assertEquals(Compatibility.IDENTICAL, aKey2.getCompatibility(aKey1));
- assertEquals(Compatibility.PATCH, aKey3.getCompatibility(aKey1));
- assertEquals(Compatibility.MINOR, aKey4.getCompatibility(aKey1));
- assertEquals(Compatibility.MAJOR, aKey5.getCompatibility(aKey1));
- assertEquals(Compatibility.MAJOR, aKey6.getCompatibility(aKey1));
-
- assertTrue(aKey1.isCompatible(aKey2));
- assertTrue(aKey1.isCompatible(aKey3));
- assertTrue(aKey1.isCompatible(aKey4));
- assertFalse(aKey1.isCompatible(aKey0));
- assertFalse(aKey1.isCompatible(aKey5));
- assertFalse(aKey1.isCompatible(new AxReferenceKey()));
-
- assertEquals(AxValidationResult.ValidationResult.VALID, aKey0.validate(new AxValidationResult()).getValidationResult());
- assertEquals(AxValidationResult.ValidationResult.VALID, aKey1.validate(new AxValidationResult()).getValidationResult());
- assertEquals(AxValidationResult.ValidationResult.VALID, aKey2.validate(new AxValidationResult()).getValidationResult());
- assertEquals(AxValidationResult.ValidationResult.VALID, aKey3.validate(new AxValidationResult()).getValidationResult());
- assertEquals(AxValidationResult.ValidationResult.VALID, aKey4.validate(new AxValidationResult()).getValidationResult());
- assertEquals(AxValidationResult.ValidationResult.VALID, aKey5.validate(new AxValidationResult()).getValidationResult());
- assertEquals(AxValidationResult.ValidationResult.VALID, aKey6.validate(new AxValidationResult()).getValidationResult());
-
- aKey0.clean();
- assertNotNull(aKey0.toString());
-
- AxArtifactKey aKey7 = new AxArtifactKey(aKey1);
- assertEquals(150332875, aKey7.hashCode());
- assertEquals(0, aKey7.compareTo(aKey1));
- assertEquals(-12, aKey7.compareTo(aKey0));
-
+
+ AxArtifactKey someKey0 = new AxArtifactKey();
+ assertEquals(AxArtifactKey.getNullKey(), someKey0);
+
+ AxArtifactKey someKey1 = new AxArtifactKey("name", "0.0.1");
+ AxArtifactKey someKey2 = new AxArtifactKey(someKey1);
+ AxArtifactKey someKey3 = new AxArtifactKey(someKey1.getId());
+ assertEquals(someKey1, someKey2);
+ assertEquals(someKey1, someKey3);
+
+ assertEquals(someKey2, someKey1.getKey());
+ assertEquals(1, someKey1.getKeys().size());
+
+ someKey0.setName("zero");
+ someKey0.setVersion("0.0.2");
+
+ someKey3.setVersion("0.0.2");
+
+ AxArtifactKey someKey4 = new AxArtifactKey(someKey1);
+ someKey4.setVersion("0.1.2");
+
+ AxArtifactKey someKey5 = new AxArtifactKey(someKey1);
+ someKey5.setVersion("1.2.2");
+
+ AxArtifactKey someKey6 = new AxArtifactKey(someKey1);
+ someKey6.setVersion("3");
+
+ assertEquals(Compatibility.DIFFERENT, someKey0.getCompatibility(new AxReferenceKey()));
+ assertEquals(Compatibility.DIFFERENT, someKey0.getCompatibility(someKey1));
+ assertEquals(Compatibility.IDENTICAL, someKey2.getCompatibility(someKey1));
+ assertEquals(Compatibility.PATCH, someKey3.getCompatibility(someKey1));
+ assertEquals(Compatibility.MINOR, someKey4.getCompatibility(someKey1));
+ assertEquals(Compatibility.MAJOR, someKey5.getCompatibility(someKey1));
+ assertEquals(Compatibility.MAJOR, someKey6.getCompatibility(someKey1));
+
+ assertTrue(someKey1.isCompatible(someKey2));
+ assertTrue(someKey1.isCompatible(someKey3));
+ assertTrue(someKey1.isCompatible(someKey4));
+ assertFalse(someKey1.isCompatible(someKey0));
+ assertFalse(someKey1.isCompatible(someKey5));
+ assertFalse(someKey1.isCompatible(new AxReferenceKey()));
+
+ assertEquals(AxValidationResult.ValidationResult.VALID,
+ someKey0.validate(new AxValidationResult()).getValidationResult());
+ assertEquals(AxValidationResult.ValidationResult.VALID,
+ someKey1.validate(new AxValidationResult()).getValidationResult());
+ assertEquals(AxValidationResult.ValidationResult.VALID,
+ someKey2.validate(new AxValidationResult()).getValidationResult());
+ assertEquals(AxValidationResult.ValidationResult.VALID,
+ someKey3.validate(new AxValidationResult()).getValidationResult());
+ assertEquals(AxValidationResult.ValidationResult.VALID,
+ someKey4.validate(new AxValidationResult()).getValidationResult());
+ assertEquals(AxValidationResult.ValidationResult.VALID,
+ someKey5.validate(new AxValidationResult()).getValidationResult());
+ assertEquals(AxValidationResult.ValidationResult.VALID,
+ someKey6.validate(new AxValidationResult()).getValidationResult());
+
+ someKey0.clean();
+ assertNotNull(someKey0.toString());
+
+ AxArtifactKey someKey7 = new AxArtifactKey(someKey1);
+ assertEquals(150332875, someKey7.hashCode());
+ assertEquals(0, someKey7.compareTo(someKey1));
+ assertEquals(-12, someKey7.compareTo(someKey0));
+
try {
- aKey0.compareTo(null);
- }
- catch (IllegalArgumentException e) {
+ someKey0.compareTo(null);
+ } catch (IllegalArgumentException e) {
assertEquals("comparison object may not be null", e.getMessage());
}
-
- assertEquals(0, aKey0.compareTo(aKey0));
- assertEquals(353602977, aKey0.compareTo(new AxReferenceKey()));
-
- assertFalse(aKey0.equals(null));
- assertTrue(aKey0.equals(aKey0));
- assertFalse(((AxKey)aKey0).equals(new AxReferenceKey()));
+
+ assertEquals(0, someKey0.compareTo(someKey0));
+ assertEquals(353602977, someKey0.compareTo(new AxReferenceKey()));
+
+ assertFalse(someKey0.equals(null));
+ assertTrue(someKey0.equals(someKey0));
+ assertFalse(((AxKey) someKey0).equals(new AxReferenceKey()));
}
}
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestAxKeyInfo.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestAxKeyInfo.java
index 8368634bf..f615d9db9 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestAxKeyInfo.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestAxKeyInfo.java
@@ -33,9 +33,6 @@ 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.AxValidationResult;
-/**
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
public class TestAxKeyInfo {
@Test
@@ -46,23 +43,24 @@ public class TestAxKeyInfo {
AxKeyInfo testKeyInfo = new AxKeyInfo();
testKeyInfo.setKey((new AxArtifactKey("PN", "0.0.1")));
- assertEquals("PN:0.0.1", testKeyInfo.getKey().getID());
+ assertEquals("PN:0.0.1", testKeyInfo.getKey().getId());
AxArtifactKey key = new AxArtifactKey("key", "0.0.1");
testKeyInfo.setKey(key);
assertEquals(key, testKeyInfo.getKey());
-
+
UUID uuid = UUID.randomUUID();
testKeyInfo.setUuid(uuid);
- assertEquals(uuid, testKeyInfo.getUUID());
+ assertEquals(uuid, testKeyInfo.getUuid());
testKeyInfo.setDescription("Key Description");
assertEquals("Key Description", testKeyInfo.getDescription());
-
+
AxKeyInfo clonedReferenceKey = new AxKeyInfo(testKeyInfo);
- assertTrue(clonedReferenceKey.toString().startsWith("AxKeyInfo:(artifactId=AxArtifactKey:(name=key,version=0.0.1),uuid="));
-
+ assertTrue(clonedReferenceKey.toString()
+ .startsWith("AxKeyInfo:(artifactId=AxArtifactKey:(name=key,version=0.0.1),uuid="));
+
assertFalse(testKeyInfo.hashCode() == 0);
-
+
assertTrue(testKeyInfo.equals(testKeyInfo));
assertTrue(testKeyInfo.equals(clonedReferenceKey));
assertFalse(testKeyInfo.equals(null));
@@ -71,7 +69,7 @@ public class TestAxKeyInfo {
assertFalse(testKeyInfo.equals(new AxKeyInfo(key, UUID.randomUUID(), "Some Description")));
assertFalse(testKeyInfo.equals(new AxKeyInfo(key, uuid, "Some Description")));
assertTrue(testKeyInfo.equals(new AxKeyInfo(key, uuid, "Key Description")));
-
+
assertEquals(0, testKeyInfo.compareTo(testKeyInfo));
assertEquals(0, testKeyInfo.compareTo(clonedReferenceKey));
assertNotEquals(0, testKeyInfo.compareTo(null));
@@ -80,28 +78,28 @@ public class TestAxKeyInfo {
assertNotEquals(0, testKeyInfo.compareTo(new AxKeyInfo(key, UUID.randomUUID(), "Some Description")));
assertNotEquals(0, testKeyInfo.compareTo(new AxKeyInfo(key, uuid, "Some Description")));
assertEquals(0, testKeyInfo.compareTo(new AxKeyInfo(key, uuid, "Key Description")));
-
+
assertNotNull(testKeyInfo.getKeys());
-
+
AxValidationResult result = new AxValidationResult();
result = testKeyInfo.validate(result);
assertEquals(AxValidationResult.ValidationResult.VALID, result.getValidationResult());
-
+
testKeyInfo.setDescription("");
result = testKeyInfo.validate(result);
assertEquals(AxValidationResult.ValidationResult.OBSERVATION, result.getValidationResult());
-
+
testKeyInfo.setUuid(new UUID(0, 0));
result = testKeyInfo.validate(result);
assertEquals(AxValidationResult.ValidationResult.WARNING, result.getValidationResult());
-
+
testKeyInfo.setKey(AxArtifactKey.getNullKey());
result = testKeyInfo.validate(result);
assertEquals(AxValidationResult.ValidationResult.INVALID, result.getValidationResult());
-
- assertNotNull(AxKeyInfo.generateReproducibleUUID(null));
- assertNotNull(AxKeyInfo.generateReproducibleUUID("SeedString"));
-
+
+ assertNotNull(AxKeyInfo.generateReproducibleUuid(null));
+ assertNotNull(AxKeyInfo.generateReproducibleUuid("SeedString"));
+
testKeyInfo.clean();
assertNotNull(testKeyInfo);
}
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestAxReferenceKey.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestAxReferenceKey.java
index dbc925d66..79f3984c3 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestAxReferenceKey.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestAxReferenceKey.java
@@ -32,9 +32,6 @@ 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.AxValidationResult;
-/**
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
public class TestAxReferenceKey {
@Test
@@ -49,46 +46,47 @@ public class TestAxReferenceKey {
assertNotNull(new AxReferenceKey("ParentKeyName", "0.0.1", "ParentLocalName", "LocalName"));
assertNotNull(new AxReferenceKey("ParentKeyName:0.0.1:ParentLocalName:LocalName"));
assertEquals(AxReferenceKey.getNullKey().getKey(), AxReferenceKey.getNullKey());
- assertEquals("NULL:0.0.0:NULL:NULL", AxReferenceKey.getNullKey().getID());
+ assertEquals("NULL:0.0.0:NULL:NULL", AxReferenceKey.getNullKey().getId());
AxReferenceKey testReferenceKey = new AxReferenceKey();
testReferenceKey.setParentArtifactKey(new AxArtifactKey("PN", "0.0.1"));
- assertEquals("PN:0.0.1", testReferenceKey.getParentArtifactKey().getID());
-
+ assertEquals("PN:0.0.1", testReferenceKey.getParentArtifactKey().getId());
+
testReferenceKey.setParentReferenceKey(new AxReferenceKey("PN", "0.0.1", "LN"));
- assertEquals("PN:0.0.1:NULL:LN", testReferenceKey.getParentReferenceKey().getID());
-
+ assertEquals("PN:0.0.1:NULL:LN", testReferenceKey.getParentReferenceKey().getId());
+
testReferenceKey.setParentKeyName("NPKN");
assertEquals("NPKN", testReferenceKey.getParentKeyName());
-
+
testReferenceKey.setParentKeyVersion("0.0.1");
assertEquals("0.0.1", testReferenceKey.getParentKeyVersion());
-
+
testReferenceKey.setParentLocalName("NPKLN");
assertEquals("NPKLN", testReferenceKey.getParentLocalName());
-
+
testReferenceKey.setLocalName("NLN");
assertEquals("NLN", testReferenceKey.getLocalName());
-
+
assertFalse(testReferenceKey.isCompatible(AxArtifactKey.getNullKey()));
assertFalse(testReferenceKey.isCompatible(AxReferenceKey.getNullKey()));
assertTrue(testReferenceKey.isCompatible(testReferenceKey));
-
+
assertEquals(AxKey.Compatibility.DIFFERENT, testReferenceKey.getCompatibility(AxArtifactKey.getNullKey()));
assertEquals(AxKey.Compatibility.DIFFERENT, testReferenceKey.getCompatibility(AxReferenceKey.getNullKey()));
assertEquals(AxKey.Compatibility.IDENTICAL, testReferenceKey.getCompatibility(testReferenceKey));
-
+
AxValidationResult result = new AxValidationResult();
result = testReferenceKey.validate(result);
assertEquals(AxValidationResult.ValidationResult.VALID, result.getValidationResult());
-
+
testReferenceKey.clean();
-
+
AxReferenceKey clonedReferenceKey = new AxReferenceKey(testReferenceKey);
- assertEquals("AxReferenceKey:(parentKeyName=NPKN,parentKeyVersion=0.0.1,parentLocalName=NPKLN,localName=NLN)", clonedReferenceKey.toString());
-
+ assertEquals("AxReferenceKey:(parentKeyName=NPKN,parentKeyVersion=0.0.1,parentLocalName=NPKLN,localName=NLN)",
+ clonedReferenceKey.toString());
+
assertFalse(testReferenceKey.hashCode() == 0);
-
+
assertTrue(testReferenceKey.equals(testReferenceKey));
assertTrue(testReferenceKey.equals(clonedReferenceKey));
assertFalse(testReferenceKey.equals("Hello"));
@@ -97,7 +95,7 @@ public class TestAxReferenceKey {
assertFalse(testReferenceKey.equals(new AxReferenceKey("NPKN", "0.0.1", "PLN", "LN")));
assertFalse(testReferenceKey.equals(new AxReferenceKey("NPKN", "0.0.1", "NPLN", "LN")));
assertTrue(testReferenceKey.equals(new AxReferenceKey("NPKN", "0.0.1", "NPKLN", "NLN")));
-
+
assertEquals(0, testReferenceKey.compareTo(testReferenceKey));
assertEquals(0, testReferenceKey.compareTo(clonedReferenceKey));
assertNotEquals(0, testReferenceKey.compareTo(new AxArtifactKey()));
@@ -106,7 +104,7 @@ public class TestAxReferenceKey {
assertNotEquals(0, testReferenceKey.compareTo(new AxReferenceKey("NPKN", "0.0.1", "PLN", "LN")));
assertNotEquals(0, testReferenceKey.compareTo(new AxReferenceKey("NPKN", "0.0.1", "NPLN", "LN")));
assertEquals(0, testReferenceKey.compareTo(new AxReferenceKey("NPKN", "0.0.1", "NPKLN", "NLN")));
-
+
assertNotNull(testReferenceKey.getKeys());
}
}
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestEntity.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestEntity.java
index 6ba380bb8..2667f3d4d 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestEntity.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestEntity.java
@@ -47,22 +47,22 @@ public class TestEntity extends AxConcept {
protected AxReferenceKey key;
private double doubleValue;
-
+
public TestEntity() {
this.key = new AxReferenceKey();
this.doubleValue = 0;
}
-
+
public TestEntity(Double doubleValue) {
this.key = new AxReferenceKey();
this.doubleValue = doubleValue;
}
-
+
public TestEntity(AxReferenceKey key, Double doubleValue) {
this.key = key;
this.doubleValue = doubleValue;
}
-
+
public AxReferenceKey getKey() {
return key;
}
@@ -96,7 +96,7 @@ public class TestEntity extends AxConcept {
public void clean() {
key.clean();
}
-
+
@Override
public String toString() {
final StringBuilder builder = new StringBuilder();
@@ -107,20 +107,18 @@ public class TestEntity extends AxConcept {
@Override
public AxConcept copyTo(AxConcept target) {
- final Object copyObject = ((target == null) ? new TestEntity(): target);
+ final Object copyObject = ((target == null) ? new TestEntity() : target);
if (copyObject instanceof TestEntity) {
final TestEntity copy = ((TestEntity) copyObject);
if (this.checkSetKey()) {
copy.setKey(new AxReferenceKey(key));
- }
- else {
+ } else {
copy.key = null;
}
copy.doubleValue = doubleValue;
return copy;
- }
- else {
- return null;
+ } else {
+ return null;
}
}
@@ -134,42 +132,49 @@ public class TestEntity extends AxConcept {
@Override
public boolean equals(Object obj) {
- if (obj == null)
+ if (obj == null) {
return false;
- if (this == obj)
+ }
+ if (this == obj) {
return true;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
+ }
TestEntity other = (TestEntity) obj;
if (key == null) {
- if (other.key != null)
+ if (other.key != null) {
return false;
+ }
+ } else if (!key.equals(other.key)) {
+ return false;
+ }
+ if (doubleValue != other.doubleValue) {
+ return false;
}
- else
- if (!key.equals(other.key))
- return false;
- if (doubleValue != other.doubleValue)
- return false;
return true;
}
-
+
@Override
public int compareTo(AxConcept otherObj) {
- if (otherObj == null)
+ if (otherObj == null) {
return -1;
- if (this == otherObj)
+ }
+ if (this == otherObj) {
return 0;
+ }
TestEntity other = (TestEntity) otherObj;
if (key == null) {
- if (other.key != null)
+ if (other.key != null) {
return 1;
+ }
+ } else if (!key.equals(other.key)) {
+ return key.compareTo(other.key);
}
- else
- if (!key.equals(other.key))
- return key.compareTo(other.key);
- if (doubleValue != other.doubleValue)
+ if (doubleValue != other.doubleValue) {
return new Double(doubleValue).compareTo(other.doubleValue);
-
+ }
+
return 0;
}
}
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestExceptions.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestExceptions.java
index 1fc5209b0..7a980d5f6 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestExceptions.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestExceptions.java
@@ -31,9 +31,6 @@ import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.model.basicmodel.concepts.ApexRuntimeException;
import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
-/**
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
public class TestExceptions {
@Test
@@ -42,29 +39,32 @@ public class TestExceptions {
assertNotNull(new ApexException("Message", new AxArtifactKey()));
assertNotNull(new ApexException("Message", new IOException()));
assertNotNull(new ApexException("Message", new IOException(), new AxArtifactKey()));
-
+
AxArtifactKey key = new AxArtifactKey();
ApexException ae = new ApexException("Message", new IOException("IO exception message"), key);
assertEquals("Message\ncaused by: Message\ncaused by: IO exception message", ae.getCascadedMessage());
assertEquals(key, ae.getObject());
-
+
assertNotNull(new ApexRuntimeException("Message"));
assertNotNull(new ApexRuntimeException("Message", new AxArtifactKey()));
assertNotNull(new ApexRuntimeException("Message", new IOException()));
assertNotNull(new ApexRuntimeException("Message", new IOException(), new AxArtifactKey()));
-
- AxArtifactKey rKey = new AxArtifactKey();
- ApexRuntimeException re = new ApexRuntimeException("Runtime Message", new IOException("IO runtime exception message"), rKey);
- assertEquals("Runtime Message\ncaused by: Runtime Message\ncaused by: IO runtime exception message", re.getCascadedMessage());
+
+ AxArtifactKey rkey = new AxArtifactKey();
+ ApexRuntimeException re = new ApexRuntimeException("Runtime Message",
+ new IOException("IO runtime exception message"), rkey);
+ assertEquals("Runtime Message\ncaused by: Runtime Message\ncaused by: IO runtime exception message",
+ re.getCascadedMessage());
assertEquals(key, re.getObject());
-
+
assertNotNull(new ApexConceptException("Message"));
assertNotNull(new ApexConceptException("Message", new IOException()));
-
- AxArtifactKey cKey = new AxArtifactKey();
- ApexException ace = new ApexException("Concept Message", new IOException("IO concept exception message"), cKey);
- assertEquals("Concept Message\ncaused by: Concept Message\ncaused by: IO concept exception message", ace.getCascadedMessage());
- assertEquals(cKey, ace.getObject());
+
+ AxArtifactKey ckey = new AxArtifactKey();
+ ApexException ace = new ApexException("Concept Message", new IOException("IO concept exception message"), ckey);
+ assertEquals("Concept Message\ncaused by: Concept Message\ncaused by: IO concept exception message",
+ ace.getCascadedMessage());
+ assertEquals(ckey, ace.getObject());
}
}
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/testKeyUse.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestKeyUse.java
index 10706f36a..6b5346971 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/testKeyUse.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestKeyUse.java
@@ -28,12 +28,12 @@ import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
+import org.onap.policy.apex.model.basicmodel.concepts.AxKey.Compatibility;
import org.onap.policy.apex.model.basicmodel.concepts.AxKeyUse;
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.AxKey.Compatibility;
-public class testKeyUse {
+public class TestKeyUse {
@Test
public void test() {
@@ -45,7 +45,7 @@ public class testKeyUse {
AxKeyUse keyUse = new AxKeyUse();
keyUse.setKey(key);
assertEquals(key, keyUse.getKey());
- assertEquals("Key:0.0.1", keyUse.getID());
+ assertEquals("Key:0.0.1", keyUse.getId());
assertEquals(key, keyUse.getKeys().get(0));
assertEquals(Compatibility.IDENTICAL, keyUse.getCompatibility(key));
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestValidation.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestValidation.java
index 93eb78b7c..cfa4d0ded 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestValidation.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/TestValidation.java
@@ -32,9 +32,6 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxValidationMessage;
import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
-/**
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
public class TestValidation {
@Test
@@ -42,49 +39,53 @@ public class TestValidation {
AxValidationResult result = new AxValidationResult();
AxReferenceKey refKey = new AxReferenceKey("PK", "0.0.1", "PLN", "LN");
result = refKey.validate(result);
-
+
assertNotNull(result);
- assertTrue(result.isOK());
+ assertTrue(result.isOk());
assertTrue(result.isValid());
assertEquals(AxValidationResult.ValidationResult.VALID, result.getValidationResult());
assertNotNull(result.getMessageList());
-
- AxValidationMessage vMess0 = new AxValidationMessage(AxArtifactKey.getNullKey(), AxArtifactKey.class, ValidationResult.VALID, "Some message");
- result.addValidationMessage(vMess0);
-
- assertTrue(result.isOK());
+
+ AxValidationMessage vmess0 = new AxValidationMessage(AxArtifactKey.getNullKey(), AxArtifactKey.class,
+ ValidationResult.VALID, "Some message");
+ result.addValidationMessage(vmess0);
+
+ assertTrue(result.isOk());
assertTrue(result.isValid());
assertEquals(AxValidationResult.ValidationResult.VALID, result.getValidationResult());
assertNotNull(result.getMessageList());
assertNotNull("hello", result.toString());
-
- AxValidationMessage vMess1 = new AxValidationMessage(AxArtifactKey.getNullKey(), AxArtifactKey.class, ValidationResult.OBSERVATION, "Some message");
- result.addValidationMessage(vMess1);
-
- assertTrue(result.isOK());
+
+ AxValidationMessage vmess1 = new AxValidationMessage(AxArtifactKey.getNullKey(), AxArtifactKey.class,
+ ValidationResult.OBSERVATION, "Some message");
+ result.addValidationMessage(vmess1);
+
+ assertTrue(result.isOk());
assertTrue(result.isValid());
assertEquals(AxValidationResult.ValidationResult.OBSERVATION, result.getValidationResult());
assertNotNull(result.getMessageList());
assertNotNull("hello", result.toString());
-
- AxValidationMessage vMess2 = new AxValidationMessage(AxArtifactKey.getNullKey(), AxArtifactKey.class, ValidationResult.WARNING, "Some message");
- result.addValidationMessage(vMess2);
-
- assertFalse(result.isOK());
+
+ AxValidationMessage vmess2 = new AxValidationMessage(AxArtifactKey.getNullKey(), AxArtifactKey.class,
+ ValidationResult.WARNING, "Some message");
+ result.addValidationMessage(vmess2);
+
+ assertFalse(result.isOk());
assertTrue(result.isValid());
assertEquals(AxValidationResult.ValidationResult.WARNING, result.getValidationResult());
assertNotNull(result.getMessageList());
assertNotNull("hello", result.toString());
-
- AxValidationMessage vMess3 = new AxValidationMessage(AxArtifactKey.getNullKey(), AxArtifactKey.class, ValidationResult.INVALID, "Some message");
- result.addValidationMessage(vMess3);
-
- assertFalse(result.isOK());
+
+ AxValidationMessage vmess3 = new AxValidationMessage(AxArtifactKey.getNullKey(), AxArtifactKey.class,
+ ValidationResult.INVALID, "Some message");
+ result.addValidationMessage(vmess3);
+
+ assertFalse(result.isOk());
assertFalse(result.isValid());
assertEquals(AxValidationResult.ValidationResult.INVALID, result.getValidationResult());
assertNotNull(result.getMessageList());
assertNotNull("hello", result.toString());
-
+
assertEquals(AxValidationResult.ValidationResult.INVALID, result.getMessageList().get(3).getValidationResult());
assertEquals("Some message", result.getMessageList().get(3).getMessage());
assertEquals(AxArtifactKey.class.getCanonicalName(), result.getMessageList().get(3).getObservedClass());
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/dao/EntityTest.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/dao/EntityTest.java
index e5d597375..4c99ce314 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/dao/EntityTest.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/dao/EntityTest.java
@@ -45,7 +45,7 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
import org.onap.policy.apex.model.basicmodel.concepts.TestEntity;
/**
- * JUnit test class
+ * JUnit test class.
*/
public class EntityTest {
private Connection connection;
@@ -65,7 +65,7 @@ public class EntityTest {
@Test
public void testEntityTestSanity() throws ApexException {
- final DAOParameters daoParameters = new DAOParameters();
+ final DaoParameters daoParameters = new DaoParameters();
apexDao = new ApexDaoFactory().createApexDao(daoParameters);
@@ -101,10 +101,10 @@ public class EntityTest {
}
@Test
- public void testEntityTestAllOpsJPA() throws ApexException {
- final DAOParameters daoParameters = new DAOParameters();
+ public void testEntityTestAllOpsJpa() throws ApexException {
+ final DaoParameters daoParameters = new DaoParameters();
daoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao");
- daoParameters.setPersistenceUnit("DAOTest");
+ daoParameters.setPersistenceUnit("DaoTest");
apexDao = new ApexDaoFactory().createApexDao(daoParameters);
apexDao.init(daoParameters);
@@ -115,9 +115,9 @@ public class EntityTest {
@Test
public void testEntityTestBadVals() throws ApexException {
- final DAOParameters daoParameters = new DAOParameters();
+ final DaoParameters daoParameters = new DaoParameters();
daoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao");
- daoParameters.setPersistenceUnit("DAOTest");
+ daoParameters.setPersistenceUnit("DaoTest");
apexDao = new ApexDaoFactory().createApexDao(daoParameters);
apexDao.init(daoParameters);
@@ -130,12 +130,12 @@ public class EntityTest {
final List<AxReferenceKey> emptyRKeyList = new ArrayList<>();
apexDao.create(nullKey);
- apexDao.create(nullKeyList);
- apexDao.create(emptyKeyList);
+ apexDao.createCollection(nullKeyList);
+ apexDao.createCollection(emptyKeyList);
apexDao.delete(nullKey);
- apexDao.delete(nullKeyList);
- apexDao.delete(emptyKeyList);
+ apexDao.deleteCollection(nullKeyList);
+ apexDao.deleteCollection(emptyKeyList);
apexDao.delete(AxArtifactKey.class, nullKey);
apexDao.delete(AxReferenceKey.class, nullRefKey);
apexDao.deleteByArtifactKey(AxArtifactKey.class, nullKeyList);
@@ -160,12 +160,12 @@ public class EntityTest {
final AxArtifactKey aKey0 = new AxArtifactKey("A-KEY0", "0.0.1");
final AxArtifactKey aKey1 = new AxArtifactKey("A-KEY1", "0.0.1");
final AxArtifactKey aKey2 = new AxArtifactKey("A-KEY2", "0.0.1");
- final AxKeyInfo keyInfo0 =
- new AxKeyInfo(aKey0, UUID.fromString("00000000-0000-0000-0000-000000000000"), "key description 0");
- final AxKeyInfo keyInfo1 =
- new AxKeyInfo(aKey1, UUID.fromString("00000000-0000-0000-0000-000000000001"), "key description 1");
- final AxKeyInfo keyInfo2 =
- new AxKeyInfo(aKey2, UUID.fromString("00000000-0000-0000-0000-000000000002"), "key description 2");
+ final AxKeyInfo keyInfo0 = new AxKeyInfo(aKey0, UUID.fromString("00000000-0000-0000-0000-000000000000"),
+ "key description 0");
+ final AxKeyInfo keyInfo1 = new AxKeyInfo(aKey1, UUID.fromString("00000000-0000-0000-0000-000000000001"),
+ "key description 1");
+ final AxKeyInfo keyInfo2 = new AxKeyInfo(aKey2, UUID.fromString("00000000-0000-0000-0000-000000000002"),
+ "key description 2");
apexDao.create(keyInfo0);
@@ -185,7 +185,7 @@ public class EntityTest {
keyInfoSetIn.add(keyInfo1);
keyInfoSetIn.add(keyInfo2);
- apexDao.create(keyInfoSetIn);
+ apexDao.createCollection(keyInfoSetIn);
Set<AxKeyInfo> keyInfoSetOut = new TreeSet<AxKeyInfo>(apexDao.getAll(AxKeyInfo.class));
@@ -197,14 +197,14 @@ public class EntityTest {
keyInfoSetOut = new TreeSet<AxKeyInfo>(apexDao.getAll(AxKeyInfo.class));
assertTrue(keyInfoSetIn.equals(keyInfoSetOut));
- apexDao.delete(keyInfoSetIn);
+ apexDao.deleteCollection(keyInfoSetIn);
keyInfoSetOut = new TreeSet<AxKeyInfo>(apexDao.getAll(AxKeyInfo.class));
assertEquals(0, keyInfoSetOut.size());
keyInfoSetIn.add(keyInfo0);
keyInfoSetIn.add(keyInfo1);
keyInfoSetIn.add(keyInfo0);
- apexDao.create(keyInfoSetIn);
+ apexDao.createCollection(keyInfoSetIn);
keyInfoSetOut = new TreeSet<AxKeyInfo>(apexDao.getAll(AxKeyInfo.class));
assertTrue(keyInfoSetIn.equals(keyInfoSetOut));
@@ -226,7 +226,7 @@ public class EntityTest {
keyInfoSetIn.add(keyInfo0);
keyInfoSetIn.add(keyInfo1);
keyInfoSetIn.add(keyInfo0);
- apexDao.create(keyInfoSetIn);
+ apexDao.createCollection(keyInfoSetIn);
keyInfoSetOut = new TreeSet<AxKeyInfo>(apexDao.getAll(AxKeyInfo.class));
assertTrue(keyInfoSetIn.equals(keyInfoSetOut));
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/dao/TestDaoMisc.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/dao/TestDaoMisc.java
index 9f5b72d39..7966e8d4f 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/dao/TestDaoMisc.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/dao/TestDaoMisc.java
@@ -27,28 +27,25 @@ import static org.junit.Assert.fail;
import java.util.Properties;
import org.junit.Test;
-import org.onap.policy.apex.model.basicmodel.dao.converters.CDATAConditioner;
-import org.onap.policy.apex.model.basicmodel.dao.converters.UUID2String;
+import org.onap.policy.apex.model.basicmodel.dao.converters.CDataConditioner;
+import org.onap.policy.apex.model.basicmodel.dao.converters.Uuid2String;
-/**
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
public class TestDaoMisc {
@Test
- public void testUUID2StringMopUp() {
- final UUID2String uuid2String = new UUID2String();
+ public void testUuid2StringMopUp() {
+ final Uuid2String uuid2String = new Uuid2String();
assertEquals("", uuid2String.convertToDatabaseColumn(null));
}
@Test
public void testCDataConditionerMopUp() {
- assertNull(CDATAConditioner.clean(null));
+ assertNull(CDataConditioner.clean(null));
}
@Test
public void testDaoFactory() {
- final DAOParameters daoParameters = new DAOParameters();
+ final DaoParameters daoParameters = new DaoParameters();
daoParameters.setPluginClass("somewhere.over.the.rainbow");
try {
@@ -63,15 +60,14 @@ public class TestDaoMisc {
new ApexDaoFactory().createApexDao(daoParameters);
fail("test shold throw an exception here");
} catch (final Exception e) {
- assertEquals(
- "Specified Apex DAO plugin class \"java.lang.String\" does not implement the ApexDao interface",
- e.getMessage());
+ assertEquals("Specified Apex DAO plugin class \"java.lang.String\" "
+ + "does not implement the ApexDao interface", e.getMessage());
}
}
@Test
public void testDaoParameters() {
- final DAOParameters pars = new DAOParameters();
+ final DaoParameters pars = new DaoParameters();
pars.setJdbcProperties(new Properties());
assertEquals(0, pars.getJdbcProperties().size());
@@ -84,8 +80,7 @@ public class TestDaoMisc {
pars.setPluginClass("somewhere.over.the.rainbow");
assertEquals("somewhere.over.the.rainbow", pars.getPluginClass());
- assertEquals(
- "DAOParameters [pluginClass=somewhere.over.the.rainbow, persistenceUnit=Kansas, jdbcProperties={name=Dorothy}]",
- pars.toString());
+ assertEquals("DAOParameters [pluginClass=somewhere.over.the.rainbow, "
+ + "persistenceUnit=Kansas, jdbcProperties={name=Dorothy}]", pars.toString());
}
}
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/AxModelWithReferences.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/AxModelWithReferences.java
index 38359052b..8e52b393f 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/AxModelWithReferences.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/AxModelWithReferences.java
@@ -31,7 +31,7 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
public class AxModelWithReferences extends AxModel {
private static final long serialVersionUID = -8194956638511120008L;
- private List<AxKey> extraKeyList = new ArrayList<>();
+ private List<AxKey> extrakeyList = new ArrayList<>();
public AxModelWithReferences(final AxArtifactKey key) {
super(key);
@@ -40,30 +40,33 @@ public class AxModelWithReferences extends AxModel {
@Override
public List<AxKey> getKeys() {
List<AxKey> keys = super.getKeys();
- keys.addAll(extraKeyList);
+ keys.addAll(extrakeyList);
return keys;
}
- public List<AxKey> getExtraKeyList() {
- return extraKeyList;
+ public List<AxKey> getExtrakeyList() {
+ return extrakeyList;
}
+ /**
+ * Set the reference key list.
+ */
public void setReferenceKeyList() {
List<AxKey> keys = super.getKeys();
for (AxKey key: keys) {
- AxArtifactKey aKey = (AxArtifactKey)key;
- AxReferenceKey keyRef = new AxReferenceKey(aKey, aKey.getName());
- extraKeyList.add(keyRef);
+ AxArtifactKey akey = (AxArtifactKey)key;
+ AxReferenceKey keyRef = new AxReferenceKey(akey, akey.getName());
+ extrakeyList.add(keyRef);
}
}
- public void addKey(final AxKey aKey) {
- extraKeyList.add(aKey);
+ public void addKey(final AxKey akey) {
+ extrakeyList.add(akey);
}
- public void removeKey(final AxKey aKey) {
- extraKeyList.remove(aKey);
+ public void removeKey(final AxKey akey) {
+ extrakeyList.remove(akey);
}
}
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexBasicModel.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexBasicModel.java
index d0423eb3a..69942b3df 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexBasicModel.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexBasicModel.java
@@ -33,13 +33,18 @@ import org.junit.Test;
import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.model.basicmodel.concepts.AxModel;
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.dao.DaoParameters;
import org.onap.policy.apex.model.basicmodel.test.TestApexModel;
public class TestApexBasicModel {
private Connection connection;
TestApexModel<AxModel> testApexModel;
+ /**
+ * Set up the test.
+ *
+ * @throws Exception any exception thrown by the test
+ */
@Before
public void setup() throws Exception {
Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance();
@@ -88,46 +93,57 @@ public class TestApexBasicModel {
}
@Test
- public void testModelWriteReadXML() throws Exception {
- testApexModel.testApexModelWriteReadXML();
+ public void testModelWriteReadXml() throws Exception {
+ testApexModel.testApexModelWriteReadXml();
}
@Test
- public void testModelWriteReadJSON() throws Exception {
- testApexModel.testApexModelWriteReadJSON();
+ public void testModelWriteReadJson() throws Exception {
+ testApexModel.testApexModelWriteReadJson();
}
@Test
- public void testModelWriteReadJPA() throws Exception {
- final DAOParameters daoParameters = new DAOParameters();
+ public void testModelWriteReadJpa() throws Exception {
+ final DaoParameters daoParameters = new DaoParameters();
daoParameters.setPluginClass("org.onap.policy.apex.model.basicmodel.dao.impl.DefaultApexDao");
- daoParameters.setPersistenceUnit("DAOTest");
+ daoParameters.setPersistenceUnit("DaoTest");
- testApexModel.testApexModelWriteReadJPA(daoParameters);
+ testApexModel.testApexModelWriteReadJpa(daoParameters);
}
// As there are no real concepts in a basic model, this is as near to a valid model as we can get
private static final String VALID_MODEL_STRING = "\n" + "***warnings issued during validation of model***\n"
- + "AxArtifactKey:(name=FloatKIKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxModel:WARNING:key not found for key information entry\n"
- + "AxArtifactKey:(name=IntegerKIKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxModel:WARNING:key not found for key information entry\n"
- + "********************************";
+ + "AxArtifactKey:(name=FloatKIKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts"
+ + ".AxModel:WARNING:key not found for key information entry\n"
+ + "AxArtifactKey:(name=IntegerKIKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts"
+ + ".AxModel:WARNING:key not found for key information entry\n" + "********************************";
private static final String WARNING_MODEL_STRING = "\n" + "***warnings issued during validation of model***\n"
- + "AxArtifactKey:(name=FloatKIKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxModel:WARNING:key not found for key information entry\n"
- + "AxArtifactKey:(name=IntegerKIKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxModel:WARNING:key not found for key information entry\n"
- + "AxArtifactKey:(name=Unref0,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxModel:WARNING:key not found for key information entry\n"
- + "AxArtifactKey:(name=Unref1,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxModel:WARNING:key not found for key information entry\n"
- + "********************************";
+ + "AxArtifactKey:(name=FloatKIKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts"
+ + ".AxModel:WARNING:key not found for key information entry\n"
+ + "AxArtifactKey:(name=IntegerKIKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts"
+ + ".AxModel:WARNING:key not found for key information entry\n"
+ + "AxArtifactKey:(name=Unref0,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts"
+ + ".AxModel:WARNING:key not found for key information entry\n"
+ + "AxArtifactKey:(name=Unref1,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts"
+ + ".AxModel:WARNING:key not found for key information entry\n" + "********************************";
private static final String INVALID_MODEL_STRING = "\n" + "***validation of model failed***\n"
- + "AxArtifactKey:(name=BasicModelKey,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=KeyInfoMapKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo:OBSERVATION:description is blank\n"
- + "AxArtifactKey:(name=KeyInfoMapKey,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=KeyInfoMapKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation:INVALID:duplicate UUID found on keyInfoMap entry AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1):00000000-0000-0000-0000-000000000000\n"
- + "********************************";
+ + "AxArtifactKey:(name=BasicModelKey,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=KeyInfoMapKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts."
+ + "AxKeyInfo:OBSERVATION:description is blank\n"
+ + "AxArtifactKey:(name=KeyInfoMapKey,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=KeyInfoMapKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts."
+ + "AxKeyInformation:INVALID:duplicate UUID found on keyInfoMap entry AxArtifactKey:"
+ + "(name=KeyInfoMapKey,version=0.0.1):00000000-0000-0000-0000-000000000000\n"
+ + "********************************";
private static final String INVALID_MODEL_MALSTRUCTURED_STRING = "\n" + "***validation of model failed***\n"
- + "AxArtifactKey:(name=BasicModelKey,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=BasicModelKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts.AxModel:INVALID:key information not found for key AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1)\n"
- + "********************************";
+ + "AxArtifactKey:(name=BasicModelKey,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=BasicModelKey,version=0.0.1):org.onap.policy.apex.model.basicmodel.concepts."
+ + "AxModel:INVALID:key information not found for key "
+ + "AxArtifactKey:(name=KeyInfoMapKey,version=0.0.1)\n" + "********************************";
}
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexBasicModelConcepts.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexBasicModelConcepts.java
index 1ab7a2666..11cab6d88 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexBasicModelConcepts.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexBasicModelConcepts.java
@@ -257,20 +257,20 @@ public class TestApexBasicModelConcepts {
mwr.removeKey(keyU);
// Key Use on bad artifact key
- final AxKeyUse keyBU = new AxKeyUse(new AxArtifactKey("SomeKey", "0.0.1"));
- mwr.addKey(keyBU);
+ final AxKeyUse keyBadUsage = new AxKeyUse(new AxArtifactKey("SomeKey", "0.0.1"));
+ mwr.addKey(keyBadUsage);
result = new AxValidationResult();
result = mwr.validate(result);
assertEquals(ValidationResult.INVALID, result.getValidationResult());
- mwr.removeKey(keyBU);
+ mwr.removeKey(keyBadUsage);
// Key Use on bad reference key
- final AxKeyUse keyBRU = new AxKeyUse(new AxReferenceKey("SomeKey", "0.0.1", "Local"));
- mwr.addKey(keyBRU);
+ final AxKeyUse keyBadReferenceUsage = new AxKeyUse(new AxReferenceKey("SomeKey", "0.0.1", "Local"));
+ mwr.addKey(keyBadReferenceUsage);
result = new AxValidationResult();
result = mwr.validate(result);
assertEquals(ValidationResult.INVALID, result.getValidationResult());
- mwr.removeKey(keyBRU);
+ mwr.removeKey(keyBadReferenceUsage);
result = new AxValidationResult();
result = mwr.validate(result);
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexBasicModelCreator.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexBasicModelCreator.java
index 762c7555f..b11669fdf 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexBasicModelCreator.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexBasicModelCreator.java
@@ -38,13 +38,16 @@ public class TestApexBasicModelCreator implements TestApexModelCreator<AxModel>
basicModel.setKeyInformation(new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1")));
basicModel.getKeyInformation().getKeyInfoMap().put(basicModel.getKey(), new AxKeyInfo(basicModel.getKey()));
- basicModel.getKeyInformation().getKeyInfoMap().put(basicModel.getKeyInformation().getKey(), new AxKeyInfo(basicModel.getKeyInformation().getKey()));
+ basicModel.getKeyInformation().getKeyInfoMap().put(basicModel.getKeyInformation().getKey(),
+ new AxKeyInfo(basicModel.getKeyInformation().getKey()));
- AxKeyInfo intKI = new AxKeyInfo(new AxArtifactKey("IntegerKIKey", "0.0.1"), UUID.randomUUID(), "IntegerKIKey description");
- basicModel.getKeyInformation().getKeyInfoMap().put(intKI.getKey(), new AxKeyInfo(intKI.getKey()));
+ AxKeyInfo intKeyInfo = new AxKeyInfo(new AxArtifactKey("IntegerKIKey", "0.0.1"), UUID.randomUUID(),
+ "IntegerKIKey description");
+ basicModel.getKeyInformation().getKeyInfoMap().put(intKeyInfo.getKey(), new AxKeyInfo(intKeyInfo.getKey()));
- AxKeyInfo floatKI = new AxKeyInfo(new AxArtifactKey("FloatKIKey", "0.0.1"), UUID.randomUUID(), "FloatKIKey description");
- basicModel.getKeyInformation().getKeyInfoMap().put(floatKI.getKey(), new AxKeyInfo(floatKI.getKey()));
+ AxKeyInfo floatKeyInfo = new AxKeyInfo(new AxArtifactKey("FloatKIKey", "0.0.1"), UUID.randomUUID(),
+ "FloatKIKey description");
+ basicModel.getKeyInformation().getKeyInfoMap().put(floatKeyInfo.getKey(), new AxKeyInfo(floatKeyInfo.getKey()));
return basicModel;
}
@@ -57,10 +60,7 @@ public class TestApexBasicModelCreator implements TestApexModelCreator<AxModel>
basicModel.setKey(new AxArtifactKey("BasicModelKey", "0.0.1"));
basicModel.setKeyInformation(new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1")));
- basicModel.getKeyInformation().getKeyInfoMap().put(
- basicModel.getKey(),
- new AxKeyInfo(
- basicModel.getKey(),
+ basicModel.getKeyInformation().getKeyInfoMap().put(basicModel.getKey(), new AxKeyInfo(basicModel.getKey(),
UUID.fromString("00000000-0000-0000-0000-000000000000"),
"\nbasic model description\nThis is a multi line description\nwith another line of text."));
@@ -98,29 +98,27 @@ public class TestApexBasicModelCreator implements TestApexModelCreator<AxModel>
basicModel.setKey(new AxArtifactKey("BasicModelKey", "0.0.1"));
basicModel.setKeyInformation(new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1")));
- basicModel.getKeyInformation().getKeyInfoMap().put(
- basicModel.getKey(),
- new AxKeyInfo(
- basicModel.getKey(),
+ basicModel.getKeyInformation().getKeyInfoMap().put(basicModel.getKey(), new AxKeyInfo(basicModel.getKey(),
UUID.fromString("00000000-0000-0000-0000-000000000000"),
"nbasic model description\nThis is a multi line description\nwith another line of text."));
- basicModel.getKeyInformation().getKeyInfoMap().put(
- basicModel.getKeyInformation().getKey(),
- new AxKeyInfo(
- basicModel.getKeyInformation().getKey(),
- UUID.fromString("00000000-0000-0000-0000-000000000000"),
- ""));
+ basicModel.getKeyInformation().getKeyInfoMap().put(basicModel.getKeyInformation().getKey(),
+ new AxKeyInfo(basicModel.getKeyInformation().getKey(),
+ UUID.fromString("00000000-0000-0000-0000-000000000000"), ""));
return basicModel;
}
-
+
+ /**
+ * Get the model with its references.
+ * @return the model with its references
+ */
public final AxModelWithReferences getModelWithReferences() {
AxModel model = getModel();
-
+
AxModelWithReferences modelWithReferences = new AxModelWithReferences(model.getKey());
modelWithReferences.setKeyInformation(model.getKeyInformation());
modelWithReferences.setReferenceKeyList();
-
+
return modelWithReferences;
}
}
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexTestModelCreator0.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexTestModelCreator0.java
index ff958373e..a3d841a51 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexTestModelCreator0.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexTestModelCreator0.java
@@ -36,7 +36,8 @@ public class TestApexTestModelCreator0 implements TestApexModelCreator<AxModel>
basicModel.setKeyInformation(new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1")));
basicModel.getKeyInformation().getKeyInfoMap().put(basicModel.getKey(), new AxKeyInfo(basicModel.getKey()));
- basicModel.getKeyInformation().getKeyInfoMap().put(basicModel.getKeyInformation().getKey(), new AxKeyInfo(basicModel.getKeyInformation().getKey()));
+ basicModel.getKeyInformation().getKeyInfoMap().put(basicModel.getKeyInformation().getKey(),
+ new AxKeyInfo(basicModel.getKeyInformation().getKey()));
return basicModel;
}
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexTestModelCreator1.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexTestModelCreator1.java
index d2aa738a0..cbbe05a36 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexTestModelCreator1.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexTestModelCreator1.java
@@ -57,18 +57,12 @@ public class TestApexTestModelCreator1 implements TestApexModelCreator<AxModel>
basicModel.setKey(new AxArtifactKey("BasicModelKey", "0.0.1"));
basicModel.setKeyInformation(new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1")));
- basicModel.getKeyInformation().getKeyInfoMap().put(
- basicModel.getKey(),
- new AxKeyInfo(
- basicModel.getKey(),
+ basicModel.getKeyInformation().getKeyInfoMap().put(basicModel.getKey(), new AxKeyInfo(basicModel.getKey(),
UUID.fromString("00000000-0000-0000-0000-000000000000"),
"nbasic model description\nThis is a multi line description\nwith another line of text."));
- basicModel.getKeyInformation().getKeyInfoMap().put(
- basicModel.getKeyInformation().getKey(),
- new AxKeyInfo(
- basicModel.getKeyInformation().getKey(),
- UUID.fromString("00000000-0000-0000-0000-000000000000"),
- ""));
+ basicModel.getKeyInformation().getKeyInfoMap().put(basicModel.getKeyInformation().getKey(),
+ new AxKeyInfo(basicModel.getKeyInformation().getKey(),
+ UUID.fromString("00000000-0000-0000-0000-000000000000"), ""));
return basicModel;
}
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexTestModelCreator2.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexTestModelCreator2.java
index 85751bf12..a7b77865d 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexTestModelCreator2.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestApexTestModelCreator2.java
@@ -36,7 +36,8 @@ public class TestApexTestModelCreator2 implements TestApexModelCreator<AxModel>
basicModel.setKeyInformation(new AxKeyInformation(new AxArtifactKey("KeyInfoMapKey", "0.0.1")));
basicModel.getKeyInformation().getKeyInfoMap().put(basicModel.getKey(), new AxKeyInfo(basicModel.getKey()));
- basicModel.getKeyInformation().getKeyInfoMap().put(basicModel.getKeyInformation().getKey(), new AxKeyInfo(basicModel.getKeyInformation().getKey()));
+ basicModel.getKeyInformation().getKeyInfoMap().put(basicModel.getKeyInformation().getKey(),
+ new AxKeyInfo(basicModel.getKeyInformation().getKey()));
basicModel.getKeyInformation().get("BasicModel").setDescription("");
return basicModel;
}
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestBasicModelTest.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestBasicModelTest.java
index 9ddd3cc7e..9ced9d84b 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestBasicModelTest.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestBasicModelTest.java
@@ -29,15 +29,12 @@ import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.model.basicmodel.concepts.AxModel;
import org.onap.policy.apex.model.basicmodel.test.TestApexModel;
-/**
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
public class TestBasicModelTest {
@Test
public void testNormalModelCreator() throws ApexException {
- final TestApexModel<AxModel> testApexModel =
- new TestApexModel<AxModel>(AxModel.class, new TestApexBasicModelCreator());
+ final TestApexModel<AxModel> testApexModel = new TestApexModel<AxModel>(AxModel.class,
+ new TestApexBasicModelCreator());
testApexModel.testApexModelValid();
try {
@@ -50,14 +47,14 @@ public class TestBasicModelTest {
testApexModel.testApexModelVaidateInvalidModel();
testApexModel.testApexModelVaidateMalstructured();
- testApexModel.testApexModelWriteReadJSON();
- testApexModel.testApexModelWriteReadXML();
+ testApexModel.testApexModelWriteReadJson();
+ testApexModel.testApexModelWriteReadXml();
}
@Test
public void testModelCreator0() throws ApexException {
- final TestApexModel<AxModel> testApexModel =
- new TestApexModel<AxModel>(AxModel.class, new TestApexTestModelCreator0());
+ final TestApexModel<AxModel> testApexModel = new TestApexModel<AxModel>(AxModel.class,
+ new TestApexTestModelCreator0());
testApexModel.testApexModelValid();
try {
@@ -88,8 +85,8 @@ public class TestBasicModelTest {
@Test
public void testModelCreator1() throws ApexException {
- final TestApexModel<AxModel> testApexModel =
- new TestApexModel<AxModel>(AxModel.class, new TestApexTestModelCreator1());
+ final TestApexModel<AxModel> testApexModel = new TestApexModel<AxModel>(AxModel.class,
+ new TestApexTestModelCreator1());
try {
testApexModel.testApexModelValid();
@@ -115,8 +112,8 @@ public class TestBasicModelTest {
@Test
public void testModelCreator2() throws ApexException {
- final TestApexModel<AxModel> testApexModel =
- new TestApexModel<AxModel>(AxModel.class, new TestApexTestModelCreator2());
+ final TestApexModel<AxModel> testApexModel = new TestApexModel<AxModel>(AxModel.class,
+ new TestApexTestModelCreator2());
testApexModel.testApexModelValid();
testApexModel.testApexModelVaidateObservation();
@@ -129,19 +126,19 @@ public class TestBasicModelTest {
}
@Test
- public void testModelCreator1XMLJSON() throws ApexException {
- final TestApexModel<AxModel> testApexModel =
- new TestApexModel<AxModel>(AxModel.class, new TestApexTestModelCreator1());
+ public void testModelCreator1XmlJson() throws ApexException {
+ final TestApexModel<AxModel> testApexModel = new TestApexModel<AxModel>(AxModel.class,
+ new TestApexTestModelCreator1());
try {
- testApexModel.testApexModelWriteReadJSON();
+ testApexModel.testApexModelWriteReadJson();
fail("Test should throw an exception");
} catch (final Exception e) {
assertTrue(e.getMessage().startsWith("error processing file"));
}
try {
- testApexModel.testApexModelWriteReadXML();
+ testApexModel.testApexModelWriteReadXml();
fail("Test should throw an exception");
} catch (final Exception e) {
assertTrue(e.getMessage().startsWith("error processing file"));
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestConceptGetter.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestConceptGetter.java
index 83545bf06..f95c0b41d 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestConceptGetter.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestConceptGetter.java
@@ -37,37 +37,55 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxModel;
import org.onap.policy.apex.model.basicmodel.handling.ApexModelFileWriter;
import org.onap.policy.apex.model.basicmodel.handling.ApexModelReader;
-/**
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
public class TestConceptGetter {
@Test
public void testConceptGetter() throws IOException, ApexException {
AxModel basicModel = new TestApexBasicModelCreator().getModel();
assertNotNull(basicModel);
-
- AxKeyInfo intKI01 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey01", "0.0.1"), UUID.randomUUID(), "IntegerKIKey01 description");
- AxKeyInfo intKI11 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey11", "0.0.1"), UUID.randomUUID(), "IntegerKIKey11 description");
- AxKeyInfo intKI21 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey21", "0.0.1"), UUID.randomUUID(), "IntegerKIKey21 description");
- AxKeyInfo intKI22 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey22", "0.0.2"), UUID.randomUUID(), "IntegerKIKey22 description");
- AxKeyInfo intKI23 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey23", "0.0.3"), UUID.randomUUID(), "IntegerKIKey23 description");
- AxKeyInfo intKI24 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey24", "0.0.4"), UUID.randomUUID(), "IntegerKIKey24 description");
- AxKeyInfo intKI25 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey25", "0.0.5"), UUID.randomUUID(), "IntegerKIKey25 description");
- AxKeyInfo intKI26 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey26", "0.0.6"), UUID.randomUUID(), "IntegerKIKey26 description");
- AxKeyInfo intKI31 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey31", "0.0.1"), UUID.randomUUID(), "IntegerKIKey31 description");
- AxKeyInfo intKI41 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey41", "0.0.1"), UUID.randomUUID(), "IntegerKIKey41 description");
- AxKeyInfo intKI51 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey51", "0.0.1"), UUID.randomUUID(), "IntegerKIKey51 description");
- AxKeyInfo intKI52 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey52", "0.0.2"), UUID.randomUUID(), "IntegerKIKey52 description");
- AxKeyInfo intKI53 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey53", "0.0.3"), UUID.randomUUID(), "IntegerKIKey53 description");
- AxKeyInfo intKI54 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey54", "0.0.4"), UUID.randomUUID(), "IntegerKIKey54 description");
- AxKeyInfo intKI61 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey61", "0.0.1"), UUID.randomUUID(), "IntegerKIKey61 description");
- AxKeyInfo intKI62 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey62", "0.0.2"), UUID.randomUUID(), "IntegerKIKey62 description");
- AxKeyInfo intKI63 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey63", "0.0.3"), UUID.randomUUID(), "IntegerKIKey63 description");
- AxKeyInfo intKI64 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey64", "0.0.4"), UUID.randomUUID(), "IntegerKIKey64 description");
- AxKeyInfo intKI71 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey71", "0.0.1"), UUID.randomUUID(), "IntegerKIKey71 description");
- AxKeyInfo intKI81 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey81", "0.0.1"), UUID.randomUUID(), "IntegerKIKey81 description");
- AxKeyInfo intKI91 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey91", "0.0.1"), UUID.randomUUID(), "IntegerKIKey91 description");
+
+ AxKeyInfo intKI01 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey01", "0.0.1"), UUID.randomUUID(),
+ "IntegerKIKey01 description");
+ AxKeyInfo intKI11 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey11", "0.0.1"), UUID.randomUUID(),
+ "IntegerKIKey11 description");
+ AxKeyInfo intKI21 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey21", "0.0.1"), UUID.randomUUID(),
+ "IntegerKIKey21 description");
+ AxKeyInfo intKI22 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey22", "0.0.2"), UUID.randomUUID(),
+ "IntegerKIKey22 description");
+ AxKeyInfo intKI23 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey23", "0.0.3"), UUID.randomUUID(),
+ "IntegerKIKey23 description");
+ AxKeyInfo intKI24 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey24", "0.0.4"), UUID.randomUUID(),
+ "IntegerKIKey24 description");
+ AxKeyInfo intKI25 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey25", "0.0.5"), UUID.randomUUID(),
+ "IntegerKIKey25 description");
+ AxKeyInfo intKI26 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey26", "0.0.6"), UUID.randomUUID(),
+ "IntegerKIKey26 description");
+ AxKeyInfo intKI31 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey31", "0.0.1"), UUID.randomUUID(),
+ "IntegerKIKey31 description");
+ AxKeyInfo intKI41 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey41", "0.0.1"), UUID.randomUUID(),
+ "IntegerKIKey41 description");
+ AxKeyInfo intKI51 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey51", "0.0.1"), UUID.randomUUID(),
+ "IntegerKIKey51 description");
+ AxKeyInfo intKI52 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey52", "0.0.2"), UUID.randomUUID(),
+ "IntegerKIKey52 description");
+ AxKeyInfo intKI53 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey53", "0.0.3"), UUID.randomUUID(),
+ "IntegerKIKey53 description");
+ AxKeyInfo intKI54 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey54", "0.0.4"), UUID.randomUUID(),
+ "IntegerKIKey54 description");
+ AxKeyInfo intKI61 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey61", "0.0.1"), UUID.randomUUID(),
+ "IntegerKIKey61 description");
+ AxKeyInfo intKI62 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey62", "0.0.2"), UUID.randomUUID(),
+ "IntegerKIKey62 description");
+ AxKeyInfo intKI63 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey63", "0.0.3"), UUID.randomUUID(),
+ "IntegerKIKey63 description");
+ AxKeyInfo intKI64 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey64", "0.0.4"), UUID.randomUUID(),
+ "IntegerKIKey64 description");
+ AxKeyInfo intKI71 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey71", "0.0.1"), UUID.randomUUID(),
+ "IntegerKIKey71 description");
+ AxKeyInfo intKI81 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey81", "0.0.1"), UUID.randomUUID(),
+ "IntegerKIKey81 description");
+ AxKeyInfo intKI91 = new AxKeyInfo(new AxArtifactKey("IntegerKIKey91", "0.0.1"), UUID.randomUUID(),
+ "IntegerKIKey91 description");
basicModel.getKeyInformation().getKeyInfoMap().put(intKI31.getKey(), intKI31);
basicModel.getKeyInformation().getKeyInfoMap().put(intKI24.getKey(), intKI24);
basicModel.getKeyInformation().getKeyInfoMap().put(intKI11.getKey(), intKI11);
@@ -90,20 +108,34 @@ public class TestConceptGetter {
basicModel.getKeyInformation().getKeyInfoMap().put(intKI61.getKey(), intKI61);
basicModel.getKeyInformation().getKeyInfoMap().put(intKI63.getKey(), intKI63);
- AxKeyInfo floatKI01 = new AxKeyInfo(new AxArtifactKey("FloatKIKey01", "0.0.1"), UUID.randomUUID(), "IntegerKIKey01 description");
- AxKeyInfo floatKI11 = new AxKeyInfo(new AxArtifactKey("FloatKIKey11", "0.0.1"), UUID.randomUUID(), "IntegerKIKey11 description");
- AxKeyInfo floatKI21 = new AxKeyInfo(new AxArtifactKey("FloatKIKey21", "0.0.1"), UUID.randomUUID(), "IntegerKIKey21 description");
- AxKeyInfo floatKI31 = new AxKeyInfo(new AxArtifactKey("FloatKIKey31", "0.0.1"), UUID.randomUUID(), "IntegerKIKey31 description");
- AxKeyInfo floatKI41 = new AxKeyInfo(new AxArtifactKey("FloatKIKey41", "0.0.1"), UUID.randomUUID(), "IntegerKIKey41 description");
- AxKeyInfo floatKI51 = new AxKeyInfo(new AxArtifactKey("FloatKIKey51", "0.0.1"), UUID.randomUUID(), "IntegerKIKey51 description");
- AxKeyInfo floatKI61 = new AxKeyInfo(new AxArtifactKey("FloatKIKey61", "0.0.1"), UUID.randomUUID(), "IntegerKIKey61 description");
- AxKeyInfo floatKI71 = new AxKeyInfo(new AxArtifactKey("FloatKIKey71", "0.0.1"), UUID.randomUUID(), "IntegerKIKey71 description");
- AxKeyInfo floatKI81 = new AxKeyInfo(new AxArtifactKey("FloatKIKey81", "0.0.1"), UUID.randomUUID(), "IntegerKIKey81 description");
- AxKeyInfo floatKI82 = new AxKeyInfo(new AxArtifactKey("FloatKIKey82", "0.0.2"), UUID.randomUUID(), "IntegerKIKey82 description");
- AxKeyInfo floatKI83 = new AxKeyInfo(new AxArtifactKey("FloatKIKey83", "0.0.3"), UUID.randomUUID(), "IntegerKIKey83 description");
- AxKeyInfo floatKI91 = new AxKeyInfo(new AxArtifactKey("FloatKIKey91", "0.0.1"), UUID.randomUUID(), "IntegerKIKey91 description");
- AxKeyInfo floatKI92 = new AxKeyInfo(new AxArtifactKey("FloatKIKey92", "0.0.2"), UUID.randomUUID(), "IntegerKIKey92 description");
- AxKeyInfo floatKI93 = new AxKeyInfo(new AxArtifactKey("FloatKIKey93", "0.0.3"), UUID.randomUUID(), "IntegerKIKey93 description");
+ AxKeyInfo floatKI01 = new AxKeyInfo(new AxArtifactKey("FloatKIKey01", "0.0.1"), UUID.randomUUID(),
+ "IntegerKIKey01 description");
+ AxKeyInfo floatKI11 = new AxKeyInfo(new AxArtifactKey("FloatKIKey11", "0.0.1"), UUID.randomUUID(),
+ "IntegerKIKey11 description");
+ AxKeyInfo floatKI21 = new AxKeyInfo(new AxArtifactKey("FloatKIKey21", "0.0.1"), UUID.randomUUID(),
+ "IntegerKIKey21 description");
+ AxKeyInfo floatKI31 = new AxKeyInfo(new AxArtifactKey("FloatKIKey31", "0.0.1"), UUID.randomUUID(),
+ "IntegerKIKey31 description");
+ AxKeyInfo floatKI41 = new AxKeyInfo(new AxArtifactKey("FloatKIKey41", "0.0.1"), UUID.randomUUID(),
+ "IntegerKIKey41 description");
+ AxKeyInfo floatKI51 = new AxKeyInfo(new AxArtifactKey("FloatKIKey51", "0.0.1"), UUID.randomUUID(),
+ "IntegerKIKey51 description");
+ AxKeyInfo floatKI61 = new AxKeyInfo(new AxArtifactKey("FloatKIKey61", "0.0.1"), UUID.randomUUID(),
+ "IntegerKIKey61 description");
+ AxKeyInfo floatKI71 = new AxKeyInfo(new AxArtifactKey("FloatKIKey71", "0.0.1"), UUID.randomUUID(),
+ "IntegerKIKey71 description");
+ AxKeyInfo floatKI81 = new AxKeyInfo(new AxArtifactKey("FloatKIKey81", "0.0.1"), UUID.randomUUID(),
+ "IntegerKIKey81 description");
+ AxKeyInfo floatKI82 = new AxKeyInfo(new AxArtifactKey("FloatKIKey82", "0.0.2"), UUID.randomUUID(),
+ "IntegerKIKey82 description");
+ AxKeyInfo floatKI83 = new AxKeyInfo(new AxArtifactKey("FloatKIKey83", "0.0.3"), UUID.randomUUID(),
+ "IntegerKIKey83 description");
+ AxKeyInfo floatKI91 = new AxKeyInfo(new AxArtifactKey("FloatKIKey91", "0.0.1"), UUID.randomUUID(),
+ "IntegerKIKey91 description");
+ AxKeyInfo floatKI92 = new AxKeyInfo(new AxArtifactKey("FloatKIKey92", "0.0.2"), UUID.randomUUID(),
+ "IntegerKIKey92 description");
+ AxKeyInfo floatKI93 = new AxKeyInfo(new AxArtifactKey("FloatKIKey93", "0.0.3"), UUID.randomUUID(),
+ "IntegerKIKey93 description");
basicModel.getKeyInformation().getKeyInfoMap().put(floatKI11.getKey(), floatKI11);
basicModel.getKeyInformation().getKeyInfoMap().put(floatKI83.getKey(), floatKI83);
basicModel.getKeyInformation().getKeyInfoMap().put(floatKI51.getKey(), floatKI51);
@@ -124,9 +156,9 @@ public class TestConceptGetter {
assertTrue(basicModel.getKeyInformation().get("IntegerKIKey62", "0.0.2").equals(intKI62));
assertTrue(basicModel.getKeyInformation().get("IntegerKIKey21", "0.0.1").equals(intKI21));
assertTrue(basicModel.getKeyInformation().get("IntegerKIKey61", "0.0.1").equals(intKI61));
-
+
assertNull(basicModel.getKeyInformation().get("NonExistantKey"));
-
+
assertTrue(basicModel.getKeyInformation().get("IntegerKIKey01").equals(intKI01));
assertTrue(basicModel.getKeyInformation().get("IntegerKIKey11").equals(intKI11));
assertTrue(basicModel.getKeyInformation().get("IntegerKIKey26").equals(intKI26));
@@ -137,7 +169,7 @@ public class TestConceptGetter {
assertTrue(basicModel.getKeyInformation().get("IntegerKIKey71").equals(intKI71));
assertTrue(basicModel.getKeyInformation().get("IntegerKIKey81").equals(intKI81));
assertTrue(basicModel.getKeyInformation().get("IntegerKIKey91").equals(intKI91));
-
+
assertTrue(basicModel.getKeyInformation().get("FloatKIKey01").equals(floatKI01));
assertTrue(basicModel.getKeyInformation().get("FloatKIKey11").equals(floatKI11));
assertTrue(basicModel.getKeyInformation().get("FloatKIKey21").equals(floatKI21));
@@ -149,23 +181,22 @@ public class TestConceptGetter {
assertTrue(basicModel.getKeyInformation().get("FloatKIKey83").equals(floatKI83));
assertTrue(basicModel.getKeyInformation().get("FloatKIKey93").equals(floatKI93));
-
// Ensure marshalling and unmarshalling is OK
ApexModelReader<AxModel> modelReader = new ApexModelReader<AxModel>(AxModel.class);
ApexModelFileWriter<AxModel> modelWriter = new ApexModelFileWriter<AxModel>(true);
-
+
modelReader.setValidateFlag(false);
modelWriter.setValidateFlag(false);
-
- File tempXMLFile = File.createTempFile("ApexModel", "xml");
- modelWriter.apexModelWriteJSONFile(basicModel, AxModel.class, tempXMLFile.getCanonicalPath());
-
- FileInputStream xmlFileInputStream = new FileInputStream(tempXMLFile);
- AxModel readXMLModel = modelReader.read(xmlFileInputStream);
+
+ File tempXmlFile = File.createTempFile("ApexModel", "xml");
+ modelWriter.apexModelWriteJsonFile(basicModel, AxModel.class, tempXmlFile.getCanonicalPath());
+
+ FileInputStream xmlFileInputStream = new FileInputStream(tempXmlFile);
+ AxModel readXmlModel = modelReader.read(xmlFileInputStream);
xmlFileInputStream.close();
- assertTrue(basicModel.equals(readXMLModel));
- assertTrue(readXMLModel.getKeyInformation().get("IntegerKIKey91").equals(intKI91));
- assertNotNull(readXMLModel.getKeyInformation().get("FloatKIKey"));
- tempXMLFile.delete();
+ assertTrue(basicModel.equals(readXmlModel));
+ assertTrue(readXmlModel.getKeyInformation().get("IntegerKIKey91").equals(intKI91));
+ assertNotNull(readXmlModel.getKeyInformation().get("FloatKIKey"));
+ tempXmlFile.delete();
}
}
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestExceptions.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestExceptions.java
index 5c8922793..8b0196b31 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestExceptions.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestExceptions.java
@@ -28,9 +28,6 @@ import java.io.IOException;
import org.junit.Test;
import org.onap.policy.apex.model.basicmodel.handling.ApexModelException;
-/**
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
public class TestExceptions {
@Test
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelFileWriter.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelFileWriter.java
index ec4d0a5a9..3e860e3b1 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelFileWriter.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelFileWriter.java
@@ -31,15 +31,10 @@ import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.model.basicmodel.concepts.AxModel;
import org.onap.policy.apex.model.basicmodel.handling.ApexModelFileWriter;
-/**
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
public class TestModelFileWriter {
@Test
public void testModelFileWriter() throws IOException, ApexException {
- AxModel model = new TestApexBasicModelCreator().getModel();
-
ApexModelFileWriter<AxModel> modelFileWriter = new ApexModelFileWriter<>(true);
modelFileWriter.setValidateFlag(true);
@@ -52,9 +47,10 @@ public class TestModelFileWriter {
File jsonTempFile = new File(tempDir.getAbsolutePath() + "/aaa/ApexFileWriterTest.json");
File xmlTempFile = new File(tempDir.getAbsolutePath() + "/ccc/ApexFileWriterTest.xml");
- modelFileWriter.apexModelWriteJSONFile(model, AxModel.class, jsonTempFile.getAbsolutePath());
+ AxModel model = new TestApexBasicModelCreator().getModel();
- modelFileWriter.apexModelWriteXMLFile(model, AxModel.class, xmlTempFile.getAbsolutePath());
+ modelFileWriter.apexModelWriteJsonFile(model, AxModel.class, jsonTempFile.getAbsolutePath());
+ modelFileWriter.apexModelWriteXmlFile(model, AxModel.class, xmlTempFile.getAbsolutePath());
jsonTempFile.delete();
xmlTempFile.delete();
@@ -64,8 +60,8 @@ public class TestModelFileWriter {
jsonTempFile = new File(tempDir.getAbsolutePath() + "/aaa/bbb/ApexFileWriterTest.json");
xmlTempFile = new File(tempDir.getAbsolutePath() + "/ccc/ddd/ApexFileWriterTest.xml");
- modelFileWriter.apexModelWriteJSONFile(model, AxModel.class, jsonTempFile.getAbsolutePath());
- modelFileWriter.apexModelWriteXMLFile(model, AxModel.class, xmlTempFile.getAbsolutePath());
+ modelFileWriter.apexModelWriteJsonFile(model, AxModel.class, jsonTempFile.getAbsolutePath());
+ modelFileWriter.apexModelWriteXmlFile(model, AxModel.class, xmlTempFile.getAbsolutePath());
jsonTempFile.delete();
xmlTempFile.delete();
@@ -84,7 +80,7 @@ public class TestModelFileWriter {
jsonTempFile = new File(tempDir.getAbsolutePath() + "/aaa/bbb/ApexFileWriterTest.xml");
try {
- modelFileWriter.apexModelWriteJSONFile(model, AxModel.class, jsonTempFile.getAbsolutePath());
+ modelFileWriter.apexModelWriteJsonFile(model, AxModel.class, jsonTempFile.getAbsolutePath());
fail("this test should throw an exception here");
}
catch (Exception e) {
@@ -92,7 +88,7 @@ public class TestModelFileWriter {
}
try {
- modelFileWriter.apexModelWriteXMLFile(model, AxModel.class, jsonTempFile.getAbsolutePath());
+ modelFileWriter.apexModelWriteXmlFile(model, AxModel.class, jsonTempFile.getAbsolutePath());
fail("this test should throw an exception here");
}
catch (Exception e) {
@@ -110,7 +106,7 @@ public class TestModelFileWriter {
jsonTempFile = new File(tempDir.getAbsolutePath() + "/aaa/bbb/ApexFileWriterTest.xml");
try {
- modelFileWriter.apexModelWriteJSONFile(model, AxModel.class, jsonTempFile.getAbsolutePath());
+ modelFileWriter.apexModelWriteJsonFile(model, AxModel.class, jsonTempFile.getAbsolutePath());
fail("this test should throw an exception here");
}
catch (Exception e) {
@@ -118,7 +114,7 @@ public class TestModelFileWriter {
}
try {
- modelFileWriter.apexModelWriteXMLFile(model, AxModel.class, jsonTempFile.getAbsolutePath());
+ modelFileWriter.apexModelWriteXmlFile(model, AxModel.class, jsonTempFile.getAbsolutePath());
fail("this test should throw an exception here");
}
catch (Exception e) {
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelReader.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelReader.java
index 140817e00..1695a0b2c 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelReader.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelReader.java
@@ -39,9 +39,6 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxModel;
import org.onap.policy.apex.model.basicmodel.handling.ApexModelReader;
import org.onap.policy.apex.model.basicmodel.handling.ApexModelWriter;
-/**
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
public class TestModelReader {
@Test
@@ -87,12 +84,12 @@ public class TestModelReader {
modelWriter.setJsonOutput(false);
- ByteArrayOutputStream baosXML = new ByteArrayOutputStream();
- modelWriter.write(model, baosXML);
+ ByteArrayOutputStream baosXml = new ByteArrayOutputStream();
+ modelWriter.write(model, baosXml);
- ByteArrayInputStream baisXML = new ByteArrayInputStream(baosXML.toByteArray());
- AxModel readModelXML = modelReader.read(baisXML);
- assertEquals(model, readModelXML);
+ ByteArrayInputStream baisXml = new ByteArrayInputStream(baosXml.toByteArray());
+ AxModel readModelXml = modelReader.read(baisXml);
+ assertEquals(model, readModelXml);
String dummyString = "SomeDummyText";
ByteArrayInputStream baisDummy = new ByteArrayInputStream(dummyString.getBytes());
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelSaver.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelSaver.java
index 08f123cba..634a929d9 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelSaver.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelSaver.java
@@ -30,22 +30,20 @@ import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.model.basicmodel.concepts.AxModel;
import org.onap.policy.apex.model.basicmodel.handling.ApexModelSaver;
-/**
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
public class TestModelSaver {
@Test
public void testModelSaver() throws IOException, ApexException {
AxModel model = new TestApexBasicModelCreator().getModel();
-
+
Path tempPath = Files.createTempDirectory("ApexTest");
-
- ApexModelSaver<AxModel> modelSaver = new ApexModelSaver<AxModel>(AxModel.class, model, tempPath.toAbsolutePath().toString());
-
- modelSaver.apexModelWriteXML();
- modelSaver.apexModelWriteJSON();
-
+
+ ApexModelSaver<AxModel> modelSaver = new ApexModelSaver<AxModel>(AxModel.class, model,
+ tempPath.toAbsolutePath().toString());
+
+ modelSaver.apexModelWriteXml();
+ modelSaver.apexModelWriteJson();
+
Files.deleteIfExists(new File(tempPath.toAbsolutePath() + "/BasicModel.json").toPath());
Files.deleteIfExists(new File(tempPath.toAbsolutePath() + "/BasicModel.xml").toPath());
Files.deleteIfExists(tempPath);
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelStringWriter.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelStringWriter.java
index d2a504676..d187e55ee 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelStringWriter.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelStringWriter.java
@@ -33,9 +33,6 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo;
import org.onap.policy.apex.model.basicmodel.concepts.AxModel;
import org.onap.policy.apex.model.basicmodel.handling.ApexModelStringWriter;
-/**
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
public class TestModelStringWriter {
@Test
@@ -43,23 +40,23 @@ public class TestModelStringWriter {
AxModel basicModel = new TestApexBasicModelCreator().getModel();
assertNotNull(basicModel);
- AxKeyInfo intKI = basicModel.getKeyInformation().get("IntegerKIKey");
- AxKeyInfo floatKI = basicModel.getKeyInformation().get("FloatKIKey");
+ AxKeyInfo intKeyInfo = basicModel.getKeyInformation().get("IntegerKIKey");
+ AxKeyInfo floatKeyInfo = basicModel.getKeyInformation().get("FloatKIKey");
// Ensure marshalling is OK
ApexModelStringWriter<AxKeyInfo> stringWriter = new ApexModelStringWriter<AxKeyInfo>(true);
- assertNotNull(stringWriter.writeJSONString(intKI, AxKeyInfo.class));
- assertNotNull(stringWriter.writeJSONString(floatKI, AxKeyInfo.class));
+ assertNotNull(stringWriter.writeJsonString(intKeyInfo, AxKeyInfo.class));
+ assertNotNull(stringWriter.writeJsonString(floatKeyInfo, AxKeyInfo.class));
- assertNotNull(stringWriter.writeString(intKI, AxKeyInfo.class, true));
- assertNotNull(stringWriter.writeString(floatKI, AxKeyInfo.class, true));
+ assertNotNull(stringWriter.writeString(intKeyInfo, AxKeyInfo.class, true));
+ assertNotNull(stringWriter.writeString(floatKeyInfo, AxKeyInfo.class, true));
- assertNotNull(stringWriter.writeString(intKI, AxKeyInfo.class, false));
- assertNotNull(stringWriter.writeString(floatKI, AxKeyInfo.class, false));
+ assertNotNull(stringWriter.writeString(intKeyInfo, AxKeyInfo.class, false));
+ assertNotNull(stringWriter.writeString(floatKeyInfo, AxKeyInfo.class, false));
- assertNotNull(stringWriter.writeXMLString(intKI, AxKeyInfo.class));
- assertNotNull(stringWriter.writeXMLString(floatKI, AxKeyInfo.class));
+ assertNotNull(stringWriter.writeXmlString(intKeyInfo, AxKeyInfo.class));
+ assertNotNull(stringWriter.writeXmlString(floatKeyInfo, AxKeyInfo.class));
try {
stringWriter.writeString(null, AxKeyInfo.class, true);
@@ -78,7 +75,7 @@ public class TestModelStringWriter {
}
try {
- stringWriter.writeJSONString(null, AxKeyInfo.class);
+ stringWriter.writeJsonString(null, AxKeyInfo.class);
fail("test should thrown an exception here");
}
catch (Exception e) {
@@ -86,7 +83,7 @@ public class TestModelStringWriter {
}
try {
- stringWriter.writeXMLString(null, AxKeyInfo.class);
+ stringWriter.writeXmlString(null, AxKeyInfo.class);
fail("test should thrown an exception here");
}
catch (Exception e) {
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelWriter.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelWriter.java
index 8e5af45b3..648194a52 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelWriter.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestModelWriter.java
@@ -33,15 +33,10 @@ import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.model.basicmodel.concepts.AxModel;
import org.onap.policy.apex.model.basicmodel.handling.ApexModelWriter;
-/**
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
public class TestModelWriter {
@Test
public void testModelWriter() throws IOException, ApexException {
- AxModel model = new TestApexBasicModelCreator().getModel();
-
ApexModelWriter<AxModel> modelWriter = new ApexModelWriter<AxModel>(AxModel.class);
modelWriter.setValidateFlag(true);
@@ -56,6 +51,8 @@ public class TestModelWriter {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ AxModel model = new TestApexBasicModelCreator().getModel();
+
modelWriter.write(model, baos);
modelWriter.setJsonOutput(true);
modelWriter.write(model, baos);
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestSchemaGenerator.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestSchemaGenerator.java
index cdf3b4615..36e4125ec 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestSchemaGenerator.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/handling/TestSchemaGenerator.java
@@ -31,9 +31,6 @@ import java.io.PrintStream;
import org.junit.Test;
-/**
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
public class TestSchemaGenerator {
@Test
@@ -83,7 +80,7 @@ public class TestSchemaGenerator {
final File tempFile = File.createTempFile("ApexSchemaGeneratorTest", "xsd");
final String[] args5 =
- { "org.onap.policy.apex.model.basicmodel.concepts.AxModel", tempFile.getCanonicalPath() };
+ { "org.onap.policy.apex.model.basicmodel.concepts.AxModel", tempFile.getCanonicalPath() };
ApexSchemaGenerator.main(args5);
assertTrue(tempFile.length() > 100);
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/service/TestModelService.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/service/TestModelService.java
index 9c20d837f..4f05de177 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/service/TestModelService.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/service/TestModelService.java
@@ -29,9 +29,6 @@ import org.junit.Test;
import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation;
import org.onap.policy.apex.model.basicmodel.handling.TestApexBasicModelCreator;
-/**
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
public class TestModelService {
@Test
@@ -42,13 +39,12 @@ public class TestModelService {
try {
ModelService.getModel(AxKeyInformation.class);
} catch (final Exception e) {
- assertEquals(
- "Model for org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation not found in model service",
- e.getMessage());
+ assertEquals("Model for org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation "
+ + "not found in model service", e.getMessage());
}
ModelService.registerModel(AxKeyInformation.class,
- new TestApexBasicModelCreator().getModel().getKeyInformation());
+ new TestApexBasicModelCreator().getModel().getKeyInformation());
assertTrue(ModelService.existsModel(AxKeyInformation.class));
assertNotNull(ModelService.getModel(AxKeyInformation.class));
@@ -58,13 +54,12 @@ public class TestModelService {
try {
ModelService.getModel(AxKeyInformation.class);
} catch (final Exception e) {
- assertEquals(
- "Model for org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation not found in model service",
- e.getMessage());
+ assertEquals("Model for org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation "
+ + "not found in model service", e.getMessage());
}
ModelService.registerModel(AxKeyInformation.class,
- new TestApexBasicModelCreator().getModel().getKeyInformation());
+ new TestApexBasicModelCreator().getModel().getKeyInformation());
assertTrue(ModelService.existsModel(AxKeyInformation.class));
assertNotNull(ModelService.getModel(AxKeyInformation.class));
@@ -73,9 +68,8 @@ public class TestModelService {
try {
ModelService.getModel(AxKeyInformation.class);
} catch (final Exception e) {
- assertEquals(
- "Model for org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation not found in model service",
- e.getMessage());
+ assertEquals("Model for org.onap.policy.apex.model.basicmodel.concepts.AxKeyInformation "
+ + "not found in model service", e.getMessage());
}
}
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/xml/TestAxReferenceKeyAdapter.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/xml/TestAxReferenceKeyAdapter.java
index bde0956b8..a7773c37c 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/xml/TestAxReferenceKeyAdapter.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/xml/TestAxReferenceKeyAdapter.java
@@ -27,9 +27,6 @@ import org.junit.Test;
import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
import org.onap.policy.apex.model.basicmodel.xml.AxReferenceKeyAdapter;
-/**
- * @author Liam Fallon (liam.fallon@ericsson.com)
- */
public class TestAxReferenceKeyAdapter {
@Test
@@ -37,10 +34,10 @@ public class TestAxReferenceKeyAdapter {
AxReferenceKeyAdapter arka = new AxReferenceKeyAdapter();
assertNotNull(arka);
- AxReferenceKey rKey = new AxReferenceKey("Name", "0.0.1", "PLN", "LN");
+ AxReferenceKey rkey = new AxReferenceKey("Name", "0.0.1", "PLN", "LN");
- String rKeyString = arka.marshal(rKey);
- assertEquals("LN", rKeyString);
- assertEquals(rKey.getLocalName(),arka.unmarshal(rKeyString).getLocalName());
+ String rkeyString = arka.marshal(rkey);
+ assertEquals("LN", rkeyString);
+ assertEquals(rkey.getLocalName(),arka.unmarshal(rkeyString).getLocalName());
}
}