List of usage examples for java.util Calendar FEBRUARY
int FEBRUARY
To view the source code for java.util Calendar FEBRUARY.
Click Source Link
From source file:it.caladyon.akka.molla.topology.help.Test_StrategistListenerActor_with_TimedListening.java
/** * Risposta a 3 messaggi contemporanei./*w ww . j av a2 s.c o m*/ * @throws Exception */ @SuppressWarnings("deprecation") @Test public void test_0() throws Exception { log.info("---- test 0 -------------------------------"); // questo metodo di creazione delle Props e' ripreso da ActorSystemStarter final SpringExt springExtProvider = SpringExtensionProvider.springExtProvider.get(system); final Props props = springExtProvider.props(LISTENER_BEAN_NAME); final TestActorRef<TestTimedListenerActor> ref = TestActorRef.create(system, props, "test_0"); final TestTimedListenerActor actor = ref.underlyingActor(); try { final Date d1 = new Date(2015, Calendar.FEBRUARY, 27, 12, 00, 00); final MessageWrapper mw1 = new MessageWrapper(SOURCE1_BEAN_NAME, d1, "message1"); final Future<Object> future1 = ask(ref, mw1, TIMEOUT); final Date d2 = new Date(2015, Calendar.FEBRUARY, 27, 12, 00, 01); final MessageWrapper mw2 = new MessageWrapper(SOURCE2_BEAN_NAME, d2, "message2"); final Future<Object> future2 = ask(ref, mw2, TIMEOUT); final Date d3 = new Date(2015, Calendar.FEBRUARY, 27, 12, 00, 02); final MessageWrapper mw3 = new MessageWrapper(SOURCE3_BEAN_NAME, d3, "message3"); final Future<Object> future3 = ask(ref, mw3, TIMEOUT); try { Thread.sleep(WAIT + 100); } catch (InterruptedException e1) { e1.printStackTrace(); } assertTrue("future1", future1.isCompleted()); assertTrue("future2", future2.isCompleted()); assertTrue("future3", future3.isCompleted()); assertTrue("response3", Await.result(future3, Duration.Zero()) == d3); assertTrue("execution count: " + actor.getExecCount(), actor.getExecCount() == 1); int inputsSize = ((TimedListening) actor.getListening()).inputs.size(); assertTrue("input size: " + inputsSize, inputsSize == 0); } finally { ref.stop(); } }
From source file:it.caladyon.akka.molla.topology.Test_TimedListenerActor.java
/** * Risposta a 3 messaggi contemporanei.//from w w w.ja v a 2s.c o m */ @Test @Ignore public void test_0() { log.info("---- test 0 -------------------------------"); // questo metodo di creazione delle Props e' ripreso da ActorSystemStarter final SpringExt springExtProvider = SpringExtensionProvider.springExtProvider.get(system); final Props props = springExtProvider.props(LISTENER_BEAN_NAME); final TestActorRef<TestTimedListenerActor> ref = TestActorRef.create(system, props, "test_0"); final TestTimedListenerActor actor = ref.underlyingActor(); try { final Date d1 = new Date(2015, Calendar.FEBRUARY, 27, 12, 00, 00); final MessageWrapper mw1 = new MessageWrapper(SOURCE1_BEAN_NAME, d1, "message1"); final Future<Object> future1 = ask(ref, mw1, TIMEOUT); final Date d2 = new Date(2015, Calendar.FEBRUARY, 27, 12, 00, 01); final MessageWrapper mw2 = new MessageWrapper(SOURCE2_BEAN_NAME, d2, "message2"); final Future<Object> future2 = ask(ref, mw2, TIMEOUT); final Date d3 = new Date(2015, Calendar.FEBRUARY, 27, 12, 00, 02); final MessageWrapper mw3 = new MessageWrapper(SOURCE3_BEAN_NAME, d3, "message3"); final Future<Object> future3 = ask(ref, mw3, TIMEOUT); try { Thread.sleep(WAIT + 100); } catch (InterruptedException e1) { e1.printStackTrace(); } assertTrue("future1", future1.isCompleted()); assertTrue("future2", future2.isCompleted()); assertTrue("future3", future3.isCompleted()); try { assertTrue("response3", Await.result(future3, Duration.Zero()) == d3); } catch (Exception e) { e.printStackTrace(); } assertTrue("execution count: " + actor.getExecCount(), actor.getExecCount() == 1); assertTrue("input size: " + actor.inputsSize(), actor.inputsSize() == 0); } finally { ref.stop(); } }
From source file:it.caladyon.akka.molla.topology.help.Test_StrategistListenerActor_with_TolerantTimedListening_0.java
/** * Risposta a 3 messaggi contemporanei./*w w w .ja v a 2 s .c o m*/ * @throws Exception */ @SuppressWarnings("deprecation") @Test public void test_0() throws Exception { log.info("---- test 0 -------------------------------"); // questo metodo di creazione delle Props e' ripreso da ActorSystemStarter final SpringExt springExtProvider = SpringExtensionProvider.springExtProvider.get(system); final Props props = springExtProvider.props(LISTENER_BEAN_NAME); final TestActorRef<TestTolerantListenerActor> ref = TestActorRef.create(system, props, "test_0"); final TestTolerantListenerActor actor = ref.underlyingActor(); try { final Date d1 = new Date(2015, Calendar.FEBRUARY, 27, 12, 00, 00); final MessageWrapper mw1 = new MessageWrapper(SOURCE1_BEAN_NAME, d1, "message1"); final Future<Object> future1 = ask(ref, mw1, TIMEOUT); final Date d2 = new Date(2015, Calendar.FEBRUARY, 27, 12, 00, 01); final MessageWrapper mw2 = new MessageWrapper(SOURCE2_BEAN_NAME, d2, "message2"); final Future<Object> future2 = ask(ref, mw2, TIMEOUT); final Date d3 = new Date(2015, Calendar.FEBRUARY, 27, 12, 00, 02); final MessageWrapper mw3 = new MessageWrapper(SOURCE3_BEAN_NAME, d3, "message3"); final Future<Object> future3 = ask(ref, mw3, TIMEOUT); try { Thread.sleep(WAIT + 100); } catch (InterruptedException e1) { e1.printStackTrace(); } assertTrue("future1", future1.isCompleted()); assertTrue("future2", future2.isCompleted()); assertTrue("future3", future3.isCompleted()); assertTrue("response3", Await.result(future3, Duration.Zero()) == d3); assertTrue("execution count: " + actor.getExecCount(), actor.getExecCount() == 1); int inputsSize = ((TolerantTimedListening) actor.getListening()).inputs.size(); assertTrue("input size: " + inputsSize, inputsSize == 0); } finally { ref.stop(); } }
From source file:ch.puzzle.itc.mobiliar.business.generator.control.extracted.ResourceDependencyResolverServiceTest.java
@Test public void testFindNearestRelease() { // given//w w w .j a va 2s. c o m Calendar cal = new GregorianCalendar(); cal.set(2001, Calendar.JANUARY, 1); ReleaseEntity release1 = createRelease(1, new Date(cal.getTimeInMillis())); cal.set(2013, Calendar.JANUARY, 1); ReleaseEntity release2 = createRelease(2, new Date(cal.getTimeInMillis())); cal.set(2013, Calendar.JANUARY, 23); ReleaseEntity release3 = createRelease(3, new Date(cal.getTimeInMillis())); cal.set(2013, Calendar.AUGUST, 8); ReleaseEntity release4 = createRelease(4, new Date(cal.getTimeInMillis())); cal.set(2013, Calendar.DECEMBER, 31); ReleaseEntity release5 = createRelease(5, new Date(cal.getTimeInMillis())); cal.set(2014, Calendar.NOVEMBER, 10); ReleaseEntity release6 = createRelease(6, new Date(cal.getTimeInMillis())); SortedSet<ReleaseEntity> releases = new TreeSet<ReleaseEntity>(); // when only past release exists releases.add(release1); cal.set(2013, Calendar.JANUARY, 10); ReleaseEntity nearestRelease = service.findMostRelevantRelease(releases, new Date(cal.getTimeInMillis())); // then assertEquals(release1.getId(), nearestRelease.getId()); // when there are multiple past releases releases.add(release2); releases.add(release3); cal.set(2013, Calendar.FEBRUARY, 10); nearestRelease = service.findMostRelevantRelease(releases, new Date(cal.getTimeInMillis())); // then assertEquals(release3.getId(), nearestRelease.getId()); // when there is one future release releases.add(release4); cal.set(2013, Calendar.FEBRUARY, 10); nearestRelease = service.findMostRelevantRelease(releases, new Date(cal.getTimeInMillis())); // then assertEquals(release4.getId(), nearestRelease.getId()); // when there are multiple future releases cal.set(2013, Calendar.AUGUST, 9); releases.add(release5); releases.add(release6); nearestRelease = service.findMostRelevantRelease(releases, new Date(cal.getTimeInMillis())); // then Assert.assertEquals(release5.getId(), nearestRelease.getId()); }
From source file:org.sakaiproject.util.CalendarUtil.java
void initDates() { Calendar calendarSunday = Calendar.getInstance(); Calendar calendarMonday = Calendar.getInstance(); Calendar calendarTuesday = Calendar.getInstance(); Calendar calendarWednesday = Calendar.getInstance(); Calendar calendarThursday = Calendar.getInstance(); Calendar calendarFriday = Calendar.getInstance(); Calendar calendarSaturday = Calendar.getInstance(); calendarSunday.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY); calendarMonday.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); calendarTuesday.set(Calendar.DAY_OF_WEEK, Calendar.TUESDAY); calendarWednesday.set(Calendar.DAY_OF_WEEK, Calendar.WEDNESDAY); calendarThursday.set(Calendar.DAY_OF_WEEK, Calendar.THURSDAY); calendarFriday.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY); calendarSaturday.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY); dateSunday = calendarSunday.getTime(); dateMonday = calendarMonday.getTime(); dateTuesday = calendarTuesday.getTime(); dateWednesday = calendarWednesday.getTime(); dateThursday = calendarThursday.getTime(); dateFriday = calendarFriday.getTime(); dateSaturday = calendarSaturday.getTime(); Calendar calendarJanuary = Calendar.getInstance(); Calendar calendarFebruary = Calendar.getInstance(); Calendar calendarMarch = Calendar.getInstance(); Calendar calendarApril = Calendar.getInstance(); Calendar calendarMay = Calendar.getInstance(); Calendar calendarJune = Calendar.getInstance(); Calendar calendarJuly = Calendar.getInstance(); Calendar calendarAugust = Calendar.getInstance(); Calendar calendarSeptember = Calendar.getInstance(); Calendar calendarOctober = Calendar.getInstance(); Calendar calendarNovember = Calendar.getInstance(); Calendar calendarDecember = Calendar.getInstance(); calendarJanuary.set(Calendar.MONTH, Calendar.JANUARY); calendarFebruary.set(Calendar.MONTH, Calendar.FEBRUARY); calendarMarch.set(Calendar.MONTH, Calendar.MARCH); calendarApril.set(Calendar.MONTH, Calendar.APRIL); calendarMay.set(Calendar.MONTH, Calendar.MAY); calendarJune.set(Calendar.MONTH, Calendar.JUNE); calendarJuly.set(Calendar.MONTH, Calendar.JULY); calendarAugust.set(Calendar.MONTH, Calendar.AUGUST); calendarSeptember.set(Calendar.MONTH, Calendar.SEPTEMBER); calendarOctober.set(Calendar.MONTH, Calendar.OCTOBER); calendarNovember.set(Calendar.MONTH, Calendar.NOVEMBER); calendarDecember.set(Calendar.MONTH, Calendar.DECEMBER); dateJanuary = calendarJanuary.getTime(); dateFebruary = calendarFebruary.getTime(); dateMarch = calendarMarch.getTime(); dateApril = calendarApril.getTime(); dateMay = calendarMay.getTime();/*from w w w .j a va 2 s . c o m*/ dateJune = calendarJune.getTime(); dateJuly = calendarJuly.getTime(); dateAugust = calendarAugust.getTime(); dateSeptember = calendarSeptember.getTime(); dateOctober = calendarOctober.getTime(); dateNovember = calendarNovember.getTime(); dateDecember = calendarDecember.getTime(); }
From source file:it.caladyon.akka.molla.topology.Test_TolerantTimedListenerActor_0.java
/** * Risposta a 3 messaggi contemporanei./*from ww w . j ava 2s. com*/ */ @Ignore @Test public void test_0() { log.info("---- test 0 -------------------------------"); // questo metodo di creazione delle Props e' ripreso da ActorSystemStarter final SpringExt springExtProvider = SpringExtensionProvider.springExtProvider.get(system); final Props props = springExtProvider.props(LISTENER_BEAN_NAME); final TestActorRef<TestTimedListenerActor> ref = TestActorRef.create(system, props, "test_0"); final TestTimedListenerActor actor = ref.underlyingActor(); try { final Date d1 = new Date(2015, Calendar.FEBRUARY, 27, 12, 00, 00); final MessageWrapper mw1 = new MessageWrapper(SOURCE1_BEAN_NAME, d1, "message1"); final Future<Object> future1 = ask(ref, mw1, TIMEOUT); final Date d2 = new Date(2015, Calendar.FEBRUARY, 27, 12, 00, 01); final MessageWrapper mw2 = new MessageWrapper(SOURCE2_BEAN_NAME, d2, "message2"); final Future<Object> future2 = ask(ref, mw2, TIMEOUT); final Date d3 = new Date(2015, Calendar.FEBRUARY, 27, 12, 00, 02); final MessageWrapper mw3 = new MessageWrapper(SOURCE3_BEAN_NAME, d3, "message3"); final Future<Object> future3 = ask(ref, mw3, TIMEOUT); try { Thread.sleep(WAIT + 100); } catch (InterruptedException e1) { e1.printStackTrace(); } assertTrue("future1", future1.isCompleted()); assertTrue("future2", future2.isCompleted()); assertTrue("future3", future3.isCompleted()); try { assertTrue("response3", Await.result(future3, Duration.Zero()) == d3); } catch (Exception e) { e.printStackTrace(); } assertTrue("execution count: " + actor.getExecCount(), actor.getExecCount() == 1); assertTrue("input size: " + actor.inputsSize(), actor.inputsSize() == 0); } finally { ref.stop(); } }
From source file:moviemanager.backend.RelationshipManagerTest.java
@Test public void addPersonAsWriter() { log.info("Testing adding person as writer..."); String personName = "John Smith (personAsWriter)"; String movieTitle = "Writer Movie"; //create movie Movie movie = new Movie(); movie.setTitle(movieTitle);//from w w w.j av a2s. c om movie.setYear(2010); movie.setLength(150); movieManager.createMovie(movie); assertNotNull(movie); //create person Calendar calendar = new GregorianCalendar(1985, Calendar.FEBRUARY, 19); Person person = new Person(personName, calendar); personManager.createPerson(person); assertNotNull(person); // add to relationship dtb and check it was added relationManager.addPersonToRole(person, movie, Consts.WRITER); assertTrue(relationManager.checkRole(person, movie, Consts.WRITER)); // check if person from relationship dtb is the same as person inserted List<Person> resultPerson = relationManager.personsOfMovie(movie); assertNotNull(resultPerson); assertEquals(resultPerson.get(0).getName(), personName); assertEquals(resultPerson.get(0), person); // check if movie from relationship dtb is the same as movie inserted List<Movie> resultMovie = relationManager.moviesOfPerson(person); assertNotNull(resultMovie); assertEquals(resultMovie.get(0).getTitle(), movieTitle); assertEquals(resultMovie.get(0), movie); }
From source file:org.apache.logging.log4j.core.util.datetime.FastDateParserTest.java
@Test public void testParseZone() throws ParseException { final Calendar cal = Calendar.getInstance(NEW_YORK, Locale.US); cal.clear();//from w w w . ja va 2s.co m cal.set(2003, Calendar.JULY, 10, 16, 33, 20); final DateParser fdf = getInstance(yMdHmsSZ, NEW_YORK, Locale.US); assertEquals(cal.getTime(), fdf.parse("2003-07-10T15:33:20.000 -0500")); assertEquals(cal.getTime(), fdf.parse("2003-07-10T15:33:20.000 GMT-05:00")); assertEquals(cal.getTime(), fdf.parse("2003-07-10T16:33:20.000 Eastern Daylight Time")); assertEquals(cal.getTime(), fdf.parse("2003-07-10T16:33:20.000 EDT")); cal.setTimeZone(TimeZone.getTimeZone("GMT-3")); cal.set(2003, Calendar.FEBRUARY, 10, 9, 0, 0); assertEquals(cal.getTime(), fdf.parse("2003-02-10T09:00:00.000 -0300")); cal.setTimeZone(TimeZone.getTimeZone("GMT+5")); cal.set(2003, Calendar.FEBRUARY, 10, 15, 5, 6); assertEquals(cal.getTime(), fdf.parse("2003-02-10T15:05:06.000 +0500")); }
From source file:com.mycompany.CRMFly.ManagedBeans.ScheduleBean.java
public Date getInitialDate() { Calendar calendar = Calendar.getInstance(); calendar.set(calendar.get(Calendar.YEAR), Calendar.FEBRUARY, calendar.get(Calendar.DATE), 0, 0, 0); return calendar.getTime(); }
From source file:org.projectforge.framework.configuration.ConfigXmlTest.java
@Test public void testHolidayDefinition() { createTestConfiguration();/*from w w w .j av a 2 s .c o m*/ final ConfigXml config = ConfigXml.getInstance(); assertEquals(5, config.getHolidays().size()); ConfigureHoliday holiday = config.getHolidays().get(0); assertEquals(Calendar.MAY, (int) holiday.getMonth()); holiday = config.getHolidays().get(2); assertEquals(HolidayDefinition.XMAS_EVE, holiday.getId()); holiday = config.getHolidays().get(3); assertEquals(HolidayDefinition.SHROVE_TUESDAY, holiday.getId()); assertEquals(true, holiday.isIgnore()); final Holidays holidays = Holidays.getInstance(); final Calendar cal = Calendar.getInstance(); cal.set(Calendar.YEAR, 2009); cal.set(Calendar.MONTH, Calendar.MAY); cal.set(Calendar.DAY_OF_MONTH, 1); assertEquals("Should be there.", true, holidays.isHoliday(2009, cal.get(Calendar.DAY_OF_YEAR))); cal.set(Calendar.MONTH, Calendar.FEBRUARY); cal.set(Calendar.DAY_OF_MONTH, 23); assertEquals("Should be there.", true, holidays.isHoliday(2009, cal.get(Calendar.DAY_OF_YEAR))); cal.set(Calendar.DAY_OF_MONTH, 24); assertEquals("Should be ignored.", false, holidays.isHoliday(2009, cal.get(Calendar.DAY_OF_YEAR))); }