You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by mi...@apache.org on 2014/07/09 15:32:03 UTC
[2/3] [OLINGO-317] Added DataProvider with data for TecSvc
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/13d8d36f/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/EntityTypeProvider.java
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/EntityTypeProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/EntityTypeProvider.java
index da43d5b..4763de8 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/EntityTypeProvider.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/EntityTypeProvider.java
@@ -123,7 +123,7 @@ public class EntityTypeProvider {
.setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
.setProperties(Arrays.asList(
PropertyProvider.propertyInt16_NotNullable, PropertyProvider.collPropertyString,
- PropertyProvider.propertyComplex_CTTwoPrim, PropertyProvider.collPropertyComplex_CTTwoPrim));
+ PropertyProvider.propertyComp_CTTwoPrim, PropertyProvider.collPropertyComp_CTTwoPrim));
} else if (entityTypeName.equals(nameETTwoKeyTwoPrim)) {
return new EntityType()
@@ -194,7 +194,7 @@ public class EntityTypeProvider {
.setName("ETCompAllPrim")
.setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
.setProperties(
- Arrays.asList(PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyComplex_CTAllPrim));
+ Arrays.asList(PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyComp_CTAllPrim));
} else if (entityTypeName.equals(nameETCompCollAllPrim)) {
return new EntityType()
@@ -203,14 +203,14 @@ public class EntityTypeProvider {
.setProperties(
Arrays.asList(PropertyProvider.propertyInt16_NotNullable,
- PropertyProvider.propertyComplex_CTCollAllPrim));
+ PropertyProvider.propertyComp_CTCollAllPrim));
} else if (entityTypeName.equals(nameETCompComp)) {
return new EntityType()
.setName("ETCompComp")
.setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
.setProperties(
- Arrays.asList(PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyComplex_CTCompComp));
+ Arrays.asList(PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyComp_CTCompComp));
} else if (entityTypeName.equals(nameETCompCollComp)) {
return new EntityType()
@@ -218,7 +218,7 @@ public class EntityTypeProvider {
.setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
.setProperties(
Arrays
- .asList(PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyComplex_CTCompCollComp));
+ .asList(PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyComp_CTCompCollComp));
} else if (entityTypeName.equals(nameETMedia)) {
return new EntityType()
@@ -234,18 +234,18 @@ public class EntityTypeProvider {
new PropertyRef()
.setPropertyName("PropertyInt16"),
new PropertyRef()
- .setPropertyName("PropertyComplex/PropertyInt16")
+ .setPropertyName("PropertyComp/PropertyInt16")
.setAlias("KeyAlias1"),
new PropertyRef()
- .setPropertyName("PropertyComplex/PropertyString")
+ .setPropertyName("PropertyComp/PropertyString")
.setAlias("KeyAlias2"),
new PropertyRef()
- .setPropertyName("PropertyComplexComplex/PropertyComplex/PropertyString")
+ .setPropertyName("PropertyCompComp/PropertyComp/PropertyString")
.setAlias("KeyAlias3")))
.setProperties(
Arrays.asList(
- PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyComplex_CTTwoPrim,
- PropertyProvider.propertyComplexComplex_CTCompComp));
+ PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyComp_CTTwoPrim,
+ PropertyProvider.propertyCompComp_CTCompComp));
} else if (entityTypeName.equals(nameETServerSidePaging)) {
return new EntityType()
@@ -295,12 +295,12 @@ public class EntityTypeProvider {
.setProperties(
Arrays.asList(
PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyString_NotNullable,
- PropertyProvider.propertyComplex_CTNavFiveProp,
- PropertyProvider.propertyComplexAllPrim_CTAllPrim, PropertyProvider.propertyComplexTwoPrim_CTTwoPrim,
+ PropertyProvider.propertyComp_CTNavFiveProp,
+ PropertyProvider.propertyCompAllPrim_CTAllPrim, PropertyProvider.propertyCompTwoPrim_CTTwoPrim,
PropertyProvider.collPropertyString, PropertyProvider.collPropertyInt16,
- PropertyProvider.collPropertyComplex_CTPrimComp,
+ PropertyProvider.collPropertyComp_CTPrimComp,
new Property()
- .setName("PropertyComplexComplex").setType(ComplexTypeProvider.nameCTCompNav)
+ .setName("PropertyCompComp").setType(ComplexTypeProvider.nameCTCompNav)
))
.setNavigationProperties(
Arrays.asList(
@@ -330,14 +330,14 @@ public class EntityTypeProvider {
.setProperties(
Arrays.asList(
PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyString_NotNullable,
- PropertyProvider.propertyComplex_CTPrimComp_NotNullable,
- new Property().setName("PropertyComplexNav").setType(ComplexTypeProvider.nameCTBasePrimCompNav)
+ PropertyProvider.propertyComp_CTPrimComp_NotNullable,
+ new Property().setName("PropertyCompNav").setType(ComplexTypeProvider.nameCTBasePrimCompNav)
.setNullable(false),
- PropertyProvider.propertyComplexEnum_CTPrimEnum_NotNullable,
- PropertyProvider.collPropertyComplex_CTPrimComp,
- new Property().setName("CollPropertyComplexNav").setType(ComplexTypeProvider.nameCTNavFiveProp)
+ PropertyProvider.propertyCompEnum_CTPrimEnum_NotNullable,
+ PropertyProvider.collPropertyComp_CTPrimComp,
+ new Property().setName("CollPropertyCompNav").setType(ComplexTypeProvider.nameCTNavFiveProp)
.setCollection(true),
- PropertyProvider.collPropertyString, PropertyProvider.propertyComplexTwoPrim_CTTwoPrim,
+ PropertyProvider.collPropertyString, PropertyProvider.propertyCompTwoPrim_CTTwoPrim,
PropertyProvider.propertyEnumString_ENString
))
.setNavigationProperties(Arrays.asList(
@@ -384,14 +384,14 @@ public class EntityTypeProvider {
.setKey(
Arrays.asList(
new PropertyRef().setPropertyName("PropertyInt16"),
- new PropertyRef().setPath("PropertyComplex/PropertyInt16").setPropertyName("PropertyInt16").setAlias(
+ new PropertyRef().setPath("PropertyComp/PropertyInt16").setPropertyName("PropertyInt16").setAlias(
"KeyAlias1"),
- new PropertyRef().setPath("PropertyComplex/PropertyString").setPropertyName("PropertyString")
+ new PropertyRef().setPath("PropertyComp/PropertyString").setPropertyName("PropertyString")
.setAlias("KeyAlias2"),
- new PropertyRef().setPath("PropertyComplexComplex/PropertyComplex/PropertyString").setPropertyName(
+ new PropertyRef().setPath("PropertyCompComp/PropertyComp/PropertyString").setPropertyName(
"PropertyString").setAlias("KeyAlias3"))).setProperties(
- Arrays.asList(PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyComplex_CTTwoPrim,
- PropertyProvider.propertyComplexComplex_CTCompComp));
+ Arrays.asList(PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyComp_CTTwoPrim,
+ PropertyProvider.propertyCompComp_CTCompComp));
} else if (entityTypeName.equals(nameETCompMixPrimCollComp)) {
return new EntityType()
.setName("ETCompMixPrimCollComp")
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/13d8d36f/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/PropertyProvider.java
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/PropertyProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/PropertyProvider.java
index 491b6f3..765a534 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/PropertyProvider.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/PropertyProvider.java
@@ -461,60 +461,60 @@ public class PropertyProvider {
*/
// Complex Properties ----------------------------------------------------------------------------------------------
- public static final Property collPropertyComplex_CTPrimComp = new Property()
- .setName("CollPropertyComplex")
+ public static final Property collPropertyComp_CTPrimComp = new Property()
+ .setName("CollPropertyComp")
.setType(ComplexTypeProvider.nameCTPrimComp)
.setCollection(true);
- public static final Property collPropertyComplex_CTTwoPrim = new Property()
- .setName("CollPropertyComplex")
+ public static final Property collPropertyComp_CTTwoPrim = new Property()
+ .setName("CollPropertyComp")
.setType(ComplexTypeProvider.nameCTTwoPrim)
.setCollection(true);
- public static final Property propertyComplex_CTAllPrim = new Property()
- .setName("PropertyComplex")
+ public static final Property propertyComp_CTAllPrim = new Property()
+ .setName("PropertyComp")
.setType(ComplexTypeProvider.nameCTAllPrim);
- public static final Property propertyComplex_CTCollAllPrim = new Property()
- .setName("PropertyComplex")
+ public static final Property propertyComp_CTCollAllPrim = new Property()
+ .setName("PropertyComp")
.setType(ComplexTypeProvider.nameCTCollAllPrim);
- public static final Property propertyComplex_CTCompCollComp = new Property()
- .setName("PropertyComplex")
+ public static final Property propertyComp_CTCompCollComp = new Property()
+ .setName("PropertyComp")
.setType(ComplexTypeProvider.nameCTCompCollComp);
- public static final Property propertyComplex_CTCompComp = new Property()
- .setName("PropertyComplex")
+ public static final Property propertyComp_CTCompComp = new Property()
+ .setName("PropertyComp")
.setType(ComplexTypeProvider.nameCTCompComp);
- public static final Property propertyComplex_CTNavFiveProp = new Property()
- .setName("PropertyComplex")
+ public static final Property propertyComp_CTNavFiveProp = new Property()
+ .setName("PropertyComp")
.setType(ComplexTypeProvider.nameCTNavFiveProp);
- public static final Property propertyComplex_CTPrimComp_NotNullable = new Property()
- .setName("PropertyComplex")
+ public static final Property propertyComp_CTPrimComp_NotNullable = new Property()
+ .setName("PropertyComp")
.setType(ComplexTypeProvider.nameCTPrimComp)
.setNullable(false);
- public static final Property propertyComplex_CTTwoPrim = new Property()
- .setName("PropertyComplex")
+ public static final Property propertyComp_CTTwoPrim = new Property()
+ .setName("PropertyComp")
.setType(ComplexTypeProvider.nameCTTwoPrim);
- public static final Property propertyComplexAllPrim_CTAllPrim = new Property()
- .setName("PropertyComplexAllPrim")
+ public static final Property propertyCompAllPrim_CTAllPrim = new Property()
+ .setName("PropertyCompAllPrim")
.setType(ComplexTypeProvider.nameCTAllPrim);
- public static final Property propertyComplexComplex_CTCompComp = new Property()
- .setName("PropertyComplexComplex")
+ public static final Property propertyCompComp_CTCompComp = new Property()
+ .setName("PropertyCompComp")
.setType(ComplexTypeProvider.nameCTCompComp);
- public static final Property propertyComplexEnum_CTPrimEnum_NotNullable = new Property()
- .setName("PropertyComplexEnum")
+ public static final Property propertyCompEnum_CTPrimEnum_NotNullable = new Property()
+ .setName("PropertyCompEnum")
.setType(ComplexTypeProvider.nameCTPrimEnum)
.setNullable(false);
- public static final Property propertyComplexTwoPrim_CTTwoPrim = new Property()
- .setName("PropertyComplexTwoPrim")
+ public static final Property propertyCompTwoPrim_CTTwoPrim = new Property()
+ .setName("PropertyCompTwoPrim")
.setType(ComplexTypeProvider.nameCTTwoPrim);
public static final Property propertyMixedPrimCollComp_CTMixPrimCollComp = new Property()
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/13d8d36f/lib/server-tecsvc/src/main/resources/ESAllPrim.json
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/main/resources/ESAllPrim.json b/lib/server-tecsvc/src/main/resources/ESAllPrim.json
deleted file mode 100644
index 0e0da29..0000000
--- a/lib/server-tecsvc/src/main/resources/ESAllPrim.json
+++ /dev/null
@@ -1,56 +0,0 @@
-{"@odata.context": "$metadata#ESAllPrim", "value": [
- {
- "PropertyInt16": 32767,
- "PropertyString": "First Resource - positive values",
- "PropertyBoolean": true,
- "PropertyByte": 255,
- "PropertySByte": 127,
- "PropertyInt32": 2147483647,
- "PropertyInt64": 9223372036854775807,
- "PropertySingle": 1.79000000E+20,
- "PropertyDouble": -1.7900000000000000E+19,
- "PropertyDecimal": 34,
- "PropertyBinary": "ASNFZ4mrze8=",
- "PropertyDate": "2012-12-03",
- "PropertyDateTimeOffset": "2012-12-03T07:16:23Z",
- "PropertyDuration": "P0DT0H0M6S",
- "PropertyGuid": "01234567-89ab-cdef-0123-456789abcdef",
- "PropertyTimeOfDay": "03:26:05"
- },
- {
- "PropertyInt16": -32768,
- "PropertyString": "Second Resource - negative values",
- "PropertyBoolean": false,
- "PropertyByte": 0,
- "PropertySByte": -128,
- "PropertyInt32": -2147483648,
- "PropertyInt64": -9223372036854775808,
- "PropertySingle": -1.79000000E+08,
- "PropertyDouble": -1.7900000000000000E+05,
- "PropertyDecimal": -34,
- "PropertyBinary": "ASNFZ4mrze8=",
- "PropertyDate": "2015-11-05",
- "PropertyDateTimeOffset": "2005-12-03T07:17:08Z",
- "PropertyDuration": "P0DT0H0M9S",
- "PropertyGuid": "76543201-23ab-cdef-0123-456789dddfff",
- "PropertyTimeOfDay": "23:49:14"
- },
- {
- "PropertyInt16": 0,
- "PropertyString": "",
- "PropertyBoolean": false,
- "PropertyByte": 0,
- "PropertySByte": 0,
- "PropertyInt32": 0,
- "PropertyInt64": 0,
- "PropertySingle": 0.00000000E+00,
- "PropertyDouble": 0.0000000000000000E+00,
- "PropertyDecimal": 0,
- "PropertyBinary": "",
- "PropertyDate": "1970-01-01",
- "PropertyDateTimeOffset": "2005-12-03T00:00:00Z",
- "PropertyDuration": "P0DT0H0M0S",
- "PropertyGuid": "76543201-23ab-cdef-0123-456789cccddd",
- "PropertyTimeOfDay": "00:01:01"
- }
-]}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/13d8d36f/lib/server-tecsvc/src/main/resources/ESCollAllPrim.json
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/main/resources/ESCollAllPrim.json b/lib/server-tecsvc/src/main/resources/ESCollAllPrim.json
deleted file mode 100644
index 89471d4..0000000
--- a/lib/server-tecsvc/src/main/resources/ESCollAllPrim.json
+++ /dev/null
@@ -1,59 +0,0 @@
-{"@odata.context": "$metadata#ESCollAllPrim", "value": [
- {
- "PropertyInt16": 1,
- "CollPropertyString": ["spiderman@comic.com", "spidermaus@comic.com", "spidergirl@comic.com"],
- "CollPropertyBoolean": [true, false, true],
- "CollPropertyByte": [50, 200, 249],
- "CollPropertySByte": [-120, 120, 126],
- "CollPropertyInt16": [1000, 2000, 30112],
- "CollPropertyInt32": [23232323, 11223355, 10000001],
- "CollPropertyInt64": [929292929292, 333333333333, 444444444444],
- "CollPropertySingle": [1.79000000E+03, 2.66000000E+04, 3.21000000E+03],
- "CollPropertyDouble": [-1.7900000000000000E+04, -2.7800000000000000E+07, 3.2100000000000000E+03],
- "CollPropertyDecimal": [12, -2, 1234],
- "CollPropertyBinary": ["q83v", "ASNF", "VGeJ"],
- "CollPropertyDate": ["1958-12-03", "1999-08-05", "2013-06-25"],
- "CollPropertyDateTimeOffset": ["2015-08-12T03:08:34Z", "1970-03-28T12:11:10Z", "1948-02-17T09:09:09Z"],
- "CollPropertyDuration": ["P0DT0H0M13S", "P0DT5H28M20S", "P0DT1H0M0S"],
- "CollPropertyGuid": ["ffffff67-89ab-cdef-0123-456789aaaaaa", "eeeeee67-89ab-cdef-0123-456789bbbbbb", "cccccc67-89ab-cdef-0123-456789cccccc"],
- "CollPropertyTimeOfDay": ["04:14:13", "23:59:59", "01:12:33"]
- },
- {
- "PropertyInt16": 2,
- "CollPropertyString": ["spiderman@comic.com", "spidermaus@comic.com", "spidergirl@comic.com"],
- "CollPropertyBoolean": [true, false, true],
- "CollPropertyByte": [50, 200, 249],
- "CollPropertySByte": [-120, 120, 126],
- "CollPropertyInt16": [1000, 2000, 30112],
- "CollPropertyInt32": [23232323, 11223355, 10000001],
- "CollPropertyInt64": [929292929292, 333333333333, 444444444444],
- "CollPropertySingle": [1.79000000E+03, 2.66000000E+04, 3.21000000E+03],
- "CollPropertyDouble": [-1.7900000000000000E+04, -2.7800000000000000E+07, 3.2100000000000000E+03],
- "CollPropertyDecimal": [12, -2, 1234],
- "CollPropertyBinary": ["q83v", "ASNF", "VGeJ"],
- "CollPropertyDate": ["1958-12-03", "1999-08-05", "2013-06-25"],
- "CollPropertyDateTimeOffset": ["2015-08-12T03:08:34Z", "1970-03-28T12:11:10Z", "1948-02-17T09:09:09Z"],
- "CollPropertyDuration": ["P0DT0H0M13S", "P0DT5H28M20S", "P0DT1H0M0S"],
- "CollPropertyGuid": ["ffffff67-89ab-cdef-0123-456789aaaaaa", "eeeeee67-89ab-cdef-0123-456789bbbbbb", "cccccc67-89ab-cdef-0123-456789cccccc"],
- "CollPropertyTimeOfDay": ["04:14:13", "23:59:59", "01:12:33"]
- },
- {
- "PropertyInt16": 3,
- "CollPropertyString": ["spiderman@comic.com", "spidermaus@comic.com", "spidergirl@comic.com"],
- "CollPropertyBoolean": [true, false, true],
- "CollPropertyByte": [50, 200, 249],
- "CollPropertySByte": [-120, 120, 126],
- "CollPropertyInt16": [1000, 2000, 30112],
- "CollPropertyInt32": [23232323, 11223355, 10000001],
- "CollPropertyInt64": [929292929292, 333333333333, 444444444444],
- "CollPropertySingle": [1.79000000E+03, 2.66000000E+04, 3.21000000E+03],
- "CollPropertyDouble": [-1.7900000000000000E+04, -2.7800000000000000E+07, 3.2100000000000000E+03],
- "CollPropertyDecimal": [12, -2, 1234],
- "CollPropertyBinary": ["q83v", "ASNF", "VGeJ"],
- "CollPropertyDate": ["1958-12-03", "1999-08-05", "2013-06-25"],
- "CollPropertyDateTimeOffset": ["2015-08-12T03:08:34Z", "1970-03-28T12:11:10Z", "1948-02-17T09:09:09Z"],
- "CollPropertyDuration": ["P0DT0H0M13S", "P0DT5H28M20S", "P0DT1H0M0S"],
- "CollPropertyGuid": ["ffffff67-89ab-cdef-0123-456789aaaaaa", "eeeeee67-89ab-cdef-0123-456789bbbbbb", "cccccc67-89ab-cdef-0123-456789cccccc"],
- "CollPropertyTimeOfDay": ["04:14:13", "23:59:59", "01:12:33"]
- }
-]}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/13d8d36f/lib/server-tecsvc/src/main/resources/ESCompAllPrim.json
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/main/resources/ESCompAllPrim.json b/lib/server-tecsvc/src/main/resources/ESCompAllPrim.json
deleted file mode 100644
index bd87bc3..0000000
--- a/lib/server-tecsvc/src/main/resources/ESCompAllPrim.json
+++ /dev/null
@@ -1,65 +0,0 @@
-{"@odata.context": "$metadata#ESCompAllPrim", "value": [
- {
- "PropertyInt16": 32767,
- "PropertyComp": {
- "PropertyString": "First Resource - first",
- "PropertyBinary": "ASNFZ4mrze8=",
- "PropertyBoolean": true,
- "PropertyByte": 255,
- "PropertyDate": "2012-10-03",
- "PropertyDateTimeOffset": "2012-10-03T07:16:23.1234567Z",
- "PropertyDecimal": 34.27,
- "PropertySingle": 1.79000000E+20,
- "PropertyDouble": -1.7900000000000000E+19,
- "PropertyDuration": "P0DT0H0M6S",
- "PropertyGuid": "01234567-89ab-cdef-0123-456789abcdef",
- "PropertyInt16": 32767,
- "PropertyInt32": 2147483647,
- "PropertyInt64": 9223372036854775807,
- "PropertySByte": 127,
- "PropertyTimeOfDay": "01:00:01"
- }
- },
- {
- "PropertyInt16": 7,
- "PropertyComp": {
- "PropertyString": "Second Resource - second",
- "PropertyBinary": "ASNFZ4mrze8=",
- "PropertyBoolean": true,
- "PropertyByte": 255,
- "PropertyDate": "2013-11-04",
- "PropertyDateTimeOffset": "2013-11-04T07:16:23Z",
- "PropertyDecimal": 34.27,
- "PropertySingle": 1.79000000E+20,
- "PropertyDouble": -1.7900000000000000E+02,
- "PropertyDuration": "P0DT0H0M6S",
- "PropertyGuid": "01234567-89ab-cdef-0123-456789abcdef",
- "PropertyInt16": 25,
- "PropertyInt32": 2147483647,
- "PropertyInt64": 9223372036854775807,
- "PropertySByte": 127,
- "PropertyTimeOfDay": "07:45:12.7654321"
- }
- },
- {
- "PropertyInt16": 0,
- "PropertyComp": {
- "PropertyString": "Third Resource - third",
- "PropertyBinary": "ASNFZ4mrze8=",
- "PropertyBoolean": true,
- "PropertyByte": 255,
- "PropertyDate": "2014-12-05",
- "PropertyDateTimeOffset": "2014-12-05T08:17:45.1234567Z",
- "PropertyDecimal": 17.98,
- "PropertySingle": 1.79000000E+20,
- "PropertyDouble": -1.7900000000000000E+02,
- "PropertyDuration": "P0DT0H0M6S",
- "PropertyGuid": "01234567-89ab-cdef-0123-456789abcdef",
- "PropertyInt16": -25,
- "PropertyInt32": 2147483647,
- "PropertyInt64": 9223372036854775807,
- "PropertySByte": 127,
- "PropertyTimeOfDay": "13:27:45"
- }
- }
-]}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/13d8d36f/lib/server-tecsvc/src/main/resources/ESMixPrimCollComp.json
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/main/resources/ESMixPrimCollComp.json b/lib/server-tecsvc/src/main/resources/ESMixPrimCollComp.json
deleted file mode 100644
index a58c603..0000000
--- a/lib/server-tecsvc/src/main/resources/ESMixPrimCollComp.json
+++ /dev/null
@@ -1,68 +0,0 @@
-{"@odata.context": "$metadata#ESMixPrimCollComp", "value": [
- {
- "PropertyInt16": 32767,
- "CollPropertyString": ["spiderman@comic.com", "spidermaus@comic.com", "spidergirl@comic.com"],
- "PropertyComp": {
- "PropertyInt16": 111,
- "PropertyString": "TEST A"
- },
- "CollPropertyComp": [
- {
- "PropertyInt16": 123,
- "PropertyString": "TEST 1"
- },
- {
- "PropertyInt16": 456,
- "PropertyString": "TEST 2"
- },
- {
- "PropertyInt16": 789,
- "PropertyString": "TEST 3"
- }
- ]
- },
- {
- "PropertyInt16": 7,
- "CollPropertyString": ["spiderman@comic.com", "spidermaus@comic.com", "spidergirl@comic.com"],
- "PropertyComp": {
- "PropertyInt16": 222,
- "PropertyString": "TEST B"
- },
- "CollPropertyComp": [
- {
- "PropertyInt16": 123,
- "PropertyString": "TEST 1"
- },
- {
- "PropertyInt16": 456,
- "PropertyString": "TEST 2"
- },
- {
- "PropertyInt16": 789,
- "PropertyString": "TEST 3"
- }
- ]
- },
- {
- "PropertyInt16": 0,
- "CollPropertyString": ["spiderman@comic.com", "spidermaus@comic.com", "spidergirl@comic.com"],
- "PropertyComp": {
- "PropertyInt16": 333,
- "PropertyString": "TEST C"
- },
- "CollPropertyComp": [
- {
- "PropertyInt16": 123,
- "PropertyString": "TEST 1"
- },
- {
- "PropertyInt16": 456,
- "PropertyString": "TEST 2"
- },
- {
- "PropertyInt16": 789,
- "PropertyString": "TEST 3"
- }
- ]
- }
-]}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/13d8d36f/lib/server-tecsvc/src/main/resources/ESTwoPrim.json
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/main/resources/ESTwoPrim.json b/lib/server-tecsvc/src/main/resources/ESTwoPrim.json
deleted file mode 100644
index 727c6a8..0000000
--- a/lib/server-tecsvc/src/main/resources/ESTwoPrim.json
+++ /dev/null
@@ -1 +0,0 @@
-{"@odata.context":"$metadata#ESTwoPrim","value":[{"PropertyInt16":32766,"PropertyString":"Test String1"},{"PropertyInt16":-365,"PropertyString":"Test String2"},{"PropertyInt16":-32766,"PropertyString":"Test String3"},{"PropertyInt16":32767,"PropertyString":"Test String4"}]}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/13d8d36f/lib/server-tecsvc/src/test/java/org/apache/olingo/server/tecsvc/data/JsonDataProviderTest.java
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/test/java/org/apache/olingo/server/tecsvc/data/JsonDataProviderTest.java b/lib/server-tecsvc/src/test/java/org/apache/olingo/server/tecsvc/data/JsonDataProviderTest.java
index 9ac0be6..23536ff 100644
--- a/lib/server-tecsvc/src/test/java/org/apache/olingo/server/tecsvc/data/JsonDataProviderTest.java
+++ b/lib/server-tecsvc/src/test/java/org/apache/olingo/server/tecsvc/data/JsonDataProviderTest.java
@@ -26,10 +26,12 @@ import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmComplexType;
import org.apache.olingo.commons.api.edm.EdmElement;
+import org.apache.olingo.commons.api.edm.EdmEntityContainer;
import org.apache.olingo.commons.api.edm.EdmEntitySet;
import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.commons.api.edm.EdmProperty;
import org.apache.olingo.commons.api.edm.EdmStructuredType;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.server.api.OData;
import org.apache.olingo.server.core.serializer.json.ODataJsonSerializer;
import org.apache.olingo.server.tecsvc.provider.ContainerProvider;
@@ -44,19 +46,34 @@ import java.util.List;
*/
public class JsonDataProviderTest {
+ private final Edm edm = OData.newInstance().createEdm(new EdmTechProvider());
+ private final EdmEntityContainer entityContainer = edm.getEntityContainer(
+ new FullQualifiedName("com.sap.odata.test1", "Container"));
+
+ private final EdmEntitySet esAllPrim;
+ private final EdmEntitySet esCompAllPrim;
+ private final EdmEntitySet esCollAllPrim;
+ private final EdmEntitySet esMixPrimCollAllPrim;
+
+ public JsonDataProviderTest() {
+ esAllPrim = entityContainer.getEntitySet("ESAllPrim");
+ esCompAllPrim = entityContainer.getEntitySet("ESCompAllPrim");
+ esCollAllPrim = entityContainer.getEntitySet("ESCollAllPrim");
+ esMixPrimCollAllPrim = entityContainer.getEntitySet("ESMixPrimCollComp");
+ }
+
@Test
public void doRoundTrip() throws Exception {
- doRoundTrip("ESAllPrim", 1405);
- doRoundTrip("ESCompAllPrim", 1597);
- doRoundTrip("ESCollAllPrim", 2858);
- doRoundTrip("ESMixPrimCollComp", 1050);
+ doRoundTrip(entityContainer.getEntitySet("ESAllPrim"), 1401);
+ doRoundTrip(entityContainer.getEntitySet("ESCompAllPrim"), 1592);
+ doRoundTrip(entityContainer.getEntitySet("ESCollAllPrim"), 2855);
+ doRoundTrip(entityContainer.getEntitySet("ESMixPrimCollComp"), 1032);
}
@Test
public void esAllPrimEntity() throws Exception {
DataProvider jdp = getDataProvider();
- jdp.reset();
- Entity first = jdp.read("ESAllPrim", Integer.valueOf(0));
+ Entity first = jdp.readAll(esAllPrim).getEntities().get(0);
Assert.assertEquals(16, first.getProperties().size());
}
@@ -64,7 +81,7 @@ public class JsonDataProviderTest {
@Test
public void esAllPrim() throws Exception {
DataProvider jdp = getDataProvider();
- EntitySet outSet = jdp.readAll("ESAllPrim");
+ EntitySet outSet = jdp.readAll(esAllPrim);
Assert.assertEquals(3, outSet.getEntities().size());
Entity first = outSet.getEntities().get(0);
@@ -76,7 +93,7 @@ public class JsonDataProviderTest {
@Test
public void esCollAllPrim() throws Exception {
DataProvider jdp = getDataProvider();
- EntitySet outSet = jdp.readAll("ESCollAllPrim");
+ EntitySet outSet = jdp.readAll(esCollAllPrim);
Assert.assertEquals(3, outSet.getEntities().size());
Assert.assertEquals(17, outSet.getEntities().get(0).getProperties().size());
@@ -90,7 +107,7 @@ public class JsonDataProviderTest {
@Test
public void esCompAllPrim() throws Exception {
DataProvider jdp = getDataProvider();
- EntitySet outSet = jdp.readAll("ESCompAllPrim");
+ EntitySet outSet = jdp.readAll(esCompAllPrim);
Assert.assertEquals(3, outSet.getEntities().size());
Assert.assertEquals(2, outSet.getEntities().get(0).getProperties().size());
@@ -104,7 +121,7 @@ public class JsonDataProviderTest {
@Test
public void esMixPrimCollComp() throws Exception {
DataProvider jdp = getDataProvider();
- EntitySet outSet = jdp.readAll("ESMixPrimCollComp");
+ EntitySet outSet = jdp.readAll(esMixPrimCollAllPrim);
Assert.assertEquals(3, outSet.getEntities().size());
Assert.assertEquals(4, outSet.getEntities().get(0).getProperties().size());
@@ -119,7 +136,7 @@ public class JsonDataProviderTest {
Assert.assertEquals(2, linkedComplexValue.getValue().size());
Property lcProp = linkedComplexValue.getValue().get(0);
Assert.assertFalse(lcProp.isCollection());
- Assert.assertEquals(Short.valueOf("123"), lcProp.getValue());
+ Assert.assertEquals(Integer.valueOf("123"), lcProp.getValue());
//
Assert.assertEquals(4, outSet.getEntities().get(1).getProperties().size());
Assert.assertEquals(4, outSet.getEntities().get(2).getProperties().size());
@@ -128,7 +145,7 @@ public class JsonDataProviderTest {
private DataProvider getDataProvider() throws DataProvider.DataProviderException {
OData odata = OData.newInstance();
Edm edm = odata.createEdm(new EdmTechProvider());
- return new JefDataProvider(edm);
+ return new DataProvider(edm);
}
@Test
@@ -162,24 +179,20 @@ public class JsonDataProviderTest {
}
}
- private void doRoundTrip(String name, int expectedLength) throws Exception {
- OData odata = OData.newInstance();
- Edm edm = odata.createEdm(new EdmTechProvider());
- EdmEntitySet edmEntitySet = edm.getEntityContainer(ContainerProvider.nameContainer).getEntitySet(name);
-
- DataProvider jdp = new JefDataProvider(edm);
- EntitySet outSet = jdp.readAll(name);
+ private void doRoundTrip(EdmEntitySet entitySet, int expectedLength) throws Exception {
+ DataProvider jdp = new DataProvider(edm);
+ EntitySet outSet = jdp.readAll(entitySet);
ODataJsonSerializer serializer = new ODataJsonSerializer();
ContextURL contextUrl = null;
- InputStream is = serializer.entitySet(edmEntitySet, outSet, contextUrl);
+ InputStream is = serializer.entitySet(entitySet, outSet, contextUrl);
StringHelper.Stream stream = StringHelper.toStream(is);
- System.out.println("========== " + name + " =================");
- stream.print();
- System.out.println("\n========== " + name + " =================");
+// System.out.println("========== " + entitySet.getName() + " =================");
+// stream.print();
+// System.out.println("\n========== " + entitySet.getName() + " =================");
Assert.assertEquals(expectedLength, stream.asString().length());
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/13d8d36f/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializerTest.java
----------------------------------------------------------------------
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializerTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializerTest.java
new file mode 100644
index 0000000..634f0ca
--- /dev/null
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializerTest.java
@@ -0,0 +1,176 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.server.core.serializer.json;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+
+import org.apache.olingo.commons.api.data.ContextURL;
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.EntitySet;
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmEntityContainer;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.server.api.OData;
+import org.apache.olingo.server.api.serializer.ODataSerializer;
+import org.apache.olingo.server.tecsvc.data.DataProvider;
+import org.apache.olingo.server.tecsvc.provider.EdmTechProvider;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class ODataJsonSerializerTest {
+
+ private final Edm edm = OData.newInstance().createEdm(new EdmTechProvider());
+ private final EdmEntityContainer entityContainer = edm.getEntityContainer(
+ new FullQualifiedName("com.sap.odata.test1", "Container"));
+ private final DataProvider data = new DataProvider(edm);
+ private ODataSerializer serializer = new ODataJsonSerializer();
+
+ @Test
+ public void entitySimple() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
+ final Entity entity = data.readAll(edmEntitySet).getEntities().get(0);
+ InputStream result = serializer.entity(edmEntitySet.getEntityType(), entity,
+ ContextURL.getInstance(URI.create("$metadata#ESAllPrim/$entity")));
+ final String resultString = streamToString(result);
+ final String expectedResult = "{"
+ + "\"@odata.context\":\"$metadata#ESAllPrim/$entity\","
+ + "\"PropertyInt16\":32767,"
+ + "\"PropertyString\":\"First Resource - positive values\","
+ + "\"PropertyBoolean\":true,"
+ + "\"PropertyByte\":255,"
+ + "\"PropertySByte\":127,"
+ + "\"PropertyInt32\":2147483647,"
+ + "\"PropertyInt64\":9223372036854775807,"
+ + "\"PropertySingle\":1.79E20,"
+ + "\"PropertyDouble\":-1.79E19,"
+ + "\"PropertyDecimal\":34,"
+ + "\"PropertyBinary\":\"ASNFZ4mrze8=\","
+ + "\"PropertyDate\":\"2012-12-03\","
+ + "\"PropertyDateTimeOffset\":\"2012-12-03T07:16:23Z\","
+ + "\"PropertyDuration\":\"PT6S\","
+ + "\"PropertyGuid\":\"01234567-89ab-cdef-0123-456789abcdef\","
+ + "\"PropertyTimeOfDay\":\"03:26:05\""
+ + "}";
+ Assert.assertEquals(expectedResult, resultString);
+ }
+
+ @Test
+ public void entitySetAllPrim() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
+ EntitySet entitySet = data.readAll(edmEntitySet);
+ entitySet.setCount(entitySet.getEntities().size());
+ entitySet.setNext(URI.create("/next"));
+ InputStream result = serializer.entitySet(edmEntitySet, entitySet,
+ ContextURL.getInstance(URI.create("$metadata#ESAllPrim")));
+ final String resultString = streamToString(result);
+
+ Assert.assertTrue(resultString.matches("\\{"
+ + "\"@odata\\.context\":\"\\$metadata#ESAllPrim\","
+ + "\"@odata\\.count\":3,"
+ + "\"value\":\\[.*\\],"
+ + "\"@odata\\.nextLink\":\"/next\""
+ + "\\}"));
+
+ int count = 0;
+ int index = -1;
+ while ((index = resultString.indexOf("PropertyInt16\":", ++index)) > 0) {
+ count++;
+ }
+ Assert.assertEquals(3, count);
+ }
+
+ @Test
+ public void entityCollAllPrim() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESCollAllPrim");
+ final Entity entity = data.readAll(edmEntitySet).getEntities().get(0);
+ InputStream result = serializer.entity(edmEntitySet.getEntityType(), entity,
+ ContextURL.getInstance(URI.create("$metadata#ESCollAllPrim/$entity")));
+ final String resultString = streamToString(result);
+ final String expectedResult = "{"
+ + "\"@odata.context\":\"$metadata#ESCollAllPrim/$entity\","
+ + "\"PropertyInt16\":1,"
+ + "\"CollPropertyString\":[\"spiderman@comic.com\",\"spidermaus@comic.com\",\"spidergirl@comic.com\"],"
+ + "\"CollPropertyBoolean\":[true,false,true],"
+ + "\"CollPropertyByte\":[50,200,249],"
+ + "\"CollPropertySByte\":[-120,120,126],"
+ + "\"CollPropertyInt16\":[1000,2000,30112],"
+ + "\"CollPropertyInt32\":[23232323,11223355,10000001],"
+ + "\"CollPropertyInt64\":[929292929292,333333333333,444444444444],"
+ + "\"CollPropertySingle\":[1790.0,26600.0,3210.0],"
+ + "\"CollPropertyDouble\":[-17900.0,-2.78E7,3210.0],"
+ + "\"CollPropertyDecimal\":[12,-2,1234],"
+ + "\"CollPropertyBinary\":[\"q83v\",\"ASNF\",\"VGeJ\"],"
+ + "\"CollPropertyDate\":[\"1958-12-03\",\"1999-08-05\",\"2013-06-25\"],"
+ + "\"CollPropertyDateTimeOffset\":[\"2015-08-12T03:08:34Z\",\"1970-03-28T12:11:10Z\","
+ + "\"1948-02-17T09:09:09Z\"],"
+ + "\"CollPropertyDuration\":[\"PT13S\",\"PT5H28M0S\",\"PT1H0S\"],"
+ + "\"CollPropertyGuid\":[\"ffffff67-89ab-cdef-0123-456789aaaaaa\",\"eeeeee67-89ab-cdef-0123-456789bbbbbb\","
+ + "\"cccccc67-89ab-cdef-0123-456789cccccc\"],"
+ + "\"CollPropertyTimeOfDay\":[\"04:14:13\",\"23:59:59\",\"01:12:33\"]"
+ + "}";
+ Assert.assertEquals(expectedResult, resultString);
+ }
+
+ @Test
+ public void entityCompAllPrim() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESCompAllPrim");
+ final Entity entity = data.readAll(edmEntitySet).getEntities().get(0);
+ InputStream result = serializer.entity(edmEntitySet.getEntityType(), entity,
+ ContextURL.getInstance(URI.create("$metadata#ESCompAllPrim/$entity")));
+ final String resultString = streamToString(result);
+ final String expectedResult = "{"
+ + "\"@odata.context\":\"$metadata#ESCompAllPrim/$entity\","
+ + "\"PropertyInt16\":32767,"
+ + "\"PropertyComp\":{"
+ + "\"PropertyString\":\"First Resource - first\","
+ + "\"PropertyBinary\":\"ASNFZ4mrze8=\","
+ + "\"PropertyBoolean\":true,"
+ + "\"PropertyByte\":255,"
+ + "\"PropertyDate\":\"2012-10-03\","
+ + "\"PropertyDateTimeOffset\":\"2012-10-03T07:16:23.1234567Z\","
+ + "\"PropertyDecimal\":34.27,"
+ + "\"PropertySingle\":1.79E20,"
+ + "\"PropertyDouble\":-1.79E19,"
+ + "\"PropertyDuration\":\"PT6S\","
+ + "\"PropertyGuid\":\"01234567-89ab-cdef-0123-456789abcdef\","
+ + "\"PropertyInt16\":32767,"
+ + "\"PropertyInt32\":2147483647,"
+ + "\"PropertyInt64\":9223372036854775807,"
+ + "\"PropertySByte\":127,"
+ + "\"PropertyTimeOfDay\":\"01:00:01\""
+ + "}}";
+ Assert.assertEquals(expectedResult, resultString);
+ }
+
+ private String streamToString(InputStream input) throws IOException {
+ byte[] buffer = new byte[8192];
+ StringBuilder result = new StringBuilder();
+
+ int count = input.read(buffer);
+ while (count >= 0) {
+ result.append(new String(buffer, 0, count, "UTF-8"));
+ count = input.read(buffer);
+ }
+
+ return result.toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/13d8d36f/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java
index 99abfd8..b1f16d7 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java
@@ -130,7 +130,7 @@ public class UriResourceImplTest {
assertEquals(UriResourceKind.complexProperty, impl.getKind());
EdmEntityType entityType = edm.getEntityType(EntityTypeProvider.nameETKeyNav);
- EdmProperty property = (EdmProperty) entityType.getProperty("PropertyComplex");
+ EdmProperty property = (EdmProperty) entityType.getProperty("PropertyComp");
impl.setProperty(property);
assertEquals(property, impl.getProperty());