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());
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());
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));
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);
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);
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 {
}
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);