Package org.apache.log4j.pattern

Examples of org.apache.log4j.pattern.CachedDateFormat.format()


    c.set(2005, Calendar.JANUARY, 1, 0, 0);
    c.set(Calendar.SECOND, 13);
    c.set(Calendar.MILLISECOND, 905);

    s = cachedFormat.format(c.getTime());
    assertEquals("2005-January-01 00:00:13,905 GMT+01:00", s);
  }
 

  /**
 
View Full Code Here


    c.set(2004, Calendar.OCTOBER, 5, 20, 0);
    c.set(Calendar.SECOND, 37);
    c.set(Calendar.MILLISECOND, 23);
    c.setTimeZone(cet);

    String s = cachedFormat.format(c.getTime());
    assertEquals("October 023 Tuesday", s);

    c.set(2004, Calendar.NOVEMBER, 1, 0, 0);
    c.set(Calendar.MILLISECOND, 23);
    s = cachedFormat.format(c.getTime());
View Full Code Here

    String s = cachedFormat.format(c.getTime());
    assertEquals("October 023 Tuesday", s);

    c.set(2004, Calendar.NOVEMBER, 1, 0, 0);
    c.set(Calendar.MILLISECOND, 23);
    s = cachedFormat.format(c.getTime());
    assertEquals("November 023 Monday", s);


    c.set(Calendar.MILLISECOND, 984);
    s = cachedFormat.format(c.getTime());
View Full Code Here

    s = cachedFormat.format(c.getTime());
    assertEquals("November 023 Monday", s);


    c.set(Calendar.MILLISECOND, 984);
    s = cachedFormat.format(c.getTime());
    assertEquals("November 984 Monday", s);
  }

  /**
   * Test that tests if caching is skipped if only "SS"
View Full Code Here

     //
     // The first request has to 100 ms after an ordinal second
     //    to push the literal zero out of the pattern check
     long ticks = 11142L * 86400000L;
     Date jul2 = new Date(ticks + 120);
     assertEquals("00,1200", gmtFormat.format(jul2));
     jul2.setTime(ticks + 87);
    

     //
     //   Cache gives 00,087
View Full Code Here

     jul2.setTime(ticks + 87);
    

     //
     //   Cache gives 00,087
     assertEquals("00,870", gmtFormat.format(jul2));

  }

  /**
   * Check pattern location for ISO8601
View Full Code Here

      Date jul2 = new Date(12602L * 86400000L);
      String badPattern = "HH:mm:ss,SSS HH:mm:ss,SSS";
      SimpleDateFormat simpleFormat = new SimpleDateFormat(badPattern);
      simpleFormat.setTimeZone(GMT);
      DateFormat cachedFormat = new CachedDateFormat(simpleFormat, 1000);
      String s = cachedFormat.format(jul2);
      assertEquals("00:00:00,000 00:00:00,000", s);
      jul2.setTime(jul2.getTime() + 120);
      assertEquals("00:00:00,120 00:00:00,120", simpleFormat.format(jul2));
      s = cachedFormat.format(jul2);
      //
View Full Code Here

      DateFormat cachedFormat = new CachedDateFormat(simpleFormat, 1000);
      String s = cachedFormat.format(jul2);
      assertEquals("00:00:00,000 00:00:00,000", s);
      jul2.setTime(jul2.getTime() + 120);
      assertEquals("00:00:00,120 00:00:00,120", simpleFormat.format(jul2));
      s = cachedFormat.format(jul2);
      //
      //  TODO: why is this returning ,120 ... , 120
      //
      //assertEquals("00:00:00,120 00:00:00,000", s) ;
     
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.