List of usage examples for java.util Calendar DECEMBER
int DECEMBER
To view the source code for java.util Calendar DECEMBER.
Click Source Link
From source file:org.sipfoundry.sipxconfig.admin.dialplan.InternalRuleTest.java
@Override protected void setUp() throws Exception { m_schedule = new GeneralSchedule(); m_schedule.setName("Custom schedule"); WorkingHours[] hours = new WorkingHours[1]; WorkingTime wt = new WorkingTime(); hours[0] = new WorkingHours(); Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT")); cal.set(2006, Calendar.DECEMBER, 31, 10, 12); hours[0].setStart(cal.getTime());//from w w w . j a va 2s . c om cal.set(2006, Calendar.DECEMBER, 31, 11, 88); hours[0].setStop(cal.getTime()); hours[0].setEnabled(true); hours[0].setDay(ScheduledDay.WEDNESDAY); wt.setWorkingHours(hours); wt.setEnabled(true); m_schedule.setWorkingTime(wt); m_mediaServer = new FreeswitchMediaServer(); FreeswitchMediaServerTest.configureMediaServer(m_mediaServer); m_localizationContext = EasyMock.createNiceMock(LocalizationContext.class); m_mediaServer.setLocalizationContext(m_localizationContext); m_beanFactory = EasyMock.createNiceMock(BeanFactory.class); m_beanFactory.getBean("freeswitchMediaServer", MediaServer.class); EasyMock.expectLastCall().andReturn(m_mediaServer); }
From source file:org.lieuofs.commune.biz.RechercheCommuneTest.java
@Test public void recherche2012() { CommuneCritere critere = new CommuneCritere(); Calendar cal = Calendar.getInstance(); cal.set(2012, Calendar.JANUARY, 1); critere.setDateValiditeApres(cal.getTime()); cal.set(2012, Calendar.DECEMBER, 31); critere.setDateValiditeAvant(cal.getTime()); List<ICommuneSuisse> communes = gestionnaire.rechercher(critere); IterableAssert<Object> liste = assertThat(extractProperty("numeroOFS").from(communes)); // La commune Collina d'Oro(5236) a absorb la commune Carabietta(5169) le 01.04.2012 // Les 2 communes ont donc exist en 2012 liste.contains(5236, 5169);//from w w w . ja v a 2s . c om // La commune Estavayer-le-Lac(2015) a absorb la commune Font(2017) le 01.01.2012 liste.contains(2015).doesNotContain(2017); // La commune Val Terbi(6730) est ne de la fusion des communes Montsevelier(6717), Vermes(6726), Vicques(6727) le 01.01.2013 liste.contains(6717, 6726, 6727).doesNotContain(6730); // 2496 communes valides en 2012 (2 doublons de numOFS !!) liste.hasSize(2498); }
From source file:net.audumla.astronomy.SeasonTest.java
@Test public void testSummerStart() throws Exception { SeasonalEvent event = new SeasonalEvent(SeasonalEvent.SUMMERSTART, Geolocation.newGeoLocation(30, 0, 0)); Date et = event.calculateEventFrom(new Date()); assert DateUtils.toCalendar(et).get(Calendar.MONTH) == Calendar.JUNE; event = new SeasonalEvent(SeasonalEvent.SUMMERSTART, Geolocation.newGeoLocation(-30, 0, 0)); et = event.calculateEventFrom(new Date()); assert DateUtils.toCalendar(et).get(Calendar.MONTH) == Calendar.DECEMBER; }
From source file:org.sipfoundry.sipxconfig.admin.dialplan.SiteToSiteDialingRuleTest.java
@Before public void setUp() throws Exception { m_schedule = new GeneralSchedule(); m_schedule.setName("Custom schedule"); WorkingHours[] hours = new WorkingHours[1]; WorkingTime wt = new WorkingTime(); hours[0] = new WorkingHours(); Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT")); cal.set(2006, Calendar.DECEMBER, 31, 10, 12); hours[0].setStart(cal.getTime());// ww w . java 2 s.com cal.set(2006, Calendar.DECEMBER, 31, 11, 88); hours[0].setStop(cal.getTime()); hours[0].setEnabled(true); hours[0].setDay(ScheduledDay.WEDNESDAY); wt.setWorkingHours(hours); wt.setEnabled(true); m_schedule.setWorkingTime(wt); DialPattern[] dialPatterns = new DialPattern[PATTERN_COUNT]; for (int i = 0; i < dialPatterns.length; i++) { DialPattern p = new DialPattern(); p.setPrefix("91"); p.setDigits(i + 2); dialPatterns[i] = p; } m_patternsList = Arrays.asList(dialPatterns); m_rule = new SiteToSiteDialingRule(); m_rule.setDialPatterns(m_patternsList); for (int i = 0; i < GATEWAYS.length; i++) { Gateway gateway = new Gateway(); gateway.setUniqueId(); gateway.setAddress(GATEWAYS[i]); gateway.setPrefix(PREFIXES[i]); gateway.setAddressPort(PORTS[i]); m_rule.addGateway(gateway); } m_rule.setEnabled(true); m_rule.setCallPattern(new CallPattern("999", CallDigits.VARIABLE_DIGITS)); }
From source file:moviemanager.backend.PersonManagerTest.java
/** * Unit test for adding persons to database. * Attempts to add person to the database and checks if person is present in list of all persons in the database. *///from ww w.j av a 2 s . co m @Test public void testAddPerson() { log.info("Testing adding person..."); Calendar calendar = new GregorianCalendar(1995, Calendar.DECEMBER, 1); Person person = new Person("Jane Doe (Add)", calendar); personManager.createPerson(person); Long id = person.getId(); assertNotNull(id); Person result = personManager.getPerson(id); assertEquals(person, result); assertNotSame(person, result); }
From source file:com.blackberry.logdriver.timestamp.Rfc3164TimestampParser.java
@Override public long parseTimestatmp(String timestamp) throws ParseException { if (timestamp == null) { throw new ParseException("Timestamp is null", 0); }/*from www .j a v a 2 s . co m*/ // Before we parse the date, add the current year to the string. That way, // we get a correct timestamp. If I try to add the year after, we run into // issues with leap years. Calendar currentCalendar = Calendar.getInstance(); int currentYear = currentCalendar.get(Calendar.YEAR); Date date = dateFormat.parse(currentYear + " " + timestamp); Calendar logCalendar = Calendar.getInstance(); logCalendar.setTime(date); // If today is the first of January, and the log is for the 31st of // December, then we probably just used the wrong year. So lets roll the // year back by one in that case. if (logCalendar.get(Calendar.DAY_OF_MONTH) == 31 && logCalendar.get(Calendar.MONTH) == Calendar.DECEMBER && currentCalendar.get(Calendar.DAY_OF_MONTH) == 1 && currentCalendar.get(Calendar.MONTH) == Calendar.JANUARY) { logCalendar.add(Calendar.YEAR, -1); // Contrariwise, a bad clock can give us Jan 1 logs on December 31 } else if (currentCalendar.get(Calendar.DAY_OF_MONTH) == 31 && currentCalendar.get(Calendar.MONTH) == Calendar.DECEMBER && logCalendar.get(Calendar.DAY_OF_MONTH) == 1 && logCalendar.get(Calendar.MONTH) == Calendar.JANUARY) { logCalendar.add(Calendar.YEAR, 1); } return logCalendar.getTimeInMillis(); }
From source file:org.sipfoundry.sipxconfig.dialplan.InternalRuleTest.java
@Override protected void setUp() throws Exception { m_schedule = new GeneralSchedule(); m_schedule.setName("Custom schedule"); WorkingHours[] hours = new WorkingHours[1]; WorkingTime wt = new WorkingTime(); hours[0] = new WorkingHours(); Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT")); cal.set(2006, Calendar.DECEMBER, 31, 10, 12); hours[0].setStart(cal.getTime());/*from w ww . ja v a 2 s . com*/ cal.set(2006, Calendar.DECEMBER, 31, 11, 88); hours[0].setStop(cal.getTime()); hours[0].setEnabled(true); hours[0].setDay(ScheduledDay.WEDNESDAY); wt.setWorkingHours(hours); wt.setEnabled(true); m_schedule.setWorkingTime(wt); m_mediaServer = new FreeswitchMediaServer(); AddressManager addressManager = createMock(AddressManager.class); addressManager.getSingleAddress(FreeswitchFeature.SIP_ADDRESS); expectLastCall().andReturn(new Address(FreeswitchFeature.SIP_ADDRESS, "192.168.1.1", 100)).anyTimes(); replay(addressManager); m_mediaServer.setAddressManager(addressManager); m_localizationContext = EasyMock.createNiceMock(LocalizationContext.class); m_mediaServer.setLocalizationContext(m_localizationContext); m_beanFactory = EasyMock.createNiceMock(BeanFactory.class); m_beanFactory.getBean("freeswitchMediaServer", MediaServer.class); EasyMock.expectLastCall().andReturn(m_mediaServer); }
From source file:org.projectforge.plugins.teamcal.event.TeamEventDaoTestFork.java
@Test public void accessTest() { final TeamCalTestHelper testHelper = new TeamCalTestHelper(); final TeamCalDO cal = testHelper.prepareUsersAndGroups("teamEvent", this, getTeamCalDao()); calId = cal.getId();//from w ww. j a v a2 s . c o m logon(testHelper.getOwner()); final TeamEventDO event = new TeamEventDO(); event.setStartDate( new Timestamp(DateHelperTest.createDate(2012, Calendar.DECEMBER, 8, 8, 0, 0, 0).getTime())); event.setEndDate( new Timestamp(DateHelperTest.createDate(2012, Calendar.DECEMBER, 8, 15, 0, 0, 0).getTime())); event.setSubject("Testing the event dao."); event.setAttendees(new TreeSet<TeamEventAttendeeDO>()); event.getAttendees().add(new TeamEventAttendeeDO().setUrl("k.reinhard@acme.com")); event.setLocation("At home").setNote("This is a note."); try { log.info("Next AccessException is expected:"); teamEventDao.save(event); Assert.fail("AccessException expected, no calendar given in event."); } catch (final AccessException ex) { // OK } event.setCalendar(cal); eventId = (Integer) teamEventDao.save(event); checkSelectAccess(true, testHelper.getOwner(), testHelper.getFullUser1(), testHelper.getFullUser3(), testHelper.getReadonlyUser1(), testHelper.getReadonlyUser3()); checkSelectAccess(false, testHelper.getNoAccessUser()); checkUpdateAccess(event, true, testHelper.getOwner(), testHelper.getFullUser1(), testHelper.getFullUser3()); checkUpdateAccess(event, false, testHelper.getReadonlyUser1(), testHelper.getReadonlyUser3(), testHelper.getMinimalUser1(), testHelper.getMinimalUser3(), testHelper.getNoAccessUser(), getUser(TEST_ADMIN_USER)); checkMinimalAccess(eventId, testHelper.getMinimalUser1(), testHelper.getMinimalUser3()); }
From source file:org.lieuofs.commune.biz.GestionCommuneTest.java
@Test public void rechercheLaTourDeTreme() { // numro OFS 2154 : la Tour de Trme a t incluse dans Bulle le 1er janvier 2006 CommuneCritere critere = new CommuneCritere(); critere.setCodeCanton("FR"); Calendar cal = Calendar.getInstance(); cal.setTimeZone(TimeZone.getTimeZone("Europe/Zurich")); cal.set(2005, Calendar.DECEMBER, 31); critere.setDateValidite(cal.getTime()); List<ICommuneSuisse> communes = gestionnaire.rechercher(critere); boolean trouve = false; for (ICommuneSuisse commune : communes) { if (2154 == commune.getNumeroOFS()) { trouve = true;//from w w w . ja va 2s .c om break; } } assertTrue("Le 31 dcembre 2005 la Tour-de-Trme est une commune fribourgeoise", trouve); cal.add(Calendar.DATE, 1); critere.setDateValidite(cal.getTime()); communes = gestionnaire.rechercher(critere); trouve = false; for (ICommuneSuisse commune : communes) { if (2154 == commune.getNumeroOFS()) { trouve = true; break; } } assertTrue("Le 1er janvier 2006 la Tour-de-Trme n'est plus une commune fribourgeoise", !trouve); }
From source file:org.sipfoundry.sipxconfig.admin.dialplan.CustomDialingRuleTest.java
@Before public void setUp() throws Exception { m_schedule = new GeneralSchedule(); m_schedule.setName("Custom schedule"); WorkingHours[] hours = new WorkingHours[1]; WorkingTime wt = new WorkingTime(); hours[0] = new WorkingHours(); Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT")); cal.set(2006, Calendar.DECEMBER, 31, 10, 12); hours[0].setStart(cal.getTime());// w ww . j a v a2s . c o m cal.set(2006, Calendar.DECEMBER, 31, 11, 88); hours[0].setStop(cal.getTime()); hours[0].setEnabled(true); hours[0].setDay(ScheduledDay.WEDNESDAY); wt.setWorkingHours(hours); wt.setEnabled(true); m_schedule.setWorkingTime(wt); DialPattern[] dialPatterns = new DialPattern[PATTERN_COUNT]; for (int i = 0; i < dialPatterns.length; i++) { DialPattern p = new DialPattern(); p.setPrefix("91"); p.setDigits(i + 2); dialPatterns[i] = p; } m_patternsList = Arrays.asList(dialPatterns); m_rule = new CustomDialingRule(); m_rule.setDialPatterns(m_patternsList); for (int i = 0; i < GATEWAYS.length; i++) { Gateway gateway = new Gateway(); gateway.setUniqueId(); gateway.setAddress(GATEWAYS[i]); gateway.setPrefix(PREFIXES[i]); gateway.setAddressPort(PORTS[i]); m_rule.addGateway(gateway); } m_rule.setEnabled(true); m_rule.setCallPattern(new CallPattern("999", CallDigits.VARIABLE_DIGITS)); }