Package org.apache.ws.jaxme.xs.util

Examples of org.apache.ws.jaxme.xs.util.XsTimeFormat


   *   instance of {@link org.apache.ws.jaxme.xs.util.XsTimeFormat}
   *   (default).
   */
public Format getTimeFormat() {
      if (timeFormat == null) {
          timeFormat = new XsTimeFormat();
      }
      return timeFormat;
  }
View Full Code Here


    }

    public void testFormatTime() {
        Calendar cal = getCalendar(TimeZone.getTimeZone("GMT"));
        assertEquals(0, cal.get(Calendar.MILLISECOND));
        XsTimeFormat format = new XsTimeFormat();
        String got = format.format(cal);
        String expect = "03:12:07Z";
        assertEquals(expect, got);

        cal = getCalendar(TimeZone.getTimeZone("GMT-03:00"));
        assertEquals(0, cal.get(Calendar.MILLISECOND));
        got = format.format(cal);
        expect = "03:12:07-03:00";
        assertEquals(expect, got);
    }
View Full Code Here

      "03:12:07.000Z",
      "03:12:07",
      "03:12:07-00:00",
      "03:12:07+00:00",
        };
        XsTimeFormat format = new XsTimeFormat();
        Calendar expect = getCalendar(TimeZone.getTimeZone("GMT"));
        for (int i = 0;  i < dateTimes.length;  i++) {
            Calendar got = (Calendar) format.parseObject(dateTimes[0]);
            assertEqualTime(expect, got);
        }

        String dateTime = "03:12:07.000-03:00";
        expect = getCalendar(TimeZone.getTimeZone("GMT-03:00"));
        Calendar got = (Calendar) format.parseObject(dateTime);
        assertEqualTime(expect, got);
    }
View Full Code Here

   *   instance of {@link org.apache.ws.jaxme.xs.util.XsTimeFormat}
   *   (default).
   */
  public Format getTimeFormat() {
    if (timeFormat == null) {
      timeFormat = new XsTimeFormat();
    }
    return timeFormat;
  }
View Full Code Here

   * contents.</p>
   */
  public void testAllElement() throws Exception {
    final Format defaultDateTimeFormat = new XsDateTimeFormat();
    final Format defaultDateFormat = new XsDateFormat();
    final Format defaultTimeFormat = new XsTimeFormat();
    testAllElement(defaultDateTimeFormat, defaultDateFormat, defaultTimeFormat);

    final Format otherDateTimeFormat = new Format(){
    private static final long serialVersionUID = -6173879133371739286L;
    private final DateFormat df = new SimpleDateFormat("yyyy.MMM.dd 'at' HH:mm:ss.SSS z");
View Full Code Here

        }
        return i;
    }

    public Calendar parseTime(String arg0) {
        XsTimeFormat format = new XsTimeFormat();
        ParsePosition pos = new ParsePosition(0);
        Calendar cal = (Calendar) format.parseObject(arg0, pos);
        if (cal == null) {
            throw new IllegalArgumentException("Failed to parse time " + arg0 +
                                   " at:" + arg0.substring(pos.getErrorIndex()));
        }
        return cal;
View Full Code Here

    public String printUnsignedShort(int arg0) {
        return Integer.toString(arg0);
    }

    public String printTime(Calendar arg0) {
        return new XsTimeFormat().format(arg0);
    }
View Full Code Here

   *   instance of {@link org.apache.ws.jaxme.xs.util.XsTimeFormat}
   *   (default).
   */
  public Format getTimeFormat() {
    if (timeFormat == null) {
      timeFormat = new XsTimeFormat();
    }
    return timeFormat;
  }
View Full Code Here

     * {@link org.apache.ws.jaxme.xs.util.XsTimeFormat#format(Object, StringBuffer, java.text.FieldPosition)}.
     */
    public void testFormatTime() {
        Calendar cal = getCalendar(TimeZone.getTimeZone("GMT"));
        assertEquals(0, cal.get(Calendar.MILLISECOND));
        XsTimeFormat format = new XsTimeFormat();
        String got = format.format(cal);
        String expect = "03:12:07Z";
        assertEquals(expect, got);

        cal = getCalendar(TimeZone.getTimeZone("GMT-03:00"));
        assertEquals(0, cal.get(Calendar.MILLISECOND));
        got = format.format(cal);
        expect = "03:12:07-03:00";
        assertEquals(expect, got);
    }
View Full Code Here

      "03:12:07.000Z",
      "03:12:07",
      "03:12:07-00:00",
      "03:12:07+00:00",
        };
        XsTimeFormat format = new XsTimeFormat();
        Calendar expect = getCalendar(TimeZone.getTimeZone("GMT"));
        for (int i = 0;  i < dateTimes.length;  i++) {
            Calendar got = (Calendar) format.parseObject(dateTimes[0]);
            assertEqualTime(expect, got);
        }

        String dateTime = "03:12:07.000-03:00";
        expect = getCalendar(TimeZone.getTimeZone("GMT-03:00"));
        Calendar got = (Calendar) format.parseObject(dateTime);
        assertEqualTime(expect, got);
    }
View Full Code Here

TOP

Related Classes of org.apache.ws.jaxme.xs.util.XsTimeFormat

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.