use of org.testng.annotations.Test in project che by eclipse.
the class CronExpressionTest method testIsSatisfiedBy.
/*
* Test method for 'org.quartz.CronExpression.isSatisfiedBy(Date)'.
*/
@Test
public void testIsSatisfiedBy() throws Exception {
CronExpression cronExpression = new CronExpression("0 15 10 * * ? 2005");
Calendar cal = Calendar.getInstance();
cal.set(2005, Calendar.JUNE, 1, 10, 15, 0);
assertTrue(cronExpression.isSatisfiedBy(cal.getTime()));
cal.set(Calendar.YEAR, 2006);
assertFalse(cronExpression.isSatisfiedBy(cal.getTime()));
cal = Calendar.getInstance();
cal.set(2005, Calendar.JUNE, 1, 10, 16, 0);
assertFalse(cronExpression.isSatisfiedBy(cal.getTime()));
cal = Calendar.getInstance();
cal.set(2005, Calendar.JUNE, 1, 10, 14, 0);
assertFalse(cronExpression.isSatisfiedBy(cal.getTime()));
}
use of org.testng.annotations.Test in project che by eclipse.
the class CronExpressionTest method testQtz259.
/**
* QTZ-259 : last day offset causes repeating fire time
*/
@Test
public void testQtz259() throws Exception {
CronExpression cronExpression = new CronExpression("0 0 0 L-2 * ? *");
int i = 0;
Date pdate = cronExpression.getNextValidTimeAfter(new Date());
while (++i < 26) {
Date date = cronExpression.getNextValidTimeAfter(pdate);
LOG.info("fireTime: " + date + ", previousFireTime: " + pdate);
assertFalse(pdate.equals(date), "Next fire time is the same as previous fire time!");
pdate = date;
}
}
use of org.testng.annotations.Test in project che by eclipse.
the class CronExpressionTest method testQtz259LW.
/**
* QTZ-259 : last day offset causes repeating fire time
*/
@Test
public void testQtz259LW() throws Exception {
CronExpression cronExpression = new CronExpression("0 0 0 LW * ? *");
int i = 0;
Date pdate = cronExpression.getNextValidTimeAfter(new Date());
while (++i < 26) {
Date date = cronExpression.getNextValidTimeAfter(pdate);
LOG.info("fireTime: " + date + ", previousFireTime: " + pdate);
assertFalse(pdate.equals(date), "Next fire time is the same as previous fire time!");
pdate = date;
}
}
use of org.testng.annotations.Test in project che by eclipse.
the class PersistTestModuleBuilderTest method generatesPersistenceXml.
@Test
public void generatesPersistenceXml() throws Exception {
Path path = new PersistTestModuleBuilder().setDriver("org.h2.Driver").addEntityClass(MyEntity1.class).addEntityClass("org.eclipse.che.commons.test.db.PersistTestModuleBuilderTest$MyEntity2").setUrl("jdbc:h2:mem:test").setUser("username").setPassword("secret").setLogLevel("FINE").setPersistenceUnit("test-unit").setExceptionHandler(MyExceptionHandler.class).setProperty("custom-property", "value").savePersistenceXml();
URL url = Thread.currentThread().getContextClassLoader().getResource("org/eclipse/che/commons/test/db/test-persistence-1.xml");
assertNotNull(url);
assertEquals(new String(Files.readAllBytes(path), UTF_8), Resources.toString(url, UTF_8));
}
use of org.testng.annotations.Test in project che by eclipse.
the class AgentKeyImplTest method testAgentKeyWithNameAndVersion.
@Test
public void testAgentKeyWithNameAndVersion() {
AgentKeyImpl agentKey = AgentKeyImpl.parse("id:1");
assertEquals(agentKey.getId(), "id");
assertEquals(agentKey.getVersion(), "1");
}
Aggregations