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