Search in sources :

Example 1 with HttpPartSchema

use of org.apache.juneau.httppart.HttpPartSchema in project incubator-juneau by apache.

the class OpenApiTest method b07_typeString_formatDate_Date.

@Test
public void b07_typeString_formatDate_Date() throws Exception {
    Date in = CalendarUtils.parseCalendar("2012-12-21", CalendarUtils.Format.ISO8601_D, null, null).getTime();
    HttpPartSchema ps = T_DATE;
    String s = serialize(ps, in);
    assertEquals("2012-12-21Z", s);
    Calendar r = parse(ps, s, Calendar.class);
    s = serialize(ps, r);
    assertEquals("2012-12-21Z", s);
}
Also used : HttpPartSchema(org.apache.juneau.httppart.HttpPartSchema)

Example 2 with HttpPartSchema

use of org.apache.juneau.httppart.HttpPartSchema in project incubator-juneau by apache.

the class OpenApiTest method b12_typeString_formatDateTime_Calendar.

@Test
public void b12_typeString_formatDateTime_Calendar() throws Exception {
    Calendar in = CalendarUtils.parseCalendar("2012-12-21", CalendarUtils.Format.ISO8601_D, null, null);
    HttpPartSchema ps = T_DATETIME;
    String s = serialize(ps, in);
    assertEquals("2012-12-21T00:00:00Z", s);
    Calendar r = parse(ps, s, Calendar.class);
    s = serialize(ps, r);
    assertEquals("2012-12-21T00:00:00Z", s);
}
Also used : HttpPartSchema(org.apache.juneau.httppart.HttpPartSchema)

Example 3 with HttpPartSchema

use of org.apache.juneau.httppart.HttpPartSchema in project incubator-juneau by apache.

the class OpenApiTest method a02b_noType_formatByte_null.

@Test
public void a02b_noType_formatByte_null() throws Exception {
    String in = null;
    HttpPartSchema ps = tNone().fByte().build();
    String s = serialize(ps, in);
    assertEquals("null", s);
}
Also used : HttpPartSchema(org.apache.juneau.httppart.HttpPartSchema)

Example 4 with HttpPartSchema

use of org.apache.juneau.httppart.HttpPartSchema in project incubator-juneau by apache.

the class OpenApiTest method b13_typeString_formatDateTime_Date.

@Test
public void b13_typeString_formatDateTime_Date() throws Exception {
    Date in = CalendarUtils.parseCalendar("2012-12-21", CalendarUtils.Format.ISO8601_D, null, null).getTime();
    HttpPartSchema ps = T_DATETIME;
    String s = serialize(ps, in);
    assertEquals("2012-12-21T00:00:00Z", s);
    Calendar r = parse(ps, s, Calendar.class);
    s = serialize(ps, r);
    assertEquals("2012-12-21T00:00:00Z", s);
}
Also used : HttpPartSchema(org.apache.juneau.httppart.HttpPartSchema)

Example 5 with HttpPartSchema

use of org.apache.juneau.httppart.HttpPartSchema in project incubator-juneau by apache.

the class OpenApiTest method d03_typeInteger_formatInt32_String.

@Test
public void d03_typeInteger_formatInt32_String() throws Exception {
    String in = "123";
    HttpPartSchema ps = T_INT32;
    String s = serialize(ps, in);
    assertEquals("123", s);
    String r = parse(ps, s, String.class);
    assertEquals(in, r);
}
Also used : HttpPartSchema(org.apache.juneau.httppart.HttpPartSchema)

Aggregations

HttpPartSchema (org.apache.juneau.httppart.HttpPartSchema)173 String (java.lang.String)24