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