diff options
Diffstat (limited to 'models-tosca/src/test/java')
24 files changed, 506 insertions, 501 deletions
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/mapping/PlainToscaServiceTemplateMapperTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/mapping/PlainToscaServiceTemplateMapperTest.java index 74b88e790..6ec91238f 100644 --- a/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/mapping/PlainToscaServiceTemplateMapperTest.java +++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/mapping/PlainToscaServiceTemplateMapperTest.java @@ -30,8 +30,8 @@ import org.junit.Test; import org.onap.policy.common.utils.coder.StandardCoder; import org.onap.policy.common.utils.resources.ResourceUtils; import org.onap.policy.models.base.PfValidationResult; -import org.onap.policy.models.tosca.authorative.concepts.PlainToscaServiceTemplate; -import org.onap.policy.models.tosca.simple.concepts.ToscaServiceTemplate; +import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate; import org.yaml.snakeyaml.Yaml; /** @@ -55,10 +55,10 @@ public class PlainToscaServiceTemplateMapperTest { try { String inputJson = ResourceUtils.getResourceAsString("policies/vCPE.policy.monitoring.input.tosca.json"); - PlainToscaServiceTemplate plainPolicies = standardCoder.decode(inputJson, PlainToscaServiceTemplate.class); - ToscaServiceTemplate internalPolicies = mapper.toToscaServiceTemplate(plainPolicies); + ToscaServiceTemplate plainPolicies = standardCoder.decode(inputJson, ToscaServiceTemplate.class); + JpaToscaServiceTemplate internalPolicies = mapper.toToscaServiceTemplate(plainPolicies); assertTrue(internalPolicies.validate(new PfValidationResult()).isValid()); - PlainToscaServiceTemplate plainPolicies2 = mapper.fromToscaServiceTemplate(internalPolicies); + ToscaServiceTemplate plainPolicies2 = mapper.fromToscaServiceTemplate(internalPolicies); assertTrue(plainPolicies.equals(plainPolicies2)); } catch (Exception e) { @@ -75,12 +75,12 @@ public class PlainToscaServiceTemplateMapperTest { Object yamlObject = yaml.load(inputYaml); String yamlAsJsonString = standardCoder.encode(yamlObject); - PlainToscaServiceTemplate plainPolicyTypes = standardCoder.decode(yamlAsJsonString, - PlainToscaServiceTemplate.class); - ToscaServiceTemplate internalPolicyTypes = mapper.toToscaServiceTemplate(plainPolicyTypes); + ToscaServiceTemplate plainPolicyTypes = standardCoder.decode(yamlAsJsonString, + ToscaServiceTemplate.class); + JpaToscaServiceTemplate internalPolicyTypes = mapper.toToscaServiceTemplate(plainPolicyTypes); assertTrue(internalPolicyTypes.validate(new PfValidationResult()).isValid()); - PlainToscaServiceTemplate plainPolicyTypes2 = mapper.fromToscaServiceTemplate(internalPolicyTypes); - ToscaServiceTemplate internalPolicyTypes2 = mapper.toToscaServiceTemplate(plainPolicyTypes2); + ToscaServiceTemplate plainPolicyTypes2 = mapper.fromToscaServiceTemplate(internalPolicyTypes); + JpaToscaServiceTemplate internalPolicyTypes2 = mapper.toToscaServiceTemplate(plainPolicyTypes2); assertTrue(internalPolicyTypes2.validate(new PfValidationResult()).isValid()); assertTrue(internalPolicyTypes.compareTo(internalPolicyTypes2) == 0); diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/legacy/serialization/LegacyOperationalPolicySerializationTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/legacy/serialization/LegacyOperationalPolicySerializationTest.java index c13583178..26242611b 100644 --- a/models-tosca/src/test/java/org/onap/policy/models/tosca/legacy/serialization/LegacyOperationalPolicySerializationTest.java +++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/legacy/serialization/LegacyOperationalPolicySerializationTest.java @@ -31,7 +31,7 @@ import org.onap.policy.common.utils.resources.ResourceUtils; import org.onap.policy.models.base.PfValidationResult; import org.onap.policy.models.tosca.legacy.concepts.LegacyOperationalPolicy; import org.onap.policy.models.tosca.legacy.mapping.LegacyOperationalPolicyMapper; -import org.onap.policy.models.tosca.simple.concepts.ToscaServiceTemplate; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -58,7 +58,7 @@ public class LegacyOperationalPolicySerializationTest { LegacyOperationalPolicy legacyOperationalPolicy = standardCoder.decode(vcpePolicyJson, LegacyOperationalPolicy.class); - ToscaServiceTemplate serviceTemplate = + JpaToscaServiceTemplate serviceTemplate = new LegacyOperationalPolicyMapper().toToscaServiceTemplate(legacyOperationalPolicy); assertNotNull(serviceTemplate); diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/ToscaConstraintLogicalKeyTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintLogicalKeyTest.java index 35a1c0a99..98d7dcfea 100644 --- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/ToscaConstraintLogicalKeyTest.java +++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintLogicalKeyTest.java @@ -30,31 +30,31 @@ import org.junit.Test; import org.onap.policy.models.base.PfConceptKey; import org.onap.policy.models.base.PfReferenceKey; import org.onap.policy.models.base.PfValidationResult; -import org.onap.policy.models.tosca.simple.concepts.ToscaConstraintLogicalKey; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaConstraintLogicalKey; /** * DAO test for ToscaConstraintLogicalKey. * * @author Liam Fallon (liam.fallon@est.tech) */ -public class ToscaConstraintLogicalKeyTest { +public class JpaToscaConstraintLogicalKeyTest { @Test public void testConstraintLogicalKeyPojo() { - assertNotNull(new ToscaConstraintLogicalKey()); - assertNotNull(new ToscaConstraintLogicalKey(new PfReferenceKey())); - assertNotNull(new ToscaConstraintLogicalKey(new PfReferenceKey(), ToscaConstraintLogicalKey.Operation.EQ, + assertNotNull(new JpaToscaConstraintLogicalKey()); + assertNotNull(new JpaToscaConstraintLogicalKey(new PfReferenceKey())); + assertNotNull(new JpaToscaConstraintLogicalKey(new PfReferenceKey(), JpaToscaConstraintLogicalKey.Operation.EQ, new PfConceptKey())); try { - new ToscaConstraintLogicalKey((PfReferenceKey) null); + new JpaToscaConstraintLogicalKey((PfReferenceKey) null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaConstraintLogicalKey((ToscaConstraintLogicalKey) null); + new JpaToscaConstraintLogicalKey((JpaToscaConstraintLogicalKey) null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage()); @@ -63,24 +63,24 @@ public class ToscaConstraintLogicalKeyTest { PfConceptKey tclParentKey = new PfConceptKey("tParentKey", "0.0.1"); PfReferenceKey tclKey = new PfReferenceKey(tclParentKey, "trigger0"); PfConceptKey constraintKey = new PfConceptKey("tParentKey", "0.0.1"); - ToscaConstraintLogicalKey tcl = - new ToscaConstraintLogicalKey(tclKey, ToscaConstraintLogicalKey.Operation.EQ, constraintKey); + JpaToscaConstraintLogicalKey tcl = + new JpaToscaConstraintLogicalKey(tclKey, JpaToscaConstraintLogicalKey.Operation.EQ, constraintKey); try { - new ToscaConstraintLogicalKey(tcl); + new JpaToscaConstraintLogicalKey(tcl); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("cannot copy an immutable constraint", exc.getMessage()); } - ToscaConstraintLogicalKey tclClone1 = new ToscaConstraintLogicalKey(); + JpaToscaConstraintLogicalKey tclClone1 = new JpaToscaConstraintLogicalKey(); try { tcl.copyTo(tclClone1); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("cannot copy an immutable constraint", exc.getMessage()); } - tclClone1 = new ToscaConstraintLogicalKey(tclKey, ToscaConstraintLogicalKey.Operation.EQ, constraintKey); + tclClone1 = new JpaToscaConstraintLogicalKey(tclKey, JpaToscaConstraintLogicalKey.Operation.EQ, constraintKey); assertEquals(tcl, tclClone1); assertEquals(0, tcl.compareTo(tclClone1)); @@ -89,12 +89,12 @@ public class ToscaConstraintLogicalKeyTest { assertEquals(0, tcl.compareTo(tcl)); assertFalse(tcl.compareTo(tcl.getKey()) == 0); - ToscaConstraintLogicalKey differentTcl = new ToscaConstraintLogicalKey(new PfReferenceKey(), - ToscaConstraintLogicalKey.Operation.EQ, constraintKey); + JpaToscaConstraintLogicalKey differentTcl = new JpaToscaConstraintLogicalKey(new PfReferenceKey(), + JpaToscaConstraintLogicalKey.Operation.EQ, constraintKey); assertFalse(tcl.compareTo(differentTcl) == 0); - ToscaConstraintLogicalKey otherTc = - new ToscaConstraintLogicalKey(tclKey, ToscaConstraintLogicalKey.Operation.EQ, constraintKey); + JpaToscaConstraintLogicalKey otherTc = + new JpaToscaConstraintLogicalKey(tclKey, JpaToscaConstraintLogicalKey.Operation.EQ, constraintKey); assertEquals(0, tcl.compareTo(otherTc)); try { @@ -105,13 +105,13 @@ public class ToscaConstraintLogicalKeyTest { } assertEquals(2, tcl.getKeys().size()); - assertEquals(2, new ToscaConstraintLogicalKey().getKeys().size()); + assertEquals(2, new JpaToscaConstraintLogicalKey().getKeys().size()); - new ToscaConstraintLogicalKey().clean(); + new JpaToscaConstraintLogicalKey().clean(); tcl.clean(); assertEquals(tclClone1, tcl); - assertFalse(new ToscaConstraintLogicalKey().validate(new PfValidationResult()).isValid()); + assertFalse(new JpaToscaConstraintLogicalKey().validate(new PfValidationResult()).isValid()); assertTrue(tcl.validate(new PfValidationResult()).isValid()); try { @@ -122,14 +122,15 @@ public class ToscaConstraintLogicalKeyTest { } try { - new ToscaConstraintLogicalKey(tclKey, ToscaConstraintLogicalKey.Operation.EQ, null) + new JpaToscaConstraintLogicalKey(tclKey, JpaToscaConstraintLogicalKey.Operation.EQ, null) .validate(new PfValidationResult()); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("compareToKey is marked @NonNull but is null", exc.getMessage()); } - assertFalse(new ToscaConstraintLogicalKey(tclKey, ToscaConstraintLogicalKey.Operation.EQ, new PfConceptKey()) - .validate(new PfValidationResult()).isValid()); + assertFalse( + new JpaToscaConstraintLogicalKey(tclKey, JpaToscaConstraintLogicalKey.Operation.EQ, new PfConceptKey()) + .validate(new PfValidationResult()).isValid()); } } diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/ToscaConstraintLogicalStringTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintLogicalStringTest.java index 764a6f46b..c27ec2660 100644 --- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/ToscaConstraintLogicalStringTest.java +++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintLogicalStringTest.java @@ -30,31 +30,31 @@ import org.junit.Test; import org.onap.policy.models.base.PfConceptKey; import org.onap.policy.models.base.PfReferenceKey; import org.onap.policy.models.base.PfValidationResult; -import org.onap.policy.models.tosca.simple.concepts.ToscaConstraintLogicalString; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaConstraintLogicalString; /** * DAO test for ToscaConstraintLogicalString. * * @author Liam Fallon (liam.fallon@est.tech) */ -public class ToscaConstraintLogicalStringTest { +public class JpaToscaConstraintLogicalStringTest { @Test public void testConstraintLogicalStringPojo() { - assertNotNull(new ToscaConstraintLogicalString()); - assertNotNull(new ToscaConstraintLogicalString(new PfReferenceKey())); - assertNotNull(new ToscaConstraintLogicalString(new PfReferenceKey(), ToscaConstraintLogicalString.Operation.EQ, - "Constraint")); + assertNotNull(new JpaToscaConstraintLogicalString()); + assertNotNull(new JpaToscaConstraintLogicalString(new PfReferenceKey())); + assertNotNull(new JpaToscaConstraintLogicalString(new PfReferenceKey(), + JpaToscaConstraintLogicalString.Operation.EQ, "Constraint")); try { - new ToscaConstraintLogicalString((PfReferenceKey) null); + new JpaToscaConstraintLogicalString((PfReferenceKey) null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaConstraintLogicalString((ToscaConstraintLogicalString) null); + new JpaToscaConstraintLogicalString((JpaToscaConstraintLogicalString) null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage()); @@ -62,24 +62,25 @@ public class ToscaConstraintLogicalStringTest { PfConceptKey tclParentKey = new PfConceptKey("tParentKey", "0.0.1"); PfReferenceKey tclKey = new PfReferenceKey(tclParentKey, "trigger0"); - ToscaConstraintLogicalString tcl = - new ToscaConstraintLogicalString(tclKey, ToscaConstraintLogicalString.Operation.EQ, "Constraint"); + JpaToscaConstraintLogicalString tcl = + new JpaToscaConstraintLogicalString(tclKey, JpaToscaConstraintLogicalString.Operation.EQ, "Constraint"); try { - new ToscaConstraintLogicalString(tcl); + new JpaToscaConstraintLogicalString(tcl); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("cannot copy an immutable constraint", exc.getMessage()); } - ToscaConstraintLogicalString tclClone1 = new ToscaConstraintLogicalString(); + JpaToscaConstraintLogicalString tclClone1 = new JpaToscaConstraintLogicalString(); try { tcl.copyTo(tclClone1); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("cannot copy an immutable constraint", exc.getMessage()); } - tclClone1 = new ToscaConstraintLogicalString(tclKey, ToscaConstraintLogicalString.Operation.EQ, "Constraint"); + tclClone1 = + new JpaToscaConstraintLogicalString(tclKey, JpaToscaConstraintLogicalString.Operation.EQ, "Constraint"); assertEquals(tcl, tclClone1); assertEquals(0, tcl.compareTo(tclClone1)); @@ -88,12 +89,12 @@ public class ToscaConstraintLogicalStringTest { assertEquals(0, tcl.compareTo(tcl)); assertFalse(tcl.compareTo(tcl.getKey()) == 0); - ToscaConstraintLogicalString differentTcl = new ToscaConstraintLogicalString(new PfReferenceKey(), - ToscaConstraintLogicalString.Operation.EQ, "Constraint"); + JpaToscaConstraintLogicalString differentTcl = new JpaToscaConstraintLogicalString(new PfReferenceKey(), + JpaToscaConstraintLogicalString.Operation.EQ, "Constraint"); assertFalse(tcl.compareTo(differentTcl) == 0); - ToscaConstraintLogicalString otherTc = - new ToscaConstraintLogicalString(tclKey, ToscaConstraintLogicalString.Operation.EQ, "Constraint"); + JpaToscaConstraintLogicalString otherTc = + new JpaToscaConstraintLogicalString(tclKey, JpaToscaConstraintLogicalString.Operation.EQ, "Constraint"); assertEquals(0, tcl.compareTo(otherTc)); try { @@ -104,13 +105,13 @@ public class ToscaConstraintLogicalStringTest { } assertEquals(1, tcl.getKeys().size()); - assertEquals(1, new ToscaConstraintLogicalString().getKeys().size()); + assertEquals(1, new JpaToscaConstraintLogicalString().getKeys().size()); - new ToscaConstraintLogicalString().clean(); + new JpaToscaConstraintLogicalString().clean(); tcl.clean(); assertEquals(tclClone1, tcl); - assertFalse(new ToscaConstraintLogicalString().validate(new PfValidationResult()).isValid()); + assertFalse(new JpaToscaConstraintLogicalString().validate(new PfValidationResult()).isValid()); assertTrue(tcl.validate(new PfValidationResult()).isValid()); try { @@ -121,14 +122,14 @@ public class ToscaConstraintLogicalStringTest { } try { - new ToscaConstraintLogicalString(tclKey, ToscaConstraintLogicalString.Operation.EQ, null) + new JpaToscaConstraintLogicalString(tclKey, JpaToscaConstraintLogicalString.Operation.EQ, null) .validate(new PfValidationResult()); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("compareToString is marked @NonNull but is null", exc.getMessage()); } - assertFalse(new ToscaConstraintLogicalString(tclKey, ToscaConstraintLogicalString.Operation.EQ, "") + assertFalse(new JpaToscaConstraintLogicalString(tclKey, JpaToscaConstraintLogicalString.Operation.EQ, "") .validate(new PfValidationResult()).isValid()); } } diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/ToscaConstraintLogicalTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintLogicalTest.java index d1617204a..2da46a71e 100644 --- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/ToscaConstraintLogicalTest.java +++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintLogicalTest.java @@ -30,7 +30,7 @@ import org.junit.Test; import org.onap.policy.models.base.PfConceptKey; import org.onap.policy.models.base.PfReferenceKey; import org.onap.policy.models.base.PfValidationResult; -import org.onap.policy.models.tosca.simple.concepts.ToscaConstraintLogical; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaConstraintLogical; import org.onap.policy.models.tosca.simple.concepts.testconcepts.DummyToscaConstraint; /** @@ -38,22 +38,22 @@ import org.onap.policy.models.tosca.simple.concepts.testconcepts.DummyToscaConst * * @author Liam Fallon (liam.fallon@est.tech) */ -public class ToscaConstraintLogicalTest { +public class JpaToscaConstraintLogicalTest { @Test public void testConstraintLogicalPojo() { - assertNotNull(new ToscaConstraintLogical()); - assertNotNull(new ToscaConstraintLogical(new PfReferenceKey())); + assertNotNull(new JpaToscaConstraintLogical()); + assertNotNull(new JpaToscaConstraintLogical(new PfReferenceKey())); try { - new ToscaConstraintLogical((PfReferenceKey) null); + new JpaToscaConstraintLogical((PfReferenceKey) null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaConstraintLogical((ToscaConstraintLogical) null); + new JpaToscaConstraintLogical((JpaToscaConstraintLogical) null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage()); @@ -61,23 +61,23 @@ public class ToscaConstraintLogicalTest { PfConceptKey tclParentKey = new PfConceptKey("tParentKey", "0.0.1"); PfReferenceKey tclKey = new PfReferenceKey(tclParentKey, "trigger0"); - ToscaConstraintLogical tcl = new ToscaConstraintLogical(tclKey, ToscaConstraintLogical.Operation.EQ); + JpaToscaConstraintLogical tcl = new JpaToscaConstraintLogical(tclKey, JpaToscaConstraintLogical.Operation.EQ); try { - new ToscaConstraintLogical(tcl); + new JpaToscaConstraintLogical(tcl); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("cannot copy an immutable constraint", exc.getMessage()); } - ToscaConstraintLogical tclClone1 = new ToscaConstraintLogical(); + JpaToscaConstraintLogical tclClone1 = new JpaToscaConstraintLogical(); try { tcl.copyTo(tclClone1); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("cannot copy an immutable constraint", exc.getMessage()); } - tclClone1 = new ToscaConstraintLogical(tclKey, ToscaConstraintLogical.Operation.EQ); + tclClone1 = new JpaToscaConstraintLogical(tclKey, JpaToscaConstraintLogical.Operation.EQ); assertEquals(tcl, tclClone1); assertEquals(0, tcl.compareTo(tclClone1)); @@ -86,11 +86,12 @@ public class ToscaConstraintLogicalTest { assertEquals(0, tcl.compareTo(tcl)); assertFalse(tcl.compareTo(tcl.getKey()) == 0); - ToscaConstraintLogical differentTcl = - new ToscaConstraintLogical(new PfReferenceKey(), ToscaConstraintLogical.Operation.EQ); + JpaToscaConstraintLogical differentTcl = + new JpaToscaConstraintLogical(new PfReferenceKey(), JpaToscaConstraintLogical.Operation.EQ); assertFalse(tcl.compareTo(differentTcl) == 0); - ToscaConstraintLogical otherTc = new ToscaConstraintLogical(tclKey, ToscaConstraintLogical.Operation.EQ); + JpaToscaConstraintLogical otherTc = + new JpaToscaConstraintLogical(tclKey, JpaToscaConstraintLogical.Operation.EQ); assertEquals(0, tcl.compareTo(otherTc)); try { @@ -101,14 +102,14 @@ public class ToscaConstraintLogicalTest { } assertEquals(1, tcl.getKeys().size()); - assertEquals(1, new ToscaConstraintLogical().getKeys().size()); + assertEquals(1, new JpaToscaConstraintLogical().getKeys().size()); - ToscaConstraintLogical tclClone0 = new ToscaConstraintLogical(); - new ToscaConstraintLogical().clean(); + JpaToscaConstraintLogical tclClone0 = new JpaToscaConstraintLogical(); + new JpaToscaConstraintLogical().clean(); tcl.clean(); assertEquals(tclClone0, tcl); - assertFalse(new ToscaConstraintLogical().validate(new PfValidationResult()).isValid()); + assertFalse(new JpaToscaConstraintLogical().validate(new PfValidationResult()).isValid()); assertTrue(tcl.validate(new PfValidationResult()).isValid()); try { @@ -127,14 +128,14 @@ public class ToscaConstraintLogicalTest { } try { - new DummyToscaConstraint((PfReferenceKey)null); + new DummyToscaConstraint((PfReferenceKey) null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); } try { - new DummyToscaConstraint((DummyToscaConstraint)null); + new DummyToscaConstraint((DummyToscaConstraint) null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage()); diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/ToscaDataTypeTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataTypeTest.java index 5adeece5b..bf710e881 100644 --- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/ToscaDataTypeTest.java +++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataTypeTest.java @@ -33,60 +33,60 @@ import org.junit.Test; import org.onap.policy.models.base.PfConceptKey; import org.onap.policy.models.base.PfReferenceKey; import org.onap.policy.models.base.PfValidationResult; -import org.onap.policy.models.tosca.simple.concepts.ToscaConstraint; -import org.onap.policy.models.tosca.simple.concepts.ToscaConstraintLogical.Operation; -import org.onap.policy.models.tosca.simple.concepts.ToscaConstraintLogicalString; -import org.onap.policy.models.tosca.simple.concepts.ToscaDataType; -import org.onap.policy.models.tosca.simple.concepts.ToscaProperty; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaConstraint; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaConstraintLogical.Operation; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaConstraintLogicalString; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaDataType; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaProperty; /** * DAO test for ToscaDatatype. * * @author Liam Fallon (liam.fallon@est.tech) */ -public class ToscaDataTypeTest { +public class JpaToscaDataTypeTest { @Test public void testDataTypePojo() { - assertNotNull(new ToscaDataType()); - assertNotNull(new ToscaDataType(new PfConceptKey())); - assertNotNull(new ToscaDataType(new ToscaDataType())); + assertNotNull(new JpaToscaDataType()); + assertNotNull(new JpaToscaDataType(new PfConceptKey())); + assertNotNull(new JpaToscaDataType(new JpaToscaDataType())); try { - new ToscaDataType((PfConceptKey) null); + new JpaToscaDataType((PfConceptKey) null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaDataType((ToscaDataType) null); + new JpaToscaDataType((JpaToscaDataType) null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage()); } PfConceptKey dtKey = new PfConceptKey("tdt", "0.0.1"); - ToscaDataType tdt = new ToscaDataType(dtKey); + JpaToscaDataType tdt = new JpaToscaDataType(dtKey); - List<ToscaConstraint> constraints = new ArrayList<>(); - ToscaConstraintLogicalString lsc = - new ToscaConstraintLogicalString(new PfReferenceKey(dtKey, "sc"), Operation.EQ, "hello"); + List<JpaToscaConstraint> constraints = new ArrayList<>(); + JpaToscaConstraintLogicalString lsc = + new JpaToscaConstraintLogicalString(new PfReferenceKey(dtKey, "sc"), Operation.EQ, "hello"); constraints.add(lsc); tdt.setConstraints(constraints); assertEquals(constraints, tdt.getConstraints()); - List<ToscaProperty> properties = new ArrayList<>(); - ToscaProperty tp = new ToscaProperty(new PfReferenceKey(dtKey, "pr"), new PfConceptKey("type", "0.0.1")); + List<JpaToscaProperty> properties = new ArrayList<>(); + JpaToscaProperty tp = new JpaToscaProperty(new PfReferenceKey(dtKey, "pr"), new PfConceptKey("type", "0.0.1")); properties.add(tp); tdt.setProperties(properties); assertEquals(properties, tdt.getProperties()); - ToscaDataType tdtClone0 = new ToscaDataType(tdt); + JpaToscaDataType tdtClone0 = new JpaToscaDataType(tdt); assertEquals(tdt, tdtClone0); assertEquals(0, tdt.compareTo(tdtClone0)); - ToscaDataType tdtClone1 = new ToscaDataType(); + JpaToscaDataType tdtClone1 = new JpaToscaDataType(); tdt.copyTo(tdtClone1); assertEquals(tdt, tdtClone1); assertEquals(0, tdt.compareTo(tdtClone1)); @@ -96,7 +96,7 @@ public class ToscaDataTypeTest { assertFalse(tdt.compareTo(tdt.getKey()) == 0); PfConceptKey otherDtKey = new PfConceptKey("otherDt", "0.0.1"); - ToscaDataType otherDt = new ToscaDataType(otherDtKey); + JpaToscaDataType otherDt = new JpaToscaDataType(otherDtKey); assertFalse(tdt.compareTo(otherDt) == 0); otherDt.setKey(dtKey); @@ -114,13 +114,13 @@ public class ToscaDataTypeTest { } assertEquals(4, tdt.getKeys().size()); - assertEquals(1, new ToscaDataType().getKeys().size()); + assertEquals(1, new JpaToscaDataType().getKeys().size()); - new ToscaDataType().clean(); + new JpaToscaDataType().clean(); tdt.clean(); assertEquals(tdtClone0, tdt); - assertFalse(new ToscaDataType().validate(new PfValidationResult()).isValid()); + assertFalse(new JpaToscaDataType().validate(new PfValidationResult()).isValid()); assertTrue(tdt.validate(new PfValidationResult()).isValid()); tdt.getConstraints().add(null); diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/ToscaDataTypesTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataTypesTest.java index b92b6b08a..ce90e372c 100644 --- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/ToscaDataTypesTest.java +++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataTypesTest.java @@ -28,48 +28,48 @@ import java.util.TreeMap; import org.junit.Test; import org.onap.policy.models.base.PfConceptKey; -import org.onap.policy.models.tosca.simple.concepts.ToscaDataType; -import org.onap.policy.models.tosca.simple.concepts.ToscaDataTypes; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaDataType; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaDataTypes; -public class ToscaDataTypesTest { +public class JpaToscaDataTypesTest { @Test public void testDataTypes() { - assertNotNull(new ToscaDataTypes()); - assertNotNull(new ToscaDataTypes(new PfConceptKey())); - assertNotNull(new ToscaDataTypes(new PfConceptKey(), new TreeMap<PfConceptKey, ToscaDataType>())); - assertNotNull(new ToscaDataTypes(new ToscaDataTypes())); + assertNotNull(new JpaToscaDataTypes()); + assertNotNull(new JpaToscaDataTypes(new PfConceptKey())); + assertNotNull(new JpaToscaDataTypes(new PfConceptKey(), new TreeMap<PfConceptKey, JpaToscaDataType>())); + assertNotNull(new JpaToscaDataTypes(new JpaToscaDataTypes())); try { - new ToscaDataTypes((PfConceptKey) null); + new JpaToscaDataTypes((PfConceptKey) null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaDataTypes((ToscaDataTypes) null); + new JpaToscaDataTypes((JpaToscaDataTypes) null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaDataTypes(null, null); + new JpaToscaDataTypes(null, null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaDataTypes(new PfConceptKey(), null); + new JpaToscaDataTypes(new PfConceptKey(), null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("conceptMap is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaDataTypes(null, new TreeMap<PfConceptKey, ToscaDataType>()); + new JpaToscaDataTypes(null, new TreeMap<PfConceptKey, JpaToscaDataType>()); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/ToscaEntrySchemaTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEntrySchemaTest.java index e1a9f0c6f..a69b9a777 100644 --- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/ToscaEntrySchemaTest.java +++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEntrySchemaTest.java @@ -33,34 +33,34 @@ import org.junit.Test; import org.onap.policy.models.base.PfConceptKey; import org.onap.policy.models.base.PfReferenceKey; import org.onap.policy.models.base.PfValidationResult; -import org.onap.policy.models.tosca.simple.concepts.ToscaConstraint; -import org.onap.policy.models.tosca.simple.concepts.ToscaConstraintLogical.Operation; -import org.onap.policy.models.tosca.simple.concepts.ToscaConstraintLogicalString; -import org.onap.policy.models.tosca.simple.concepts.ToscaEntrySchema; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaConstraint; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaConstraintLogical.Operation; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaConstraintLogicalString; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaEntrySchema; /** * DAO test for ToscaEntrySchema. * * @author Liam Fallon (liam.fallon@est.tech) */ -public class ToscaEntrySchemaTest { +public class JpaToscaEntrySchemaTest { @Test public void testEntrySchemaPojo() { - assertNotNull(new ToscaEntrySchema()); - assertNotNull(new ToscaEntrySchema(new PfReferenceKey())); - assertNotNull(new ToscaEntrySchema(new PfReferenceKey(), new PfConceptKey())); - assertNotNull(new ToscaEntrySchema(new ToscaEntrySchema())); + assertNotNull(new JpaToscaEntrySchema()); + assertNotNull(new JpaToscaEntrySchema(new PfReferenceKey())); + assertNotNull(new JpaToscaEntrySchema(new PfReferenceKey(), new PfConceptKey())); + assertNotNull(new JpaToscaEntrySchema(new JpaToscaEntrySchema())); try { - new ToscaEntrySchema((PfReferenceKey) null); + new JpaToscaEntrySchema((PfReferenceKey) null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaEntrySchema((ToscaEntrySchema) null); + new JpaToscaEntrySchema((JpaToscaEntrySchema) null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage()); @@ -68,23 +68,23 @@ public class ToscaEntrySchemaTest { PfReferenceKey esKey = new PfReferenceKey("entrySchemaParent", "0.0.1", "entrySchema"); PfConceptKey typeKey = new PfConceptKey("type", "0.0.1"); - ToscaEntrySchema tes = new ToscaEntrySchema(esKey, typeKey); + JpaToscaEntrySchema tes = new JpaToscaEntrySchema(esKey, typeKey); tes.setDescription("A Description"); assertEquals("A Description", tes.getDescription()); - List<ToscaConstraint> constraints = new ArrayList<>(); - ToscaConstraintLogicalString lsc = - new ToscaConstraintLogicalString(new PfReferenceKey(esKey, "sc"), Operation.EQ, "hello"); + List<JpaToscaConstraint> constraints = new ArrayList<>(); + JpaToscaConstraintLogicalString lsc = + new JpaToscaConstraintLogicalString(new PfReferenceKey(esKey, "sc"), Operation.EQ, "hello"); constraints.add(lsc); tes.setConstraints(constraints); assertEquals(constraints, tes.getConstraints()); - ToscaEntrySchema tdtClone0 = new ToscaEntrySchema(tes); + JpaToscaEntrySchema tdtClone0 = new JpaToscaEntrySchema(tes); assertEquals(tes, tdtClone0); assertEquals(0, tes.compareTo(tdtClone0)); - ToscaEntrySchema tdtClone1 = new ToscaEntrySchema(); + JpaToscaEntrySchema tdtClone1 = new JpaToscaEntrySchema(); tes.copyTo(tdtClone1); assertEquals(tes, tdtClone1); assertEquals(0, tes.compareTo(tdtClone1)); @@ -94,7 +94,7 @@ public class ToscaEntrySchemaTest { assertFalse(tes.compareTo(tes.getKey()) == 0); PfReferenceKey otherEsKey = new PfReferenceKey("entrySchemaParent", "0.0.1", "otherEntrySchema"); - ToscaEntrySchema otherEs = new ToscaEntrySchema(otherEsKey); + JpaToscaEntrySchema otherEs = new JpaToscaEntrySchema(otherEsKey); assertFalse(tes.compareTo(otherEs) == 0); otherEs.setKey(esKey); @@ -114,13 +114,13 @@ public class ToscaEntrySchemaTest { } assertEquals(3, tes.getKeys().size()); - assertEquals(2, new ToscaEntrySchema().getKeys().size()); + assertEquals(2, new JpaToscaEntrySchema().getKeys().size()); - new ToscaEntrySchema().clean(); + new JpaToscaEntrySchema().clean(); tes.clean(); assertEquals(tdtClone0, tes); - assertFalse(new ToscaEntrySchema().validate(new PfValidationResult()).isValid()); + assertFalse(new JpaToscaEntrySchema().validate(new PfValidationResult()).isValid()); assertTrue(tes.validate(new PfValidationResult()).isValid()); tes.setType(PfConceptKey.getNullKey()); diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/ToscaEventFilterTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEventFilterTest.java index b1fb33fce..19846a0cc 100644 --- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/ToscaEventFilterTest.java +++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEventFilterTest.java @@ -30,52 +30,52 @@ import org.junit.Test; import org.onap.policy.models.base.PfConceptKey; import org.onap.policy.models.base.PfReferenceKey; import org.onap.policy.models.base.PfValidationResult; -import org.onap.policy.models.tosca.simple.concepts.ToscaEventFilter; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaEventFilter; /** * DAO test for ToscaEventFilter. * * @author Liam Fallon (liam.fallon@est.tech) */ -public class ToscaEventFilterTest { +public class JpaToscaEventFilterTest { @Test public void testEventFilterPojo() { - assertNotNull(new ToscaEventFilter()); - assertNotNull(new ToscaEventFilter(new PfReferenceKey())); - assertNotNull(new ToscaEventFilter(new PfReferenceKey(), new PfConceptKey())); - assertNotNull(new ToscaEventFilter(new ToscaEventFilter())); + assertNotNull(new JpaToscaEventFilter()); + assertNotNull(new JpaToscaEventFilter(new PfReferenceKey())); + assertNotNull(new JpaToscaEventFilter(new PfReferenceKey(), new PfConceptKey())); + assertNotNull(new JpaToscaEventFilter(new JpaToscaEventFilter())); try { - new ToscaEventFilter((PfReferenceKey) null); + new JpaToscaEventFilter((PfReferenceKey) null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaEventFilter(null, null); + new JpaToscaEventFilter(null, null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaEventFilter(null, new PfConceptKey()); + new JpaToscaEventFilter(null, new PfConceptKey()); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaEventFilter(new PfReferenceKey(), null); + new JpaToscaEventFilter(new PfReferenceKey(), null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("node is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaEventFilter((ToscaEventFilter) null); + new JpaToscaEventFilter((JpaToscaEventFilter) null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage()); @@ -84,7 +84,7 @@ public class ToscaEventFilterTest { PfConceptKey efParentKey = new PfConceptKey("tParentKey", "0.0.1"); PfReferenceKey efKey = new PfReferenceKey(efParentKey, "trigger0"); PfConceptKey nodeKey = new PfConceptKey("tParentKey", "0.0.1"); - ToscaEventFilter tef = new ToscaEventFilter(efKey, nodeKey); + JpaToscaEventFilter tef = new JpaToscaEventFilter(efKey, nodeKey); tef.setRequirement("A Requrement"); assertEquals("A Requrement", tef.getRequirement()); @@ -92,11 +92,11 @@ public class ToscaEventFilterTest { tef.setCapability("A Capability"); assertEquals("A Capability", tef.getCapability()); - ToscaEventFilter tdtClone0 = new ToscaEventFilter(tef); + JpaToscaEventFilter tdtClone0 = new JpaToscaEventFilter(tef); assertEquals(tef, tdtClone0); assertEquals(0, tef.compareTo(tdtClone0)); - ToscaEventFilter tdtClone1 = new ToscaEventFilter(); + JpaToscaEventFilter tdtClone1 = new JpaToscaEventFilter(); tef.copyTo(tdtClone1); assertEquals(tef, tdtClone1); assertEquals(0, tef.compareTo(tdtClone1)); @@ -106,7 +106,7 @@ public class ToscaEventFilterTest { assertFalse(tef.compareTo(tef.getKey()) == 0); PfReferenceKey otherDtKey = new PfReferenceKey("otherDt", "0.0.1", "OtherEventFilter"); - ToscaEventFilter otherDt = new ToscaEventFilter(otherDtKey); + JpaToscaEventFilter otherDt = new JpaToscaEventFilter(otherDtKey); assertFalse(tef.compareTo(otherDt) == 0); otherDt.setKey(efKey); @@ -126,13 +126,13 @@ public class ToscaEventFilterTest { } assertEquals(2, tef.getKeys().size()); - assertEquals(2, new ToscaEventFilter().getKeys().size()); + assertEquals(2, new JpaToscaEventFilter().getKeys().size()); - new ToscaEventFilter().clean(); + new JpaToscaEventFilter().clean(); tef.clean(); assertEquals(tdtClone0, tef); - assertFalse(new ToscaEventFilter().validate(new PfValidationResult()).isValid()); + assertFalse(new JpaToscaEventFilter().validate(new PfValidationResult()).isValid()); assertTrue(tef.validate(new PfValidationResult()).isValid()); tef.setRequirement(null); diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/ToscaModelTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaModelTest.java index af8cc2d3b..a62c79956 100644 --- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/ToscaModelTest.java +++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaModelTest.java @@ -33,70 +33,70 @@ import org.junit.Test; import org.onap.policy.models.base.PfConceptKey; import org.onap.policy.models.base.PfModelService; import org.onap.policy.models.base.PfValidationResult; -import org.onap.policy.models.tosca.simple.concepts.ToscaModel; -import org.onap.policy.models.tosca.simple.concepts.ToscaServiceTemplate; -import org.onap.policy.models.tosca.simple.concepts.ToscaServiceTemplates; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaModel; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplates; /** * DAO test for ToscaDatatype. * * @author Liam Fallon (liam.fallon@est.tech) */ -public class ToscaModelTest { +public class JpaToscaModelTest { @Test public void testModelPojo() { - assertNotNull(new ToscaModel()); - assertNotNull(new ToscaModel(new PfConceptKey())); - assertNotNull(new ToscaModel(new PfConceptKey(), new ToscaServiceTemplates())); - assertNotNull(new ToscaModel(new ToscaModel())); + assertNotNull(new JpaToscaModel()); + assertNotNull(new JpaToscaModel(new PfConceptKey())); + assertNotNull(new JpaToscaModel(new PfConceptKey(), new JpaToscaServiceTemplates())); + assertNotNull(new JpaToscaModel(new JpaToscaModel())); try { - new ToscaModel((PfConceptKey) null); + new JpaToscaModel((PfConceptKey) null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaModel(null, null); + new JpaToscaModel(null, null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaModel(null, new ToscaServiceTemplates()); + new JpaToscaModel(null, new JpaToscaServiceTemplates()); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaModel(new PfConceptKey(), null); + new JpaToscaModel(new PfConceptKey(), null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("serviceTemplates is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaModel((ToscaModel) null); + new JpaToscaModel((JpaToscaModel) null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage()); } PfConceptKey tstsKey = new PfConceptKey("tsts", "0.0.1"); - Map<PfConceptKey, ToscaServiceTemplate> tstMap = new TreeMap<>(); - ToscaServiceTemplates tsts = new ToscaServiceTemplates(tstsKey, tstMap); + Map<PfConceptKey, JpaToscaServiceTemplate> tstMap = new TreeMap<>(); + JpaToscaServiceTemplates tsts = new JpaToscaServiceTemplates(tstsKey, tstMap); PfConceptKey tmKey = new PfConceptKey("tst", "0.0.1"); - ToscaModel tm = new ToscaModel(tmKey, tsts); + JpaToscaModel tm = new JpaToscaModel(tmKey, tsts); - ToscaModel tttClone0 = new ToscaModel(tm); + JpaToscaModel tttClone0 = new JpaToscaModel(tm); assertEquals(tm, tttClone0); assertEquals(0, tm.compareTo(tttClone0)); - ToscaModel tttClone1 = new ToscaModel(); + JpaToscaModel tttClone1 = new JpaToscaModel(); tm.copyTo(tttClone1); assertEquals(tm, tttClone1); assertEquals(0, tm.compareTo(tttClone1)); @@ -106,7 +106,7 @@ public class ToscaModelTest { assertFalse(tm.compareTo(tm.getKey()) == 0); PfConceptKey otherDtKey = new PfConceptKey("otherDt", "0.0.1"); - ToscaModel otherDt = new ToscaModel(otherDtKey); + JpaToscaModel otherDt = new JpaToscaModel(otherDtKey); assertFalse(tm.compareTo(otherDt) == 0); otherDt.setKey(tmKey); @@ -122,13 +122,13 @@ public class ToscaModelTest { } assertEquals(2, tm.getKeys().size()); - assertEquals(2, new ToscaModel().getKeys().size()); + assertEquals(2, new JpaToscaModel().getKeys().size()); - new ToscaModel().clean(); + new JpaToscaModel().clean(); tm.clean(); assertEquals(tttClone0, tm); - assertFalse(new ToscaModel().validate(new PfValidationResult()).isValid()); + assertFalse(new JpaToscaModel().validate(new PfValidationResult()).isValid()); assertFalse(tm.validate(new PfValidationResult()).isValid()); tm.register(); diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/ToscaPoliciesTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPoliciesTest.java index 127aac4f4..6f6141c5b 100644 --- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/ToscaPoliciesTest.java +++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPoliciesTest.java @@ -28,48 +28,48 @@ import java.util.TreeMap; import org.junit.Test; import org.onap.policy.models.base.PfConceptKey; -import org.onap.policy.models.tosca.simple.concepts.ToscaPolicies; -import org.onap.policy.models.tosca.simple.concepts.ToscaPolicy; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicies; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicy; -public class ToscaPoliciesTest { +public class JpaToscaPoliciesTest { @Test public void testPolicies() { - assertNotNull(new ToscaPolicies()); - assertNotNull(new ToscaPolicies(new PfConceptKey())); - assertNotNull(new ToscaPolicies(new PfConceptKey(), new TreeMap<PfConceptKey, ToscaPolicy>())); - assertNotNull(new ToscaPolicies(new ToscaPolicies())); + assertNotNull(new JpaToscaPolicies()); + assertNotNull(new JpaToscaPolicies(new PfConceptKey())); + assertNotNull(new JpaToscaPolicies(new PfConceptKey(), new TreeMap<PfConceptKey, JpaToscaPolicy>())); + assertNotNull(new JpaToscaPolicies(new JpaToscaPolicies())); try { - new ToscaPolicies((PfConceptKey) null); + new JpaToscaPolicies((PfConceptKey) null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaPolicies((ToscaPolicies) null); + new JpaToscaPolicies((JpaToscaPolicies) null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaPolicies(null, null); + new JpaToscaPolicies(null, null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaPolicies(new PfConceptKey(), null); + new JpaToscaPolicies(new PfConceptKey(), null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("conceptMap is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaPolicies(null, new TreeMap<PfConceptKey, ToscaPolicy>()); + new JpaToscaPolicies(null, new TreeMap<PfConceptKey, JpaToscaPolicy>()); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/ToscaPolicyTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyTest.java index 01c1377b9..ec8e6da8f 100644 --- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/ToscaPolicyTest.java +++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyTest.java @@ -34,52 +34,52 @@ import java.util.Map; import org.junit.Test; import org.onap.policy.models.base.PfConceptKey; import org.onap.policy.models.base.PfValidationResult; -import org.onap.policy.models.tosca.simple.concepts.ToscaPolicy; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicy; /** * DAO test for ToscaPolicy. * * @author Liam Fallon (liam.fallon@est.tech) */ -public class ToscaPolicyTest { +public class JpaToscaPolicyTest { @Test public void testPolicyPojo() { - assertNotNull(new ToscaPolicy()); - assertNotNull(new ToscaPolicy(new PfConceptKey())); - assertNotNull(new ToscaPolicy(new PfConceptKey(), new PfConceptKey())); - assertNotNull(new ToscaPolicy(new ToscaPolicy())); + assertNotNull(new JpaToscaPolicy()); + assertNotNull(new JpaToscaPolicy(new PfConceptKey())); + assertNotNull(new JpaToscaPolicy(new PfConceptKey(), new PfConceptKey())); + assertNotNull(new JpaToscaPolicy(new JpaToscaPolicy())); try { - new ToscaPolicy((PfConceptKey) null); + new JpaToscaPolicy((PfConceptKey) null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaPolicy(null, null); + new JpaToscaPolicy(null, null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaPolicy(new PfConceptKey(), null); + new JpaToscaPolicy(new PfConceptKey(), null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("type is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaPolicy(null, new PfConceptKey()); + new JpaToscaPolicy(null, new PfConceptKey()); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaPolicy((ToscaPolicy) null); + new JpaToscaPolicy((JpaToscaPolicy) null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage()); @@ -87,7 +87,7 @@ public class ToscaPolicyTest { PfConceptKey tpKey = new PfConceptKey("tdt", "0.0.1"); PfConceptKey ptKey = new PfConceptKey("policyType", "0.0.1"); - ToscaPolicy tp = new ToscaPolicy(tpKey, ptKey); + JpaToscaPolicy tp = new JpaToscaPolicy(tpKey, ptKey); Map<String, String> propertyMap = new HashMap<>(); propertyMap.put("Property", "Property Value"); @@ -100,11 +100,11 @@ public class ToscaPolicyTest { tp.setTargets(targets); assertEquals(targets, tp.getTargets()); - ToscaPolicy tdtClone0 = new ToscaPolicy(tp); + JpaToscaPolicy tdtClone0 = new JpaToscaPolicy(tp); assertEquals(tp, tdtClone0); assertEquals(0, tp.compareTo(tdtClone0)); - ToscaPolicy tdtClone1 = new ToscaPolicy(); + JpaToscaPolicy tdtClone1 = new JpaToscaPolicy(); tp.copyTo(tdtClone1); assertEquals(tp, tdtClone1); assertEquals(0, tp.compareTo(tdtClone1)); @@ -114,7 +114,7 @@ public class ToscaPolicyTest { assertFalse(tp.compareTo(tp.getKey()) == 0); PfConceptKey otherDtKey = new PfConceptKey("otherDt", "0.0.1"); - ToscaPolicy otherDt = new ToscaPolicy(otherDtKey); + JpaToscaPolicy otherDt = new JpaToscaPolicy(otherDtKey); assertFalse(tp.compareTo(otherDt) == 0); otherDt.setKey(tpKey); @@ -134,13 +134,13 @@ public class ToscaPolicyTest { } assertEquals(3, tp.getKeys().size()); - assertEquals(2, new ToscaPolicy().getKeys().size()); + assertEquals(2, new JpaToscaPolicy().getKeys().size()); - new ToscaPolicy().clean(); + new JpaToscaPolicy().clean(); tp.clean(); assertEquals(tdtClone0, tp); - assertFalse(new ToscaPolicy().validate(new PfValidationResult()).isValid()); + assertFalse(new JpaToscaPolicy().validate(new PfValidationResult()).isValid()); System.err.println(tp.validate(new PfValidationResult())); assertTrue(tp.validate(new PfValidationResult()).isValid()); diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/ToscaPolicyTypeTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyTypeTest.java index 3be0cff3d..7dac2684f 100644 --- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/ToscaPolicyTypeTest.java +++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyTypeTest.java @@ -35,40 +35,40 @@ import org.junit.Test; import org.onap.policy.models.base.PfConceptKey; import org.onap.policy.models.base.PfReferenceKey; import org.onap.policy.models.base.PfValidationResult; -import org.onap.policy.models.tosca.simple.concepts.ToscaEntityType; -import org.onap.policy.models.tosca.simple.concepts.ToscaPolicyType; -import org.onap.policy.models.tosca.simple.concepts.ToscaProperty; -import org.onap.policy.models.tosca.simple.concepts.ToscaTrigger; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaEntityType; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicyType; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaProperty; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaTrigger; /** * DAO test for ToscaPolicyType. * * @author Liam Fallon (liam.fallon@est.tech) */ -public class ToscaPolicyTypeTest { +public class JpaToscaPolicyTypeTest { @Test public void testPolicyTypePojo() { - assertNotNull(new ToscaPolicyType()); - assertNotNull(new ToscaPolicyType(new PfConceptKey())); - assertNotNull(new ToscaPolicyType(new ToscaPolicyType())); + assertNotNull(new JpaToscaPolicyType()); + assertNotNull(new JpaToscaPolicyType(new PfConceptKey())); + assertNotNull(new JpaToscaPolicyType(new JpaToscaPolicyType())); try { - new ToscaPolicyType((PfConceptKey) null); + new JpaToscaPolicyType((PfConceptKey) null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaPolicyType((ToscaPolicyType) null); + new JpaToscaPolicyType((JpaToscaPolicyType) null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage()); } PfConceptKey ptKey = new PfConceptKey("tdt", "0.0.1"); - ToscaPolicyType tpt = new ToscaPolicyType(ptKey); + JpaToscaPolicyType tpt = new JpaToscaPolicyType(ptKey); PfConceptKey derivedFromKey = new PfConceptKey("deriveFrom", "0.0.1"); tpt.setDerivedFrom(derivedFromKey); @@ -81,8 +81,8 @@ public class ToscaPolicyTypeTest { tpt.setDescription("A Description"); PfConceptKey propTypeKey = new PfConceptKey("propType", "0.0.1"); - List<ToscaProperty> properties = new ArrayList<>(); - ToscaProperty tp = new ToscaProperty(new PfReferenceKey(ptKey, "aProp"), propTypeKey); + List<JpaToscaProperty> properties = new ArrayList<>(); + JpaToscaProperty tp = new JpaToscaProperty(new PfReferenceKey(ptKey, "aProp"), propTypeKey); properties.add(tp); tpt.setProperties(properties); assertEquals(properties, tpt.getProperties()); @@ -93,17 +93,17 @@ public class ToscaPolicyTypeTest { tpt.setTargets(targets); assertEquals(targets, tpt.getTargets()); - List<ToscaTrigger> triggers = new ArrayList<>(); - ToscaTrigger trigger = new ToscaTrigger(new PfReferenceKey(ptKey, "aTrigger"), "EventType", "Action"); + List<JpaToscaTrigger> triggers = new ArrayList<>(); + JpaToscaTrigger trigger = new JpaToscaTrigger(new PfReferenceKey(ptKey, "aTrigger"), "EventType", "Action"); triggers.add(trigger); tpt.setTriggers(triggers); assertEquals(triggers, tpt.getTriggers()); - ToscaPolicyType tdtClone0 = new ToscaPolicyType(tpt); + JpaToscaPolicyType tdtClone0 = new JpaToscaPolicyType(tpt); assertEquals(tpt, tdtClone0); assertEquals(0, tpt.compareTo(tdtClone0)); - ToscaPolicyType tdtClone1 = new ToscaPolicyType(); + JpaToscaPolicyType tdtClone1 = new JpaToscaPolicyType(); tpt.copyTo(tdtClone1); assertEquals(tpt, tdtClone1); assertEquals(0, tpt.compareTo(tdtClone1)); @@ -113,7 +113,7 @@ public class ToscaPolicyTypeTest { assertFalse(tpt.compareTo(tpt.getKey()) == 0); PfConceptKey otherDtKey = new PfConceptKey("otherDt", "0.0.1"); - ToscaPolicyType otherDt = new ToscaPolicyType(otherDtKey); + JpaToscaPolicyType otherDt = new JpaToscaPolicyType(otherDtKey); assertFalse(tpt.compareTo(otherDt) == 0); otherDt.setKey(ptKey); @@ -139,13 +139,13 @@ public class ToscaPolicyTypeTest { } assertEquals(6, tpt.getKeys().size()); - assertEquals(1, new ToscaPolicyType().getKeys().size()); + assertEquals(1, new JpaToscaPolicyType().getKeys().size()); - new ToscaPolicyType().clean(); + new JpaToscaPolicyType().clean(); tpt.clean(); assertEquals(tdtClone0, tpt); - assertFalse(new ToscaPolicyType().validate(new PfValidationResult()).isValid()); + assertFalse(new JpaToscaPolicyType().validate(new PfValidationResult()).isValid()); assertTrue(tpt.validate(new PfValidationResult()).isValid()); tpt.getProperties().add(null); @@ -191,20 +191,20 @@ public class ToscaPolicyTypeTest { } try { - new ToscaEntityType((PfConceptKey) null); + new JpaToscaEntityType((PfConceptKey) null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaEntityType((ToscaEntityType) null); + new JpaToscaEntityType((JpaToscaEntityType) null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage()); } - ToscaEntityType tet = new ToscaEntityType(tpt.getKey()); + JpaToscaEntityType tet = new JpaToscaEntityType(tpt.getKey()); assertEquals(-1, tet.compareTo(null)); assertEquals(0, tet.compareTo(tet)); assertFalse(tet.compareTo(tet.getKey()) == 0); diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/ToscaPolicyTypesTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyTypesTest.java index a85c8285e..d0ea1782f 100644 --- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/ToscaPolicyTypesTest.java +++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyTypesTest.java @@ -28,48 +28,48 @@ import java.util.TreeMap; import org.junit.Test; import org.onap.policy.models.base.PfConceptKey; -import org.onap.policy.models.tosca.simple.concepts.ToscaPolicyType; -import org.onap.policy.models.tosca.simple.concepts.ToscaPolicyTypes; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicyType; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicyTypes; -public class ToscaPolicyTypesTest { +public class JpaToscaPolicyTypesTest { @Test public void testPolicyTypes() { - assertNotNull(new ToscaPolicyTypes()); - assertNotNull(new ToscaPolicyTypes(new PfConceptKey())); - assertNotNull(new ToscaPolicyTypes(new PfConceptKey(), new TreeMap<PfConceptKey, ToscaPolicyType>())); - assertNotNull(new ToscaPolicyTypes(new ToscaPolicyTypes())); + assertNotNull(new JpaToscaPolicyTypes()); + assertNotNull(new JpaToscaPolicyTypes(new PfConceptKey())); + assertNotNull(new JpaToscaPolicyTypes(new PfConceptKey(), new TreeMap<PfConceptKey, JpaToscaPolicyType>())); + assertNotNull(new JpaToscaPolicyTypes(new JpaToscaPolicyTypes())); try { - new ToscaPolicyTypes((PfConceptKey) null); + new JpaToscaPolicyTypes((PfConceptKey) null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaPolicyTypes((ToscaPolicyTypes) null); + new JpaToscaPolicyTypes((JpaToscaPolicyTypes) null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaPolicyTypes(null, null); + new JpaToscaPolicyTypes(null, null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaPolicyTypes(new PfConceptKey(), null); + new JpaToscaPolicyTypes(new PfConceptKey(), null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("conceptMap is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaPolicyTypes(null, new TreeMap<PfConceptKey, ToscaPolicyType>()); + new JpaToscaPolicyTypes(null, new TreeMap<PfConceptKey, JpaToscaPolicyType>()); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/ToscaPropertyTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPropertyTest.java index 0fcf96a89..8d46c9533 100644 --- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/ToscaPropertyTest.java +++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPropertyTest.java @@ -33,56 +33,56 @@ import org.junit.Test; import org.onap.policy.models.base.PfConceptKey; import org.onap.policy.models.base.PfReferenceKey; import org.onap.policy.models.base.PfValidationResult; -import org.onap.policy.models.tosca.simple.concepts.ToscaConstraint; -import org.onap.policy.models.tosca.simple.concepts.ToscaConstraintLogical.Operation; -import org.onap.policy.models.tosca.simple.concepts.ToscaConstraintLogicalString; -import org.onap.policy.models.tosca.simple.concepts.ToscaEntrySchema; -import org.onap.policy.models.tosca.simple.concepts.ToscaProperty; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaConstraint; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaConstraintLogical.Operation; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaConstraintLogicalString; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaEntrySchema; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaProperty; /** * DAO test for ToscaProperty. * * @author Liam Fallon (liam.fallon@est.tech) */ -public class ToscaPropertyTest { +public class JpaToscaPropertyTest { @Test public void testPropertyPojo() { - assertNotNull(new ToscaProperty()); - assertNotNull(new ToscaProperty(new PfReferenceKey())); - assertNotNull(new ToscaProperty(new PfReferenceKey(), new PfConceptKey())); - assertNotNull(new ToscaProperty(new ToscaProperty())); + assertNotNull(new JpaToscaProperty()); + assertNotNull(new JpaToscaProperty(new PfReferenceKey())); + assertNotNull(new JpaToscaProperty(new PfReferenceKey(), new PfConceptKey())); + assertNotNull(new JpaToscaProperty(new JpaToscaProperty())); try { - new ToscaProperty((PfReferenceKey) null); + new JpaToscaProperty((PfReferenceKey) null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaProperty(null, null); + new JpaToscaProperty(null, null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaProperty(null, new PfConceptKey()); + new JpaToscaProperty(null, new PfConceptKey()); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaProperty(new PfReferenceKey(), null); + new JpaToscaProperty(new PfReferenceKey(), null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("type is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaProperty((ToscaProperty) null); + new JpaToscaProperty((JpaToscaProperty) null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage()); @@ -91,7 +91,7 @@ public class ToscaPropertyTest { PfConceptKey pparentKey = new PfConceptKey("tParentKey", "0.0.1"); PfReferenceKey pkey = new PfReferenceKey(pparentKey, "trigger0"); PfConceptKey ptypeKey = new PfConceptKey("TTypeKey", "0.0.1"); - ToscaProperty tp = new ToscaProperty(pkey, ptypeKey); + JpaToscaProperty tp = new JpaToscaProperty(pkey, ptypeKey); tp.setDescription("A Description"); assertEquals("A Description", tp.getDescription()); @@ -101,25 +101,25 @@ public class ToscaPropertyTest { tp.setDefaultValue("defaultKey"); - tp.setStatus(ToscaProperty.Status.SUPPORTED); + tp.setStatus(JpaToscaProperty.Status.SUPPORTED); - List<ToscaConstraint> constraints = new ArrayList<>(); - ToscaConstraintLogicalString lsc = - new ToscaConstraintLogicalString(new PfReferenceKey(pkey, "sc"), Operation.EQ, "hello"); + List<JpaToscaConstraint> constraints = new ArrayList<>(); + JpaToscaConstraintLogicalString lsc = + new JpaToscaConstraintLogicalString(new PfReferenceKey(pkey, "sc"), Operation.EQ, "hello"); constraints.add(lsc); tp.setConstraints(constraints); assertEquals(constraints, tp.getConstraints()); PfReferenceKey esKey = new PfReferenceKey(pkey, "entrySchema"); PfConceptKey typeKey = new PfConceptKey("type", "0.0.1"); - ToscaEntrySchema tes = new ToscaEntrySchema(esKey, typeKey); + JpaToscaEntrySchema tes = new JpaToscaEntrySchema(esKey, typeKey); tp.setEntrySchema(tes); - ToscaProperty tdtClone0 = new ToscaProperty(tp); + JpaToscaProperty tdtClone0 = new JpaToscaProperty(tp); assertEquals(tp, tdtClone0); assertEquals(0, tp.compareTo(tdtClone0)); - ToscaProperty tdtClone1 = new ToscaProperty(); + JpaToscaProperty tdtClone1 = new JpaToscaProperty(); tp.copyTo(tdtClone1); assertEquals(tp, tdtClone1); assertEquals(0, tp.compareTo(tdtClone1)); @@ -129,7 +129,7 @@ public class ToscaPropertyTest { assertFalse(tp.compareTo(tp.getKey()) == 0); PfReferenceKey otherDtKey = new PfReferenceKey("otherDt", "0.0.1", "OtherProperty"); - ToscaProperty otherDt = new ToscaProperty(otherDtKey); + JpaToscaProperty otherDt = new JpaToscaProperty(otherDtKey); assertFalse(tp.compareTo(otherDt) == 0); otherDt.setKey(pkey); @@ -142,7 +142,7 @@ public class ToscaPropertyTest { assertFalse(tp.compareTo(otherDt) == 0); otherDt.setDefaultValue("defaultKey"); assertFalse(tp.compareTo(otherDt) == 0); - otherDt.setStatus(ToscaProperty.Status.SUPPORTED); + otherDt.setStatus(JpaToscaProperty.Status.SUPPORTED); assertFalse(tp.compareTo(otherDt) == 0); assertFalse(tp.compareTo(otherDt) == 0); otherDt.setConstraints(constraints); @@ -155,9 +155,9 @@ public class ToscaPropertyTest { otherDt.setRequired(false); assertEquals(0, tp.compareTo(otherDt)); - otherDt.setStatus(ToscaProperty.Status.UNSUPPORTED); + otherDt.setStatus(JpaToscaProperty.Status.UNSUPPORTED); assertFalse(tp.compareTo(otherDt) == 0); - otherDt.setStatus(ToscaProperty.Status.SUPPORTED); + otherDt.setStatus(JpaToscaProperty.Status.SUPPORTED); assertEquals(0, tp.compareTo(otherDt)); try { @@ -168,13 +168,13 @@ public class ToscaPropertyTest { } assertEquals(5, tp.getKeys().size()); - assertEquals(2, new ToscaProperty().getKeys().size()); + assertEquals(2, new JpaToscaProperty().getKeys().size()); - new ToscaProperty().clean(); + new JpaToscaProperty().clean(); tp.clean(); assertEquals(tdtClone0, tp); - assertFalse(new ToscaProperty().validate(new PfValidationResult()).isValid()); + assertFalse(new JpaToscaProperty().validate(new PfValidationResult()).isValid()); assertTrue(tp.validate(new PfValidationResult()).isValid()); tp.setDescription(null); diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/ToscaServiceTemplateTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplateTest.java index aad410e89..4569d42ff 100644 --- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/ToscaServiceTemplateTest.java +++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplateTest.java @@ -33,93 +33,93 @@ import org.junit.Test; import org.onap.policy.models.base.PfConceptKey; import org.onap.policy.models.base.PfReferenceKey; import org.onap.policy.models.base.PfValidationResult; -import org.onap.policy.models.tosca.simple.concepts.ToscaDataType; -import org.onap.policy.models.tosca.simple.concepts.ToscaDataTypes; -import org.onap.policy.models.tosca.simple.concepts.ToscaPolicyType; -import org.onap.policy.models.tosca.simple.concepts.ToscaPolicyTypes; -import org.onap.policy.models.tosca.simple.concepts.ToscaServiceTemplate; -import org.onap.policy.models.tosca.simple.concepts.ToscaTopologyTemplate; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaDataType; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaDataTypes; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicyType; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicyTypes; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaTopologyTemplate; /** * DAO test for ToscaDatatype. * * @author Liam Fallon (liam.fallon@est.tech) */ -public class ToscaServiceTemplateTest { +public class JpaToscaServiceTemplateTest { @Test public void testServiceTemplatePojo() { - assertNotNull(new ToscaServiceTemplate()); - assertNotNull(new ToscaServiceTemplate(new PfConceptKey())); - assertNotNull(new ToscaServiceTemplate(new PfConceptKey(), "")); - assertNotNull(new ToscaServiceTemplate(new ToscaServiceTemplate())); + assertNotNull(new JpaToscaServiceTemplate()); + assertNotNull(new JpaToscaServiceTemplate(new PfConceptKey())); + assertNotNull(new JpaToscaServiceTemplate(new PfConceptKey(), "")); + assertNotNull(new JpaToscaServiceTemplate(new JpaToscaServiceTemplate())); try { - new ToscaServiceTemplate((PfConceptKey) null); + new JpaToscaServiceTemplate((PfConceptKey) null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaServiceTemplate(null, null); + new JpaToscaServiceTemplate(null, null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaServiceTemplate(null, ""); + new JpaToscaServiceTemplate(null, ""); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaServiceTemplate(new PfConceptKey(), null); + new JpaToscaServiceTemplate(new PfConceptKey(), null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("toscaDefinitionsVersion is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaServiceTemplate((ToscaServiceTemplate) null); + new JpaToscaServiceTemplate((JpaToscaServiceTemplate) null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage()); } PfConceptKey tstKey = new PfConceptKey("tst", "0.0.1"); - ToscaServiceTemplate tst = new ToscaServiceTemplate(tstKey, "Tosca Version"); + JpaToscaServiceTemplate tst = new JpaToscaServiceTemplate(tstKey, "Tosca Version"); PfConceptKey dataTypeKey = new PfConceptKey("DataType", "0.0.1"); - ToscaDataType dataType0 = new ToscaDataType(dataTypeKey); + JpaToscaDataType dataType0 = new JpaToscaDataType(dataTypeKey); PfConceptKey dtsKey = new PfConceptKey("dts", "0.0.1"); - Map<PfConceptKey, ToscaDataType> dataTypeMap = new TreeMap<>(); + Map<PfConceptKey, JpaToscaDataType> dataTypeMap = new TreeMap<>(); dataTypeMap.put(dataTypeKey, dataType0); - ToscaDataTypes dataTypes = new ToscaDataTypes(dtsKey, dataTypeMap); + JpaToscaDataTypes dataTypes = new JpaToscaDataTypes(dtsKey, dataTypeMap); tst.setDataTypes(dataTypes); assertEquals(dataTypes, tst.getDataTypes()); PfConceptKey policyTypeKey = new PfConceptKey("DataType", "0.0.1"); - ToscaPolicyType policyType0 = new ToscaPolicyType(policyTypeKey); + JpaToscaPolicyType policyType0 = new JpaToscaPolicyType(policyTypeKey); PfConceptKey ptsKey = new PfConceptKey("dts", "0.0.1"); - Map<PfConceptKey, ToscaPolicyType> policyTypeMap = new TreeMap<>(); + Map<PfConceptKey, JpaToscaPolicyType> policyTypeMap = new TreeMap<>(); policyTypeMap.put(policyTypeKey, policyType0); - ToscaPolicyTypes policyTypes = new ToscaPolicyTypes(ptsKey, policyTypeMap); + JpaToscaPolicyTypes policyTypes = new JpaToscaPolicyTypes(ptsKey, policyTypeMap); tst.setPolicyTypes(policyTypes); assertEquals(policyTypes, tst.getPolicyTypes()); PfReferenceKey tttKey = new PfReferenceKey(tstKey, "TopologyTemplate"); - ToscaTopologyTemplate ttt = new ToscaTopologyTemplate(tttKey); + JpaToscaTopologyTemplate ttt = new JpaToscaTopologyTemplate(tttKey); tst.setTopologyTemplate(ttt); assertEquals(ttt, tst.getTopologyTemplate()); - ToscaServiceTemplate tttClone0 = new ToscaServiceTemplate(tst); + JpaToscaServiceTemplate tttClone0 = new JpaToscaServiceTemplate(tst); assertEquals(tst, tttClone0); assertEquals(0, tst.compareTo(tttClone0)); - ToscaServiceTemplate tttClone1 = new ToscaServiceTemplate(); + JpaToscaServiceTemplate tttClone1 = new JpaToscaServiceTemplate(); tst.copyTo(tttClone1); assertEquals(tst, tttClone1); assertEquals(0, tst.compareTo(tttClone1)); @@ -129,7 +129,7 @@ public class ToscaServiceTemplateTest { assertFalse(tst.compareTo(tst.getKey()) == 0); PfConceptKey otherDtKey = new PfConceptKey("otherDt", "0.0.1"); - ToscaServiceTemplate otherDt = new ToscaServiceTemplate(otherDtKey); + JpaToscaServiceTemplate otherDt = new JpaToscaServiceTemplate(otherDtKey); assertFalse(tst.compareTo(otherDt) == 0); otherDt.setKey(tstKey); @@ -151,13 +151,13 @@ public class ToscaServiceTemplateTest { } assertEquals(6, tst.getKeys().size()); - assertEquals(1, new ToscaServiceTemplate().getKeys().size()); + assertEquals(1, new JpaToscaServiceTemplate().getKeys().size()); - new ToscaServiceTemplate().clean(); + new JpaToscaServiceTemplate().clean(); tst.clean(); assertEquals(tttClone0, tst); - assertFalse(new ToscaServiceTemplate().validate(new PfValidationResult()).isValid()); + assertFalse(new JpaToscaServiceTemplate().validate(new PfValidationResult()).isValid()); assertTrue(tst.validate(new PfValidationResult()).isValid()); tst.setDescription(null); diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/ToscaServiceTemplatesTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplatesTest.java index 2864be829..91d6d0bd3 100644 --- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/ToscaServiceTemplatesTest.java +++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplatesTest.java @@ -28,48 +28,49 @@ import java.util.TreeMap; import org.junit.Test; import org.onap.policy.models.base.PfConceptKey; -import org.onap.policy.models.tosca.simple.concepts.ToscaServiceTemplate; -import org.onap.policy.models.tosca.simple.concepts.ToscaServiceTemplates; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplates; -public class ToscaServiceTemplatesTest { +public class JpaToscaServiceTemplatesTest { @Test public void testServiceTemplates() { - assertNotNull(new ToscaServiceTemplates()); - assertNotNull(new ToscaServiceTemplates(new PfConceptKey())); - assertNotNull(new ToscaServiceTemplates(new PfConceptKey(), new TreeMap<PfConceptKey, ToscaServiceTemplate>())); - assertNotNull(new ToscaServiceTemplates(new ToscaServiceTemplates())); + assertNotNull(new JpaToscaServiceTemplates()); + assertNotNull(new JpaToscaServiceTemplates(new PfConceptKey())); + assertNotNull( + new JpaToscaServiceTemplates(new PfConceptKey(), new TreeMap<PfConceptKey, JpaToscaServiceTemplate>())); + assertNotNull(new JpaToscaServiceTemplates(new JpaToscaServiceTemplates())); try { - new ToscaServiceTemplates((PfConceptKey) null); + new JpaToscaServiceTemplates((PfConceptKey) null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaServiceTemplates((ToscaServiceTemplates) null); + new JpaToscaServiceTemplates((JpaToscaServiceTemplates) null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaServiceTemplates(null, null); + new JpaToscaServiceTemplates(null, null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaServiceTemplates(new PfConceptKey(), null); + new JpaToscaServiceTemplates(new PfConceptKey(), null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("conceptMap is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaServiceTemplates(null, new TreeMap<PfConceptKey, ToscaServiceTemplate>()); + new JpaToscaServiceTemplates(null, new TreeMap<PfConceptKey, JpaToscaServiceTemplate>()); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/ToscaTimeIntervalTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTimeIntervalTest.java index cbfde2d11..707e66dfd 100644 --- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/ToscaTimeIntervalTest.java +++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTimeIntervalTest.java @@ -32,80 +32,80 @@ import org.junit.Test; import org.onap.policy.models.base.PfConceptKey; import org.onap.policy.models.base.PfReferenceKey; import org.onap.policy.models.base.PfValidationResult; -import org.onap.policy.models.tosca.simple.concepts.ToscaTimeInterval; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaTimeInterval; /** * DAO test for ToscaTimeInterval. * * @author Liam Fallon (liam.fallon@est.tech) */ -public class ToscaTimeIntervalTest { +public class JpaToscaTimeIntervalTest { @Test public void testTimeIntervalPojo() { - assertNotNull(new ToscaTimeInterval()); - assertNotNull(new ToscaTimeInterval(new PfReferenceKey())); - assertNotNull(new ToscaTimeInterval(new PfReferenceKey(), new Date(), new Date())); - assertNotNull(new ToscaTimeInterval(new ToscaTimeInterval())); + assertNotNull(new JpaToscaTimeInterval()); + assertNotNull(new JpaToscaTimeInterval(new PfReferenceKey())); + assertNotNull(new JpaToscaTimeInterval(new PfReferenceKey(), new Date(), new Date())); + assertNotNull(new JpaToscaTimeInterval(new JpaToscaTimeInterval())); try { - new ToscaTimeInterval((PfReferenceKey) null); + new JpaToscaTimeInterval((PfReferenceKey) null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaTimeInterval(null, null, null); + new JpaToscaTimeInterval(null, null, null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaTimeInterval(null, null, new Date()); + new JpaToscaTimeInterval(null, null, new Date()); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaTimeInterval(null, new Date(), null); + new JpaToscaTimeInterval(null, new Date(), null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaTimeInterval(null, new Date(), new Date()); + new JpaToscaTimeInterval(null, new Date(), new Date()); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaTimeInterval(new PfReferenceKey(), null, null); + new JpaToscaTimeInterval(new PfReferenceKey(), null, null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("startTime is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaTimeInterval(new PfReferenceKey(), null, new Date()); + new JpaToscaTimeInterval(new PfReferenceKey(), null, new Date()); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("startTime is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaTimeInterval(new PfReferenceKey(), new Date(), null); + new JpaToscaTimeInterval(new PfReferenceKey(), new Date(), null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("endTime is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaTimeInterval((ToscaTimeInterval) null); + new JpaToscaTimeInterval((JpaToscaTimeInterval) null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage()); @@ -115,13 +115,13 @@ public class ToscaTimeIntervalTest { PfReferenceKey ttiKey = new PfReferenceKey(ttiParentKey, "trigger0"); Date startTime = new Date(1000); Date endTime = new Date(2000); - ToscaTimeInterval tti = new ToscaTimeInterval(ttiKey, startTime, endTime); + JpaToscaTimeInterval tti = new JpaToscaTimeInterval(ttiKey, startTime, endTime); - ToscaTimeInterval tdtClone0 = new ToscaTimeInterval(tti); + JpaToscaTimeInterval tdtClone0 = new JpaToscaTimeInterval(tti); assertEquals(tti, tdtClone0); assertEquals(0, tti.compareTo(tdtClone0)); - ToscaTimeInterval tdtClone1 = new ToscaTimeInterval(); + JpaToscaTimeInterval tdtClone1 = new JpaToscaTimeInterval(); tti.copyTo(tdtClone1); assertEquals(tti, tdtClone1); assertEquals(0, tti.compareTo(tdtClone1)); @@ -131,7 +131,7 @@ public class ToscaTimeIntervalTest { assertFalse(tti.compareTo(tti.getKey()) == 0); PfReferenceKey otherDtKey = new PfReferenceKey("otherDt", "0.0.1", "OtherTimeInterval"); - ToscaTimeInterval otherDt = new ToscaTimeInterval(otherDtKey); + JpaToscaTimeInterval otherDt = new JpaToscaTimeInterval(otherDtKey); assertFalse(tti.compareTo(otherDt) == 0); otherDt.setKey(ttiKey); @@ -149,13 +149,13 @@ public class ToscaTimeIntervalTest { } assertEquals(1, tti.getKeys().size()); - assertEquals(1, new ToscaTimeInterval().getKeys().size()); + assertEquals(1, new JpaToscaTimeInterval().getKeys().size()); - new ToscaTimeInterval().clean(); + new JpaToscaTimeInterval().clean(); tti.clean(); assertEquals(tdtClone0, tti); - assertFalse(new ToscaTimeInterval().validate(new PfValidationResult()).isValid()); + assertFalse(new JpaToscaTimeInterval().validate(new PfValidationResult()).isValid()); assertTrue(tti.validate(new PfValidationResult()).isValid()); tti.setStartTime(null); diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/ToscaTopologyTemplateTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTopologyTemplateTest.java index d35c3d661..417f202f5 100644 --- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/ToscaTopologyTemplateTest.java +++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTopologyTemplateTest.java @@ -33,39 +33,39 @@ import org.junit.Test; import org.onap.policy.models.base.PfConceptKey; import org.onap.policy.models.base.PfReferenceKey; import org.onap.policy.models.base.PfValidationResult; -import org.onap.policy.models.tosca.simple.concepts.ToscaPolicies; -import org.onap.policy.models.tosca.simple.concepts.ToscaPolicy; -import org.onap.policy.models.tosca.simple.concepts.ToscaTopologyTemplate; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicies; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicy; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaTopologyTemplate; /** * DAO test for ToscaDatatype. * * @author Liam Fallon (liam.fallon@est.tech) */ -public class ToscaTopologyTemplateTest { +public class JpaToscaTopologyTemplateTest { @Test public void testTopologyTemplatePojo() { - assertNotNull(new ToscaTopologyTemplate()); - assertNotNull(new ToscaTopologyTemplate(new PfReferenceKey())); - assertNotNull(new ToscaTopologyTemplate(new ToscaTopologyTemplate())); + assertNotNull(new JpaToscaTopologyTemplate()); + assertNotNull(new JpaToscaTopologyTemplate(new PfReferenceKey())); + assertNotNull(new JpaToscaTopologyTemplate(new JpaToscaTopologyTemplate())); try { - new ToscaTopologyTemplate((PfReferenceKey) null); + new JpaToscaTopologyTemplate((PfReferenceKey) null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaTopologyTemplate((ToscaTopologyTemplate) null); + new JpaToscaTopologyTemplate((JpaToscaTopologyTemplate) null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage()); } PfReferenceKey tttKey = new PfReferenceKey("tst", "0.0.1", "ttt"); - ToscaTopologyTemplate ttt = new ToscaTopologyTemplate(tttKey); + JpaToscaTopologyTemplate ttt = new JpaToscaTopologyTemplate(tttKey); ttt.setDescription("A Description"); assertEquals("A Description", ttt.getDescription()); @@ -73,18 +73,18 @@ public class ToscaTopologyTemplateTest { PfConceptKey policy0TypeKey = new PfConceptKey("Policy0Type", "0.0.1"); PfConceptKey policy0Key = new PfConceptKey("Policy0", "0.0.1"); - ToscaPolicy policy0 = new ToscaPolicy(policy0Key, policy0TypeKey); + JpaToscaPolicy policy0 = new JpaToscaPolicy(policy0Key, policy0TypeKey); PfConceptKey polsKey = new PfConceptKey("pols", "0.0.1"); - Map<PfConceptKey, ToscaPolicy> policyMap = new TreeMap<>(); + Map<PfConceptKey, JpaToscaPolicy> policyMap = new TreeMap<>(); policyMap.put(policy0Key, policy0); - ToscaPolicies policies = new ToscaPolicies(polsKey, policyMap); + JpaToscaPolicies policies = new JpaToscaPolicies(polsKey, policyMap); ttt.setPolicies(policies); - ToscaTopologyTemplate tttClone0 = new ToscaTopologyTemplate(ttt); + JpaToscaTopologyTemplate tttClone0 = new JpaToscaTopologyTemplate(ttt); assertEquals(ttt, tttClone0); assertEquals(0, ttt.compareTo(tttClone0)); - ToscaTopologyTemplate tttClone1 = new ToscaTopologyTemplate(); + JpaToscaTopologyTemplate tttClone1 = new JpaToscaTopologyTemplate(); ttt.copyTo(tttClone1); assertEquals(ttt, tttClone1); assertEquals(0, ttt.compareTo(tttClone1)); @@ -94,7 +94,7 @@ public class ToscaTopologyTemplateTest { assertFalse(ttt.compareTo(ttt.getKey()) == 0); PfReferenceKey otherDtKey = new PfReferenceKey("otherSt", "0.0.1", "otherDt"); - ToscaTopologyTemplate otherDt = new ToscaTopologyTemplate(otherDtKey); + JpaToscaTopologyTemplate otherDt = new JpaToscaTopologyTemplate(otherDtKey); assertFalse(ttt.compareTo(otherDt) == 0); otherDt.setKey(tttKey); @@ -112,13 +112,13 @@ public class ToscaTopologyTemplateTest { } assertEquals(4, ttt.getKeys().size()); - assertEquals(1, new ToscaTopologyTemplate().getKeys().size()); + assertEquals(1, new JpaToscaTopologyTemplate().getKeys().size()); - new ToscaTopologyTemplate().clean(); + new JpaToscaTopologyTemplate().clean(); ttt.clean(); assertEquals(tttClone0, ttt); - assertTrue(new ToscaTopologyTemplate().validate(new PfValidationResult()).isValid()); + assertTrue(new JpaToscaTopologyTemplate().validate(new PfValidationResult()).isValid()); assertTrue(ttt.validate(new PfValidationResult()).isValid()); ttt.setDescription(null); diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/ToscaTriggerTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTriggerTest.java index be60165ff..661882a3f 100644 --- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/ToscaTriggerTest.java +++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTriggerTest.java @@ -33,84 +33,84 @@ import org.junit.Test; import org.onap.policy.models.base.PfConceptKey; import org.onap.policy.models.base.PfReferenceKey; import org.onap.policy.models.base.PfValidationResult; -import org.onap.policy.models.tosca.simple.concepts.ToscaConstraintLogical.Operation; -import org.onap.policy.models.tosca.simple.concepts.ToscaConstraintLogicalString; -import org.onap.policy.models.tosca.simple.concepts.ToscaEventFilter; -import org.onap.policy.models.tosca.simple.concepts.ToscaTimeInterval; -import org.onap.policy.models.tosca.simple.concepts.ToscaTrigger; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaConstraintLogical.Operation; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaConstraintLogicalString; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaEventFilter; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaTimeInterval; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaTrigger; /** * DAO test for ToscaTrigger. * * @author Liam Fallon (liam.fallon@est.tech) */ -public class ToscaTriggerTest { +public class JpaToscaTriggerTest { @Test public void testTriggerPojo() { - assertNotNull(new ToscaTrigger()); - assertNotNull(new ToscaTrigger(new PfReferenceKey())); - assertNotNull(new ToscaTrigger(new PfReferenceKey(), "EventType", "Action")); - assertNotNull(new ToscaTrigger(new ToscaTrigger())); + assertNotNull(new JpaToscaTrigger()); + assertNotNull(new JpaToscaTrigger(new PfReferenceKey())); + assertNotNull(new JpaToscaTrigger(new PfReferenceKey(), "EventType", "Action")); + assertNotNull(new JpaToscaTrigger(new JpaToscaTrigger())); try { - new ToscaTrigger((PfReferenceKey) null); + new JpaToscaTrigger((PfReferenceKey) null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaTrigger(null, null, null); + new JpaToscaTrigger(null, null, null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaTrigger(null, "EventType", null); + new JpaToscaTrigger(null, "EventType", null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaTrigger(null, "EventType", "Action"); + new JpaToscaTrigger(null, "EventType", "Action"); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaTrigger(null, null, "Action"); + new JpaToscaTrigger(null, null, "Action"); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("key is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaTrigger(new PfReferenceKey(), null, null); + new JpaToscaTrigger(new PfReferenceKey(), null, null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("eventType is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaTrigger(new PfReferenceKey(), "EventType", null); + new JpaToscaTrigger(new PfReferenceKey(), "EventType", null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("action is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaTrigger(new PfReferenceKey(), null, "Action"); + new JpaToscaTrigger(new PfReferenceKey(), null, "Action"); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("eventType is marked @NonNull but is null", exc.getMessage()); } try { - new ToscaTrigger((ToscaTrigger) null); + new JpaToscaTrigger((JpaToscaTrigger) null); fail("test should throw an exception"); } catch (Exception exc) { assertEquals("copyConcept is marked @NonNull but is null", exc.getMessage()); @@ -118,17 +118,18 @@ public class ToscaTriggerTest { PfConceptKey tparentKey = new PfConceptKey("tParentKey", "0.0.1"); PfReferenceKey tkey = new PfReferenceKey(tparentKey, "trigger0"); - ToscaTrigger tdt = new ToscaTrigger(tkey, "EventType", "Action"); + JpaToscaTrigger tdt = new JpaToscaTrigger(tkey, "EventType", "Action"); - ToscaTimeInterval schedule = new ToscaTimeInterval(new PfReferenceKey(tkey, "sched"), new Date(), new Date()); + JpaToscaTimeInterval schedule = + new JpaToscaTimeInterval(new PfReferenceKey(tkey, "sched"), new Date(), new Date()); tdt.setSchedule(schedule); - ToscaEventFilter targetFilter = - new ToscaEventFilter(new PfReferenceKey(tkey, "filter"), new PfConceptKey("NodeName", "0.0.1")); + JpaToscaEventFilter targetFilter = + new JpaToscaEventFilter(new PfReferenceKey(tkey, "filter"), new PfConceptKey("NodeName", "0.0.1")); tdt.setTargetFilter(targetFilter); - ToscaConstraintLogicalString lsc = - new ToscaConstraintLogicalString(new PfReferenceKey(tkey, "sc"), Operation.EQ, "hello"); + JpaToscaConstraintLogicalString lsc = + new JpaToscaConstraintLogicalString(new PfReferenceKey(tkey, "sc"), Operation.EQ, "hello"); tdt.setCondition(lsc); assertEquals(lsc, tdt.getCondition()); tdt.setConstraint(lsc); @@ -143,11 +144,11 @@ public class ToscaTriggerTest { tdt.setMethod("A Method"); assertEquals("A Method", tdt.getMethod()); - ToscaTrigger tdtClone0 = new ToscaTrigger(tdt); + JpaToscaTrigger tdtClone0 = new JpaToscaTrigger(tdt); assertEquals(tdt, tdtClone0); assertEquals(0, tdt.compareTo(tdtClone0)); - ToscaTrigger tdtClone1 = new ToscaTrigger(); + JpaToscaTrigger tdtClone1 = new JpaToscaTrigger(); tdt.copyTo(tdtClone1); assertEquals(tdt, tdtClone1); assertEquals(0, tdt.compareTo(tdtClone1)); @@ -157,7 +158,7 @@ public class ToscaTriggerTest { assertFalse(tdt.compareTo(tdt.getKey()) == 0); PfReferenceKey otherDtKey = new PfReferenceKey("otherDt", "0.0.1", "OtherTrigger"); - ToscaTrigger otherDt = new ToscaTrigger(otherDtKey); + JpaToscaTrigger otherDt = new JpaToscaTrigger(otherDtKey); assertFalse(tdt.compareTo(otherDt) == 0); otherDt.setKey(tkey); @@ -194,13 +195,13 @@ public class ToscaTriggerTest { } assertEquals(6, tdt.getKeys().size()); - assertEquals(1, new ToscaTrigger().getKeys().size()); + assertEquals(1, new JpaToscaTrigger().getKeys().size()); - new ToscaTrigger().clean(); + new JpaToscaTrigger().clean(); tdt.clean(); assertEquals(tdtClone0, tdt); - assertFalse(new ToscaTrigger().validate(new PfValidationResult()).isValid()); + assertFalse(new JpaToscaTrigger().validate(new PfValidationResult()).isValid()); assertTrue(tdt.validate(new PfValidationResult()).isValid()); tdt.setDescription(null); diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/testconcepts/DummyToscaConstraint.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/testconcepts/DummyToscaConstraint.java index 2e03fd215..a743e2834 100644 --- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/testconcepts/DummyToscaConstraint.java +++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/concepts/testconcepts/DummyToscaConstraint.java @@ -24,14 +24,14 @@ import javax.ws.rs.core.Response; import org.onap.policy.models.base.PfModelRuntimeException; import org.onap.policy.models.base.PfReferenceKey; -import org.onap.policy.models.tosca.simple.concepts.ToscaConstraint; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaConstraint; /** * Dummy constraint to test abstract ToscaConstraint class. * * @author Liam Fallon (liam.fallon@est.tech) */ -public class DummyToscaConstraint extends ToscaConstraint { +public class DummyToscaConstraint extends JpaToscaConstraint { private static final long serialVersionUID = 1L; /** diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProviderTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProviderTest.java index ed25a7a25..029c7a7e1 100644 --- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProviderTest.java +++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProviderTest.java @@ -39,9 +39,9 @@ import org.onap.policy.models.dao.DaoParameters; import org.onap.policy.models.dao.PfDao; import org.onap.policy.models.dao.PfDaoFactory; import org.onap.policy.models.dao.impl.DefaultPfDao; -import org.onap.policy.models.tosca.simple.concepts.ToscaPolicies; -import org.onap.policy.models.tosca.simple.concepts.ToscaServiceTemplate; -import org.onap.policy.models.tosca.simple.concepts.ToscaTopologyTemplate; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicies; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaTopologyTemplate; import org.onap.policy.models.tosca.simple.serialization.ToscaServiceTemplateMessageBodyHandler; /** @@ -114,19 +114,19 @@ public class SimpleToscaProviderTest { assertEquals("policyKey is marked @NonNull but is null", exc.getMessage()); } - ToscaServiceTemplate originalServiceTemplate = + JpaToscaServiceTemplate originalServiceTemplate = gson.fromJson(ResourceUtils.getResourceAsString("policies/vCPE.policy.monitoring.input.tosca.json"), - ToscaServiceTemplate.class); + JpaToscaServiceTemplate.class); assertNotNull(originalServiceTemplate); - ToscaServiceTemplate createdServiceTemplate = + JpaToscaServiceTemplate createdServiceTemplate = new SimpleToscaProvider().createPolicies(pfDao, originalServiceTemplate); assertEquals(originalServiceTemplate, createdServiceTemplate); PfConceptKey policyKey = new PfConceptKey("onap.restart.tca:1.0.0"); - ToscaServiceTemplate gotServiceTemplate = + JpaToscaServiceTemplate gotServiceTemplate = new SimpleToscaProvider().getPolicies(pfDao, new PfConceptKey(policyKey)); assertEquals(originalServiceTemplate.getTopologyTemplate().getPolicies().get(policyKey), @@ -144,7 +144,7 @@ public class SimpleToscaProviderTest { } try { - new SimpleToscaProvider().createPolicies(null, new ToscaServiceTemplate()); + new SimpleToscaProvider().createPolicies(null, new JpaToscaServiceTemplate()); fail("test should throw an exception here"); } catch (Exception exc) { assertEquals("dao is marked @NonNull but is null", exc.getMessage()); @@ -157,12 +157,12 @@ public class SimpleToscaProviderTest { assertEquals("serviceTemplate is marked @NonNull but is null", exc.getMessage()); } - ToscaServiceTemplate originalServiceTemplate = + JpaToscaServiceTemplate originalServiceTemplate = gson.fromJson(ResourceUtils.getResourceAsString("policies/vCPE.policy.monitoring.input.tosca.json"), - ToscaServiceTemplate.class); + JpaToscaServiceTemplate.class); assertNotNull(originalServiceTemplate); - ToscaServiceTemplate createdServiceTemplate = + JpaToscaServiceTemplate createdServiceTemplate = new SimpleToscaProvider().createPolicies(pfDao, originalServiceTemplate); assertEquals(originalServiceTemplate, createdServiceTemplate); @@ -178,7 +178,7 @@ public class SimpleToscaProviderTest { } try { - new SimpleToscaProvider().updatePolicies(null, new ToscaServiceTemplate()); + new SimpleToscaProvider().updatePolicies(null, new JpaToscaServiceTemplate()); fail("test should throw an exception here"); } catch (Exception exc) { assertEquals("dao is marked @NonNull but is null", exc.getMessage()); @@ -191,12 +191,12 @@ public class SimpleToscaProviderTest { assertEquals("serviceTemplate is marked @NonNull but is null", exc.getMessage()); } - ToscaServiceTemplate originalServiceTemplate = + JpaToscaServiceTemplate originalServiceTemplate = gson.fromJson(ResourceUtils.getResourceAsString("policies/vCPE.policy.monitoring.input.tosca.json"), - ToscaServiceTemplate.class); + JpaToscaServiceTemplate.class); assertNotNull(originalServiceTemplate); - ToscaServiceTemplate updatedServiceTemplate = + JpaToscaServiceTemplate updatedServiceTemplate = new SimpleToscaProvider().updatePolicies(pfDao, originalServiceTemplate); assertEquals(originalServiceTemplate, updatedServiceTemplate); @@ -225,19 +225,19 @@ public class SimpleToscaProviderTest { assertEquals("policyKey is marked @NonNull but is null", exc.getMessage()); } - ToscaServiceTemplate originalServiceTemplate = + JpaToscaServiceTemplate originalServiceTemplate = gson.fromJson(ResourceUtils.getResourceAsString("policies/vCPE.policy.monitoring.input.tosca.json"), - ToscaServiceTemplate.class); + JpaToscaServiceTemplate.class); assertNotNull(originalServiceTemplate); - ToscaServiceTemplate createdServiceTemplate = + JpaToscaServiceTemplate createdServiceTemplate = new SimpleToscaProvider().createPolicies(pfDao, originalServiceTemplate); assertEquals(originalServiceTemplate, createdServiceTemplate); PfConceptKey policyKey = new PfConceptKey("onap.restart.tca:1.0.0"); - ToscaServiceTemplate deletedServiceTemplate = + JpaToscaServiceTemplate deletedServiceTemplate = new SimpleToscaProvider().deletePolicies(pfDao, new PfConceptKey(policyKey)); assertEquals(originalServiceTemplate.getTopologyTemplate().getPolicies().get(policyKey), @@ -253,7 +253,7 @@ public class SimpleToscaProviderTest { @Test public void testAssertPoliciesExist() throws PfModelException { - ToscaServiceTemplate testServiceTemplate = new ToscaServiceTemplate(); + JpaToscaServiceTemplate testServiceTemplate = new JpaToscaServiceTemplate(); try { new SimpleToscaProvider().createPolicies(pfDao, testServiceTemplate); @@ -262,7 +262,7 @@ public class SimpleToscaProviderTest { assertEquals("topology template not specified on service template", exc.getMessage()); } - testServiceTemplate.setTopologyTemplate(new ToscaTopologyTemplate()); + testServiceTemplate.setTopologyTemplate(new JpaToscaTopologyTemplate()); try { new SimpleToscaProvider().createPolicies(pfDao, testServiceTemplate); fail("test should throw an exception here"); @@ -270,7 +270,7 @@ public class SimpleToscaProviderTest { assertEquals("no policies specified on topology template of service template", exc.getMessage()); } - testServiceTemplate.getTopologyTemplate().setPolicies(new ToscaPolicies()); + testServiceTemplate.getTopologyTemplate().setPolicies(new JpaToscaPolicies()); try { new SimpleToscaProvider().createPolicies(pfDao, testServiceTemplate); fail("test should throw an exception here"); diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/serialization/MonitoringPolicySerializationTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/serialization/MonitoringPolicySerializationTest.java index 833e06a82..1f17a43bf 100644 --- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/serialization/MonitoringPolicySerializationTest.java +++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/serialization/MonitoringPolicySerializationTest.java @@ -40,8 +40,8 @@ import org.onap.policy.common.utils.coder.StandardCoder; import org.onap.policy.common.utils.resources.ResourceUtils; import org.onap.policy.models.base.PfConceptKey; import org.onap.policy.models.base.PfValidationResult; -import org.onap.policy.models.tosca.simple.concepts.ToscaPolicy; -import org.onap.policy.models.tosca.simple.concepts.ToscaServiceTemplate; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicy; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate; import org.onap.policy.models.tosca.simple.serialization.ToscaServiceTemplateMessageBodyHandler; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -57,12 +57,12 @@ public class MonitoringPolicySerializationTest { private static final Logger LOGGER = LoggerFactory.getLogger(MonitoringPolicySerializationTest.class); - private static final String VCPE_MONITORING_INPUT_JSON = "policies/vCPE.policy.monitoring.input.tosca.json"; - private static final String VCPE_MONITORING_INPUT_YAML = "policies/vCPE.policy.monitoring.input.tosca.yaml"; - private static final String VDNS_MONITORING_INPUT_JSON = "policies/vDNS.policy.monitoring.input.tosca.json"; - private static final String VDNS_MONITORING_INPUT_YAML = "policies/vDNS.policy.monitoring.input.tosca.yaml"; - private static final String VFW_MONITORING_INPUT_JSON = "policies/vFirewall.policy.monitoring.input.tosca.json"; - private static final String VFW_MONITORING_INPUT_YAML = "policies/vFirewall.policy.monitoring.input.tosca.yaml"; + private static final String VCPE_MON_INPUT_JSON = "policies/vCPE.policy.monitoring.input.tosca.json"; + private static final String VCPE_MON_INPUT_YAML = "policies/vCPE.policy.monitoring.input.tosca.yaml"; + private static final String VDNS_MON_INPUT_JSON = "policies/vDNS.policy.monitoring.input.tosca.json"; + private static final String VDNS_MON_INPUT_YAML = "policies/vDNS.policy.monitoring.input.tosca.yaml"; + private static final String VFW_MON_INPUT_JSON = "policies/vFirewall.policy.monitoring.input.tosca.json"; + private static final String VFW_MON_INPUT_YAML = "policies/vFirewall.policy.monitoring.input.tosca.yaml"; private Gson gson; @@ -75,21 +75,21 @@ public class MonitoringPolicySerializationTest { public void testDeserialization() { try { // vCPE - ToscaServiceTemplate serviceTemplateFromJson = deserializeMonitoringInputJson(VCPE_MONITORING_INPUT_JSON); + JpaToscaServiceTemplate serviceTemplateFromJson = deserializeMonitoringInputJson(VCPE_MON_INPUT_JSON); verifyVcpeMonitoringInputDeserialization(serviceTemplateFromJson); - ToscaServiceTemplate serviceTemplateFromYaml = deserializeMonitoringInputYaml(VCPE_MONITORING_INPUT_YAML); + JpaToscaServiceTemplate serviceTemplateFromYaml = deserializeMonitoringInputYaml(VCPE_MON_INPUT_YAML); assertTrue(serviceTemplateFromJson.compareTo(serviceTemplateFromYaml) == 0); // vDNS - serviceTemplateFromJson = deserializeMonitoringInputJson(VDNS_MONITORING_INPUT_JSON); + serviceTemplateFromJson = deserializeMonitoringInputJson(VDNS_MON_INPUT_JSON); verifyVdnsMonitoringInputDeserialization(serviceTemplateFromJson); - serviceTemplateFromYaml = deserializeMonitoringInputYaml(VDNS_MONITORING_INPUT_YAML); + serviceTemplateFromYaml = deserializeMonitoringInputYaml(VDNS_MON_INPUT_YAML); assertTrue(serviceTemplateFromJson.compareTo(serviceTemplateFromYaml) == 0); // vFirewall - serviceTemplateFromJson = deserializeMonitoringInputJson(VFW_MONITORING_INPUT_JSON); + serviceTemplateFromJson = deserializeMonitoringInputJson(VFW_MON_INPUT_JSON); verifyVfwMonitoringInputDeserialization(serviceTemplateFromJson); - serviceTemplateFromYaml = deserializeMonitoringInputYaml(VFW_MONITORING_INPUT_YAML); + serviceTemplateFromYaml = deserializeMonitoringInputYaml(VFW_MON_INPUT_YAML); assertTrue(serviceTemplateFromJson.compareTo(serviceTemplateFromYaml) == 0); } catch (Exception e) { @@ -101,17 +101,17 @@ public class MonitoringPolicySerializationTest { public void testSerialization() { try { // vCPE - ToscaServiceTemplate serviceTemplate = deserializeMonitoringInputJson(VCPE_MONITORING_INPUT_JSON); + JpaToscaServiceTemplate serviceTemplate = deserializeMonitoringInputJson(VCPE_MON_INPUT_JSON); String serializedServiceTemplate = serializeMonitoringServiceTemplate(serviceTemplate); verifyVcpeMonitoringOutputserialization(serializedServiceTemplate); // vDNS - serviceTemplate = deserializeMonitoringInputJson(VDNS_MONITORING_INPUT_JSON); + serviceTemplate = deserializeMonitoringInputJson(VDNS_MON_INPUT_JSON); serializedServiceTemplate = serializeMonitoringServiceTemplate(serviceTemplate); verifyVdnsMonitoringOutputserialization(serializedServiceTemplate); // vFirewall - serviceTemplate = deserializeMonitoringInputJson(VFW_MONITORING_INPUT_JSON); + serviceTemplate = deserializeMonitoringInputJson(VFW_MON_INPUT_JSON); serializedServiceTemplate = serializeMonitoringServiceTemplate(serviceTemplate); verifyVfwMonitoringOutputserialization(serializedServiceTemplate); @@ -121,30 +121,30 @@ public class MonitoringPolicySerializationTest { } } - private ToscaServiceTemplate deserializeMonitoringInputJson(String resourcePath) + private JpaToscaServiceTemplate deserializeMonitoringInputJson(String resourcePath) throws JsonSyntaxException, IOException { String policyJson = ResourceUtils.getResourceAsString(resourcePath); - ToscaServiceTemplate serviceTemplate = gson.fromJson(policyJson, ToscaServiceTemplate.class); + JpaToscaServiceTemplate serviceTemplate = gson.fromJson(policyJson, JpaToscaServiceTemplate.class); return serviceTemplate; } - private ToscaServiceTemplate deserializeMonitoringInputYaml(String resourcePath) + private JpaToscaServiceTemplate deserializeMonitoringInputYaml(String resourcePath) throws Exception { Yaml yaml = new Yaml(); String policyYaml = ResourceUtils.getResourceAsString(resourcePath); Object yamlObject = yaml.load(policyYaml); String yamlAsJsonString = new StandardCoder().encode(yamlObject); - ToscaServiceTemplate serviceTemplate = gson.fromJson(yamlAsJsonString, ToscaServiceTemplate.class); + JpaToscaServiceTemplate serviceTemplate = gson.fromJson(yamlAsJsonString, JpaToscaServiceTemplate.class); return serviceTemplate; } - private String serializeMonitoringServiceTemplate(ToscaServiceTemplate serviceTemplate) { + private String serializeMonitoringServiceTemplate(JpaToscaServiceTemplate serviceTemplate) { return gson.toJson(serviceTemplate); } - private void verifyVcpeMonitoringInputDeserialization(ToscaServiceTemplate serviceTemplate) { + private void verifyVcpeMonitoringInputDeserialization(JpaToscaServiceTemplate serviceTemplate) { // Sanity check the entire structure assertNotNull(serviceTemplate); @@ -155,7 +155,7 @@ public class MonitoringPolicySerializationTest { assertEquals("tosca_simple_yaml_1_0_0", serviceTemplate.getToscaDefinitionsVersion()); - Map<PfConceptKey, ToscaPolicy> policiesConceptMap = serviceTemplate.getTopologyTemplate() + Map<PfConceptKey, JpaToscaPolicy> policiesConceptMap = serviceTemplate.getTopologyTemplate() .getPolicies().getConceptMap(); // Check policies @@ -164,7 +164,7 @@ public class MonitoringPolicySerializationTest { assertEquals("onap.restart.tca:1.0.0", serviceTemplate.getTopologyTemplate().getPolicies().get("onap.restart.tca").getId()); - ToscaPolicy policyVal = policiesConceptMap.values().iterator().next(); + JpaToscaPolicy policyVal = policiesConceptMap.values().iterator().next(); // Check metadata assertTrue(policyVal.getMetadata().size() == 1); @@ -177,7 +177,7 @@ public class MonitoringPolicySerializationTest { assertNotNull(policyVal.getProperties().values().iterator().next()); } - private void verifyVdnsMonitoringInputDeserialization(ToscaServiceTemplate serviceTemplate) { + private void verifyVdnsMonitoringInputDeserialization(JpaToscaServiceTemplate serviceTemplate) { // Sanity check the entire structure assertNotNull(serviceTemplate); @@ -188,7 +188,7 @@ public class MonitoringPolicySerializationTest { assertEquals("tosca_simple_yaml_1_0_0", serviceTemplate.getToscaDefinitionsVersion()); - Map<PfConceptKey, ToscaPolicy> policiesConceptMap = serviceTemplate.getTopologyTemplate() + Map<PfConceptKey, JpaToscaPolicy> policiesConceptMap = serviceTemplate.getTopologyTemplate() .getPolicies().getConceptMap(); // Check policies @@ -197,7 +197,7 @@ public class MonitoringPolicySerializationTest { assertEquals("onap.scaleout.tca:1.0.0", serviceTemplate.getTopologyTemplate().getPolicies().get("onap.scaleout.tca").getId()); - ToscaPolicy policyVal = policiesConceptMap.values().iterator().next(); + JpaToscaPolicy policyVal = policiesConceptMap.values().iterator().next(); // Check metadata assertTrue(policyVal.getMetadata().size() == 1); @@ -210,7 +210,7 @@ public class MonitoringPolicySerializationTest { assertNotNull(policyVal.getProperties().values().iterator().next()); } - private void verifyVfwMonitoringInputDeserialization(ToscaServiceTemplate serviceTemplate) { + private void verifyVfwMonitoringInputDeserialization(JpaToscaServiceTemplate serviceTemplate) { // Sanity check the entire structure assertNotNull(serviceTemplate); @@ -221,7 +221,7 @@ public class MonitoringPolicySerializationTest { assertEquals("tosca_simple_yaml_1_0_0", serviceTemplate.getToscaDefinitionsVersion()); - Map<PfConceptKey, ToscaPolicy> policiesConceptMap = serviceTemplate.getTopologyTemplate() + Map<PfConceptKey, JpaToscaPolicy> policiesConceptMap = serviceTemplate.getTopologyTemplate() .getPolicies().getConceptMap(); // Check policies @@ -230,7 +230,7 @@ public class MonitoringPolicySerializationTest { assertEquals("onap.vfirewall.tca:1.0.0", serviceTemplate.getTopologyTemplate().getPolicies().get("onap.vfirewall.tca").getId()); - ToscaPolicy policyVal = policiesConceptMap.values().iterator().next(); + JpaToscaPolicy policyVal = policiesConceptMap.values().iterator().next(); // Check metadata assertTrue(policyVal.getMetadata().size() == 1); diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/serialization/MonitoringPolicyTypeSerializationTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/serialization/MonitoringPolicyTypeSerializationTest.java index c40b32e3c..b494199e8 100644 --- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/serialization/MonitoringPolicyTypeSerializationTest.java +++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/serialization/MonitoringPolicyTypeSerializationTest.java @@ -38,13 +38,13 @@ import org.junit.Test; import org.onap.policy.common.utils.resources.ResourceUtils; import org.onap.policy.models.base.PfConceptKey; import org.onap.policy.models.base.PfValidationResult; -import org.onap.policy.models.tosca.simple.concepts.ToscaConstraintLogicalString; -import org.onap.policy.models.tosca.simple.concepts.ToscaConstraintValidValues; -import org.onap.policy.models.tosca.simple.concepts.ToscaDataType; -import org.onap.policy.models.tosca.simple.concepts.ToscaEntrySchema; -import org.onap.policy.models.tosca.simple.concepts.ToscaPolicyType; -import org.onap.policy.models.tosca.simple.concepts.ToscaProperty; -import org.onap.policy.models.tosca.simple.concepts.ToscaServiceTemplate; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaConstraintLogicalString; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaConstraintValidValues; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaDataType; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaEntrySchema; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicyType; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaProperty; +import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate; import org.onap.policy.models.tosca.simple.serialization.ToscaServiceTemplateMessageBodyHandler; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -74,7 +74,7 @@ public class MonitoringPolicyTypeSerializationTest { public void testDeserialization() { try { // TCA - ToscaServiceTemplate serviceTemplateFromYaml = deserializeMonitoringInputYaml(MONITORING_TCA_YAML); + JpaToscaServiceTemplate serviceTemplateFromYaml = deserializeMonitoringInputYaml(MONITORING_TCA_YAML); verifyTcaInputDeserialization(serviceTemplateFromYaml); // Collector @@ -90,17 +90,17 @@ public class MonitoringPolicyTypeSerializationTest { public void testSerialization() { try { // TCA - ToscaServiceTemplate serviceTemplateFromYaml = deserializeMonitoringInputYaml(MONITORING_TCA_YAML); + JpaToscaServiceTemplate serviceTemplateFromYaml = deserializeMonitoringInputYaml(MONITORING_TCA_YAML); String serializedServiceTemplate1 = serializeMonitoringServiceTemplate(serviceTemplateFromYaml); - ToscaServiceTemplate serviceTemplateFromJson = gson.fromJson(serializedServiceTemplate1, - ToscaServiceTemplate.class); + JpaToscaServiceTemplate serviceTemplateFromJson = gson.fromJson(serializedServiceTemplate1, + JpaToscaServiceTemplate.class); String serializedServiceTemplate2 = serializeMonitoringServiceTemplate(serviceTemplateFromJson); assertEquals(serializedServiceTemplate1, serializedServiceTemplate2); // Collector serviceTemplateFromYaml = deserializeMonitoringInputYaml(MONITORING_COLLECTORS_YAML); serializedServiceTemplate1 = serializeMonitoringServiceTemplate(serviceTemplateFromYaml); - serviceTemplateFromJson = gson.fromJson(serializedServiceTemplate1, ToscaServiceTemplate.class); + serviceTemplateFromJson = gson.fromJson(serializedServiceTemplate1, JpaToscaServiceTemplate.class); serializedServiceTemplate2 = serializeMonitoringServiceTemplate(serviceTemplateFromJson); assertEquals(serializedServiceTemplate1, serializedServiceTemplate2); @@ -109,18 +109,18 @@ public class MonitoringPolicyTypeSerializationTest { } } - private ToscaServiceTemplate deserializeMonitoringInputYaml(String resourcePath) + private JpaToscaServiceTemplate deserializeMonitoringInputYaml(String resourcePath) throws JsonSyntaxException, IOException { Yaml yaml = new Yaml(); String policyTypeYaml = ResourceUtils.getResourceAsString(resourcePath); Object yamlObject = yaml.load(policyTypeYaml); String yamlAsJsonString = new Gson().toJson(yamlObject); - ToscaServiceTemplate serviceTemplate = gson.fromJson(yamlAsJsonString, ToscaServiceTemplate.class); + JpaToscaServiceTemplate serviceTemplate = gson.fromJson(yamlAsJsonString, JpaToscaServiceTemplate.class); return serviceTemplate; } - private void verifyTcaInputDeserialization(ToscaServiceTemplate serviceTemplate) { + private void verifyTcaInputDeserialization(JpaToscaServiceTemplate serviceTemplate) { // Sanity check the entire structure assertNotNull(serviceTemplate); @@ -131,50 +131,50 @@ public class MonitoringPolicyTypeSerializationTest { assertEquals("tosca_simple_yaml_1_0_0", serviceTemplate.getToscaDefinitionsVersion()); // Check policy_types - Map<PfConceptKey, ToscaPolicyType> policyTypesConceptMap = serviceTemplate.getPolicyTypes().getConceptMap(); + Map<PfConceptKey, JpaToscaPolicyType> policyTypesConceptMap = serviceTemplate.getPolicyTypes().getConceptMap(); assertTrue(policyTypesConceptMap.size() == 2); - Iterator<Entry<PfConceptKey, ToscaPolicyType>> policyTypesIter = policyTypesConceptMap.entrySet().iterator(); + Iterator<Entry<PfConceptKey, JpaToscaPolicyType>> policyTypesIter = policyTypesConceptMap.entrySet().iterator(); - Entry<PfConceptKey, ToscaPolicyType> firstPolicyType = policyTypesIter.next(); + Entry<PfConceptKey, JpaToscaPolicyType> firstPolicyType = policyTypesIter.next(); assertEquals("onap.policies.Monitoring", firstPolicyType.getKey().getName()); assertEquals("1.0.0", firstPolicyType.getKey().getVersion()); assertEquals("tosca.policies.Root", firstPolicyType.getValue().getDerivedFrom().getName()); assertEquals("a base policy type for all policies that governs monitoring provisioning", firstPolicyType.getValue().getDescription()); - Entry<PfConceptKey, ToscaPolicyType> secondPolicyType = policyTypesIter.next(); + Entry<PfConceptKey, JpaToscaPolicyType> secondPolicyType = policyTypesIter.next(); assertEquals("onap.policy.monitoring.cdap.tca.hi.lo.app", secondPolicyType.getKey().getName()); assertEquals("1.0.0", secondPolicyType.getKey().getVersion()); assertEquals("onap.policies.Monitoring", secondPolicyType.getValue().getDerivedFrom().getName()); assertTrue(secondPolicyType.getValue().getProperties().size() == 1); - ToscaProperty property = secondPolicyType.getValue().getProperties().iterator().next(); + JpaToscaProperty property = secondPolicyType.getValue().getProperties().iterator().next(); assertEquals("onap.policy.monitoring.cdap.tca.hi.lo.app", property.getKey().getParentKeyName()); assertEquals("1.0.0", property.getKey().getParentKeyVersion()); assertEquals("tca_policy", property.getKey().getLocalName()); assertEquals("map", property.getType().getName()); assertEquals("TCA Policy JSON", property.getDescription()); - ToscaEntrySchema entrySchema = property.getEntrySchema(); + JpaToscaEntrySchema entrySchema = property.getEntrySchema(); assertEquals("map", entrySchema.getKey().getParentKeyName()); assertEquals("1.0.0", entrySchema.getKey().getParentKeyVersion()); assertEquals("entry_schema", entrySchema.getKey().getLocalName()); assertEquals("onap.datatypes.monitoring.tca_policy", entrySchema.getType().getName()); // Check data_types - Map<PfConceptKey, ToscaDataType> dataTypesConceptMap = serviceTemplate.getDataTypes().getConceptMap(); + Map<PfConceptKey, JpaToscaDataType> dataTypesConceptMap = serviceTemplate.getDataTypes().getConceptMap(); assertTrue(dataTypesConceptMap.size() == 3); - Iterator<Entry<PfConceptKey, ToscaDataType>> dataTypesIter = dataTypesConceptMap.entrySet().iterator(); + Iterator<Entry<PfConceptKey, JpaToscaDataType>> dataTypesIter = dataTypesConceptMap.entrySet().iterator(); - Entry<PfConceptKey, ToscaDataType> firstDataType = dataTypesIter.next(); + Entry<PfConceptKey, JpaToscaDataType> firstDataType = dataTypesIter.next(); assertEquals("onap.datatypes.monitoring.metricsPerEventName", firstDataType.getKey().getName()); - ToscaDataType firstDataTypeVal = firstDataType.getValue(); + JpaToscaDataType firstDataTypeVal = firstDataType.getValue(); assertEquals("tosca.datatypes.Root", firstDataTypeVal.getDerivedFrom().getName()); assertEquals("1.0.0", firstDataTypeVal.getDerivedFrom().getVersion()); assertTrue(firstDataTypeVal.getProperties().size() == 6); - Iterator<ToscaProperty> firstDataTypePropertiesIter = firstDataTypeVal.getProperties().iterator(); + Iterator<JpaToscaProperty> firstDataTypePropertiesIter = firstDataTypeVal.getProperties().iterator(); - ToscaProperty firstDataTypeFirstProperty = firstDataTypePropertiesIter.next(); + JpaToscaProperty firstDataTypeFirstProperty = firstDataTypePropertiesIter.next(); assertEquals("onap.datatypes.monitoring.metricsPerEventName", firstDataTypeFirstProperty.getKey() .getParentKeyName()); assertEquals("controlLoopSchemaType", firstDataTypeFirstProperty.getKey().getLocalName()); @@ -188,11 +188,11 @@ public class MonitoringPolicyTypeSerializationTest { assertEquals("string", firstDataTypeFirstProperty.getConstraints().iterator().next().getKey() .getParentKeyName()); assertTrue(firstDataTypeFirstProperty.getConstraints().iterator().next() - instanceof ToscaConstraintValidValues); - assertTrue(((ToscaConstraintValidValues)(firstDataTypeFirstProperty.getConstraints().iterator().next())) + instanceof JpaToscaConstraintValidValues); + assertTrue(((JpaToscaConstraintValidValues)(firstDataTypeFirstProperty.getConstraints().iterator().next())) .getValidValues().size() == 2); - ToscaProperty firstDataTypeSecondProperty = firstDataTypePropertiesIter.next(); + JpaToscaProperty firstDataTypeSecondProperty = firstDataTypePropertiesIter.next(); assertEquals("onap.datatypes.monitoring.metricsPerEventName", firstDataTypeSecondProperty.getKey() .getParentKeyName()); assertEquals("eventName", firstDataTypeSecondProperty.getKey().getLocalName()); @@ -201,7 +201,7 @@ public class MonitoringPolicyTypeSerializationTest { assertEquals("Event name to which thresholds need to be applied", firstDataTypeSecondProperty .getDescription()); - ToscaProperty firstDataTypeThirdProperty = firstDataTypePropertiesIter.next(); + JpaToscaProperty firstDataTypeThirdProperty = firstDataTypePropertiesIter.next(); assertEquals("onap.datatypes.monitoring.metricsPerEventName", firstDataTypeThirdProperty.getKey() .getParentKeyName()); assertEquals("policyName", firstDataTypeThirdProperty.getKey().getLocalName()); @@ -209,7 +209,7 @@ public class MonitoringPolicyTypeSerializationTest { assertTrue(firstDataTypeThirdProperty.isRequired()); assertEquals("TCA Policy Scope Name", firstDataTypeThirdProperty.getDescription()); - ToscaProperty firstDataTypeFourthProperty = firstDataTypePropertiesIter.next(); + JpaToscaProperty firstDataTypeFourthProperty = firstDataTypePropertiesIter.next(); assertEquals("onap.datatypes.monitoring.metricsPerEventName", firstDataTypeFourthProperty.getKey() .getParentKeyName()); assertEquals("policyScope", firstDataTypeFourthProperty.getKey().getLocalName()); @@ -217,7 +217,7 @@ public class MonitoringPolicyTypeSerializationTest { assertTrue(firstDataTypeFourthProperty.isRequired()); assertEquals("TCA Policy Scope", firstDataTypeFourthProperty.getDescription()); - ToscaProperty firstDataTypeFifthProperty = firstDataTypePropertiesIter.next(); + JpaToscaProperty firstDataTypeFifthProperty = firstDataTypePropertiesIter.next(); assertEquals("onap.datatypes.monitoring.metricsPerEventName", firstDataTypeFifthProperty.getKey() .getParentKeyName()); assertEquals("policyVersion", firstDataTypeFifthProperty.getKey().getLocalName()); @@ -225,7 +225,7 @@ public class MonitoringPolicyTypeSerializationTest { assertTrue(firstDataTypeFifthProperty.isRequired()); assertEquals("TCA Policy Scope Version", firstDataTypeFifthProperty.getDescription()); - ToscaProperty firstDataTypeSixthProperty = firstDataTypePropertiesIter.next(); + JpaToscaProperty firstDataTypeSixthProperty = firstDataTypePropertiesIter.next(); assertEquals("onap.datatypes.monitoring.metricsPerEventName", firstDataTypeSixthProperty.getKey() .getParentKeyName()); assertEquals("thresholds", firstDataTypeSixthProperty.getKey().getLocalName()); @@ -238,15 +238,15 @@ public class MonitoringPolicyTypeSerializationTest { assertEquals("onap.datatypes.monitoring.thresholds", firstDataTypeSixthProperty.getEntrySchema().getType() .getName()); - Entry<PfConceptKey, ToscaDataType> secondDataType = dataTypesIter.next(); + Entry<PfConceptKey, JpaToscaDataType> secondDataType = dataTypesIter.next(); assertEquals("onap.datatypes.monitoring.tca_policy", secondDataType.getKey().getName()); - ToscaDataType secondDataTypeVal = secondDataType.getValue(); + JpaToscaDataType secondDataTypeVal = secondDataType.getValue(); assertEquals("tosca.datatypes.Root", secondDataTypeVal.getDerivedFrom().getName()); assertEquals("1.0.0", secondDataTypeVal.getDerivedFrom().getVersion()); assertTrue(secondDataTypeVal.getProperties().size() == 2); - Iterator<ToscaProperty> secondDataTypePropertiesIter = secondDataTypeVal.getProperties().iterator(); + Iterator<JpaToscaProperty> secondDataTypePropertiesIter = secondDataTypeVal.getProperties().iterator(); - ToscaProperty secondDataTypeFirstProperty = secondDataTypePropertiesIter.next(); + JpaToscaProperty secondDataTypeFirstProperty = secondDataTypePropertiesIter.next(); assertEquals("onap.datatypes.monitoring.tca_policy", secondDataTypeFirstProperty.getKey().getParentKeyName()); assertEquals("domain", secondDataTypeFirstProperty.getKey().getLocalName()); assertEquals("string", secondDataTypeFirstProperty.getType().getName()); @@ -258,11 +258,11 @@ public class MonitoringPolicyTypeSerializationTest { .getParentKeyName()); assertEquals("equal", secondDataTypeFirstProperty.getConstraints().iterator().next().getKey().getLocalName()); assertTrue(secondDataTypeFirstProperty.getConstraints().iterator().next() - instanceof ToscaConstraintLogicalString); - assertEquals("measurementsForVfScaling", ((ToscaConstraintLogicalString)(secondDataTypeFirstProperty + instanceof JpaToscaConstraintLogicalString); + assertEquals("measurementsForVfScaling", ((JpaToscaConstraintLogicalString)(secondDataTypeFirstProperty .getConstraints().iterator().next())).getCompareToString()); - ToscaProperty secondDataTypeSecondProperty = secondDataTypePropertiesIter.next(); + JpaToscaProperty secondDataTypeSecondProperty = secondDataTypePropertiesIter.next(); assertEquals("onap.datatypes.monitoring.tca_policy", secondDataTypeSecondProperty.getKey().getParentKeyName()); assertEquals("metricsPerEventName", secondDataTypeSecondProperty.getKey().getLocalName()); assertEquals("list", secondDataTypeSecondProperty.getType().getName()); @@ -275,15 +275,15 @@ public class MonitoringPolicyTypeSerializationTest { secondDataTypeSecondProperty.getEntrySchema().getType().getName()); assertEquals("entry_schema", secondDataTypeSecondProperty.getEntrySchema().getKey().getLocalName()); - Entry<PfConceptKey, ToscaDataType> thirdDataType = dataTypesIter.next(); + Entry<PfConceptKey, JpaToscaDataType> thirdDataType = dataTypesIter.next(); assertEquals("onap.datatypes.monitoring.thresholds", thirdDataType.getKey().getName()); - ToscaDataType thirdDataTypeVal = thirdDataType.getValue(); + JpaToscaDataType thirdDataTypeVal = thirdDataType.getValue(); assertEquals("tosca.datatypes.Root", thirdDataTypeVal.getDerivedFrom().getName()); assertEquals("1.0.0", thirdDataTypeVal.getDerivedFrom().getVersion()); assertTrue(thirdDataTypeVal.getProperties().size() == 7); - Iterator<ToscaProperty> thirdDataTypePropertiesIter = thirdDataTypeVal.getProperties().iterator(); + Iterator<JpaToscaProperty> thirdDataTypePropertiesIter = thirdDataTypeVal.getProperties().iterator(); - ToscaProperty thirdDataTypeFirstProperty = thirdDataTypePropertiesIter.next(); + JpaToscaProperty thirdDataTypeFirstProperty = thirdDataTypePropertiesIter.next(); assertEquals("onap.datatypes.monitoring.thresholds", thirdDataTypeFirstProperty.getKey().getParentKeyName()); assertEquals("closedLoopControlName", thirdDataTypeFirstProperty.getKey().getLocalName()); assertEquals("string", thirdDataTypeFirstProperty.getType().getName()); @@ -291,7 +291,7 @@ public class MonitoringPolicyTypeSerializationTest { assertEquals("Closed Loop Control Name associated with the threshold", thirdDataTypeFirstProperty .getDescription()); - ToscaProperty thirdDataTypeSecondProperty = thirdDataTypePropertiesIter.next(); + JpaToscaProperty thirdDataTypeSecondProperty = thirdDataTypePropertiesIter.next(); assertEquals("onap.datatypes.monitoring.thresholds", thirdDataTypeSecondProperty.getKey().getParentKeyName()); assertEquals("closedLoopEventStatus", thirdDataTypeSecondProperty.getKey().getLocalName()); assertEquals("string", thirdDataTypeSecondProperty.getType().getName()); @@ -304,11 +304,11 @@ public class MonitoringPolicyTypeSerializationTest { assertEquals("valid_values", thirdDataTypeSecondProperty.getConstraints().iterator().next().getKey() .getLocalName()); assertTrue(thirdDataTypeSecondProperty.getConstraints().iterator().next() - instanceof ToscaConstraintValidValues); - assertTrue(((ToscaConstraintValidValues)(thirdDataTypeSecondProperty.getConstraints().iterator().next())) + instanceof JpaToscaConstraintValidValues); + assertTrue(((JpaToscaConstraintValidValues)(thirdDataTypeSecondProperty.getConstraints().iterator().next())) .getValidValues().size() == 2); - ToscaProperty thirdDataTypeThirdProperty = thirdDataTypePropertiesIter.next(); + JpaToscaProperty thirdDataTypeThirdProperty = thirdDataTypePropertiesIter.next(); assertEquals("onap.datatypes.monitoring.thresholds", thirdDataTypeThirdProperty.getKey().getParentKeyName()); assertEquals("direction", thirdDataTypeThirdProperty.getKey().getLocalName()); assertEquals("string", thirdDataTypeThirdProperty.getType().getName()); @@ -320,10 +320,10 @@ public class MonitoringPolicyTypeSerializationTest { .getParentKeyName()); assertEquals("valid_values", thirdDataTypeThirdProperty.getConstraints().iterator().next().getKey() .getLocalName()); - assertTrue(((ToscaConstraintValidValues)(thirdDataTypeThirdProperty.getConstraints().iterator().next())) + assertTrue(((JpaToscaConstraintValidValues)(thirdDataTypeThirdProperty.getConstraints().iterator().next())) .getValidValues().size() == 5); - ToscaProperty thirdDataTypeFourthProperty = thirdDataTypePropertiesIter.next(); + JpaToscaProperty thirdDataTypeFourthProperty = thirdDataTypePropertiesIter.next(); assertEquals("onap.datatypes.monitoring.thresholds", thirdDataTypeFourthProperty.getKey().getParentKeyName()); assertEquals("fieldPath", thirdDataTypeFourthProperty.getKey().getLocalName()); assertEquals("string", thirdDataTypeFourthProperty.getType().getName()); @@ -336,10 +336,10 @@ public class MonitoringPolicyTypeSerializationTest { .getParentKeyName()); assertEquals("valid_values", thirdDataTypeFourthProperty.getConstraints().iterator().next().getKey() .getLocalName()); - assertTrue(((ToscaConstraintValidValues)(thirdDataTypeFourthProperty.getConstraints().iterator().next())) + assertTrue(((JpaToscaConstraintValidValues)(thirdDataTypeFourthProperty.getConstraints().iterator().next())) .getValidValues().size() == 43); - ToscaProperty thirdDataTypeFifthProperty = thirdDataTypePropertiesIter.next(); + JpaToscaProperty thirdDataTypeFifthProperty = thirdDataTypePropertiesIter.next(); assertEquals("onap.datatypes.monitoring.thresholds", thirdDataTypeFifthProperty.getKey().getParentKeyName()); assertEquals("severity", thirdDataTypeFifthProperty.getKey().getLocalName()); assertEquals("string", thirdDataTypeFifthProperty.getType().getName()); @@ -351,10 +351,10 @@ public class MonitoringPolicyTypeSerializationTest { .getParentKeyName()); assertEquals("valid_values", thirdDataTypeFifthProperty.getConstraints().iterator().next().getKey() .getLocalName()); - assertTrue(((ToscaConstraintValidValues)(thirdDataTypeFifthProperty.getConstraints().iterator().next())) + assertTrue(((JpaToscaConstraintValidValues)(thirdDataTypeFifthProperty.getConstraints().iterator().next())) .getValidValues().size() == 5);; - ToscaProperty thirdDataTypeSixthProperty = thirdDataTypePropertiesIter.next(); + JpaToscaProperty thirdDataTypeSixthProperty = thirdDataTypePropertiesIter.next(); assertEquals("onap.datatypes.monitoring.thresholds", thirdDataTypeSixthProperty.getKey().getParentKeyName()); assertEquals("thresholdValue", thirdDataTypeSixthProperty.getKey().getLocalName()); assertEquals("integer", thirdDataTypeSixthProperty.getType().getName()); @@ -362,7 +362,7 @@ public class MonitoringPolicyTypeSerializationTest { assertEquals("Threshold value for the field Path inside CEF message", thirdDataTypeSixthProperty .getDescription()); - ToscaProperty thirdDataTypeSeventhProperty = thirdDataTypePropertiesIter.next(); + JpaToscaProperty thirdDataTypeSeventhProperty = thirdDataTypePropertiesIter.next(); assertEquals("onap.datatypes.monitoring.thresholds", thirdDataTypeSeventhProperty.getKey().getParentKeyName()); assertEquals("version", thirdDataTypeSeventhProperty.getKey().getLocalName()); assertEquals("string", thirdDataTypeSeventhProperty.getType().getName()); @@ -370,7 +370,7 @@ public class MonitoringPolicyTypeSerializationTest { assertEquals("Version number associated with the threshold", thirdDataTypeSeventhProperty.getDescription()); } - private void verifyCollectorInputDeserialization(ToscaServiceTemplate serviceTemplate) { + private void verifyCollectorInputDeserialization(JpaToscaServiceTemplate serviceTemplate) { // Sanity check the entire structure assertNotNull(serviceTemplate); @@ -381,27 +381,27 @@ public class MonitoringPolicyTypeSerializationTest { assertEquals("tosca_simple_yaml_1_0_0", serviceTemplate.getToscaDefinitionsVersion()); // Check policy_types - Map<PfConceptKey, ToscaPolicyType> policyTypesConceptMap = serviceTemplate.getPolicyTypes().getConceptMap(); + Map<PfConceptKey, JpaToscaPolicyType> policyTypesConceptMap = serviceTemplate.getPolicyTypes().getConceptMap(); assertTrue(policyTypesConceptMap.size() == 2); - Iterator<Entry<PfConceptKey, ToscaPolicyType>> policyTypesIter = policyTypesConceptMap.entrySet().iterator(); + Iterator<Entry<PfConceptKey, JpaToscaPolicyType>> policyTypesIter = policyTypesConceptMap.entrySet().iterator(); - Entry<PfConceptKey, ToscaPolicyType> firstPolicyType = policyTypesIter.next(); + Entry<PfConceptKey, JpaToscaPolicyType> firstPolicyType = policyTypesIter.next(); assertEquals("onap.policies.Monitoring", firstPolicyType.getKey().getName()); assertEquals("1.0.0", firstPolicyType.getKey().getVersion()); assertEquals("tosca.policies.Root", firstPolicyType.getValue().getDerivedFrom().getName()); assertEquals("a base policy type for all policies that govern monitoring provision", firstPolicyType.getValue().getDescription()); - Entry<PfConceptKey, ToscaPolicyType> secondPolicyType = policyTypesIter.next(); + Entry<PfConceptKey, JpaToscaPolicyType> secondPolicyType = policyTypesIter.next(); assertEquals("onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server", secondPolicyType.getKey().getName()); assertEquals("1.0.0", secondPolicyType.getKey().getVersion()); assertEquals("policy.nodes.Root", secondPolicyType.getValue().getDerivedFrom().getName()); assertTrue(secondPolicyType.getValue().getProperties().size() == 2); - Iterator<ToscaProperty> propertiesIter = secondPolicyType.getValue().getProperties().iterator(); + Iterator<JpaToscaProperty> propertiesIter = secondPolicyType.getValue().getProperties().iterator(); - ToscaProperty firstProperty = propertiesIter.next(); + JpaToscaProperty firstProperty = propertiesIter.next(); assertEquals("onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server", firstProperty.getKey().getParentKeyName()); assertEquals("1.0.0", firstProperty.getKey().getParentKeyVersion()); @@ -409,7 +409,7 @@ public class MonitoringPolicyTypeSerializationTest { assertEquals("string", firstProperty.getType().getName()); assertEquals("DMAAP Bus Controller feed endpoint", firstProperty.getDescription()); - ToscaProperty secondProperty = propertiesIter.next(); + JpaToscaProperty secondProperty = propertiesIter.next(); assertEquals("onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server", secondProperty.getKey().getParentKeyName()); assertEquals("1.0.0", secondProperty.getKey().getParentKeyVersion()); @@ -418,7 +418,7 @@ public class MonitoringPolicyTypeSerializationTest { assertEquals("datafile Policy JSON as string", secondProperty.getDescription()); } - private String serializeMonitoringServiceTemplate(ToscaServiceTemplate serviceTemplate) { + private String serializeMonitoringServiceTemplate(JpaToscaServiceTemplate serviceTemplate) { return gson.toJson(serviceTemplate); } }
\ No newline at end of file |