• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java HolidayCalendar类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中org.quartz.impl.calendar.HolidayCalendar的典型用法代码示例。如果您正苦于以下问题:Java HolidayCalendar类的具体用法?Java HolidayCalendar怎么用?Java HolidayCalendar使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

HolidayCalendar类属于org.quartz.impl.calendar包,在下文中一共展示了HolidayCalendar类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createRegistry

点赞 2

import org.quartz.impl.calendar.HolidayCalendar; //导入依赖的package包/类
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry jndi = super.createRegistry();

    HolidayCalendar cal = new HolidayCalendar();
    java.util.Calendar tomorrow = java.util.Calendar.getInstance();
    tomorrow.setTime(new Date());
    tomorrow.add(java.util.Calendar.DAY_OF_MONTH, 1);
    cal.addExcludedDate(tomorrow.getTime());

    jndi.bind("calendar", cal);
    return jndi;
}
 

开发者ID:HydAu,
项目名称:Camel,
代码行数:14,
代码来源:QuartzCustomCalendarFireTest.java

示例2: createRegistry

点赞 2

import org.quartz.impl.calendar.HolidayCalendar; //导入依赖的package包/类
@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry jndi = super.createRegistry();

    HolidayCalendar cal = new HolidayCalendar();
    cal.addExcludedDate(new Date());

    jndi.bind("calendar", cal);
    return jndi;
}
 

开发者ID:HydAu,
项目名称:Camel,
代码行数:11,
代码来源:QuartzCustomCalendarNoFireTest.java

示例3: holidayCalendar

点赞 2

import org.quartz.impl.calendar.HolidayCalendar; //导入依赖的package包/类
@Test
public void holidayCalendar() throws Exception {
    // HolidayCalendar sets the time of any given Date to 00:00:00
    java.util.Calendar cal = java.util.Calendar.getInstance();
    cal.set(java.util.Calendar.HOUR_OF_DAY, 0);
    cal.set(java.util.Calendar.MINUTE, 0);
    cal.set(java.util.Calendar.SECOND, 0);
    cal.set(java.util.Calendar.MILLISECOND, 0);
    final Date excludedDate = cal.getTime();

    HolidayCalendar calendar = new HolidayCalendar();
    calendar.addExcludedDate(excludedDate);
    final String name = "holidayCalendar";
    jobStore.storeCalendar(name, calendar, true, true);

    final String calendarHashKey = schema.calendarHashKey(name);
    Map<String, String> calendarMap = jedis.hgetAll(calendarHashKey);

    assertThat(calendarMap, hasKey("calendar_class"));
    assertThat(calendarMap.get("calendar_class"), equalTo(HolidayCalendar.class.getName()));
    assertThat(calendarMap, hasKey("calendar_json"));
    String json = calendarMap.get("calendar_json");
    assertThat(json, containsString("\"dates\":["));
    assertThat(json, not(containsString("\"excludedDates\":")));

    Calendar retrieved = jobStore.retrieveCalendar(name);
    assertThat(retrieved, notNullValue());
    assertThat(retrieved, instanceOf(HolidayCalendar.class));
    HolidayCalendar retrievedHoliday = (HolidayCalendar) retrieved;
    assertThat(retrievedHoliday.getExcludedDates(), hasItem(excludedDate));
}
 

开发者ID:jlinn,
项目名称:quartz-redis-jobstore,
代码行数:32,
代码来源:StoreCalendarTest.java

示例4: shouldStoreAndRetrieveCalendar

点赞 2

import org.quartz.impl.calendar.HolidayCalendar; //导入依赖的package包/类
@Test
public void shouldStoreAndRetrieveCalendar() throws Exception {
    DateTime now = new DateTime();
    HolidayCalendar testCalendar = new HolidayCalendar();
    testCalendar.addExcludedDate(now.plusDays(1).toDate());

    String calendarName = id("testCalendar");
    couchdbStore.storeCalendar(calendarName, testCalendar, false, false);

    Calendar dbCalendar = couchdbStore.retrieveCalendar(calendarName);
    assertEquals(testCalendar.getClass(), dbCalendar.getClass());
    assertEquals(testCalendar.getExcludedDates(), ((HolidayCalendar) dbCalendar).getExcludedDates());
}
 

开发者ID:motech,
项目名称:quartz-couchdb-store,
代码行数:14,
代码来源:CouchDbCalendarStoreIT.java

