List of usage examples for java.util Calendar JANUARY
int JANUARY
To view the source code for java.util Calendar JANUARY.
Click Source Link
From source file:com.nexmo.client.voice.CallsFilterTest.java
@Test public void testAllParams() { /*//from w ww. ja v a2s.com private Integer recordIndex; private String order; */ Calendar startCalendar = new GregorianCalendar(TimeZone.getTimeZone("UTC")); startCalendar.set(2016, Calendar.JANUARY, 1, 7, 8, 20); startCalendar.set(Calendar.MILLISECOND, 0); Date startDate = startCalendar.getTime(); Calendar endCalendar = new GregorianCalendar(TimeZone.getTimeZone("UTC")); endCalendar.set(2016, Calendar.JANUARY, 1, 7, 8, 55); endCalendar.set(Calendar.MILLISECOND, 0); Date endDate = endCalendar.getTime(); CallsFilter filter = new CallsFilter(); filter.setStatus(CallStatus.COMPLETED); filter.setDateStart(startDate); filter.setDateEnd(endDate); filter.setRecordIndex(12); filter.setOrder("asc"); filter.setPageSize(10); filter.setConversationUuid("this-is-not-a-uuid"); assertEquals(CallStatus.COMPLETED, filter.getStatus()); assertEquals(startDate, filter.getDateStart()); assertEquals(endDate, filter.getDateEnd()); assertEquals(12, (int) filter.getRecordIndex()); assertEquals("asc", filter.getOrder()); assertEquals(10, (int) filter.getPageSize()); assertEquals("this-is-not-a-uuid", filter.getConversationUuid()); List<NameValuePair> params = filter.toUrlParams(); Map<String, String> paramLookup = new HashMap<String, String>(); for (NameValuePair pair : params) { paramLookup.put(pair.getName(), pair.getValue()); } assertEquals("completed", paramLookup.get("status")); assertEquals("2016-01-01T07:08:55Z", paramLookup.get("date_end")); assertEquals("2016-01-01T07:08:20Z", paramLookup.get("date_start")); assertEquals("12", paramLookup.get("record_index")); assertEquals("asc", paramLookup.get("order")); assertEquals("10", paramLookup.get("page_size")); assertEquals("this-is-not-a-uuid", paramLookup.get("conversation_uuid")); }
From source file:com.adobe.acs.commons.util.InfoWriterTest.java
@Test public void testPrint_ComplexVars() throws Exception { final Calendar cal = Calendar.getInstance(); cal.set(2015, Calendar.JANUARY, 1, 0, 0, 0); String expected = "String: hello " + "Integer: 10 " + "Long: 20 " + "Double: 30.1 " + "Boolean: true " + "Calendar: " + cal.getTime().toString() + " " + "Date: " + cal.getTime().toString(); iw.message("String: {} " + "Integer: {} " + "Long: {} " + "Double: {} " + "Boolean: {} " + "Calendar: {} " + "Date: {}", "hello", 10, 20L, 30.1D, true, cal, cal.getTime()); assertEquals(expected.concat(LS), iw.toString()); }
From source file:ch.ralscha.extdirectspring.provider.RemoteProviderFormLoad.java
@ExtDirectMethod(value = ExtDirectMethodType.FORM_LOAD, group = "group3", event = "test") public FormInfo method1(@RequestParam(value = "d") double d) { FormInfo info = new FormInfo(); info.setBack(d);//from w w w . ja v a 2 s . co m info.setAdmin(true); info.setAge(31); info.setBirthday(new GregorianCalendar(1980, Calendar.JANUARY, 15).getTime()); info.setName("Bob"); info.setSalary(new BigDecimal("10000.55")); return info; }
From source file:name.martingeisse.common.util.Month.java
/** * @return the constant used in {@link GregorianCalendar} for this month. *///w w w . ja v a 2s . com public int getGregorianCalendarValue() { return ordinal() + Calendar.JANUARY; }
From source file:de.forsthaus.backend.dao.impl.ChartDataDAOImpl.java
@Override public List<ChartData> getChartDataForCustomer(long kunId) { List<ChartData> result = new ArrayList<ChartData>(); if (kunId == 20) { Calendar calendar = new GregorianCalendar(); calendar.set(2009, Calendar.JANUARY, 2, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(120.30))); calendar.set(2009, Calendar.FEBRUARY, 2, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(450.30))); calendar.set(2009, Calendar.MARCH, 15, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(820.10))); calendar.set(2009, Calendar.APRIL, 20, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(654.00))); calendar.set(2009, Calendar.MAY, 2, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(120.30))); calendar.set(2009, Calendar.JUNE, 2, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(520.30))); calendar.set(2009, Calendar.JULY, 22, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(320.30))); calendar.set(2009, Calendar.AUGUST, 13, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(20.30))); calendar.set(2009, Calendar.SEPTEMBER, 6, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(480.30))); calendar.set(2009, Calendar.OCTOBER, 26, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(520.30))); calendar.set(2009, Calendar.NOVEMBER, 26, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(620.70))); calendar.set(2009, Calendar.DECEMBER, 26, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(1220.90))); } else if (kunId == 21) { Calendar calendar = new GregorianCalendar(); calendar.set(2009, Calendar.JANUARY, 2, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(320.30))); calendar.set(2009, Calendar.FEBRUARY, 2, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(450.30))); calendar.set(2009, Calendar.MARCH, 15, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(620.10))); calendar.set(2009, Calendar.APRIL, 20, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(154.00))); calendar.set(2009, Calendar.MAY, 2, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(320.30))); calendar.set(2009, Calendar.JUNE, 2, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(620.30))); calendar.set(2009, Calendar.JULY, 22, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(920.30))); calendar.set(2009, Calendar.AUGUST, 13, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(120.30))); calendar.set(2009, Calendar.SEPTEMBER, 6, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(680.30))); calendar.set(2009, Calendar.OCTOBER, 26, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(580.30))); calendar.set(2009, Calendar.NOVEMBER, 26, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(820.70))); calendar.set(2009, Calendar.DECEMBER, 26, 0, 0, 0); result.add(new ChartData(kunId, calendar.getTime(), new BigDecimal(220.90))); }//from w w w . j a va 2 s. com return result; }
From source file:com.example.geomesa.authorizations.AuthorizationsTutorial.java
/** * Creates a base filter that will return a small subset of our results. This can be tweaked to * return different results if desired. Currently it should return 16 results. * * @return/*from w ww . java 2 s. c o m*/ * * @throws CQLException * @throws IOException */ static Filter createBaseFilter() throws CQLException, IOException { // Get a FilterFactory2 to build up our query FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(); // We are going to query for events in Ukraine during the // civil unrest. // We'll start by looking at a particular day in February of 2014 Calendar calendar = Calendar.getInstance(); calendar.clear(); calendar.set(Calendar.YEAR, 2013); calendar.set(Calendar.MONTH, Calendar.JANUARY); calendar.set(Calendar.DAY_OF_MONTH, 1); calendar.set(Calendar.HOUR_OF_DAY, 0); Date start = calendar.getTime(); calendar.set(Calendar.YEAR, 2014); calendar.set(Calendar.MONTH, Calendar.APRIL); calendar.set(Calendar.DAY_OF_MONTH, 30); calendar.set(Calendar.HOUR_OF_DAY, 23); Date end = calendar.getTime(); // 2013-01-01T00:00:00.000Z/2014-04-30T23:00:00.000Z Filter timeFilter = ff.between(ff.property(GdeltFeature.Attributes.SQLDATE.getName()), ff.literal(start), ff.literal(end)); // We'll bound our query spatially to Ukraine Filter spatialFilter = ff.bbox(GdeltFeature.Attributes.geom.getName(), 31.6, 44, 37.4, 47.75, "EPSG:4326"); // we'll also restrict our query to only articles about the US, UK or UN Filter attributeFilter = ff.like(ff.property(GdeltFeature.Attributes.Actor1Name.getName()), "UNITED%"); // Now we can combine our filters using a boolean AND operator Filter conjunction = ff.and(Arrays.asList(timeFilter, spatialFilter, attributeFilter)); return conjunction; }
From source file:org.hibernate.search.test.dsl.embedded.DslEmbeddedSearchTest.java
@Before public void setUp() throws Exception { EmbeddedEntity ee = new EmbeddedEntity(); ee.setEmbeddedField("embedded"); ee.setNumber(7);// w w w .j av a 2s .c om ee.setDate(initCalendar(2007, Calendar.JANUARY, 14).getTime()); ContainerEntity pe = new ContainerEntity(); pe.setId(1L); pe.setEmbeddedEntity(ee); pe.setParentStringValue("theparentvalue"); helper.add(pe); EmbeddedEntity ee2 = new EmbeddedEntity(); ee2.setEmbeddedField("otherembedded"); ee2.setNumber(3); ee2.setDate(initCalendar(2007, Calendar.JANUARY, 12).getTime()); ContainerEntity pe2 = new ContainerEntity(); pe2.setId(2L); pe2.setEmbeddedEntity(ee2); pe2.setParentStringValue("theotherparentvalue"); helper.add(pe2); }
From source file:org.hibernate.search.test.query.dsl.embedded.DslEmbeddedSearchTest.java
@Override @Before//from w w w. j av a 2 s.co m public void setUp() throws Exception { super.setUp(); EmbeddedEntity ee = new EmbeddedEntity(); ee.setEmbeddedField("embedded"); ee.setNumber(7); ee.setDate(initCalendar(2007, Calendar.JANUARY, 14).getTime()); ContainerEntity pe = new ContainerEntity(); pe.setEmbeddedEntity(ee); pe.setParentStringValue("theparentvalue"); s = openSession(); s.getTransaction().begin(); s.persist(pe); s.getTransaction().commit(); EmbeddedEntity ee2 = new EmbeddedEntity(); ee2.setEmbeddedField("otherembedded"); ee2.setNumber(3); ee2.setDate(initCalendar(2007, Calendar.JANUARY, 12).getTime()); ContainerEntity pe2 = new ContainerEntity(); pe2.setEmbeddedEntity(ee2); pe2.setParentStringValue("theotherparentvalue"); s.getTransaction().begin(); s.persist(pe2); s.getTransaction().commit(); }
From source file:org.talend.esb.sam.server.persistence.EventRepositoryTest.java
@Test public void testWriteEvent() { GregorianCalendar cal = new GregorianCalendar(2000, Calendar.JANUARY, 1, 01, 01, 10); Event event = EventCreator.createEvent("content", cal.getTime(), EventTypeEnum.REQ_IN, "orig_id", "localhost", "10.0.0.1", "1", "2", "3", "operation", "service", "http"); event.getCustomInfo().put("mykey1", "myValue1"); event.getCustomInfo().put("mykey2", "myValue2"); Assert.assertNull(event.getPersistedId()); eventRepository.writeEvent(event);/*from w ww . j av a 2s . com*/ Assert.assertNotNull(event.getPersistedId()); //read Event from database Event readEvent = eventRepository.readEvent(event.getPersistedId().longValue()); Assert.assertTrue(EqualsBuilder.reflectionEquals(event, readEvent)); }
From source file:org.languagetool.rules.AbstractNewYearDateFilter.java
/** * Return true if the year recently changed (= it is January) *///from w w w. ja v a 2s . co m protected boolean isJanuary() { if (TestHackHelper.isJUnitTest()) { return true; } return getCalendar().get(Calendar.MONTH) == Calendar.JANUARY; }