List of usage examples for java.util Calendar MAY
int MAY
To view the source code for java.util Calendar MAY.
Click Source Link
From source file:org.openhab.persistence.dynamodb.internal.AbstractDynamoDBItemSerializationTest.java
@Test public void testDateTimeTypeWithStringItem() throws IOException { Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC")); calendar.set(2016, Calendar.MAY, 1, 13, 46, 0); calendar.set(Calendar.MILLISECOND, 50); DynamoDBItem<?> dbitem = testStateGeneric(new DateTimeType(calendar), "2016-05-01T13:46:00.050Z"); testAsHistoricGeneric(dbitem, new StringItem("foo"), new StringType("2016-05-01T13:46:00.050Z")); }
From source file:br.com.contratempo.controller.LoginController.java
private void populaOBanco() { List<Modalidade> modalidades = (List<Modalidade>) modalidadeRepository.findAll(); if (modalidades.size() == 0) { modalidadeRepository.save(new Modalidade("Samba de Gafiera")); modalidadeRepository.save(new Modalidade("Forro")); modalidadeRepository.save(new Modalidade("Bolero")); modalidadeRepository.save(new Modalidade("Zouk")); modalidades = (ArrayList<Modalidade>) modalidadeRepository.findAll(); Constants constants = new Constants(); constants.setNome(Constants.VALOR_TURMA_PADRAO); constants.setValor("75"); constantsRepository.save(constants); }//from w ww. j a va2 s.co m if (professorRepository.count() == 0) { professorRepository.save(new Professor("Cristhopher")); professorRepository.save(new Professor("Aercio")); } if (turmaRepository.count() == 0) { Turma turma1 = new Turma(); Turma turma2 = new Turma(); List<Modalidade> modalidadesTurma = new ArrayList<Modalidade>(); modalidadesTurma.add(modalidades.get(0)); modalidadesTurma.add(modalidades.get(1)); modalidadesTurma.add(modalidades.get(2)); Calendar date = new GregorianCalendar(2016, Calendar.MAY, 7, 20, 30); turma1.setProfessor(professorRepository.findOne(1L)); turma1.setModalidades(modalidadesTurma); turma1.setNome("Dana de Salo"); turma1.setHorario(date); turma1.setNivel("0"); turma1.setSala(Turma.SALA2); turma1.setValorPadrao(75D); turma2.setProfessor(professorRepository.findOne(2L)); turma2.setModalidades(modalidadesTurma); turma2.setNome("Dana de Salo 1"); turma2.setHorario(new GregorianCalendar(2016, Calendar.MAY, 2, 21, 30)); turma2.setNivel("1"); turma2.setSala(Turma.SALA2); turma1.setValorPadrao(70D); turmaRepository.save(turma1); turmaRepository.save(turma2); } if (clienteRepository.count() == 0) { clienteRepository.save( new Cliente("Jorge Peres", "jorgepgjr@gmail.com", "13997295671", "https://goo.gl/IweKcl")); clienteRepository.save( new Cliente("Dora Magno", "minhaSogra@gmail.com", "11997295671", "https://goo.gl/IweKcl")); clienteRepository.save(new Cliente("Aercio Peres Magno", "amoOJorge@gmail.com", "1191132123", "https://goo.gl/IweKcl")); clienteRepository.save(new Cliente("Erika Magno", "329148780", "Rua Tocantins 77 apt 171", "jorgepgjr@gmail.com", "11997295671", "Dancarina", "internet", Calendar.getInstance(), 'F', "https://goo.gl/IweKcl", Calendar.getInstance())); clienteRepository.save(new Cliente("Jorge Full", "312312312312", "Rua Tocantins 77 apt 171", "jorgepgjr@gmail.com", "1132139123", "Reporter", "internet", Calendar.getInstance(), 'M', "http://graph.facebook.com/v2.5/100000160917760/picture", Calendar.getInstance())); } if (matriculaRepository.count() == 0) { Calendar vencimento = Calendar.getInstance(); vencimento.add(Calendar.DAY_OF_MONTH, -1); Calendar today = Calendar.getInstance(); today.add(Calendar.MONTH, -2); Matricula matricula = new Matricula(); matricula.setAtiva(true); matricula.setDtInicio(today); matricula.setDtFim(vencimento); matricula.setPago(true); matricula.setCliente(clienteRepository.findOne(1L)); matricula.setTurma(turmaRepository.findOne(1L)); matricula.setValor(Double.valueOf(75)); Matricula matricula2 = new Matricula(matricula); matricula2.setCliente(clienteRepository.findOne(2L)); matricula2.setTurma(turmaRepository.findOne(1L)); matricula2.setPago(false); matricula2.setDtFim(Calendar.getInstance()); Matricula matricula3 = new Matricula(matricula); matricula3.setCliente(clienteRepository.findOne(3L)); matricula3.setTurma(turmaRepository.findOne(1L)); matricula3.setPago(true); Matricula matricula4 = new Matricula(matricula); matricula4.setCliente(clienteRepository.findOne(3L)); matricula4.setTurma(turmaRepository.findOne(2L)); matricula4.setPago(false); matricula4.setDtFim(Calendar.getInstance()); Matricula matricula5 = new Matricula(matricula); matricula5.setCliente(clienteRepository.findOne(4L)); matricula5.setTurma(turmaRepository.findOne(1L)); matricula5.setPago(false); Matricula matricula6 = new Matricula(matricula); matricula6.setCliente(clienteRepository.findOne(3L)); matricula6.setTurma(turmaRepository.findOne(2L)); matricula6.setPago(true); matriculaRepository.save(matricula); matriculaRepository.save(matricula2); matriculaRepository.save(matricula3); matriculaRepository.save(matricula4); matriculaRepository.save(matricula5); matriculaRepository.save(matricula6); } }
From source file:edu.cornell.mannlib.vitro.webapp.controller.freemarker.DumpTestController.java
private Employee getEmployee() { Calendar c = Calendar.getInstance(); c.set(1982, Calendar.MAY, 5); c = DateUtils.truncate(c, Calendar.DATE); Employee jdoe = new Employee("John", "Doe", 34523, c.getTime()); jdoe.setFavoriteColors("blue", "green"); jdoe.setSalary(65000);/*from w w w. j a v a 2 s . c o m*/ c.clear(); c.set(1975, Calendar.OCTOBER, 25); c = DateUtils.truncate(c, Calendar.DATE); Employee jsmith = new Employee("Jane", "Smith", 78234, c.getTime()); jsmith.setFavoriteColors("red", "orange"); jdoe.setSupervisor(jsmith); return jdoe; }
From source file:io.minio.MinioClientTest.java
@Test public void testGetObjectHeaders() throws NoSuchAlgorithmException, InvalidKeyException, IOException, XmlPullParserException, MinioException { MockWebServer server = new MockWebServer(); MockResponse response = new MockResponse(); response.setResponseCode(200);// w w w. j a va 2 s. c o m response.setHeader("Date", "Sun, 05 Jun 2015 22:01:10 GMT"); response.setHeader(CONTENT_LENGTH, "5080"); response.setHeader(CONTENT_TYPE, APPLICATION_OCTET_STREAM); response.setHeader("ETag", "\"a670520d9d36833b3e28d1e4b73cbe22\""); response.setHeader(LAST_MODIFIED, MON_04_MAY_2015_07_58_51_GMT); server.enqueue(response); server.start(); // build expected request Calendar expectedDate = Calendar.getInstance(); expectedDate.clear(); expectedDate.setTimeZone(TimeZone.getTimeZone("GMT")); expectedDate.set(2015, Calendar.MAY, 4, 7, 58, 51); ObjectStat expectedStatInfo = new ObjectStat(BUCKET, "key", expectedDate.getTime(), 5080, "a670520d9d36833b3e28d1e4b73cbe22", APPLICATION_OCTET_STREAM); // get request MinioClient client = new MinioClient(server.url("")); ObjectStat objectStatInfo = client.statObject(BUCKET, "key"); assertEquals(expectedStatInfo, objectStatInfo); }
From source file:freemarker.ext.dump.DumpDirectiveTest.java
@Test public void dumpCalendarDate() { String varName = "myDate"; Map<String, Object> dataModel = new HashMap<String, Object>(); Calendar c = Calendar.getInstance(); c.set(1991, Calendar.MAY, 5); Date myDate = c.getTime();/*from w ww . j a v a 2 s . c o m*/ dataModel.put("myDate", myDate); Map<String, Object> expectedDumpValue = new HashMap<String, Object>(); expectedDumpValue.put(Key.TYPE.toString(), Type.DATE); expectedDumpValue.put(Key.DATE_TYPE.toString(), DateType.UNKNOWN); expectedDumpValue.put(Key.VALUE.toString(), myDate); Map<String, Object> expectedDump = new HashMap<String, Object>(); expectedDump.put(varName, expectedDumpValue); test(varName, dataModel, expectedDump); }
From source file:ISO8601DateTimeFormat.java
/** * Write century, year, and months.//from ww w . j a v a 2 s . co m * @param sbuf The buffer to append the string. */ protected final void writeCCYYMM(StringBuffer sbuf) { int year = calendar.get(Calendar.YEAR); appendInt(sbuf, year, 4); String month; switch (calendar.get(Calendar.MONTH)) { case Calendar.JANUARY: month = "-01-"; break; case Calendar.FEBRUARY: month = "-02-"; break; case Calendar.MARCH: month = "-03-"; break; case Calendar.APRIL: month = "-04-"; break; case Calendar.MAY: month = "-05-"; break; case Calendar.JUNE: month = "-06-"; break; case Calendar.JULY: month = "-07-"; break; case Calendar.AUGUST: month = "-08-"; break; case Calendar.SEPTEMBER: month = "-09-"; break; case Calendar.OCTOBER: month = "-10-"; break; case Calendar.NOVEMBER: month = "-11-"; break; case Calendar.DECEMBER: month = "-12-"; break; default: month = "-NA-"; break; } sbuf.append(month); int day = calendar.get(Calendar.DAY_OF_MONTH); appendInt(sbuf, day, 2); }
From source file:com.mb.framework.util.DateTimeUtil.java
/** * This method is used for getting month long description * /*from w w w.jav a 2 s . com*/ * @param mthNum * @return */ public static String getMonthLongDesc(int mthNum) { String mthLongDesc; switch (mthNum) { case Calendar.JANUARY: { mthLongDesc = DateTimeConstants.JANUARY; break; } case Calendar.FEBRUARY: { mthLongDesc = DateTimeConstants.FEBRUARY; break; } case Calendar.MARCH: { mthLongDesc = DateTimeConstants.MARCH; break; } case Calendar.APRIL: { mthLongDesc = DateTimeConstants.APRIL; break; } case Calendar.MAY: { mthLongDesc = DateTimeConstants.MAY; break; } case Calendar.JUNE: { mthLongDesc = DateTimeConstants.JUNE; break; } case Calendar.JULY: { mthLongDesc = DateTimeConstants.JULY; break; } case Calendar.AUGUST: { mthLongDesc = DateTimeConstants.AUGUST; break; } case Calendar.SEPTEMBER: { mthLongDesc = DateTimeConstants.SEPTEMBER; break; } case Calendar.OCTOBER: { mthLongDesc = DateTimeConstants.OCTOBER; break; } case Calendar.NOVEMBER: { mthLongDesc = DateTimeConstants.NOVEMBER; break; } case Calendar.DECEMBER: { mthLongDesc = DateTimeConstants.DECEMBER; break; } default: { mthLongDesc = ""; break; } } return mthLongDesc; }
From source file:com.gemstone.gemfire.rest.internal.web.controllers.RestAPIsWithSSLDUnitTest.java
public void doPutsInClientCache() { ClientCache cache = GemFireCacheImpl.getInstance(); assertNotNull(cache);/*from www . j a va2s.co m*/ Region<String, Object> region = cache.getRegion(PEOPLE_REGION_NAME); // put person object final Person person1 = new Person(101L, "Mithali", "Dorai", "Raj", DateTimeUtils.createDate(1982, Calendar.DECEMBER, 4), Gender.FEMALE); final Person person2 = new Person(102L, "Sachin", "Ramesh", "Tendulkar", DateTimeUtils.createDate(1975, Calendar.DECEMBER, 14), Gender.MALE); final Person person3 = new Person(103L, "Saurabh", "Baburav", "Ganguly", DateTimeUtils.createDate(1972, Calendar.AUGUST, 29), Gender.MALE); final Person person4 = new Person(104L, "Rahul", "subrymanyam", "Dravid", DateTimeUtils.createDate(1979, Calendar.MARCH, 17), Gender.MALE); final Person person5 = new Person(105L, "Jhulan", "Chidambaram", "Goswami", DateTimeUtils.createDate(1983, Calendar.NOVEMBER, 25), Gender.FEMALE); region.put("1", person1); region.put("2", person2); region.put("3", person3); region.put("4", person4); region.put("5", person5); final Person person6 = new Person(101L, "Rahul", "Rajiv", "Gndhi", DateTimeUtils.createDate(1970, Calendar.MAY, 14), Gender.MALE); final Person person7 = new Person(102L, "Narendra", "Damodar", "Modi", DateTimeUtils.createDate(1945, Calendar.DECEMBER, 24), Gender.MALE); final Person person8 = new Person(103L, "Atal", "Bihari", "Vajpayee", DateTimeUtils.createDate(1920, Calendar.AUGUST, 9), Gender.MALE); final Person person9 = new Person(104L, "Soniya", "Rajiv", "Gandhi", DateTimeUtils.createDate(1929, Calendar.MARCH, 27), Gender.FEMALE); final Person person10 = new Person(104L, "Priyanka", "Robert", "Gandhi", DateTimeUtils.createDate(1973, Calendar.APRIL, 15), Gender.FEMALE); final Person person11 = new Person(104L, "Murali", "Manohar", "Joshi", DateTimeUtils.createDate(1923, Calendar.APRIL, 25), Gender.MALE); final Person person12 = new Person(104L, "Lalkrishna", "Parmhansh", "Advani", DateTimeUtils.createDate(1910, Calendar.JANUARY, 01), Gender.MALE); final Person person13 = new Person(104L, "Shushma", "kumari", "Swaraj", DateTimeUtils.createDate(1943, Calendar.AUGUST, 10), Gender.FEMALE); final Person person14 = new Person(104L, "Arun", "raman", "jetly", DateTimeUtils.createDate(1942, Calendar.OCTOBER, 27), Gender.MALE); final Person person15 = new Person(104L, "Amit", "kumar", "shah", DateTimeUtils.createDate(1958, Calendar.DECEMBER, 21), Gender.MALE); final Person person16 = new Person(104L, "Shila", "kumari", "Dixit", DateTimeUtils.createDate(1927, Calendar.FEBRUARY, 15), Gender.FEMALE); Map<String, Object> userMap = new HashMap<String, Object>(); userMap.put("6", person6); userMap.put("7", person7); userMap.put("8", person8); userMap.put("9", person9); userMap.put("10", person10); userMap.put("11", person11); userMap.put("12", person12); userMap.put("13", person13); userMap.put("14", person14); userMap.put("15", person15); userMap.put("16", person16); region.putAll(userMap); if (cache != null) cache.getLogger().info("Gemfire Cache Client: Puts successfully done"); }
From source file:edu.mayo.informatics.lexgrid.convert.directConversions.UMLSHistoryFileToSQL.java
private Date getSystemReleaseDate(String releaseId) throws Exception { String sYear = releaseId.substring(0, 4); int year = new Integer(sYear).intValue(); String sMonth = releaseId.substring(4); int mon = 0;/*from ww w.jav a 2s . c om*/ Calendar cal = Calendar.getInstance(); if ("AA".equalsIgnoreCase(sMonth)) { mon = Calendar.JANUARY; } else if ("AB".equalsIgnoreCase(sMonth)) { mon = Calendar.APRIL; } else if ("AC".equalsIgnoreCase(sMonth)) { mon = Calendar.JULY; } else if ("AD".equalsIgnoreCase(sMonth)) { mon = Calendar.OCTOBER; } else { try { int i = Integer.parseInt(sMonth); switch (i) { case 1: mon = Calendar.JANUARY; break; case 2: mon = Calendar.FEBRUARY; break; case 3: mon = Calendar.MARCH; break; case 4: mon = Calendar.APRIL; break; case 5: mon = Calendar.MAY; break; case 6: mon = Calendar.JUNE; break; case 7: mon = Calendar.JULY; break; case 8: mon = Calendar.AUGUST; break; case 9: mon = Calendar.SEPTEMBER; break; case 10: mon = Calendar.OCTOBER; break; case 11: mon = Calendar.NOVEMBER; break; case 12: mon = Calendar.DECEMBER; break; default: throw new Exception("Release ID is not in required format: " + sMonth); } } catch (NumberFormatException e) { throw new Exception("Release ID is not in required format." + sMonth); } } cal.set(year, mon, 01, 0, 0, 0); cal.set(Calendar.MILLISECOND, 0); return new Date(cal.getTimeInMillis()); }
From source file:com.xing.api.JsonSerializationTest.java
private static void assertCompanies(XingUser user) throws Exception { Company first = buildPrimaryCompany(); Company second = new Company().id("24_abcdef").name("Ninja Ltd.").title("DevOps").tag("NINJA") .url("http://www.ninja-ltd.co.uk").beginDate(new SafeCalendar(2009, Calendar.APRIL)) .endDate(new SafeCalendar(2010, Calendar.JULY)) .industries(//from w ww. j a va 2 s .c om Collections.singletonList(new Industry(220800, "Athletes, organisers and associations"))) .formOfEmployment(FormOfEmployment.OWNER) .discipline(new Discipline("12_05e01e", "IT_AND_SOFTWARE_DEVELOPMENT")); Company third = new Company().id("45_abcdef").title("Wiss. Mitarbeiter").tag("OFFIS") .url("http://www.uni.de").beginDate(new SafeCalendar(2007)).endDate(new SafeCalendar(2008)) .industries(Collections.singletonList(new Industry(20400, "Fashion and textiles"))) .formOfEmployment(FormOfEmployment.PART_TIME_EMPLOYEE) .discipline(new Discipline("9_5e231a", "TEACHING_R_AND_D")); Company forth = new Company().id("176_abcdef").title("TEST NINJA").companySize(CompanySize.SIZE_201_500) .tag("TESTCOMPANY").careerLevel(CareerLevel.ENTRY_LEVEL) .beginDate(new SafeCalendar(1998, Calendar.DECEMBER)).endDate(new SafeCalendar(1999, Calendar.MAY)) .industries( Collections.singletonList(new Industry(220800, "Athletes, organisers and associations"))) .formOfEmployment(FormOfEmployment.INTERN); assertThat(user.professionalExperience().companies()).containsExactly(first, second, third, forth); }