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