List of usage examples for java.util Calendar MARCH
int MARCH
To view the source code for java.util Calendar MARCH.
Click Source Link
From source file:net.audumla.astronomy.SeasonTest.java
@Test public void testAutumnStart() throws Exception { SeasonalEvent event = new SeasonalEvent(SeasonalEvent.AUTUMNSTART, Geolocation.newGeoLocation(30, 0, 0)); Date et = event.calculateEventFrom(new Date()); assert DateUtils.toCalendar(et).get(Calendar.MONTH) == Calendar.SEPTEMBER; event = new SeasonalEvent(SeasonalEvent.AUTUMNSTART, Geolocation.newGeoLocation(-30, 0, 0)); et = event.calculateEventFrom(new Date()); assert DateUtils.toCalendar(et).get(Calendar.MONTH) == Calendar.MARCH; }
From source file:com.cemeterylistingswebtest.test.services.ViewListingsBySubscriberServiceTest.java
@Test(enabled = false) public void hello() { subserv = ctx.getBean(ViewListingBySubscriberService.class); repoList = ctx.getBean(PublishedDeceasedListingRepository.class); subRepo = ctx.getBean(SubscriberRepository.class); userRepo = ctx.getBean(UserRoleRepository.class); //Initialise date Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, 2008); calendar.set(Calendar.MONTH, Calendar.MARCH); calendar.set(Calendar.DATE, 5); java.sql.Date javaSqlDate = new java.sql.Date(calendar.getTime().getTime()); //Initialise date Calendar calendar2 = Calendar.getInstance(); calendar2.set(Calendar.YEAR, 2014); calendar2.set(Calendar.MONTH, Calendar.JUNE); calendar2.set(Calendar.DATE, 20); java.sql.Date validDate = new java.sql.Date(calendar2.getTime().getTime()); //Initialise user role UserRole userRole = new UserRole.Builder().setLevel(2).build(); //userRepo.save(userRole); //userRoleID = userRole.getUserRoleID(); //Initialise subscriber Subscriber newSub = new Subscriber.Builder().setEmail("jackieChan@yahoo.com").setFirstName("jackie") .setSurname("Chan").setPwd("whaa").setUsername("jChan").setSubscriptionDate(javaSqlDate) .setUserRoleID(userRole).setValidUntil(validDate).build(); subRepo.save(newSub);// w w w .j a v a 2s. c o m subID = newSub.getSubscriberID(); PublishedDeceasedListing newListing = new PublishedDeceasedListing.Builder().setFirstName("Julie") .setSurname("Romanov").setMaidenName("black").setGender("Female").setDateOfBirth("08/06/1974") .setDateOfDeath("14/02/2009").setGraveInscription("triple agent").setGraveNumber("2986") .setImageOfBurialSite("/images/001.jpg") .setSubscriberSubmitID(subID).build(); repoList.save(newListing); List<PublishedDeceasedListing> pubListDod = subserv.findListingBySubscriber(javaSqlDate, validDate); Assert.assertFalse(pubListDod.isEmpty()); //Assert.assertTrue(pubListDod.isEmpty()); repoList.delete(newListing); subRepo.delete(newSub); }
From source file:net.audumla.astronomy.SeasonTest.java
@Test public void testSpringStart() throws Exception { SeasonalEvent event = new SeasonalEvent(SeasonalEvent.SPRINGSTART, Geolocation.newGeoLocation(30, 0, 0)); Date et = event.calculateEventFrom(new Date()); assert DateUtils.toCalendar(et).get(Calendar.MONTH) == Calendar.MARCH; event = new SeasonalEvent(SeasonalEvent.SPRINGSTART, Geolocation.newGeoLocation(-30, 0, 0)); et = event.calculateEventFrom(new Date()); assert DateUtils.toCalendar(et).get(Calendar.MONTH) == Calendar.SEPTEMBER; }
From source file:org.sipfoundry.sipxconfig.device.DeviceTimeZone.java
private void setDstParameters(String dstRule) { if (m_useDaylight) { // DST: Daylight Savings Time // LST: Local Standard Time - local time when DST is not in effect // LDT: Local Daylight Time - local time when DST is in effect if (dstRule.equals(DST_US)) { // http://en.wikipedia.org/wiki/Daylight_saving_time_around_the_world#North_America // into DST - 02:00 LST --> 03:00 LDT // out of DST - 02:00 LDT --> 01:00 LST m_startMonth = Calendar.MARCH; m_startWeek = 2;// w ww. j ava 2 s. c o m m_startDayOfWeek = Calendar.SUNDAY; m_startTime = 2/*am*/ * MINUTES_PER_HOUR; // 02:00 LST m_stopMonth = Calendar.NOVEMBER; m_stopWeek = 1; m_stopDayOfWeek = Calendar.SUNDAY; m_stopTime = 2/*am*/ * MINUTES_PER_HOUR; // 02:00 LDT } else if (dstRule.equals(DST_EU)) { // http://en.wikipedia.org/wiki/European_Summer_Time // into DST - 01:00 GMT --> 02:00 GMT // out of DST - 01:00 GMT --> 00:00 GMT m_startMonth = Calendar.MARCH; m_startWeek = DST_LASTWEEK; m_startDayOfWeek = Calendar.SUNDAY; // LST = 01:00 GMT + Time Zone Offset m_startTime = (1/*am*/ * MINUTES_PER_HOUR) + getOffset(); m_stopMonth = Calendar.OCTOBER; m_stopWeek = DST_LASTWEEK; m_stopDayOfWeek = Calendar.SUNDAY; // LDT = 01:00 GMT + Time Zone Offset + Daylight Savings m_stopTime = (1/*am*/ * MINUTES_PER_HOUR) + getOffset() + getDstSavings(); } } else { // if we don't use DST, set the parameters to 0 to not confuse the phones m_startMonth = 0; m_startWeek = 0; m_startDayOfWeek = 0; m_startTime = 0; m_stopMonth = 0; m_stopDayOfWeek = 0; m_stopWeek = 0; m_stopTime = 0; } }
From source file:edu.northwestern.bioinformatics.studycalendar.web.schedule.ScheduleActivityCommandTest.java
protected void setUp() throws Exception { super.setUp(); user = new PscUserBuilder("eileen").add(PscRole.STUDY_SUBJECT_CALENDAR_MANAGER).forAllSites() .forAllStudies().toUser();/*from ww w . j av a2 s .c om*/ scheduledCalendarDao = registerMockFor(ScheduledCalendarDao.class); command = new ScheduleActivityCommand(scheduledCalendarDao, user); site = Fixtures.createSite("NU"); study = Fixtures.createSingleEpochStudy("ABC 4678", "Follow up"); StudySite studySite = Fixtures.createStudySite(study, site); StudySubjectAssignment assignment = Fixtures.createAssignment(studySite, Fixtures.createSubject("Suzy", "Subject")); event = Fixtures.createScheduledActivity("ABC", 2003, Calendar.MARCH, 13); event.setScheduledStudySegment(new ScheduledStudySegment()); event.getScheduledStudySegment().setScheduledCalendar(new ScheduledCalendar()); event.getScheduledStudySegment().getScheduledCalendar().setAssignment(assignment); command.setEvent(event); command.setNewReason(NEW_REASON); command.setNewDate(NEW_DATE); }
From source file:net.audumla.astronomy.SeasonalEvent.java
protected static double autumnStart(int year, double latitude) { Date t = Time.getZeroDate(); t = DateUtils.setYears(t, year);// www. j ava 2 s.c o m if (latitude >= 0) { t = DateUtils.setMonths(t, Calendar.SEPTEMBER); } else { t = DateUtils.setMonths(t, Calendar.MARCH); } return new JulianDate(t).julian(); }
From source file:com.zergiu.tvman.jobs.TestTVRageShowLoader.java
/** * Test method for {@link com.zergiu.tvman.shows.tvrage.TVRageShowLoaderJob#execute(org.quartz.JobExecutionContext)}. * @throws JobExecutionException //from w w w . j a v a 2s . co m */ @Test public void testExecuteBuffyTheVampireSlayer() throws JobExecutionException { context.checking(new Expectations() { { oneOf(jobContext).getJobDetail(); will(returnValue(jobDetail)); } }); context.checking(new Expectations() { { oneOf(jobDetail).getJobBuilder(); will(returnValue(JobBuilder.newJob())); } }); show.setProviderSeriesId("2930"); showLoader = createShowLoader("resources/tvrage/buffy_full_show_info.xml"); showLoader.execute(jobContext); context.assertIsSatisfied(); assertNotNull(show.getSeasons()); assertEquals(7, show.getSeasons().size()); assertEquals(144, getEpisodeCount()); assertEquals(TVShowStatus.Ended, show.getStatus()); Calendar firstAirDate = Calendar.getInstance(); firstAirDate.set(Calendar.YEAR, 1997); firstAirDate.set(Calendar.MONTH, Calendar.MARCH); firstAirDate.set(Calendar.DAY_OF_MONTH, 10); firstAirDate.set(Calendar.HOUR_OF_DAY, 0); firstAirDate.set(Calendar.MINUTE, 0); firstAirDate.set(Calendar.SECOND, 0); firstAirDate.set(Calendar.MILLISECOND, 0); assertEquals(firstAirDate.getTime(), show.getFirstAirDate()); for (TVShowSeason season : show.getSeasons()) { for (TVShowEpisode ep : season.getEpisodes()) { assertNotNull(ep.getAirDate()); } } }
From source file:net.audumla.astronomy.SeasonalEvent.java
protected static double springStart(int year, double latitude) { Date t = Time.getZeroDate(); t = DateUtils.setYears(t, year);//w ww. j a v a2 s. c o m if (latitude >= 0) { t = DateUtils.setMonths(t, Calendar.MARCH); } else { t = DateUtils.setMonths(t, Calendar.SEPTEMBER); } return new JulianDate(t).julian(); }
From source file:org.pivotal.gemfire.cache.CacheRegionQueryUsingToDateTest.java
@Before public void setupPeople() { Region<Long, Person> localPeople = gemfireCache.getRegion("/People"); put(localPeople, createPerson("Jon", "Doe", createDate(1979, Calendar.MAY, 15))); put(localPeople, createPerson("Jane", "Doe", createDate(1981, Calendar.APRIL, 21))); put(localPeople, createPerson("Pie", "Doe", createDate(1997, Calendar.NOVEMBER, 22))); put(localPeople, createPerson("Cookie", "Doe", createDate(2008, Calendar.AUGUST, 16))); put(localPeople, createPerson("Sour", "Doe", createDate(2012, Calendar.DECEMBER, 1))); put(localPeople, createPerson("Jack", "Handy", createDate(1977, Calendar.MAY, 10))); put(localPeople, createPerson("Sandy", "Handy", createDate(1977, Calendar.MARCH, 3))); put(localPeople, createPerson("Jack", "Black", createDate(1972, Calendar.JUNE, 26))); put(localPeople, createPerson("Ben", "Dover", createDate(1969, Calendar.MAY, 5))); put(localPeople, createPerson("Ima", "Pigg", createDate(1975, Calendar.JULY, 17))); assertThat(localPeople.size(), is(equalTo(10))); }
From source file:com.mb.framework.util.DateTimeUtil.java
/** * This method is used for getting short description of month by the number * of month/*from w ww . j av a2 s . co m*/ * * @param mthNum * @return */ public static String getMonthShortDesc(int mthNum) { String mthShortDesc; switch (mthNum) { case Calendar.JANUARY: { mthShortDesc = DateTimeConstants.SHORT_JANUARY; break; } case Calendar.FEBRUARY: { mthShortDesc = DateTimeConstants.SHORT_FEBRUARY; break; } case Calendar.MARCH: { mthShortDesc = DateTimeConstants.SHORT_MARCH; break; } case Calendar.APRIL: { mthShortDesc = DateTimeConstants.SHORT_APRIL; break; } case Calendar.MAY: { mthShortDesc = DateTimeConstants.SHORT_MAY; break; } case Calendar.JUNE: { mthShortDesc = DateTimeConstants.SHORT_JUNE; break; } case Calendar.JULY: { mthShortDesc = DateTimeConstants.SHORT_JULY; break; } case Calendar.AUGUST: { mthShortDesc = DateTimeConstants.SHORT_AUGUST; break; } case Calendar.SEPTEMBER: { mthShortDesc = DateTimeConstants.SHORT_SEPTEMBER; break; } case Calendar.OCTOBER: { mthShortDesc = DateTimeConstants.SHORT_OCTOBER; break; } case Calendar.NOVEMBER: { mthShortDesc = DateTimeConstants.SHORT_NOVEMBER; break; } case Calendar.DECEMBER: { mthShortDesc = DateTimeConstants.SHORT_DECEMBER; break; } default: { mthShortDesc = ""; break; } } return mthShortDesc; }