Package org.joda.time

Examples of org.joda.time.LocalDate


    assertSame(getElements(category), accessor.getElements(category));
  }

  @Test
  public void shouldCreateADataNodeCorrectly() throws Exception {
    LocalDate date = new LocalDate();
    WorkspaceStorage ws = new WorkspaceStorage(new Path(""), new Path("/a"));
    E expected = createElement();
    T actual = accessor.createDataNode(date, ws, expected);
    assertValues(expected, date, ws, actual);
  }
View Full Code Here


  }

  @Override
  protected JavaEventListType createCategory() {
    JavaEventListType type = new JavaEventListType();
    type.setDate(toXmlDate(new LocalDate()));
    return type;
  }
View Full Code Here

  }

  @Override
  protected SessionEventListType createCategory() {
    SessionEventListType list = new SessionEventListType();
    list.setDate(DatatypeUtil.toXmlDate(new LocalDate()));
    return list;
  }
View Full Code Here

  private DataStore store = DataStore.PART_STORE;

  @Test
  public void testGetDataFile() {
    assertNotNull(store.getDataFile(new LocalDate()));
  }
View Full Code Here

   * {@link IDataStore#getDataFiles(LocalDate, LocalDate)}
   */
  @Test
  public void testGetDataFiles_startEnd() throws IOException {

    LocalDate lowerBound = new LocalDate(1, 1, 10);
    LocalDate upperBound = new LocalDate(3, 1, 1);

    LocalDate insideLowerBound = lowerBound.plusMonths(1);
    LocalDate insideUpperBound = upperBound.minusMonths(1);

    Set<File> files = new HashSet<File>();
    files.add(store.getDataFile(lowerBound));
    files.add(store.getDataFile(upperBound));
    files.add(store.getDataFile(insideLowerBound));
    files.add(store.getDataFile(insideUpperBound));
    for (File f : files) {
      if (!f.exists() && !f.createNewFile()) {
        throw new RuntimeException();
      }
    }

    List<File> returnedFiles = store.getDataFiles(lowerBound, upperBound);
    assertEquals(files.size(), returnedFiles.size());
    for (File f : returnedFiles) {
      assertTrue(files.contains(f));
    }
    assertEquals(0, store.getDataFiles(upperBound, lowerBound).size());
   
    for (File f : files) {
      FileUtils.forceDelete(f);
    }
    assertEquals(0, store.getDataFiles(lowerBound, upperBound).size());

    // Temporary test for testing files across multiple workspaces:
    LocalDate end = new LocalDate();
    LocalDate start = end.minusYears(1);

    List<File> result = new ArrayList<File>();
    IPath[] storagePaths = XmlPlugin.getDefault().getStoragePaths();
    MutableDateTime date = start.toDateTime(new LocalTime(0, 0, 0)).toMutableDateTime();
    while (new LocalDate(date.toInstant().getMillis()).compareTo(end) <= 0) {

      for (IPath path : storagePaths) {
        File f = store.getDataFile(new LocalDate(date.getMillis()), path);
        if (f.exists()) {
          result.add(f);
        }
      }
      date.addMonths(1);
View Full Code Here

   * @see IDataStore#getDataFiles(LocalDate, LocalDate, IPath)
   */
  @Test
  public void testGetDataFiles_startEndLocation() throws Exception {

    LocalDate lowerBound = new LocalDate(1, 1, 10);
    LocalDate upperBound = new LocalDate(3, 1, 1);

    LocalDate insideLowerBound = lowerBound.plusMonths(1);
    LocalDate insideUpperBound = upperBound.minusMonths(1);
   
    IPath path = new Path(System.getProperty("java.io.tmpdir"));

    Set<File> expectedFiles = new HashSet<File>();
    expectedFiles.add(store.getDataFile(lowerBound, path));
View Full Code Here

  }

  @Test
  public void testRead() throws IOException {

    LocalDate cal = new LocalDate(1, 1, 1);
    File f = store.getDataFile(cal);

    if (f.exists()) {
      assertNotNull(store.read(f));
View Full Code Here

  }

  @Test
  public void testToLocalDate() {
    XMLGregorianCalendar cal = toXmlDate(new DateTime());
    LocalDate date = toLocalDate(cal);
    assertEquals(cal.getYear(), date.getYear());
    assertEquals(cal.getMonth(), date.getMonthOfYear());
    assertEquals(cal.getDay(), date.getDayOfMonth());
  }
View Full Code Here

  }

  @Test
  public void testToXmlDate_fromLocalDate() {

    LocalDate cal = new LocalDate();
    XMLGregorianCalendar xmlCal = toXmlDate(cal);

    assertEquals(cal.getYear(), xmlCal.getYear());
    // Calendar.MONTH is zero based, xmlCal is one based.
    assertEquals(cal.getMonthOfYear(), xmlCal.getMonth());
    assertEquals(cal.getDayOfMonth(), xmlCal.getDay());
  }
View Full Code Here

       
        final LinkRepresentation updateLink = domainObjectRepr.getLinkWithRel(Rel.UPDATE);
       
        final JsonRepresentation argRepr = updateLink.getArguments();
       
        final LocalDate ld = new LocalDate(2013,5,1);
        final LocalDateTime ldt = new LocalDateTime(2013,2,1,14,15,0);
        final DateTime dt = new DateTime(2013,2,1,14,15,0);
        final String s = "New string";
       
        argRepr.mapPut("localDateProperty.value", asIsoNoT(ld.toDate()));
        argRepr.mapPut("localDateTimeProperty.value", asIso(ldt.toDate()));
        argRepr.mapPut("dateTimeProperty.value", asIso(dt.toDate()));
        argRepr.mapPut("stringProperty.value", s);

        final RestfulResponse<JsonRepresentation> result = client.follow(updateLink, argRepr);
        assertThat(result.getStatus(), is(HttpStatusCode.OK));
       
        final DomainObjectRepresentation afterResp = result.getEntity().as(DomainObjectRepresentation.class);
       
        assertThat(afterResp.getProperty("localDateProperty").getDate("value"), is(ld.toDate()));
        assertThat(afterResp.getProperty("localDateTimeProperty").getDateTime("value"), is(ldt.toDate()));
        assertThat(afterResp.getProperty("dateTimeProperty").getDateTime("value"), is(dt.toDate()));
        assertThat(afterResp.getProperty("stringProperty").getString("value"), is(s));
    }
View Full Code Here

TOP

Related Classes of org.joda.time.LocalDate

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.