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