示例5: shouldReplaceExistingCalendar

点赞 2

import org.quartz.impl.calendar.HolidayCalendar; //导入依赖的package包/类
@Test
public void shouldReplaceExistingCalendar() throws Exception {
    HolidayCalendar testCalendar = new HolidayCalendar();
    testCalendar.addExcludedDate(new Date());

    String calendarName = id("testCalendar");
    couchdbStore.storeCalendar(calendarName, testCalendar, false, false);
    couchdbStore.storeCalendar(calendarName, new HolidayCalendar(), true, false);

    HolidayCalendar dbCalendar = (HolidayCalendar) couchdbStore.retrieveCalendar(calendarName);
    assertEquals(0, dbCalendar.getExcludedDates().size());
}
 

开发者ID:motech,
项目名称:quartz-couchdb-store,
代码行数:13,
代码来源:CouchDbCalendarStoreIT.java

示例6: shouldNotUpdateExistingTriggers

点赞 2

import org.quartz.impl.calendar.HolidayCalendar; //导入依赖的package包/类
@Test
public void shouldNotUpdateExistingTriggers() throws Exception {
    String triggerName = id("triggerName");
    String triggerGroup = id("triggerGroup");
    String calendarName = id("testCalendar");

    couchdbStore.storeCalendar(calendarName, new HolidayCalendar(), false, false);

    final DateTime startTime = new DateTime().plusDays(1);
    OperableTrigger trigger = (SimpleTriggerImpl) newTrigger()
            .withIdentity(triggerName, triggerGroup)
            .forJob(JobKey.jobKey(id("jobName"), id("jobGroup")))
            .startAt(startTime.toDate())
            .withSchedule(simpleSchedule()
                    .withIntervalInHours(24)
                    .repeatForever())
            .modifiedByCalendar(calendarName)
            .build();
    trigger.computeFirstFireTime(couchdbStore.retrieveCalendar(calendarName));
    couchdbStore.storeTrigger(trigger, false);

    OperableTrigger triggerWithEmptyCalendar = couchdbStore.retrieveTrigger(TriggerKey.triggerKey(triggerName, triggerGroup));
    assertEquals(startTime.toDate(), triggerWithEmptyCalendar.getNextFireTime());

    HolidayCalendar testCalendar = new HolidayCalendar();
    testCalendar.addExcludedDate(startTime.toDate());
    couchdbStore.storeCalendar(calendarName, testCalendar, true, false);
    assertEquals(startTime.toDate(), triggerWithEmptyCalendar.getNextFireTime());

    couchdbStore.storeCalendar(calendarName, testCalendar, true, true);
    OperableTrigger triggerWithTestCalendar = couchdbStore.retrieveTrigger(TriggerKey.triggerKey(triggerName, triggerGroup));
    assertEquals(startTime.plusDays(1).toDate(), triggerWithTestCalendar.getNextFireTime());
}
 

开发者ID:motech,
项目名称:quartz-couchdb-store,
代码行数:34,
代码来源:CouchDbCalendarStoreIT.java

示例7: shouldRemoveCalendar

点赞 2

import org.quartz.impl.calendar.HolidayCalendar; //导入依赖的package包/类
@Test
public void shouldRemoveCalendar() throws JobPersistenceException {
    HolidayCalendar testCalendar = new HolidayCalendar();

    String calendarName = id("testCalendar");
    couchdbStore.storeCalendar(calendarName, testCalendar, false, false);

    assertTrue(couchdbStore.removeCalendar(calendarName));

    assertNull(couchdbStore.retrieveCalendar(calendarName));
}
 

开发者ID:motech,
项目名称:quartz-couchdb-store,
代码行数:12,
代码来源:CouchDbCalendarStoreIT.java

示例8: shouldNotReplaceExistingCalendar

点赞 2

import org.quartz.impl.calendar.HolidayCalendar; //导入依赖的package包/类
@Test(expected = ObjectAlreadyExistsException.class)
public void shouldNotReplaceExistingCalendar() throws Exception {
    couchdbStore.storeCalendar("testCalendar", new HolidayCalendar(), false, false);
    couchdbStore.storeCalendar("testCalendar", new HolidayCalendar(), false, false);
}
 

开发者ID:motech,
项目名称:quartz-couchdb-store,
代码行数:6,
代码来源:CouchDbCalendarStoreIT.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)