[OLINGO-317] Fixed test

This commit is contained in:
Michael Bolz 2014-07-08 14:49:21 +02:00
parent 45b7289f88
commit cc0d1a0e7c
1 changed files with 17 additions and 11 deletions

View File

@ -337,8 +337,8 @@ public class ODataJsonSerializerTest {
"\"PropertyDecimal\":4711.1174," +
"\"PropertyBinary\":\"BAcBAQ==\"," +
"\"PropertyDate\":\"2014-03-19\"," +
"\"PropertyDateTimeOffset\":\"2014-03-19T10:12:00+01:00\"," +
"\"PropertyDuration\":\"P16148383DT8H0S\"," +
"\"PropertyDateTimeOffset\":\"2014-03-19T10:12:00Z\"," +
"\"PropertyDuration\":\"P16148425DT0S\"," +
"\"PropertyGuid\":\"0000aaaa-00bb-00cc-00dd-000000ffffff\"," +
"\"PropertyTimeOfDay\":\"10:12:00\"" +
"}";
@ -396,8 +396,8 @@ public class ODataJsonSerializerTest {
"\"CollPropertyDecimal\":[4711.1174,1174.4711]," +
"\"CollPropertyBinary\":[\"BAcBAQ==\",\"dGVzdA==\"]," +
"\"CollPropertyDate\":[\"2014-03-19\",\"2014-07-02\"]," +
"\"CollPropertyDateTimeOffset\":[\"2014-03-19T10:12:00+01:00\",\"2014-07-02T13:30:00+02:00\"]," +
"\"CollPropertyDuration\":[\"P16148383DT8H0S\",\"P16253479DT4H0S\"]," +
"\"CollPropertyDateTimeOffset\":[\"2014-03-19T10:12:00Z\",\"2014-07-02T13:30:00Z\"]," +
"\"CollPropertyDuration\":[\"P16148425DT0S\",\"P16253562DT12H0S\"]," +
"\"CollPropertyGuid\":[\"0000aaaa-00bb-00cc-00dd-000000ffffff\",\"0000ffff-00dd-00cc-00bb-000000aaaaaa\"]," +
"\"CollPropertyTimeOfDay\":[\"10:12:00\",\"13:30:00\"]" +
"}";
@ -433,8 +433,8 @@ public class ODataJsonSerializerTest {
"\"PropertyDecimal\":4711.1174," +
"\"PropertyBinary\":\"BAcBAQ==\"," +
"\"PropertyDate\":\"2014-03-19\"," +
"\"PropertyDateTimeOffset\":\"2014-03-19T10:12:00+01:00\"," +
"\"PropertyDuration\":\"P16148383DT8H0S\"," +
"\"PropertyDateTimeOffset\":\"2014-03-19T10:12:00Z\"," +
"\"PropertyDuration\":\"P16148425DT0S\"," +
"\"PropertyGuid\":\"0000aaaa-00bb-00cc-00dd-000000ffffff\"," +
"\"PropertyTimeOfDay\":\"10:12:00\"" +
"}}";
@ -455,10 +455,10 @@ public class ODataJsonSerializerTest {
private Entity createETCollAllPrim(int id) {
Entity entity = new EntityImpl();
Calendar date = Calendar.getInstance();
Calendar date = createCalendarInstance();
date.set(2014, Calendar.MARCH, 19, 10, 12, 0);
date.set(Calendar.MILLISECOND, 0);
Calendar date2 = Calendar.getInstance();
Calendar date2 = createCalendarInstance();
date2.set(2014, Calendar.JULY, 2, 13, 30, 0);
date2.set(Calendar.MILLISECOND, 0);
//
@ -489,7 +489,7 @@ public class ODataJsonSerializerTest {
entity.addProperty(createProperty("Collection(Edm.Date)", TecSvcSimpleProperty.Collection_Date,
ValueType.COLLECTION_PRIMITIVE, date, date2));
entity.addProperty(createProperty("Collection(Edm.DateTimeOffset)", TecSvcSimpleProperty.Collection_DateTimeOffset,
ValueType.COLLECTION_PRIMITIVE, date.getTime(), date2.getTime()));
ValueType.COLLECTION_PRIMITIVE, date, date2));
entity.addProperty(createProperty("Collection(Edm.Duration)", TecSvcSimpleProperty.Collection_Duration,
ValueType.COLLECTION_PRIMITIVE, date.getTimeInMillis(), date2.getTimeInMillis()));
entity.addProperty(createProperty("Collection(Edm.Guid)", TecSvcSimpleProperty.Collection_Guid,
@ -503,7 +503,7 @@ public class ODataJsonSerializerTest {
private Entity createETAllPrim(int id) {
Entity entity = new EntityImpl();
Calendar date = Calendar.getInstance();
Calendar date = createCalendarInstance();
date.set(2014, Calendar.MARCH, 19, 10, 12, 0);
date.set(Calendar.MILLISECOND, 0);
entity.addProperty(createProperty("Edm.Int16", TecSvcSimpleProperty.Int16, ValueType.PRIMITIVE, id));
@ -522,7 +522,7 @@ public class ODataJsonSerializerTest {
new byte[]{0x04, 0x07, 0x01, 0x01}));
entity.addProperty(createProperty("Edm.Date", TecSvcSimpleProperty.Date, ValueType.PRIMITIVE, date));
entity.addProperty(createProperty("Edm.DateTimeOffset", TecSvcSimpleProperty.DateTimeOffset, ValueType.PRIMITIVE,
date.getTime()));
date));
entity.addProperty(createProperty("Edm.Duration", TecSvcSimpleProperty.Duration, ValueType.PRIMITIVE,
date.getTimeInMillis()));
entity.addProperty(createProperty("Edm.Guid", TecSvcSimpleProperty.Guid, ValueType.PRIMITIVE,
@ -531,6 +531,12 @@ public class ODataJsonSerializerTest {
return entity;
}
private Calendar createCalendarInstance() {
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"), Locale.ENGLISH);
cal.set(Calendar.ZONE_OFFSET, 0);
return cal;
}
private String streamToString(InputStream result) throws IOException {
byte[] buffer = new byte[8192];
StringBuilder sb = new StringBuilder();