Search in sources :

Example 26 with Test

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()));
}
Also used : Calendar(java.util.Calendar) Test(org.testng.annotations.Test)

Example 27 with Test

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;
    }
}
Also used : Date(java.util.Date) Test(org.testng.annotations.Test)

Example 28 with Test

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;
    }
}
Also used : Date(java.util.Date) Test(org.testng.annotations.Test)

Example 29 with Test

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));
}
Also used : Path(java.nio.file.Path) URL(java.net.URL) Test(org.testng.annotations.Test)

Example 30 with Test

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");
}
Also used : AgentKeyImpl(org.eclipse.che.api.agent.shared.model.impl.AgentKeyImpl) Test(org.testng.annotations.Test)

Aggregations

Test (org.testng.annotations.Test)24007 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)2438 Task (com.evolveum.midpoint.task.api.Task)2069 File (java.io.File)1433 ArrayList (java.util.ArrayList)1237 BaseTest (org.broadinstitute.hellbender.utils.test.BaseTest)1188 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)1078 HashMap (java.util.HashMap)965 CommandLineProgramTest (org.broadinstitute.hellbender.CommandLineProgramTest)814 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)692 BeforeTest (org.testng.annotations.BeforeTest)692 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)690 ODocument (com.orientechnologies.orient.core.record.impl.ODocument)651 Parameters (org.testng.annotations.Parameters)610 BaseTest (org.xdi.oxauth.BaseTest)582 BigDecimal (java.math.BigDecimal)574 List (java.util.List)558 LocalDate (org.joda.time.LocalDate)553 HashSet (java.util.HashSet)548 BaseTest (util.BaseTest)537