Package java.util

Examples of java.util.Date.before()


            throw new TimestampValidationCallback.TimestampValidationException(
                    "The creation time is older than  currenttime - timestamp-freshness-limit - max-clock-skew");
        }

        Date currentTime = getGMTDateWithSkewAdjusted(new GregorianCalendar(), maxClockSkew, true);
        if (currentTime.before(created)) {
            throw new TimestampValidationCallback.TimestampValidationException(
                    "The creation time is ahead of the current time.");
        }
    }
View Full Code Here


      StationVO destination, Date date, Date time, final BookingType bookingtype,
      final ReservationType reservationType, final PaymentType paymentType,
        String creditCardCheckNumber) throws IOException, SAXException {
    Date actTime = new Date();
    Date bookTime = DateUtils.unifyDateTime(date, time);
    if(bookTime.before(actTime)) {
      String msg = "Can not book tickets for the past.";
      ExceptionUtils.throwError(msg);
    }
    PreCommitValidationHandler preCommitHandler = doPreBooking(session, start, destination, date, time, bookingtype, reservationType, paymentType);
    if(!preCommitHandler.isValid()) {
View Full Code Here

    for (int i=0; i<timeHandler.getStartTimes().size(); i++) {
      Date startTimeDate = timeHandler.getStartTimes().get(i);
      Date destinationTimeDate = timeHandler.getEndTimes().get(i);
      String link = timeHandler.getAnchors().get(i);
      Double price = timeHandler.getPrices().get(i);
      if(destinationTimeDate.before(startTimeDate)) {
        // destination time can not be before start time, must add one day
        // TODO: does only work for less than 24 hour trips!, but right now they are not in scope
        destinationTimeDate = DateUtils.addDay(destinationTimeDate, 1);
      }
      if(startTimeDate.before(queryTime)) {
View Full Code Here

  @Test
  public final void newInstanceByReflectionWithForNameCalendar() {
    Date now = new Date();
    Object result = Loop.run("test/loop/confidence/interop/new_instance_3.loop");
    assertTrue(result instanceof Date);
    assertTrue(now.before((Date) result) || now.equals(result));
  }

  @Test
  public final void newInstanceByReflectionCalendar() {
    Date now = new Date();
View Full Code Here

  @Test
  public final void newInstanceByReflectionCalendar() {
    Date now = new Date();
    Object result = Loop.run("test/loop/confidence/interop/new_instance_4.loop");
    assertTrue(result instanceof Date);
    assertTrue(now.before((Date) result) || now.equals(result));
  }

  @Test
  public final void mainMethodArgs() {
    assertEquals(Arrays.asList("ARG1", "ARG2"),
View Full Code Here

        Calendar calendar = createBaseDateCalendar();

        assertTrue(expired.after(calendar.getTime()));
        calendar.add(Calendar.DATE, 1);
        assertFalse(expired.before(calendar.getTime()));
        calendar.add(Calendar.DATE, 1);
        assertTrue(expired.before(calendar.getTime()));
    }

    public void testGetStream() throws Exception {
View Full Code Here

        assertTrue(expired.after(calendar.getTime()));
        calendar.add(Calendar.DATE, 1);
        assertFalse(expired.before(calendar.getTime()));
        calendar.add(Calendar.DATE, 1);
        assertTrue(expired.before(calendar.getTime()));
    }

    public void testGetStream() throws Exception {
        ByteArrayInputStream testStream = new ByteArrayInputStream("test".getBytes("US-ASCII"));
        CachedResourceImpl cachedResource = createCachedResource(createTestHeaders(), testStream);
View Full Code Here

  static void assertThatSuiteAndEnvironmentInfoWereAddedTo(XmlNode root) {
    assertThat(root.valueOfAttribute("hostname")).isEqualTo(localHostName());
    assertThat(root.valueOfAttribute("name")).isEqualTo("test");
    Date timestamp = parseDate(root.valueOfAttribute("timestamp"));
    assertThat(timestamp.before(now()));
  }

  private static Date parseDate(String s) {
    try {
      return parseIso8601DateTimeOrDate(s);
View Full Code Here

        } else {
            valueDuplicate = clearDateBelowDay(valueDuplicate);
            rangeEndDuplicate = clearDateBelowDay(rangeEndDuplicate);
        }

        return !rangeEndDuplicate.before(valueDuplicate);

    }

    private static Date clearDateBelowMonth(Date date) {
        date.setDate(1);
View Full Code Here

    public String getDueDate() {
        Date dueDate = null;
        List<CustTr> invoices = custTrs != null ? custTrs : new ArrayList<CustTr>();
        for (CustTr custTr : invoices) {
            dueDate = dueDate == null ? custTr.getDueDate() : dueDate
                    .before(custTr.getDueDate() != null ? custTr.getDueDate() : dueDate) ? custTr
                    .getDueDate() : dueDate;
        }
        return dueDate!=null?Util.SHORT_DATE_FORMAT.format(dueDate):null;
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.