You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by il...@apache.org on 2014/04/01 16:18:28 UTC
[01/51] [abbrv] [OLINGO-194] geospatial literals
Repository: olingo-odata4
Updated Branches:
refs/heads/master ac385b571 -> 9806a2737
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiPoint.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiPoint.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiPoint.java
index 9311d8d..30f7a26 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiPoint.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiPoint.java
@@ -18,11 +18,12 @@
*/
package org.apache.olingo.commons.core.edm.primitivetype;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
-import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.MultiPoint;
-public final class EdmGeometryMultiPoint extends AbstractEdmGeospatialType<Point> {
+public final class EdmGeometryMultiPoint extends AbstractGeospatialType<MultiPoint> {
private static final EdmGeometryMultiPoint INSTANCE = new EdmGeometryMultiPoint();
@@ -31,7 +32,33 @@ public final class EdmGeometryMultiPoint extends AbstractEdmGeospatialType<Point
}
public EdmGeometryMultiPoint() {
- super(Point.class, Dimension.GEOMETRY, Type.MULTIPOINT);
+ super(MultiPoint.class, Dimension.GEOMETRY, Type.MULTIPOINT);
}
+ @Override
+ protected <T> T internalValueOfString(final String value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode, final Class<T> returnType)
+ throws EdmPrimitiveTypeException {
+
+ final MultiPoint point = stringToMultiPoint(value, isNullable, maxLength, precision, scale, isUnicode);
+ if (returnType.isAssignableFrom(MultiPoint.class)) {
+ return returnType.cast(point);
+ } else {
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType)");
+ }
+
+ }
+
+ @Override
+ protected <T> String internalValueToString(final T value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
+
+ if (value instanceof MultiPoint) {
+ return toString((MultiPoint) value, isNullable, maxLength, precision, scale, isUnicode);
+ }
+
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())");
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiPolygon.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiPolygon.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiPolygon.java
index f64ed87..284bada 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiPolygon.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiPolygon.java
@@ -18,11 +18,12 @@
*/
package org.apache.olingo.commons.core.edm.primitivetype;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
-import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
-public final class EdmGeometryMultiPolygon extends AbstractEdmGeospatialType<Point> {
+public final class EdmGeometryMultiPolygon extends AbstractGeospatialType<MultiPolygon> {
private static final EdmGeometryMultiPolygon INSTANCE = new EdmGeometryMultiPolygon();
@@ -31,7 +32,33 @@ public final class EdmGeometryMultiPolygon extends AbstractEdmGeospatialType<Poi
}
public EdmGeometryMultiPolygon() {
- super(Point.class, Dimension.GEOMETRY, Type.MULTIPOLYGON);
+ super(MultiPolygon.class, Dimension.GEOMETRY, Type.MULTIPOLYGON);
}
+ @Override
+ protected <T> T internalValueOfString(final String value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode,
+ final Class<T> returnType) throws EdmPrimitiveTypeException {
+
+ final MultiPolygon multiPolygon =
+ stringToMultiPolygon(value, isNullable, maxLength, precision, scale, isUnicode);
+ if (returnType.isAssignableFrom(MultiPolygon.class)) {
+ return returnType.cast(multiPolygon);
+ } else {
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType)");
+ }
+ }
+
+ @Override
+ protected <T> String internalValueToString(final T value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
+
+ if (value instanceof MultiPolygon) {
+ return toString((MultiPolygon) value, isNullable, maxLength, precision, scale, isUnicode);
+ }
+
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())");
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryPoint.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryPoint.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryPoint.java
index ba8e5d2..eaf88f8 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryPoint.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryPoint.java
@@ -18,11 +18,12 @@
*/
package org.apache.olingo.commons.core.edm.primitivetype;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
import org.apache.olingo.commons.api.edm.geo.Point;
-public final class EdmGeometryPoint extends AbstractEdmGeospatialType<Point> {
+public final class EdmGeometryPoint extends AbstractGeospatialType<Point> {
private static final EdmGeometryPoint INSTANCE = new EdmGeometryPoint();
@@ -34,4 +35,29 @@ public final class EdmGeometryPoint extends AbstractEdmGeospatialType<Point> {
super(Point.class, Dimension.GEOMETRY, Type.POINT);
}
+ @Override
+ protected <T> T internalValueOfString(final String value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode,
+ final Class<T> returnType) throws EdmPrimitiveTypeException {
+
+ final Point point = stringToPoint(value, isNullable, maxLength, precision, scale, isUnicode);
+ if (returnType.isAssignableFrom(Point.class)) {
+ return returnType.cast(point);
+ } else {
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType)");
+ }
+ }
+
+ @Override
+ protected <T> String internalValueToString(final T value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
+
+ if (value instanceof Point) {
+ return toString((Point) value, isNullable, maxLength, precision, scale, isUnicode);
+ }
+
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())");
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryPolygon.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryPolygon.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryPolygon.java
index 12f8cf1..5e86753 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryPolygon.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryPolygon.java
@@ -18,11 +18,12 @@
*/
package org.apache.olingo.commons.core.edm.primitivetype;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
-import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.Polygon;
-public final class EdmGeometryPolygon extends AbstractEdmGeospatialType<Point> {
+public final class EdmGeometryPolygon extends AbstractGeospatialType<Polygon> {
private static final EdmGeometryPolygon INSTANCE = new EdmGeometryPolygon();
@@ -31,7 +32,32 @@ public final class EdmGeometryPolygon extends AbstractEdmGeospatialType<Point> {
}
public EdmGeometryPolygon() {
- super(Point.class, Dimension.GEOMETRY, Type.POLYGON);
+ super(Polygon.class, Dimension.GEOMETRY, Type.POLYGON);
}
+ @Override
+ protected <T> T internalValueOfString(final String value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode,
+ final Class<T> returnType) throws EdmPrimitiveTypeException {
+
+ final Polygon polygon = stringToPolygon(value, isNullable, maxLength, precision, scale, isUnicode);
+ if (returnType.isAssignableFrom(Polygon.class)) {
+ return returnType.cast(polygon);
+ } else {
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType)");
+ }
+ }
+
+ @Override
+ protected <T> String internalValueToString(final T value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
+
+ if (value instanceof Polygon) {
+ return toString((Polygon) value, isNullable, maxLength, precision, scale, isUnicode);
+ }
+
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())");
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmPrimitiveTypeFactory.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmPrimitiveTypeFactory.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmPrimitiveTypeFactory.java
index 83a257d..4d2f3df 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmPrimitiveTypeFactory.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmPrimitiveTypeFactory.java
@@ -18,27 +18,18 @@
*/
package org.apache.olingo.commons.core.edm.primitivetype;
-import org.apache.olingo.commons.api.edm.EdmGeospatialType;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.EdmType;
public final class EdmPrimitiveTypeFactory {
- public static EdmType getInstance(final EdmPrimitiveTypeKind kind) {
- return kind.isGeospatial()
- ? getGeoInstance(kind)
- : getNonGeoInstance(kind);
- }
-
/**
- * Returns an instance for the provided {@link EdmPrimitiveTypeKind} in the form of {@link EdmPrimitiveType} (for
- * non-geospatial types).
+ * Returns an instance for the provided {@link EdmPrimitiveTypeKind} in the form of {@link EdmPrimitiveType}.
*
* @param kind EdmPrimitiveTypeKind
* @return {@link EdmPrimitiveType} instance
*/
- public static EdmPrimitiveType getNonGeoInstance(final EdmPrimitiveTypeKind kind) {
+ public static EdmPrimitiveType getInstance(final EdmPrimitiveTypeKind kind) {
switch (kind) {
case Binary:
return EdmBinary.getInstance();
@@ -79,19 +70,6 @@ public final class EdmPrimitiveTypeFactory {
case Stream:
return EdmStream.getInstance();
- default:
- throw new IllegalArgumentException("Wrong type: " + kind);
- }
- }
-
- /**
- * Returns an instance for the provided {@link EdmPrimitiveTypeKind} in the form of {@link EdmGeospatialType}.
- *
- * @param kind EdmPrimitiveTypeKind
- * @return {@link EdmGeospatialType} instance
- */
- public static EdmGeospatialType getGeoInstance(final EdmPrimitiveTypeKind kind) {
- switch (kind) {
case Geography:
return EdmGeography.getInstance();
case GeographyPoint:
@@ -111,7 +89,7 @@ public final class EdmPrimitiveTypeFactory {
case Geometry:
return EdmGeometry.getInstance();
case GeometryPoint:
- return EdmGeometry.getInstance();
+ return EdmGeometryPoint.getInstance();
case GeometryLineString:
return EdmGeometryLineString.getInstance();
case GeometryPolygon:
@@ -119,7 +97,7 @@ public final class EdmPrimitiveTypeFactory {
case GeometryMultiPoint:
return EdmGeometryMultiPoint.getInstance();
case GeometryMultiLineString:
- return EdmGeographyMultiLineString.getInstance();
+ return EdmGeometryMultiLineString.getInstance();
case GeometryMultiPolygon:
return EdmGeometryMultiPolygon.getInstance();
case GeometryCollection:
@@ -127,7 +105,6 @@ public final class EdmPrimitiveTypeFactory {
default:
throw new IllegalArgumentException("Wrong type: " + kind);
-
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTime.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTime.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTime.java
index 75e80cf..8f52253 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTime.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTime.java
@@ -34,6 +34,11 @@ public final class EdmTime extends SingletonPrimitiveType {
return INSTANCE;
}
+ {
+ uriPrefix = "time'";
+ uriSuffix = "'";
+ }
+
@Override
public Class<?> getDefaultType() {
return Duration.class;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/ODataObjectFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/ODataObjectFactoryImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/ODataObjectFactoryImpl.java
index 5e9f9c1..ae946e0 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/ODataObjectFactoryImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/ODataObjectFactoryImpl.java
@@ -24,7 +24,6 @@ import org.apache.olingo.commons.api.domain.ODataCollectionValue;
import org.apache.olingo.commons.api.domain.ODataComplexValue;
import org.apache.olingo.commons.api.domain.ODataEntity;
import org.apache.olingo.commons.api.domain.ODataEntitySet;
-import org.apache.olingo.commons.api.domain.ODataGeospatialValue;
import org.apache.olingo.commons.api.domain.ODataInlineEntity;
import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
import org.apache.olingo.commons.api.domain.ODataLink;
@@ -145,11 +144,6 @@ public class ODataObjectFactoryImpl implements ODataObjectFactory {
}
@Override
- public ODataProperty newPrimitiveProperty(final String name, final ODataGeospatialValue value) {
- return new ODataProperty(name, value);
- }
-
- @Override
public ODataProperty newComplexProperty(final String name, final ODataComplexValue value) {
return new ODataProperty(name, value);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/CommonPrimitiveTypeTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/CommonPrimitiveTypeTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/CommonPrimitiveTypeTest.java
index dba916b..2673427 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/CommonPrimitiveTypeTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/CommonPrimitiveTypeTest.java
@@ -41,9 +41,7 @@ public class CommonPrimitiveTypeTest extends PrimitiveTypeBaseTest {
assertEquals(EdmPrimitiveType.EDM_NAMESPACE, EdmInt32.getInstance().getNamespace());
for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) {
- final EdmType instance = kind.isGeospatial()
- ? EdmPrimitiveTypeFactory.getGeoInstance(kind)
- : EdmPrimitiveTypeFactory.getNonGeoInstance(kind);
+ final EdmType instance = EdmPrimitiveTypeFactory.getInstance(kind);
assertEquals(EdmPrimitiveType.EDM_NAMESPACE, instance.getNamespace());
}
}
@@ -52,33 +50,29 @@ public class CommonPrimitiveTypeTest extends PrimitiveTypeBaseTest {
public void names() throws Exception {
assertEquals("Uint7", Uint7.getInstance().getName());
- assertEquals("Binary", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Binary).getName());
- assertEquals("Boolean", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Boolean).getName());
- assertEquals("Byte", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte).getName());
- assertEquals("Date", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Date).getName());
+ assertEquals("Binary", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Binary).getName());
+ assertEquals("Boolean", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Boolean).getName());
+ assertEquals("Byte", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Byte).getName());
+ assertEquals("Date", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Date).getName());
assertEquals("DateTimeOffset",
- EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.DateTimeOffset).getName());
- assertEquals("Decimal", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Decimal).getName());
- assertEquals("Double", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Double).getName());
- assertEquals("Duration", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Duration).getName());
- assertEquals("Guid", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Guid).getName());
- assertEquals("Int16", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16).getName());
- assertEquals("Int32", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32).getName());
- assertEquals("Int64", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int64).getName());
- assertEquals("SByte", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte).getName());
- assertEquals("Single", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Single).getName());
- assertEquals("String", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.String).getName());
- assertEquals("TimeOfDay", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.TimeOfDay).getName());
+ EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.DateTimeOffset).getName());
+ assertEquals("Decimal", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Decimal).getName());
+ assertEquals("Double", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Double).getName());
+ assertEquals("Duration", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Duration).getName());
+ assertEquals("Guid", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Guid).getName());
+ assertEquals("Int16", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int16).getName());
+ assertEquals("Int32", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int32).getName());
+ assertEquals("Int64", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int64).getName());
+ assertEquals("SByte", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.SByte).getName());
+ assertEquals("Single", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Single).getName());
+ assertEquals("String", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.String).getName());
+ assertEquals("TimeOfDay", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.TimeOfDay).getName());
}
@Test
public void kind() throws Exception {
for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) {
- if (kind.isGeospatial()) {
- assertEquals(EdmTypeKind.PRIMITIVE, EdmPrimitiveTypeFactory.getGeoInstance(kind).getKind());
- } else {
- assertEquals(EdmTypeKind.PRIMITIVE, EdmPrimitiveTypeFactory.getNonGeoInstance(kind).getKind());
- }
+ assertEquals(EdmTypeKind.PRIMITIVE, EdmPrimitiveTypeFactory.getInstance(kind).getKind());
}
}
@@ -86,41 +80,37 @@ public class CommonPrimitiveTypeTest extends PrimitiveTypeBaseTest {
public void toStringAll() throws Exception {
assertEquals("System.Uint7", Uint7.getInstance().toString());
- assertEquals("Edm.Binary", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Binary).toString());
- assertEquals("Edm.Boolean", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Boolean).toString());
- assertEquals("Edm.Byte", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte).toString());
- assertEquals("Edm.Date", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Date).toString());
+ assertEquals("Edm.Binary", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Binary).toString());
+ assertEquals("Edm.Boolean", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Boolean).toString());
+ assertEquals("Edm.Byte", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Byte).toString());
+ assertEquals("Edm.Date", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Date).toString());
assertEquals("Edm.DateTimeOffset",
- EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.DateTimeOffset).toString());
- assertEquals("Edm.Decimal", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Decimal).toString());
- assertEquals("Edm.Double", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Double).toString());
- assertEquals("Edm.Duration", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Duration).toString());
- assertEquals("Edm.Guid", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Guid).toString());
- assertEquals("Edm.Int16", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16).toString());
- assertEquals("Edm.Int32", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32).toString());
- assertEquals("Edm.Int64", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int64).toString());
- assertEquals("Edm.SByte", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte).toString());
- assertEquals("Edm.Single", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Single).toString());
- assertEquals("Edm.String", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.String).toString());
- assertEquals("Edm.TimeOfDay", EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.TimeOfDay).toString());
+ EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.DateTimeOffset).toString());
+ assertEquals("Edm.Decimal", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Decimal).toString());
+ assertEquals("Edm.Double", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Double).toString());
+ assertEquals("Edm.Duration", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Duration).toString());
+ assertEquals("Edm.Guid", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Guid).toString());
+ assertEquals("Edm.Int16", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int16).toString());
+ assertEquals("Edm.Int32", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int32).toString());
+ assertEquals("Edm.Int64", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int64).toString());
+ assertEquals("Edm.SByte", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.SByte).toString());
+ assertEquals("Edm.Single", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Single).toString());
+ assertEquals("Edm.String", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.String).toString());
+ assertEquals("Edm.TimeOfDay", EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.TimeOfDay).toString());
for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) {
- if (!kind.isGeospatial()) {
- final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(kind);
- assertEquals(instance.toString(), kind.getFullQualifiedName().toString());
- }
+ final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(kind);
+ assertEquals(instance.toString(), kind.getFullQualifiedName().toString());
}
}
@Test
public void compatibility() {
for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) {
- if (!kind.isGeospatial()) {
- final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(kind);
- assertTrue(instance.isCompatible(instance));
- assertFalse(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(
- (kind == EdmPrimitiveTypeKind.String ? EdmPrimitiveTypeKind.Binary : EdmPrimitiveTypeKind.String))));
- }
+ final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(kind);
+ assertTrue(instance.isCompatible(instance));
+ assertFalse(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(
+ (kind == EdmPrimitiveTypeKind.String ? EdmPrimitiveTypeKind.Binary : EdmPrimitiveTypeKind.String))));
}
}
@@ -128,71 +118,67 @@ public class CommonPrimitiveTypeTest extends PrimitiveTypeBaseTest {
public void defaultType() throws Exception {
assertEquals(Byte.class, Uint7.getInstance().getDefaultType());
- assertEquals(byte[].class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Binary).getDefaultType());
+ assertEquals(byte[].class, EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Binary).getDefaultType());
assertEquals(Boolean.class,
- EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Boolean).getDefaultType());
- assertEquals(Short.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte).getDefaultType());
- assertEquals(Calendar.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Date).getDefaultType());
+ EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Boolean).getDefaultType());
+ assertEquals(Short.class, EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Byte).getDefaultType());
+ assertEquals(Calendar.class, EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Date).getDefaultType());
assertEquals(Calendar.class,
- EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.DateTimeOffset).getDefaultType());
+ EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.DateTimeOffset).getDefaultType());
assertEquals(BigDecimal.class,
- EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Decimal).getDefaultType());
- assertEquals(Double.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Double).getDefaultType());
+ EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Decimal).getDefaultType());
+ assertEquals(Double.class, EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Double).getDefaultType());
assertEquals(BigDecimal.class,
- EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Duration).getDefaultType());
- assertEquals(UUID.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Guid).getDefaultType());
- assertEquals(Short.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16).getDefaultType());
- assertEquals(Integer.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32).getDefaultType());
- assertEquals(Long.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int64).getDefaultType());
- assertEquals(Byte.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte).getDefaultType());
- assertEquals(Float.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Single).getDefaultType());
- assertEquals(String.class, EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.String).getDefaultType());
+ EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Duration).getDefaultType());
+ assertEquals(UUID.class, EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Guid).getDefaultType());
+ assertEquals(Short.class, EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int16).getDefaultType());
+ assertEquals(Integer.class, EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int32).getDefaultType());
+ assertEquals(Long.class, EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int64).getDefaultType());
+ assertEquals(Byte.class, EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.SByte).getDefaultType());
+ assertEquals(Float.class, EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Single).getDefaultType());
+ assertEquals(String.class, EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.String).getDefaultType());
assertEquals(Calendar.class,
- EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.TimeOfDay).getDefaultType());
+ EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.TimeOfDay).getDefaultType());
}
@Test
public void validate() throws Exception {
for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) {
- if (!kind.isGeospatial()) {
- final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(kind);
- assertTrue(instance.validate(null, null, null, null, null, null));
- assertTrue(instance.validate(null, true, null, null, null, null));
- assertFalse(instance.validate(null, false, null, null, null, null));
- if (kind != EdmPrimitiveTypeKind.Stream) {
- assertFalse(instance.validate("ä", null, null, null, null, false));
- }
- if (kind != EdmPrimitiveTypeKind.String && kind != EdmPrimitiveTypeKind.Binary
- && kind != EdmPrimitiveTypeKind.Stream) {
-
- assertFalse(instance.validate("", null, null, null, null, null));
- }
- if (kind != EdmPrimitiveTypeKind.String && kind != EdmPrimitiveTypeKind.Stream) {
- assertFalse(instance.validate("ä", null, null, null, null, null));
- }
+ final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(kind);
+ assertTrue(instance.validate(null, null, null, null, null, null));
+ assertTrue(instance.validate(null, true, null, null, null, null));
+ assertFalse(instance.validate(null, false, null, null, null, null));
+ if (kind != EdmPrimitiveTypeKind.Stream) {
+ assertFalse(instance.validate("ä", null, null, null, null, false));
+ }
+ if (kind != EdmPrimitiveTypeKind.String && kind != EdmPrimitiveTypeKind.Binary
+ && kind != EdmPrimitiveTypeKind.Stream) {
+
+ assertFalse(instance.validate("", null, null, null, null, null));
+ }
+ if (kind != EdmPrimitiveTypeKind.String && kind != EdmPrimitiveTypeKind.Stream) {
+ assertFalse(instance.validate("ä", null, null, null, null, null));
}
}
- assertTrue(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Binary).
+ assertTrue(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Binary).
validate("abcd", null, 3, null, null, null));
- assertFalse(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Binary).
+ assertFalse(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Binary).
validate("abcd", null, 2, null, null, null));
- assertTrue(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Decimal).
+ assertTrue(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Decimal).
validate("1", null, null, null, null, null));
- assertFalse(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Decimal).
+ assertFalse(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Decimal).
validate("1.2", null, null, null, 0, null));
}
@Test
public void uriLiteral() throws Exception {
for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) {
- if (!kind.isGeospatial()) {
- final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(kind);
- assertEquals("test", instance.fromUriLiteral(instance.toUriLiteral("test")));
- assertNull(instance.toUriLiteral(null));
- assertNull(instance.fromUriLiteral(null));
- }
+ final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(kind);
+ assertEquals("test", instance.fromUriLiteral(instance.toUriLiteral("test")));
+ assertNull(instance.toUriLiteral(null));
+ assertNull(instance.fromUriLiteral(null));
}
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBinaryTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBinaryTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBinaryTest.java
index c3ff01c..d052674 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBinaryTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBinaryTest.java
@@ -30,7 +30,7 @@ import org.junit.Test;
public class EdmBinaryTest extends PrimitiveTypeBaseTest {
- private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Binary);
+ private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Binary);
@Test
public void validate() throws Exception {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBooleanTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBooleanTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBooleanTest.java
index d1e6580..01f269d 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBooleanTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmBooleanTest.java
@@ -26,7 +26,7 @@ import org.junit.Test;
public class EdmBooleanTest extends PrimitiveTypeBaseTest {
- private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Boolean);
+ private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Boolean);
@Test
public void toUriLiteral() throws Exception {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmByteTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmByteTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmByteTest.java
index c560c39..f02401c 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmByteTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmByteTest.java
@@ -29,7 +29,7 @@ import org.junit.Test;
public class EdmByteTest extends PrimitiveTypeBaseTest {
- private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte);
+ private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Byte);
@Test
public void compatibility() {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTest.java
index 6cc3d19..d95fd99 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTest.java
@@ -30,7 +30,7 @@ import org.junit.Test;
public class EdmDateTest extends PrimitiveTypeBaseTest {
- private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Date);
+ private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Date);
@Test
public void toUriLiteral() throws Exception {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTimeOffsetTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTimeOffsetTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTimeOffsetTest.java
index bcc0123..2a1e7d5 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTimeOffsetTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDateTimeOffsetTest.java
@@ -31,7 +31,7 @@ import org.junit.Test;
public class EdmDateTimeOffsetTest extends PrimitiveTypeBaseTest {
- final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.DateTimeOffset);
+ final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.DateTimeOffset);
@Test
public void toUriLiteral() throws Exception {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDecimalTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDecimalTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDecimalTest.java
index 35917af..51185da 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDecimalTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDecimalTest.java
@@ -30,18 +30,18 @@ import org.junit.Test;
public class EdmDecimalTest extends PrimitiveTypeBaseTest {
- private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Decimal);
+ private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Decimal);
@Test
public void compatibility() {
assertTrue(instance.isCompatible(Uint7.getInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte)));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte)));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16)));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32)));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int64)));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Single)));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Double)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Byte)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.SByte)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int16)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int32)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int64)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Single)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Double)));
}
@Test
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDoubleTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDoubleTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDoubleTest.java
index 57403ce..340a480 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDoubleTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDoubleTest.java
@@ -30,17 +30,17 @@ import org.junit.Test;
public class EdmDoubleTest extends PrimitiveTypeBaseTest {
- private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Double);
+ private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Double);
@Test
public void compatibility() {
assertTrue(instance.isCompatible(Uint7.getInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte)));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte)));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16)));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32)));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int64)));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Single)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Byte)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.SByte)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int16)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int32)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int64)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Single)));
}
@Test
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDurationTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDurationTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDurationTest.java
index 85745b4..e6797a4 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDurationTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmDurationTest.java
@@ -29,7 +29,7 @@ import org.junit.Test;
public class EdmDurationTest extends PrimitiveTypeBaseTest {
- private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Duration);
+ private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Duration);
@Test
public void toUriLiteral() throws Exception {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeoTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeoTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeoTest.java
new file mode 100644
index 0000000..6b9dc9a
--- /dev/null
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeoTest.java
@@ -0,0 +1,174 @@
+/*
+ * 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.commons.core.edm.primitivetype;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Iterator;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
+import org.apache.olingo.commons.api.edm.geo.LineString;
+import org.apache.olingo.commons.api.edm.geo.MultiLineString;
+import org.apache.olingo.commons.api.edm.geo.MultiPoint;
+import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
+import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.Polygon;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.junit.Test;
+
+public class EdmGeoTest extends PrimitiveTypeBaseTest {
+
+ @Test
+ public void point() throws EdmPrimitiveTypeException {
+ final String input = "geometry'SRID=0;Point(142.1 64.1)'";
+
+ expectContentErrorInValueOfString(EdmGeographyPoint.getInstance(), input);
+
+ final Point point = EdmGeometryPoint.getInstance().valueOfString(input, null, null, null, null, null, Point.class);
+ assertNotNull(point);
+ assertEquals(0, point.getSrid(), 0);
+ assertEquals(142.1, point.getX(), 0);
+ assertEquals(64.1, point.getY(), 0);
+
+ assertEquals(input, EdmGeometryPoint.getInstance().valueToString(point, null, null, null, null, null));
+ }
+
+ @Test
+ public void multiPoint() throws EdmPrimitiveTypeException {
+ final String input = "geography'SRID=0;MultiPoint((142.1 64.1),(1.0 2.0))'";
+
+ expectContentErrorInValueOfString(EdmGeometryMultiPoint.getInstance(), input);
+
+ MultiPoint multipoint = EdmGeographyMultiPoint.getInstance().
+ valueOfString(input, null, null, null, null, null, MultiPoint.class);
+ assertNotNull(multipoint);
+ assertEquals(0, multipoint.getSrid(), 0);
+ assertEquals(142.1, multipoint.iterator().next().getX(), 0);
+ assertEquals(64.1, multipoint.iterator().next().getY(), 0);
+
+ assertEquals(input, EdmGeographyMultiPoint.getInstance().valueToString(multipoint, null, null, null, null, null));
+
+ multipoint = EdmGeographyMultiPoint.getInstance().
+ valueOfString("geography'SRID=0;MultiPoint()'", null, null, null, null, null, MultiPoint.class);
+ assertFalse(multipoint.iterator().hasNext());
+ }
+
+ @Test
+ public void lineString() throws EdmPrimitiveTypeException {
+ final String input = "geography'SRID=0;LineString(142.1 64.1,3.14 2.78)'";
+
+ expectContentErrorInValueOfString(EdmGeographyPoint.getInstance(), input);
+ expectContentErrorInValueOfString(EdmGeometryLineString.getInstance(), input);
+
+ final LineString lineString = EdmGeographyLineString.getInstance().
+ valueOfString(input, null, null, null, null, null, LineString.class);
+ assertNotNull(lineString);
+ assertEquals(0, lineString.getSrid(), 0);
+ final Iterator<Point> itor = lineString.iterator();
+ assertEquals(142.1, itor.next().getX(), 0);
+ assertEquals(2.78, itor.next().getY(), 0);
+
+ assertEquals(input, EdmGeographyLineString.getInstance().valueToString(lineString, null, null, null, null, null));
+ }
+
+ @Test
+ public void multiLineString() throws EdmPrimitiveTypeException {
+ final String input = "geography'SRID=0;MultiLineString((142.1 64.1,3.14 2.78),(142.1 64.7,3.14 2.78))'";
+
+ expectContentErrorInValueOfString(EdmGeographyPoint.getInstance(), input);
+ expectContentErrorInValueOfString(EdmGeometryLineString.getInstance(), input);
+
+ final MultiLineString multiLineString = EdmGeographyMultiLineString.getInstance().
+ valueOfString(input, null, null, null, null, null, MultiLineString.class);
+ assertNotNull(multiLineString);
+ assertEquals(0, multiLineString.getSrid(), 0);
+ final Iterator<LineString> itor = multiLineString.iterator();
+ assertEquals(142.1, itor.next().iterator().next().getX(), 0);
+ assertEquals(64.7, itor.next().iterator().next().getY(), 0);
+
+ assertEquals(input, EdmGeographyMultiLineString.getInstance().
+ valueToString(multiLineString, null, null, null, null, null));
+ }
+
+ @Test
+ public void polygon() throws EdmPrimitiveTypeException {
+ final String input = "geography'SRID=0;Polygon((1.0 1.0,1.0 1.0),(1.0 1.0,2.0 2.0,3.0 3.0,1.0 1.0))'";
+
+ expectContentErrorInValueOfString(EdmGeometryPolygon.getInstance(), input);
+
+ final Polygon polygon = EdmGeographyPolygon.getInstance().
+ valueOfString(input, null, null, null, null, null, Polygon.class);
+ assertNotNull(polygon);
+ assertEquals(0, polygon.getSrid(), 0);
+ Iterator<Point> itor = polygon.getInterior().iterator();
+ assertEquals(1, itor.next().getX(), 0);
+ assertEquals(1, itor.next().getY(), 0);
+ itor = polygon.getExterior().iterator();
+ itor.next();
+ assertEquals(2, itor.next().getX(), 0);
+ assertEquals(3, itor.next().getY(), 0);
+
+ assertEquals(input, EdmGeographyPolygon.getInstance().valueToString(polygon, null, null, null, null, null));
+ }
+
+ @Test
+ public void multiPolygon() throws EdmPrimitiveTypeException {
+ final String input = "geometry'SRID=0;MultiPolygon("
+ + "((1.0 1.0,1.0 1.0),(1.0 1.0,2.0 2.0,3.0 3.0,1.0 1.0)),"
+ + "((1.0 1.0,1.0 1.0),(1.0 1.0,2.0 2.0,3.0 3.0,1.0 1.0))"
+ + ")'";
+
+ expectContentErrorInValueOfString(EdmGeographyPolygon.getInstance(), input);
+
+ final MultiPolygon multiPolygon = EdmGeometryMultiPolygon.getInstance().
+ valueOfString(input, null, null, null, null, null, MultiPolygon.class);
+ assertNotNull(multiPolygon);
+ assertEquals(0, multiPolygon.getSrid(), 0);
+ final Iterator<Polygon> itor = multiPolygon.iterator();
+ assertEquals(1, itor.next().getInterior().iterator().next().getX(), 0);
+ assertEquals(1, itor.next().getInterior().iterator().next().getX(), 0);
+
+ assertEquals(input, EdmGeometryMultiPolygon.getInstance().
+ valueToString(multiPolygon, null, null, null, null, null));
+
+ EdmGeographyMultiPolygon.getInstance().valueOfString(
+ "geography'SRID=0;MultiPolygon(((1 1,1 1),(1 1,2 2,3 3,1 1)))'",
+ null, null, null, null, null, MultiPolygon.class);
+ }
+
+ @Test
+ public void collection() throws EdmPrimitiveTypeException {
+ final String input = "geometry'SRID=0;Collection(LineString(142.1 64.1,3.14 2.78))'";
+
+ final GeospatialCollection collection = EdmGeometryCollection.getInstance().
+ valueOfString(input, null, null, null, null, null, GeospatialCollection.class);
+ assertNotNull(collection);
+ assertEquals(0, collection.getSrid(), 0);
+
+ final Geospatial item = collection.iterator().next();
+ assertNotNull(item);
+ assertTrue(item instanceof LineString);
+
+ assertEquals(input, EdmGeometryCollection.getInstance().
+ valueToString(collection, null, null, null, null, null));
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGuidTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGuidTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGuidTest.java
index f69eddc..ea63ea8 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGuidTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGuidTest.java
@@ -28,7 +28,7 @@ import org.junit.Test;
public class EdmGuidTest extends PrimitiveTypeBaseTest {
- private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Guid);
+ private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Guid);
@Test
public void toUriLiteral() {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt16Test.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt16Test.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt16Test.java
index 55c12bb..b5844bc 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt16Test.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt16Test.java
@@ -29,13 +29,13 @@ import org.junit.Test;
public class EdmInt16Test extends PrimitiveTypeBaseTest {
- final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16);
+ final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int16);
@Test
public void testInt16Compatibility() {
assertTrue(instance.isCompatible(Uint7.getInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte)));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Byte)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.SByte)));
}
@Test
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt32Test.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt32Test.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt32Test.java
index e3410d7..1cb01e6 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt32Test.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt32Test.java
@@ -29,14 +29,14 @@ import org.junit.Test;
public class EdmInt32Test extends PrimitiveTypeBaseTest {
- private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32);
+ private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int32);
@Test
public void compatibility() {
assertTrue(instance.isCompatible(Uint7.getInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte)));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte)));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Byte)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.SByte)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int16)));
}
@Test
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt64Test.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt64Test.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt64Test.java
index f45ab49..eb08f3a 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt64Test.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmInt64Test.java
@@ -29,15 +29,15 @@ import org.junit.Test;
public class EdmInt64Test extends PrimitiveTypeBaseTest {
- private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int64);
+ private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int64);
@Test
public void compatibility() {
assertTrue(instance.isCompatible(Uint7.getInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte)));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte)));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16)));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Byte)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.SByte)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int16)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int32)));
}
@Test
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmNullTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmNullTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmNullTest.java
index 5450be8..706cd7f 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmNullTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmNullTest.java
@@ -29,26 +29,22 @@ public class EdmNullTest extends PrimitiveTypeBaseTest {
@Test
public void checkNull() throws Exception {
for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) {
- if (!kind.isGeospatial()) {
- final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(kind);
- assertNull(instance.valueToString(null, null, null, null, null, null));
- assertNull(instance.valueToString(null, true, null, null, null, null));
+ final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(kind);
+ assertNull(instance.valueToString(null, null, null, null, null, null));
+ assertNull(instance.valueToString(null, true, null, null, null, null));
- expectNullErrorInValueToString(instance);
- }
+ expectNullErrorInValueToString(instance);
}
}
@Test
public void checkValueOfNull() throws Exception {
for (EdmPrimitiveTypeKind kind : EdmPrimitiveTypeKind.values()) {
- if (!kind.isGeospatial()) {
- final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(kind);
- assertNull(instance.valueOfString(null, null, null, null, null, null, instance.getDefaultType()));
- assertNull(instance.valueOfString(null, true, null, null, null, null, instance.getDefaultType()));
+ final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(kind);
+ assertNull(instance.valueOfString(null, null, null, null, null, null, instance.getDefaultType()));
+ assertNull(instance.valueOfString(null, true, null, null, null, null, instance.getDefaultType()));
- expectNullErrorInValueOfString(instance);
- }
+ expectNullErrorInValueOfString(instance);
}
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSByteTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSByteTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSByteTest.java
index 88835e9..69e9050 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSByteTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSByteTest.java
@@ -29,7 +29,7 @@ import org.junit.Test;
public class EdmSByteTest extends PrimitiveTypeBaseTest {
- private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte);
+ private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.SByte);
@Test
public void compatibility() {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSingleTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSingleTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSingleTest.java
index 9e90f22..da62654 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSingleTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmSingleTest.java
@@ -30,16 +30,16 @@ import org.junit.Test;
public class EdmSingleTest extends PrimitiveTypeBaseTest {
- private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Single);
+ private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Single);
@Test
public void compatibility() {
assertTrue(instance.isCompatible(Uint7.getInstance()));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Byte)));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte)));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int16)));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32)));
- assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int64)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Byte)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.SByte)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int16)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int32)));
+ assertTrue(instance.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int64)));
}
@Test
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStringTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStringTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStringTest.java
index bba0f91..1cd698c 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStringTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmStringTest.java
@@ -26,7 +26,7 @@ import org.junit.Test;
public class EdmStringTest extends PrimitiveTypeBaseTest {
- private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.String);
+ private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.String);
@Test
public void toUriLiteral() throws Exception {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTimeOfDayTest.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTimeOfDayTest.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTimeOfDayTest.java
index ee9b2b8..01f824f 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTimeOfDayTest.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/EdmTimeOfDayTest.java
@@ -29,7 +29,7 @@ import org.junit.Test;
public class EdmTimeOfDayTest extends PrimitiveTypeBaseTest {
- private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.TimeOfDay);
+ private final EdmPrimitiveType instance = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.TimeOfDay);
@Test
public void toUriLiteral() throws Exception {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/UInt7Test.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/UInt7Test.java b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/UInt7Test.java
index c956789..0f1e83c 100644
--- a/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/UInt7Test.java
+++ b/lib/commons-core/src/test/java/org/apache/olingo/commons/core/edm/primitivetype/UInt7Test.java
@@ -30,6 +30,6 @@ public class UInt7Test extends PrimitiveTypeBaseTest {
public void compatibility() {
assertTrue(Uint7.getInstance().isCompatible(Uint7.getInstance()));
assertFalse(Uint7.getInstance().isCompatible(
- EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.String)));
+ EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.String)));
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEnumTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEnumTypeImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEnumTypeImpl.java
index 9645d93..7480068 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEnumTypeImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEnumTypeImpl.java
@@ -40,9 +40,9 @@ public class EdmEnumTypeImpl extends AbstractEdmEnumType implements EdmEnumType
super(edm, enumName, enumType.isFlags());
if (enumType.getUnderlyingType() == null) {
- this.underlyingType = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32);
+ this.underlyingType = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int32);
} else {
- this.underlyingType = EdmPrimitiveTypeFactory.getNonGeoInstance(
+ this.underlyingType = EdmPrimitiveTypeFactory.getInstance(
EdmPrimitiveTypeKind.valueOf(enumType.getUnderlyingType().getName()));
// TODO: Should we validate that the underlying type is of byte, sbyte, in16, int32 or int64?
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImpl.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImpl.java
index 91b0cde..63172c6 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImpl.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImpl.java
@@ -45,7 +45,7 @@ public class EdmTypeDefinitionImpl extends AbstractEdmTypeDefinition implements
public EdmPrimitiveType getUnderlyingType() {
if (edmPrimitiveTypeInstance == null) {
try {
- edmPrimitiveTypeInstance = EdmPrimitiveTypeFactory.getNonGeoInstance(
+ edmPrimitiveTypeInstance = EdmPrimitiveTypeFactory.getInstance(
EdmPrimitiveTypeKind.valueOf(typeDefinition.getUnderlyingType().getName()));
} catch (IllegalArgumentException e) {
throw new EdmException("Invalid underlying type: " + typeDefinition.getUnderlyingType(), e);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParseTreeVisitor.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParseTreeVisitor.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParseTreeVisitor.java
index 47f5cce..f74a702 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParseTreeVisitor.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParseTreeVisitor.java
@@ -878,10 +878,10 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
if (text.equals("false")) {
return new LiteralImpl().setText("false").setType(
- EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Boolean));
+ EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Boolean));
}
return new LiteralImpl().setText("true").setType(
- EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Boolean));
+ EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Boolean));
}
@Override
@@ -1551,7 +1551,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
@Override
public Object visitNaninfinity(final NaninfinityContext ctx) {
- return new LiteralImpl().setType(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Decimal)).
+ return new LiteralImpl().setType(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Decimal)).
setText(ctx.getText());
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEnumTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEnumTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEnumTest.java
index e58edb7..9e6ae64 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEnumTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEnumTest.java
@@ -105,7 +105,7 @@ public class EdmEnumTest extends PrimitiveTypeBaseTest {
@Test
public void underlyingType() throws Exception {
- assertEquals(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.SByte), instance.getUnderlyingType());
+ assertEquals(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.SByte), instance.getUnderlyingType());
}
@Test
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImportImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImportImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImportImplTest.java
index b77f7e9..ce41453 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImportImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImportImplTest.java
@@ -78,7 +78,7 @@ public class EdmFunctionImportImplTest {
assertEquals(functionName.getName(), function.getName());
assertFalse(function.isBound());
assertFalse(function.isComposable());
- assertEquals(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Boolean),
+ assertEquals(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Boolean),
function.getReturnType().getType());
assertEquals(entityContainer, functionImport.getEntityContainer());
assertNull(functionImport.getReturnedEntitySet());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmReturnTypeImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmReturnTypeImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmReturnTypeImplTest.java
index bd028ba..0429c44 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmReturnTypeImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmReturnTypeImplTest.java
@@ -46,7 +46,7 @@ public class EdmReturnTypeImplTest {
EdmReturnType typeImpl = new EdmReturnTypeImpl(mock(EdmProviderImpl.class), providerType);
- assertEquals(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.String), typeImpl.getType());
+ assertEquals(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.String), typeImpl.getType());
assertFalse(typeImpl.isCollection());
assertNull(typeImpl.getPrecision());
@@ -61,7 +61,7 @@ public class EdmReturnTypeImplTest {
EdmReturnType typeImpl = new EdmReturnTypeImpl(mock(EdmProviderImpl.class), providerType);
- assertEquals(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.String), typeImpl.getType());
+ assertEquals(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.String), typeImpl.getType());
assertTrue(typeImpl.isCollection());
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImplTest.java
index 260e77a..14fac6a 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImplTest.java
@@ -47,7 +47,7 @@ public class EdmTypeDefinitionImplTest {
assertEquals(String.class, typeDefImpl.getDefaultType());
assertEquals(EdmTypeKind.DEFINITION, typeDefImpl.getKind());
assertEquals(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.String), typeDefImpl.getUnderlyingType());
- assertTrue(typeDefImpl.isCompatible(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.String)));
+ assertTrue(typeDefImpl.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.String)));
// String validation
assertEquals("'StringValue'", typeDefImpl.toUriLiteral("StringValue"));
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java
index f2408ff..9a2119e 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java
@@ -102,7 +102,7 @@ public class UriResourceImplTest {
assertEquals(false, impl.isCollection());
assertEquals(expression, impl.getExpression());
assertEquals("A", impl.getLambdaVariable());
- assertEquals(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Boolean), impl.getType());
+ assertEquals(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Boolean), impl.getType());
assertEquals("all", impl.toString());
}
@@ -118,7 +118,7 @@ public class UriResourceImplTest {
assertEquals(false, impl.isCollection());
assertEquals(expression, impl.getExpression());
assertEquals("A", impl.getLamdaVariable());
- assertEquals(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Boolean), impl.getType());
+ assertEquals(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Boolean), impl.getType());
assertEquals("any", impl.toString());
}
[15/51] [abbrv] [OLINGO-200] V4 Atom and JSON parsers on their way -
still to refine, but most features are in, and specific tests were added
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyDeserializer.java
index fd466ea..1e60a3c 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyDeserializer.java
@@ -18,8 +18,6 @@
*/
package org.apache.olingo.commons.core.data;
-import java.net.URI;
-import javax.xml.namespace.QName;
import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.Attribute;
@@ -28,7 +26,6 @@ import javax.xml.stream.events.XMLEvent;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.data.CollectionValue;
-import org.apache.olingo.commons.api.data.ComplexValue;
import org.apache.olingo.commons.api.data.Value;
import org.apache.olingo.commons.api.domain.ODataPropertyType;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
@@ -73,17 +70,24 @@ class AtomPropertyDeserializer extends AbstractAtomDealer {
return value;
}
- private ComplexValue fromComplex(final XMLEventReader reader, final StartElement start)
+ private Value fromComplexOrEnum(final XMLEventReader reader, final StartElement start)
throws XMLStreamException {
- final ComplexValue value = new ComplexValueImpl();
+ Value value = null;
boolean foundEndProperty = false;
while (reader.hasNext() && !foundEndProperty) {
final XMLEvent event = reader.nextEvent();
if (event.isStartElement()) {
- value.get().add(deserialize(reader, event.asStartElement()));
+ if (value == null) {
+ value = new ComplexValueImpl();
+ }
+ value.asComplex().get().add(deserialize(reader, event.asStartElement()));
+ }
+
+ if (event.isCharacters() && !event.asCharacters().isWhiteSpace()) {
+ value = new EnumValueImpl(event.asCharacters().getData());
}
if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
@@ -108,9 +112,10 @@ class AtomPropertyDeserializer extends AbstractAtomDealer {
final XMLEvent event = reader.nextEvent();
if (event.isStartElement()) {
- switch (guessPropertyType(reader)) {
+ switch (guessPropertyType(reader, typeInfo)) {
case COMPLEX:
- value.get().add(fromComplex(reader, event.asStartElement()));
+ case ENUM:
+ value.get().add(fromComplexOrEnum(reader, event.asStartElement()));
break;
case PRIMITIVE:
@@ -130,7 +135,9 @@ class AtomPropertyDeserializer extends AbstractAtomDealer {
return value;
}
- private ODataPropertyType guessPropertyType(final XMLEventReader reader) throws XMLStreamException {
+ private ODataPropertyType guessPropertyType(final XMLEventReader reader, final EdmTypeInfo typeInfo)
+ throws XMLStreamException {
+
XMLEvent child = null;
while (reader.hasNext() && child == null) {
final XMLEvent event = reader.peek();
@@ -143,7 +150,9 @@ class AtomPropertyDeserializer extends AbstractAtomDealer {
final ODataPropertyType type;
if (child == null) {
- type = ODataPropertyType.PRIMITIVE;
+ type = typeInfo == null || typeInfo.isPrimitiveType()
+ ? ODataPropertyType.PRIMITIVE
+ : ODataPropertyType.ENUM;
} else {
if (child.isStartElement()) {
if (Constants.NS_GML.equals(child.asStartElement().getName().getNamespaceURI())) {
@@ -154,7 +163,9 @@ class AtomPropertyDeserializer extends AbstractAtomDealer {
type = ODataPropertyType.COMPLEX;
}
} else if (child.isCharacters()) {
- type = ODataPropertyType.PRIMITIVE;
+ type = typeInfo == null || typeInfo.isPrimitiveType()
+ ? ODataPropertyType.PRIMITIVE
+ : ODataPropertyType.ENUM;
} else {
type = ODataPropertyType.EMPTY;
}
@@ -165,20 +176,17 @@ class AtomPropertyDeserializer extends AbstractAtomDealer {
public AtomPropertyImpl deserialize(final XMLEventReader reader, final StartElement start)
throws XMLStreamException {
- final AtomPropertyImpl property = new AtomPropertyImpl();
-
- final Attribute context = start.getAttributeByName(contextQName);
- property.setContextURL(context == null ? null : URI.create(context.getValue()));
-
- final QName name = start.getName();
+ final AtomPropertyImpl property = new AtomPropertyImpl();
- if (ODataServiceVersion.V40 == version && v4PropertyValueQName.equals(name)) {
+ if (ODataServiceVersion.V40 == version && v4PropertyValueQName.equals(start.getName())) {
// retrieve name from context
- final String contextURL = property.getContextURL().toASCIIString();
- property.setName(contextURL.substring(contextURL.lastIndexOf("/") + 1));
+ final Attribute context = start.getAttributeByName(contextQName);
+ if (context != null) {
+ property.setName(StringUtils.substringAfterLast(context.getValue(), "/"));
+ }
} else {
- property.setName(name.getLocalPart());
+ property.setName(start.getName().getLocalPart());
}
final Attribute nullAttr = start.getAttributeByName(this.nullQName);
@@ -197,7 +205,7 @@ class AtomPropertyDeserializer extends AbstractAtomDealer {
}
final ODataPropertyType propType = typeInfo == null
- ? guessPropertyType(reader)
+ ? guessPropertyType(reader, typeInfo)
: typeInfo.isCollection()
? ODataPropertyType.COLLECTION
: typeInfo.isPrimitiveType()
@@ -210,7 +218,7 @@ class AtomPropertyDeserializer extends AbstractAtomDealer {
break;
case COMPLEX:
- value = fromComplex(reader, start);
+ value = fromComplexOrEnum(reader, start);
break;
case PRIMITIVE:
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertySerializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertySerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertySerializer.java
index 412a127..0461ad2 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertySerializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertySerializer.java
@@ -26,6 +26,7 @@ import org.apache.olingo.commons.api.data.CollectionValue;
import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.data.Value;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
class AtomPropertySerializer extends AbstractAtomDealer {
@@ -38,16 +39,23 @@ class AtomPropertySerializer extends AbstractAtomDealer {
private void collection(final XMLStreamWriter writer, final CollectionValue value) throws XMLStreamException {
for (Value item : value.get()) {
- writer.writeStartElement(Constants.PREFIX_DATASERVICES, Constants.ELEM_ELEMENT,
- version.getNamespaceMap().get(ODataServiceVersion.NS_DATASERVICES));
+ if (version == ODataServiceVersion.V30) {
+ writer.writeStartElement(Constants.PREFIX_DATASERVICES, Constants.ELEM_ELEMENT,
+ version.getNamespaceMap().get(ODataServiceVersion.NS_DATASERVICES));
+ } else {
+ writer.writeStartElement(Constants.PREFIX_METADATA, Constants.ELEM_ELEMENT,
+ version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA));
+ }
value(writer, item);
writer.writeEndElement();
}
}
private void value(final XMLStreamWriter writer, final Value value) throws XMLStreamException {
- if (value.isSimple()) {
- writer.writeCharacters(value.asSimple().get());
+ if (value.isPrimitive()) {
+ writer.writeCharacters(value.asPrimitive().get());
+ } else if (value.isEnum()) {
+ writer.writeCharacters(value.asEnum().get());
} else if (value.isGeospatial()) {
this.geoSerializer.serialize(writer, value.asGeospatial().get());
} else if (value.isCollection()) {
@@ -62,22 +70,34 @@ class AtomPropertySerializer extends AbstractAtomDealer {
public void property(final XMLStreamWriter writer, final Property property, final boolean standalone)
throws XMLStreamException {
- writer.writeStartElement(Constants.PREFIX_DATASERVICES, property.getName(),
- version.getNamespaceMap().get(ODataServiceVersion.NS_DATASERVICES));
-
- if (version == ODataServiceVersion.V40 && property.getContextURL() != null) {
- writer.writeAttribute(
- version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA),
- Constants.CONTEXT,
- property.getContextURL().toASCIIString());
+ if (version == ODataServiceVersion.V40 && standalone) {
+ writer.writeStartElement(Constants.PREFIX_METADATA, Constants.VALUE,
+ version.getNamespaceMap().get(ODataServiceVersion.NS_DATASERVICES));
+ } else {
+ writer.writeStartElement(Constants.PREFIX_DATASERVICES, property.getName(),
+ version.getNamespaceMap().get(ODataServiceVersion.NS_DATASERVICES));
}
if (standalone) {
namespaces(writer);
}
+
if (StringUtils.isNotBlank(property.getType())) {
+ String type = property.getType();
+ if (version == ODataServiceVersion.V40) {
+ final EdmTypeInfo typeInfo = new EdmTypeInfo.Builder().setTypeExpression(property.getType()).build();
+ if (typeInfo.isPrimitiveType()) {
+ if (typeInfo.isCollection()) {
+ type = "#Collection(" + typeInfo.getFullQualifiedName().getName() + ")";
+ } else {
+ type = typeInfo.getFullQualifiedName().getName();
+ }
+ } else {
+ type = "#" + property.getType();
+ }
+ }
writer.writeAttribute(Constants.PREFIX_METADATA, version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA),
- Constants.ATTR_TYPE, property.getType());
+ Constants.ATTR_TYPE, type);
}
if (property.getValue().isNull()) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomSerializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomSerializer.java
index 4bcd3bf..c3be420 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomSerializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomSerializer.java
@@ -127,13 +127,6 @@ public class AtomSerializer extends AbstractAtomDealer {
}
private void entry(final XMLStreamWriter writer, final Entry entry) throws XMLStreamException {
- if (version == ODataServiceVersion.V40 && entry.getContextURL() != null) {
- writer.writeAttribute(
- version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA),
- Constants.CONTEXT,
- entry.getContextURL().toASCIIString());
- }
-
if (entry.getBaseURI() != null) {
writer.writeAttribute(XMLConstants.XML_NS_URI, Constants.ATTR_XML_BASE, entry.getBaseURI().toASCIIString());
}
@@ -191,13 +184,6 @@ public class AtomSerializer extends AbstractAtomDealer {
}
private void feed(final XMLStreamWriter writer, final Feed feed) throws XMLStreamException {
- if (version == ODataServiceVersion.V40 && feed.getContextURL() != null) {
- writer.writeAttribute(
- version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA),
- Constants.CONTEXT,
- feed.getContextURL().toASCIIString());
- }
-
if (feed.getBaseURI() != null) {
writer.writeAttribute(XMLConstants.XML_NS_URI, Constants.ATTR_XML_BASE, feed.getBaseURI().toASCIIString());
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/EnumValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/EnumValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/EnumValueImpl.java
new file mode 100644
index 0000000..5d79d22
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/EnumValueImpl.java
@@ -0,0 +1,41 @@
+/*
+ * 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.commons.core.data;
+
+import org.apache.olingo.commons.api.data.EnumValue;
+
+public class EnumValueImpl extends AbstractValue implements EnumValue {
+
+ private final String value;
+
+ public EnumValueImpl(final String value) {
+ this.value = value;
+ }
+
+ @Override
+ public boolean isEnum() {
+ return true;
+ }
+
+ @Override
+ public String get() {
+ return value;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryDeserializer.java
index e87daa0..eaaa653 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryDeserializer.java
@@ -88,13 +88,17 @@ public class JSONEntryDeserializer extends AbstractJsonDeserializer<JSONEntryImp
final JSONEntryImpl entry = new JSONEntryImpl();
+ String contextURL = null;
if (tree.hasNonNull(Constants.JSON_CONTEXT)) {
- entry.setContextURL(URI.create(tree.get(Constants.JSON_CONTEXT).textValue()));
+ contextURL = tree.get(Constants.JSON_CONTEXT).textValue();
tree.remove(Constants.JSON_CONTEXT);
} else if (tree.hasNonNull(Constants.JSON_METADATA)) {
- entry.setContextURL(URI.create(tree.get(Constants.JSON_METADATA).textValue()));
+ contextURL = tree.get(Constants.JSON_METADATA).textValue();
tree.remove(Constants.JSON_METADATA);
}
+ if (contextURL != null) {
+ entry.setBaseURI(contextURL.substring(0, contextURL.indexOf(Constants.METADATA)));
+ }
if (tree.hasNonNull(Constants.JSON_MEDIA_ETAG)) {
entry.setMediaETag(tree.get(Constants.JSON_MEDIA_ETAG).textValue());
@@ -106,40 +110,40 @@ public class JSONEntryDeserializer extends AbstractJsonDeserializer<JSONEntryImp
tree.remove(Constants.JSON_ETAG);
}
- if (tree.hasNonNull(Constants.JSON_TYPE)) {
- entry.setType(tree.get(Constants.JSON_TYPE).textValue());
- tree.remove(Constants.JSON_TYPE);
+ if (tree.hasNonNull(jsonType)) {
+ entry.setType(tree.get(jsonType).textValue());
+ tree.remove(jsonType);
}
- if (tree.hasNonNull(Constants.JSON_ID)) {
- entry.setId(tree.get(Constants.JSON_ID).textValue());
- tree.remove(Constants.JSON_ID);
+ if (tree.hasNonNull(jsonId)) {
+ entry.setId(tree.get(jsonId).textValue());
+ tree.remove(jsonId);
}
- if (tree.hasNonNull(Constants.JSON_READ_LINK)) {
+ if (tree.hasNonNull(jsonReadLink)) {
final LinkImpl link = new LinkImpl();
link.setRel(Constants.SELF_LINK_REL);
- link.setHref(tree.get(Constants.JSON_READ_LINK).textValue());
+ link.setHref(tree.get(jsonReadLink).textValue());
entry.setSelfLink(link);
- tree.remove(Constants.JSON_READ_LINK);
+ tree.remove(jsonReadLink);
}
- if (tree.hasNonNull(Constants.JSON_EDIT_LINK)) {
+ if (tree.hasNonNull(jsonEditLink)) {
final LinkImpl link = new LinkImpl();
link.setRel(Constants.EDIT_LINK_REL);
- link.setHref(tree.get(Constants.JSON_EDIT_LINK).textValue());
+ link.setHref(tree.get(jsonEditLink).textValue());
entry.setEditLink(link);
- tree.remove(Constants.JSON_EDIT_LINK);
+ tree.remove(jsonEditLink);
}
- if (tree.hasNonNull(Constants.JSON_MEDIAREAD_LINK)) {
- entry.setMediaContentSource(tree.get(Constants.JSON_MEDIAREAD_LINK).textValue());
- tree.remove(Constants.JSON_MEDIAREAD_LINK);
+ if (tree.hasNonNull(jsonMediaReadLink)) {
+ entry.setMediaContentSource(tree.get(jsonMediaReadLink).textValue());
+ tree.remove(jsonMediaReadLink);
}
- if (tree.hasNonNull(Constants.JSON_MEDIAEDIT_LINK)) {
- tree.remove(Constants.JSON_MEDIAEDIT_LINK);
+ if (tree.hasNonNull(jsonMediaEditLink)) {
+ tree.remove(jsonMediaEditLink);
}
if (tree.hasNonNull(Constants.JSON_MEDIA_CONTENT_TYPE)) {
entry.setMediaContentType(tree.get(Constants.JSON_MEDIA_CONTENT_TYPE).textValue());
@@ -150,7 +154,7 @@ public class JSONEntryDeserializer extends AbstractJsonDeserializer<JSONEntryImp
for (final Iterator<Map.Entry<String, JsonNode>> itor = tree.fields(); itor.hasNext();) {
final Map.Entry<String, JsonNode> field = itor.next();
- if (field.getKey().endsWith(Constants.JSON_NAVIGATION_LINK_SUFFIX)) {
+ if (field.getKey().endsWith(jsonNavigationLink)) {
final LinkImpl link = new LinkImpl();
link.setTitle(getTitle(field));
link.setRel(version.getNamespaceMap().get(ODataServiceVersion.NAVIGATION_LINK_REL) + getTitle(field));
@@ -168,8 +172,8 @@ public class JSONEntryDeserializer extends AbstractJsonDeserializer<JSONEntryImp
entry.getNavigationLinks().add(link);
toRemove.add(field.getKey());
- toRemove.add(setInline(field.getKey(), Constants.JSON_NAVIGATION_LINK_SUFFIX, tree, parser.getCodec(), link));
- } else if (field.getKey().endsWith(Constants.JSON_ASSOCIATION_LINK_SUFFIX)) {
+ toRemove.add(setInline(field.getKey(), jsonNavigationLink, tree, parser.getCodec(), link));
+ } else if (field.getKey().endsWith(jsonAssociationLink)) {
final LinkImpl link = new LinkImpl();
link.setTitle(getTitle(field));
link.setRel(version.getNamespaceMap().get(ODataServiceVersion.ASSOCIATION_LINK_REL) + getTitle(field));
@@ -178,7 +182,7 @@ public class JSONEntryDeserializer extends AbstractJsonDeserializer<JSONEntryImp
entry.getAssociationLinks().add(link);
toRemove.add(field.getKey());
- } else if (field.getKey().endsWith(Constants.JSON_MEDIAEDIT_LINK_SUFFIX)) {
+ } else if (field.getKey().endsWith(getJSONAnnotation(jsonMediaEditLink))) {
final LinkImpl link = new LinkImpl();
link.setTitle(getTitle(field));
link.setRel(version.getNamespaceMap().get(ODataServiceVersion.MEDIA_EDIT_LINK_REL) + getTitle(field));
@@ -192,7 +196,7 @@ public class JSONEntryDeserializer extends AbstractJsonDeserializer<JSONEntryImp
}
toRemove.add(field.getKey());
- toRemove.add(setInline(field.getKey(), Constants.JSON_MEDIAEDIT_LINK_SUFFIX, tree, parser.getCodec(), link));
+ toRemove.add(setInline(field.getKey(), getJSONAnnotation(jsonMediaEditLink), tree, parser.getCodec(), link));
} else if (field.getKey().endsWith(Constants.JSON_MEDIA_CONTENT_TYPE)) {
final String linkTitle = getTitle(field);
for (Link link : entry.getMediaEditLinks()) {
@@ -220,7 +224,7 @@ public class JSONEntryDeserializer extends AbstractJsonDeserializer<JSONEntryImp
for (final Iterator<Map.Entry<String, JsonNode>> itor = tree.fields(); itor.hasNext();) {
final Map.Entry<String, JsonNode> field = itor.next();
- if (type == null && field.getKey().endsWith(Constants.JSON_TYPE_SUFFIX)) {
+ if (type == null && field.getKey().endsWith(getJSONAnnotation(jsonType))) {
type = field.getValue().asText();
} else {
final JSONPropertyImpl property = new JSONPropertyImpl();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryImpl.java
index 10123d4..a83332a 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryImpl.java
@@ -20,8 +20,6 @@ package org.apache.olingo.commons.core.data;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import java.net.URI;
-import org.apache.olingo.commons.api.Constants;
/**
* A single entry, represented via JSON.
@@ -34,17 +32,6 @@ public class JSONEntryImpl extends AbstractEntry {
private String mediaETag;
- @Override
- public URI getBaseURI() {
- URI baseURI = null;
- if (getContextURL() != null) {
- final String metadataURI = getContextURL().toASCIIString();
- baseURI = URI.create(metadataURI.substring(0, metadataURI.indexOf(Constants.METADATA)));
- }
-
- return baseURI;
- }
-
/**
* The odata.mediaEtag annotation MAY be included; its value MUST be the ETag of the binary stream represented by this
* media entity or named stream property.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntrySerializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntrySerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntrySerializer.java
index bd5a145..eb51362 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntrySerializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntrySerializer.java
@@ -45,14 +45,8 @@ public class JSONEntrySerializer extends AbstractJsonSerializer<JSONEntryImpl> {
jgen.writeStartObject();
- if (entry.getContextURL() != null) {
- jgen.writeStringField(
- version == ODataServiceVersion.V40 ? Constants.JSON_CONTEXT : Constants.JSON_METADATA,
- entry.getContextURL().toASCIIString());
- }
-
if (entry.getId() != null) {
- jgen.writeStringField(Constants.JSON_ID, entry.getId());
+ jgen.writeStringField(version.getJSONMap().get(ODataServiceVersion.JSON_ID), entry.getId());
}
final Map<String, List<String>> entitySetLinks = new HashMap<String, List<String>>();
@@ -100,7 +94,7 @@ public class JSONEntrySerializer extends AbstractJsonSerializer<JSONEntryImpl> {
for (Link link : entry.getMediaEditLinks()) {
if (link.getTitle() == null) {
- jgen.writeStringField(Constants.JSON_MEDIAEDIT_LINK, link.getHref());
+ jgen.writeStringField(version.getJSONMap().get(ODataServiceVersion.JSON_MEDIAEDIT_LINK), link.getHref());
}
if (link.getInlineEntry() != null) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedImpl.java
index e89bb1f..8994e88 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedImpl.java
@@ -51,22 +51,14 @@ public class JSONFeedImpl extends AbstractPayloadObject implements Feed {
@Override
public URI getBaseURI() {
URI baseURI = null;
- if (getContextURL() != null) {
- final String metadataURI = getContextURL().toASCIIString();
+ if (contextURL != null) {
+ final String metadataURI = contextURL.toASCIIString();
baseURI = URI.create(metadataURI.substring(0, metadataURI.indexOf(Constants.METADATA)));
}
return baseURI;
}
- /**
- * {@inheritDoc}
- */
- @Override
- public URI getContextURL() {
- return contextURL;
- }
-
public void setContextURL(final URI context) {
this.contextURL = context;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedSerializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedSerializer.java
index df359b8..649bc99 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedSerializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedSerializer.java
@@ -34,13 +34,8 @@ public class JSONFeedSerializer extends AbstractJsonSerializer<JSONFeedImpl> {
jgen.writeStartObject();
- if (feed.getContextURL() != null) {
- jgen.writeStringField(
- version == ODataServiceVersion.V40 ? Constants.JSON_CONTEXT : Constants.JSON_METADATA,
- feed.getContextURL().toASCIIString());
- }
if (feed.getId() != null) {
- jgen.writeStringField(Constants.JSON_ID, feed.getId());
+ jgen.writeStringField(version.getJSONMap().get(ODataServiceVersion.JSON_ID), feed.getId());
}
if (feed.getCount() != null) {
jgen.writeNumberField(Constants.JSON_COUNT, feed.getCount());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java
index 8af23e1..1215c5d 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java
@@ -23,7 +23,6 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.node.ObjectNode;
import java.io.IOException;
-import java.net.URI;
import org.apache.olingo.commons.api.Constants;
/**
@@ -41,24 +40,24 @@ public class JSONPropertyDeserializer extends AbstractJsonDeserializer<JSONPrope
final JSONPropertyImpl property = new JSONPropertyImpl();
+ String contextURL = null;
if (tree.hasNonNull(Constants.JSON_CONTEXT)) {
- property.setContextURL(URI.create(tree.get(Constants.JSON_CONTEXT).textValue()));
+ contextURL = tree.get(Constants.JSON_CONTEXT).textValue();
tree.remove(Constants.JSON_CONTEXT);
} else if (tree.hasNonNull(Constants.JSON_METADATA)) {
- property.setContextURL(URI.create(tree.get(Constants.JSON_METADATA).textValue()));
+ contextURL = tree.get(Constants.JSON_METADATA).textValue();
tree.remove(Constants.JSON_METADATA);
}
- if (property.getContextURL() != null) {
- final String contextURL = property.getContextURL().toASCIIString();
+ if (contextURL != null) {
final int dashIdx = contextURL.lastIndexOf('#');
if (dashIdx != -1) {
property.setType(contextURL.substring(dashIdx + 1));
}
}
- if (tree.has(Constants.JSON_TYPE) && property.getType() == null) {
- property.setType(tree.get(Constants.JSON_TYPE).asText());
+ if (tree.has(jsonType) && property.getType() == null) {
+ property.setType(tree.get(jsonType).asText());
}
if (tree.has(Constants.JSON_NULL) && tree.get(Constants.JSON_NULL).asBoolean()) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertySerializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertySerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertySerializer.java
index ce5f891..d1804eb 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertySerializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertySerializer.java
@@ -24,7 +24,6 @@ import com.fasterxml.jackson.databind.SerializerProvider;
import java.io.IOException;
import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
/**
* Writes out JSON string from <tt>JSONPropertyImpl</tt>.
@@ -39,16 +38,12 @@ public class JSONPropertySerializer extends AbstractJsonSerializer<JSONPropertyI
jgen.writeStartObject();
- if (property.getContextURL() != null) {
- jgen.writeStringField(
- version == ODataServiceVersion.V40 ? Constants.JSON_CONTEXT : Constants.JSON_METADATA,
- property.getContextURL().toASCIIString());
- }
-
if (property.getValue().isNull()) {
jgen.writeBooleanField(Constants.JSON_NULL, true);
- } else if (property.getValue().isSimple()) {
- jgen.writeStringField(Constants.VALUE, property.getValue().asSimple().get());
+ } else if (property.getValue().isPrimitive()) {
+ jgen.writeStringField(Constants.VALUE, property.getValue().asPrimitive().get());
+ } else if (property.getValue().isEnum()) {
+ jgen.writeStringField(Constants.VALUE, property.getValue().asEnum().get());
} else if (property.getValue().isGeospatial() || property.getValue().isCollection()) {
property(jgen, property, Constants.VALUE);
} else if (property.getValue().isComplex()) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonDeserializer.java
index e882be2..baf418d 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonDeserializer.java
@@ -30,14 +30,44 @@ public abstract class ODataJacksonDeserializer<T> extends JsonDeserializer<T> {
protected ODataServiceVersion version;
+ protected String jsonType;
+
+ protected String jsonId;
+
+ protected String jsonReadLink;
+
+ protected String jsonEditLink;
+
+ protected String jsonMediaEditLink;
+
+ protected String jsonMediaReadLink;
+
+ protected String jsonAssociationLink;
+
+ protected String jsonNavigationLink;
+
protected abstract T doDeserialize(JsonParser jp, DeserializationContext ctxt)
throws IOException, JsonProcessingException;
+ protected String getJSONAnnotation(final String string) {
+ return string.startsWith("@") ? string : "@" + string;
+ }
+
@Override
public T deserialize(final JsonParser jp, final DeserializationContext ctxt)
throws IOException, JsonProcessingException {
version = (ODataServiceVersion) ctxt.findInjectableValue(ODataServiceVersion.class.getName(), null, null);
+
+ jsonType = version.getJSONMap().get(ODataServiceVersion.JSON_TYPE);
+ jsonId = version.getJSONMap().get(ODataServiceVersion.JSON_ID);
+ jsonReadLink = version.getJSONMap().get(ODataServiceVersion.JSON_READ_LINK);
+ jsonEditLink = version.getJSONMap().get(ODataServiceVersion.JSON_EDIT_LINK);
+ jsonMediaReadLink = version.getJSONMap().get(ODataServiceVersion.JSON_MEDIAREAD_LINK);
+ jsonMediaEditLink = version.getJSONMap().get(ODataServiceVersion.JSON_MEDIAEDIT_LINK);
+ jsonAssociationLink = version.getJSONMap().get(ODataServiceVersion.JSON_ASSOCIATION_LINK);
+ jsonNavigationLink = version.getJSONMap().get(ODataServiceVersion.JSON_NAVIGATION_LINK);
+
return doDeserialize(jp, ctxt);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/PrimitiveValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/PrimitiveValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/PrimitiveValueImpl.java
index 2d0a6bc..b3334ae 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/PrimitiveValueImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/PrimitiveValueImpl.java
@@ -29,7 +29,7 @@ public class PrimitiveValueImpl extends AbstractValue implements PrimitiveValue
}
@Override
- public boolean isSimple() {
+ public boolean isPrimitive() {
return true;
}
[48/51] [abbrv] git commit: [OLINGO-200] Cleanup again
Posted by il...@apache.org.
[OLINGO-200] Cleanup again
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/1fa66760
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/1fa66760
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/1fa66760
Branch: refs/heads/master
Commit: 1fa667608094fb7a59395642b641113959b48798
Parents: a5b7b25
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Tue Apr 1 14:16:50 2014 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Tue Apr 1 14:16:50 2014 +0200
----------------------------------------------------------------------
.../commons/core/data/AtomDeserializer.java | 28 +++++++--------
.../core/op/AbstractODataDeserializer.java | 38 ++++++++------------
2 files changed, 26 insertions(+), 40 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/1fa66760/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
index a786803..722ea50 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
@@ -34,14 +34,10 @@ import org.apache.olingo.commons.api.domain.ODataOperation;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.core.data.v3.XMLLinkCollectionImpl;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
public class AtomDeserializer extends AbstractAtomDealer {
- private static final Logger LOG = LoggerFactory.getLogger(AtomDeserializer.class);
-
- public static final XMLInputFactory FACTORY = XMLInputFactory.newInstance();
+ private static final XMLInputFactory FACTORY = XMLInputFactory.newInstance();
private final AtomPropertyDeserializer propDeserializer;
@@ -56,7 +52,7 @@ public class AtomDeserializer extends AbstractAtomDealer {
return getContainer(start, propDeserializer.deserialize(reader, start));
}
- public StartElement skipBeforeFirstStartElement(final XMLEventReader reader) throws XMLStreamException {
+ private StartElement skipBeforeFirstStartElement(final XMLEventReader reader) throws XMLStreamException {
StartElement startEvent = null;
while (reader.hasNext() && startEvent == null) {
final XMLEvent event = reader.nextEvent();
@@ -442,6 +438,16 @@ public class AtomDeserializer extends AbstractAtomDealer {
return getContainer(start, error(reader, start));
}
+ private <T> Container<T> getContainer(final StartElement start, final T object) {
+ final Attribute context = start.getAttributeByName(contextQName);
+ final Attribute metadataETag = start.getAttributeByName(metadataEtagQName);
+
+ return new Container<T>(
+ context == null ? null : URI.create(context.getValue()),
+ metadataETag == null ? null : metadataETag.getValue(),
+ object);
+ }
+
@SuppressWarnings("unchecked")
public <T, V extends T> Container<T> read(final InputStream input, final Class<V> reference)
throws XMLStreamException {
@@ -459,14 +465,4 @@ public class AtomDeserializer extends AbstractAtomDealer {
}
return null;
}
-
- public <T> Container<T> getContainer(final StartElement start, final T object) {
- final Attribute context = start.getAttributeByName(contextQName);
- final Attribute metadataETag = start.getAttributeByName(metadataEtagQName);
-
- return new Container<T>(
- context == null ? null : URI.create(context.getValue()),
- metadataETag == null ? null : metadataETag.getValue(),
- object);
- }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/1fa66760/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
index 96043c7..ceb6b7e 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
@@ -19,14 +19,8 @@
package org.apache.olingo.commons.core.op;
import com.fasterxml.jackson.core.type.TypeReference;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.lang.reflect.Type;
-import javax.xml.stream.XMLEventReader;
-import javax.xml.stream.XMLEventWriter;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.events.StartElement;
import org.apache.olingo.commons.api.data.Entry;
import org.apache.olingo.commons.api.domain.ODataError;
import org.apache.olingo.commons.api.data.Feed;
@@ -89,38 +83,34 @@ public abstract class AbstractODataDeserializer extends AbstractJacksonTool impl
/*
* ------------------ Protected methods ------------------
*/
- @SuppressWarnings("unchecked")
- protected <T, V extends T> Container<T> xml(final InputStream input, final Class<V> reference) {
+ protected <T, V extends T> Container<T> atom(final InputStream input, final Class<V> reference) {
try {
- final ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
- final XMLEventReader reader = AtomDeserializer.FACTORY.createXMLEventReader(input);
- final StartElement start = atomDeserializer.skipBeforeFirstStartElement(reader);
-
- final XMLEventWriter writer = XMLOutputFactory.newFactory().createXMLEventWriter(baos);
- writer.add(start);
- writer.add(reader);
- writer.flush();
- writer.close();
-
- final V obj = getXmlMapper().readValue(new ByteArrayInputStream(baos.toByteArray()), reference);
- return (Container<T>) (obj instanceof Container ? obj : atomDeserializer.getContainer(start, obj));
+ return atomDeserializer.<T, V>read(input, reference);
} catch (Exception e) {
throw new IllegalArgumentException("While deserializing " + reference.getName(), e);
}
}
- protected <T, V extends T> Container<T> atom(final InputStream input, final Class<V> reference) {
+ @SuppressWarnings("unchecked")
+ protected <T, V extends T> Container<T> xml(final InputStream input, final Class<V> reference) {
try {
- return atomDeserializer.<T, V>read(input, reference);
+ final T obj = getXmlMapper().readValue(input, new TypeReference<V>() {
+ @Override
+ public Type getType() {
+ return reference;
+ }
+ });
+
+ return obj instanceof Container ? (Container<T>) obj : new Container<T>(null, null, obj);
} catch (Exception e) {
throw new IllegalArgumentException("While deserializing " + reference.getName(), e);
}
}
+ @SuppressWarnings("unchecked")
protected <T, V extends T> Container<T> json(final InputStream input, final Class<V> reference) {
try {
- T obj = getObjectMapper().readValue(input, new TypeReference<V>() {
+ final T obj = getObjectMapper().readValue(input, new TypeReference<V>() {
@Override
public Type getType() {
return reference;
[33/51] [abbrv] git commit: [OLINGO-200] Introducing specialization
for V3 and V4 domain objects
Posted by il...@apache.org.
[OLINGO-200] Introducing specialization for V3 and V4 domain objects
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/80e5ed56
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/80e5ed56
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/80e5ed56
Branch: refs/heads/master
Commit: 80e5ed56d55f46e2bf5eb5933145ab5ef66ea694
Parents: ceda474
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Sat Mar 29 16:55:41 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Sat Mar 29 16:55:41 2014 +0100
----------------------------------------------------------------------
.../olingo/client/api/CommonODataClient.java | 4 +-
.../request/cud/CommonCUDRequestFactory.java | 18 +-
.../retrieve/CommonRetrieveRequestFactory.java | 12 +-
.../request/retrieve/ODataEntityRequest.java | 4 +-
.../request/retrieve/ODataEntitySetRequest.java | 5 +-
.../request/retrieve/ODataPropertyRequest.java | 4 +-
.../retrieve/v3/RetrieveRequestFactory.java | 18 +
.../retrieve/v4/RetrieveRequestFactory.java | 17 +
.../response/ODataEntityCreateResponse.java | 4 +-
.../response/ODataEntityUpdateResponse.java | 4 +-
.../ODataMediaEntityCreateResponse.java | 4 +-
.../ODataMediaEntityUpdateResponse.java | 4 +-
.../response/ODataPropertyUpdateResponse.java | 4 +-
.../api/domain/ODataEntitySetIterator.java | 12 +-
.../olingo/client/api/op/CommonODataBinder.java | 33 +-
.../olingo/client/api/op/CommonODataReader.java | 12 +-
.../olingo/client/api/op/ODataWriter.java | 14 +-
.../olingo/client/api/op/v3/ODataBinder.java | 22 ++
.../olingo/client/api/op/v4/ODataBinder.java | 21 ++
.../olingo/client/api/v3/ODataClient.java | 10 +-
.../olingo/client/api/v4/ODataClient.java | 10 +-
.../olingo/client/core/AbstractODataClient.java | 9 -
.../request/cud/AbstractCUDRequestFactory.java | 16 +-
.../cud/ODataEntityCreateRequestImpl.java | 16 +-
.../cud/ODataEntityUpdateRequestImpl.java | 10 +-
.../cud/ODataPropertyUpdateRequestImpl.java | 10 +-
.../request/invoke/ODataInvokeRequestImpl.java | 24 +-
.../invoke/v3/InvokeRequestFactoryImpl.java | 18 +-
.../AbstractRetrieveRequestFactory.java | 18 -
.../retrieve/ODataEntityRequestImpl.java | 17 +-
.../retrieve/ODataEntitySetRequestImpl.java | 16 +-
.../retrieve/ODataPropertyRequestImpl.java | 19 +-
.../retrieve/v3/RetrieveRequestFactoryImpl.java | 27 ++
.../retrieve/v4/RetrieveRequestFactoryImpl.java | 30 +-
.../ODataMediaEntityCreateRequestImpl.java | 6 +-
.../ODataMediaEntityUpdateRequestImpl.java | 6 +-
.../client/core/op/AbstractODataBinder.java | 53 ++-
.../client/core/op/AbstractODataReader.java | 18 +-
.../olingo/client/core/op/ODataWriterImpl.java | 20 +-
.../client/core/op/impl/v3/ODataBinderImpl.java | 46 +++
.../client/core/op/impl/v4/ODataBinderImpl.java | 56 +++
.../olingo/client/core/v3/ODataClientImpl.java | 9 +
.../olingo/client/core/v4/ODataClientImpl.java | 9 +
.../client/core/it/AbstractTestITCase.java | 125 ++++---
.../client/core/it/v3/AsyncTestITCase.java | 18 +-
.../core/it/v3/EntityCreateTestITCase.java | 181 ++++-----
.../core/it/v3/EntityRetrieveTestITCase.java | 43 +--
.../client/core/it/v3/EntitySetTestITCase.java | 15 +-
.../core/it/v3/EntityUpdateTestITCase.java | 44 +--
.../client/core/it/v3/ErrorTestITCase.java | 13 +-
.../core/it/v3/FilterFactoryTestITCase.java | 4 +-
.../client/core/it/v3/FilterTestITCase.java | 4 +-
.../core/it/v3/KeyAsSegmentTestITCase.java | 21 +-
.../core/it/v3/MediaEntityTestITCase.java | 8 +-
.../it/v3/NavigationLinkCreateTestITCase.java | 159 ++++----
.../client/core/it/v3/OpenTypeTestITCase.java | 129 ++++---
.../core/it/v3/PrimitiveKeysTestITCase.java | 8 +-
.../core/it/v3/PropertyRetrieveTestITCase.java | 41 +-
.../client/core/it/v3/PropertyTestITCase.java | 29 +-
.../core/it/v3/PropertyValueTestITCase.java | 18 +-
.../core/it/v3/QueryOptionsTestITCase.java | 38 +-
.../core/it/v4/EntityRetrieveTestITCase.java | 52 +--
.../client/core/it/v4/EntitySetTestITCase.java | 18 +-
.../core/it/v4/PropertyValueTestITCase.java | 9 +-
.../olingo/client/core/v3/EntitySetTest.java | 6 +-
.../olingo/client/core/v3/EntityTest.java | 26 +-
.../olingo/client/core/v3/PropertyTest.java | 30 +-
.../commons/api/domain/CommonODataEntity.java | 177 +++++++++
.../api/domain/CommonODataEntitySet.java | 57 +++
.../api/domain/CommonODataObjectFactory.java | 210 +++++++++++
.../commons/api/domain/CommonODataProperty.java | 91 +++++
.../commons/api/domain/ODataComplexValue.java | 6 +-
.../olingo/commons/api/domain/ODataEntity.java | 197 ----------
.../commons/api/domain/ODataEntitySet.java | 57 ---
.../commons/api/domain/ODataInlineEntity.java | 8 +-
.../api/domain/ODataInlineEntitySet.java | 8 +-
.../commons/api/domain/ODataObjectFactory.java | 210 -----------
.../commons/api/domain/ODataProperty.java | 91 -----
.../commons/api/domain/v3/ODataEntity.java | 32 ++
.../commons/api/domain/v3/ODataEntitySet.java | 29 ++
.../api/domain/v3/ODataObjectFactory.java | 50 +++
.../commons/api/domain/v3/ODataProperty.java | 25 ++
.../commons/api/domain/v4/ODataEntity.java | 52 +++
.../commons/api/domain/v4/ODataEntitySet.java | 29 ++
.../commons/api/domain/v4/ODataEnumValue.java | 24 ++
.../api/domain/v4/ODataObjectFactory.java | 52 +++
.../commons/api/domain/v4/ODataProperty.java | 38 ++
.../commons/api/domain/v4/ODataValue.java | 36 ++
.../core/domain/AbstractODataEntity.java | 326 ++++++++++++++++
.../core/domain/AbstractODataEntitySet.java | 73 ++++
.../core/domain/AbstractODataObjectFactory.java | 133 +++++++
.../core/domain/AbstractODataProperty.java | 169 +++++++++
.../core/domain/ODataComplexValueImpl.java | 10 +-
.../commons/core/domain/ODataEntityImpl.java | 372 -------------------
.../commons/core/domain/ODataEntitySetImpl.java | 104 ------
.../core/domain/ODataObjectFactoryImpl.java | 171 ---------
.../commons/core/domain/ODataPropertyImpl.java | 172 ---------
.../commons/core/domain/v3/ODataEntityImpl.java | 46 +++
.../core/domain/v3/ODataEntitySetImpl.java | 51 +++
.../core/domain/v3/ODataObjectFactoryImpl.java | 75 ++++
.../core/domain/v3/ODataPropertyImpl.java | 33 ++
.../commons/core/domain/v4/ODataEntityImpl.java | 62 ++++
.../core/domain/v4/ODataEntitySetImpl.java | 51 +++
.../core/domain/v4/ODataObjectFactoryImpl.java | 81 ++++
.../core/domain/v4/ODataPropertyImpl.java | 44 +++
105 files changed, 3090 insertions(+), 2090 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
index af904b3..ed0910a 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
@@ -25,7 +25,7 @@ import org.apache.olingo.client.api.communication.request.invoke.CommonInvokeReq
import org.apache.olingo.client.api.communication.request.retrieve.CommonRetrieveRequestFactory;
import org.apache.olingo.client.api.communication.request.streamed.CommonStreamedRequestFactory;
import org.apache.olingo.client.api.op.ClientODataDeserializer;
-import org.apache.olingo.commons.api.domain.ODataObjectFactory;
+import org.apache.olingo.commons.api.domain.CommonODataObjectFactory;
import org.apache.olingo.client.api.op.CommonODataBinder;
import org.apache.olingo.client.api.op.CommonODataReader;
import org.apache.olingo.commons.api.op.ODataSerializer;
@@ -56,7 +56,7 @@ public interface CommonODataClient {
CommonODataBinder getBinder();
- ODataObjectFactory getObjectFactory();
+ CommonODataObjectFactory getObjectFactory();
CommonRetrieveRequestFactory getRetrieveRequestFactory();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CommonCUDRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CommonCUDRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CommonCUDRequestFactory.java
index 48786be..f05eb1a 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CommonCUDRequestFactory.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CommonCUDRequestFactory.java
@@ -20,10 +20,10 @@ package org.apache.olingo.client.api.communication.request.cud;
import java.io.Serializable;
import java.net.URI;
-import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.domain.ODataLink;
import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
/**
* OData request factory class.
@@ -39,17 +39,19 @@ public interface CommonCUDRequestFactory extends Serializable {
* @param entity entity to be created.
* @return new ODataEntityCreateRequest instance.
*/
- ODataEntityCreateRequest getEntityCreateRequest(URI targetURI, ODataEntity entity);
+ ODataEntityCreateRequest getEntityCreateRequest(URI targetURI, CommonODataEntity entity);
/**
* Gets an update request object instance.
*
+ * @param <UT> concrete UpdateType.
* @param targetURI edit link of the object to be updated.
* @param type type of update to be performed.
* @param changes changes to be applied.
* @return new ODataEntityUpdateRequest instance.
*/
- <UT extends UpdateType> ODataEntityUpdateRequest getEntityUpdateRequest(URI targetURI, UT type, ODataEntity changes);
+ <UT extends UpdateType> ODataEntityUpdateRequest getEntityUpdateRequest(URI targetURI, UT type,
+ CommonODataEntity changes);
/**
* Gets an update request object instance; uses entity's edit link as endpoint.
@@ -58,7 +60,7 @@ public interface CommonCUDRequestFactory extends Serializable {
* @param entity changes to be applied.
* @return new ODataEntityUpdateRequest instance.
*/
- ODataEntityUpdateRequest getEntityUpdateRequest(UpdateType type, ODataEntity entity);
+ ODataEntityUpdateRequest getEntityUpdateRequest(UpdateType type, CommonODataEntity entity);
/**
* Gets a create request object instance.
@@ -81,7 +83,7 @@ public interface CommonCUDRequestFactory extends Serializable {
* @param property value to be update.
* @return new ODataPropertyUpdateRequest instance.
*/
- ODataPropertyUpdateRequest getPropertyPrimitiveValueUpdateRequest(URI targetURI, ODataProperty property);
+ ODataPropertyUpdateRequest getPropertyPrimitiveValueUpdateRequest(URI targetURI, CommonODataProperty property);
/**
* Gets an update request object instance.
@@ -94,7 +96,7 @@ public interface CommonCUDRequestFactory extends Serializable {
* @return new ODataPropertyUpdateRequest instance.
*/
ODataPropertyUpdateRequest getPropertyComplexValueUpdateRequest(
- URI targetURI, UpdateType type, ODataProperty property);
+ URI targetURI, UpdateType type, CommonODataProperty property);
/**
* Gets an update request object instance.
@@ -105,7 +107,7 @@ public interface CommonCUDRequestFactory extends Serializable {
* @param property value to be update.
* @return new ODataPropertyUpdateRequest instance.
*/
- ODataPropertyUpdateRequest getPropertyCollectionValueUpdateRequest(URI targetURI, ODataProperty property);
+ ODataPropertyUpdateRequest getPropertyCollectionValueUpdateRequest(URI targetURI, CommonODataProperty property);
/**
* Gets an add link request object instance.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/CommonRetrieveRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/CommonRetrieveRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/CommonRetrieveRequestFactory.java
index f613cbc..02ca4ee 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/CommonRetrieveRequestFactory.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/CommonRetrieveRequestFactory.java
@@ -20,6 +20,9 @@ package org.apache.olingo.client.api.communication.request.retrieve;
import java.io.Serializable;
import java.net.URI;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
/**
* OData request factory class.
@@ -59,10 +62,11 @@ public interface CommonRetrieveRequestFactory extends Serializable {
/**
* Gets a query request returning a set of one or more OData entities.
*
+ * @param <T> concrete ODataEntitySet implementation.
* @param uri request URI.
* @return new {@link ODataEntitySetRequest} instance.
*/
- ODataEntitySetRequest getEntitySetRequest(URI uri);
+ <T extends CommonODataEntitySet> ODataEntitySetRequest<T> getEntitySetRequest(URI uri);
/**
* Gets a query request returning a set of one or more OData entities.
@@ -78,18 +82,20 @@ public interface CommonRetrieveRequestFactory extends Serializable {
/**
* Gets a query request returning a single OData entity.
*
+ * @param <T> concrete ODataEntity implementation.
* @param uri request URI.
* @return new {@link ODataEntityRequest} instance.
*/
- ODataEntityRequest getEntityRequest(URI uri);
+ <T extends CommonODataEntity> ODataEntityRequest<T> getEntityRequest(URI uri);
/**
* Gets a query request returning a single OData entity property.
*
+ * @param <T> concrete ODataProperty implementation.
* @param uri request URI.
* @return new {@link ODataPropertyRequest} instance.
*/
- ODataPropertyRequest getPropertyRequest(URI uri);
+ <T extends CommonODataProperty> ODataPropertyRequest<T> getPropertyRequest(URI uri);
/**
* Gets a query request returning a single OData entity property value.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntityRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntityRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntityRequest.java
index a22f82c..aee9602 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntityRequest.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntityRequest.java
@@ -18,11 +18,11 @@
*/
package org.apache.olingo.client.api.communication.request.retrieve;
-import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.format.ODataPubFormat;
/**
* This class implements an OData retrieve query request returning a single entity.
*/
-public interface ODataEntityRequest extends ODataRetrieveRequest<ODataEntity, ODataPubFormat> {
+public interface ODataEntityRequest<T extends CommonODataEntity> extends ODataRetrieveRequest<T, ODataPubFormat> {
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetRequest.java
index fbafafd..865596c 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetRequest.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetRequest.java
@@ -18,11 +18,12 @@
*/
package org.apache.olingo.client.api.communication.request.retrieve;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.format.ODataPubFormat;
/**
* This class implements an OData EntitySet query request.
*/
-public interface ODataEntitySetRequest extends ODataRetrieveRequest<ODataEntitySet, ODataPubFormat> {
+public interface ODataEntitySetRequest<T extends CommonODataEntitySet>
+ extends ODataRetrieveRequest<T, ODataPubFormat> {
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataPropertyRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataPropertyRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataPropertyRequest.java
index 7492e11..f61783b 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataPropertyRequest.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataPropertyRequest.java
@@ -18,11 +18,11 @@
*/
package org.apache.olingo.client.api.communication.request.retrieve;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.format.ODataFormat;
/**
* This class implements an OData entity property query request.
*/
-public interface ODataPropertyRequest extends ODataRetrieveRequest<ODataProperty, ODataFormat> {
+public interface ODataPropertyRequest<T extends CommonODataProperty> extends ODataRetrieveRequest<T, ODataFormat> {
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/RetrieveRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/RetrieveRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/RetrieveRequestFactory.java
index a0d667a..25276fe 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/RetrieveRequestFactory.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/RetrieveRequestFactory.java
@@ -20,9 +20,27 @@ package org.apache.olingo.client.api.communication.request.retrieve.v3;
import java.net.URI;
import org.apache.olingo.client.api.communication.request.retrieve.CommonRetrieveRequestFactory;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
+import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.v3.ODataProperty;
public interface RetrieveRequestFactory extends CommonRetrieveRequestFactory {
+ @SuppressWarnings("unchecked")
+ @Override
+ ODataEntitySetRequest<ODataEntitySet> getEntitySetRequest(URI uri);
+
+ @SuppressWarnings("unchecked")
+ @Override
+ ODataEntityRequest<ODataEntity> getEntityRequest(URI uri);
+
+ @SuppressWarnings("unchecked")
+ @Override
+ ODataPropertyRequest<ODataProperty> getPropertyRequest(URI uri);
+
/**
* Gets a query request returning a single OData link.
*
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v4/RetrieveRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v4/RetrieveRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v4/RetrieveRequestFactory.java
index 55005cd..8d8184b 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v4/RetrieveRequestFactory.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v4/RetrieveRequestFactory.java
@@ -18,7 +18,24 @@
*/
package org.apache.olingo.client.api.communication.request.retrieve.v4;
+import java.net.URI;
import org.apache.olingo.client.api.communication.request.retrieve.CommonRetrieveRequestFactory;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
+import org.apache.olingo.commons.api.domain.v4.ODataEntity;
+import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.v4.ODataProperty;
+@SuppressWarnings("unchecked")
public interface RetrieveRequestFactory extends CommonRetrieveRequestFactory {
+
+ @Override
+ ODataEntitySetRequest<ODataEntitySet> getEntitySetRequest(URI uri);
+
+ @Override
+ ODataEntityRequest<ODataEntity> getEntityRequest(URI uri);
+
+ @Override
+ ODataPropertyRequest<ODataProperty> getPropertyRequest(URI uri);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityCreateResponse.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityCreateResponse.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityCreateResponse.java
index 5fd7fb8..0407422 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityCreateResponse.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityCreateResponse.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.client.api.communication.response;
-import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
/**
* This class implements the response to an OData entity create request.
@@ -32,5 +32,5 @@ public interface ODataEntityCreateResponse extends ODataResponse {
*
* @return created object.
*/
- ODataEntity getBody();
+ CommonODataEntity getBody();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityUpdateResponse.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityUpdateResponse.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityUpdateResponse.java
index 6b84630..59b0112 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityUpdateResponse.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityUpdateResponse.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.client.api.communication.response;
-import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
/**
* This class implements the response to an OData update request.
@@ -32,5 +32,5 @@ public interface ODataEntityUpdateResponse extends ODataResponse {
*
* @return updated object.
*/
- ODataEntity getBody();
+ CommonODataEntity getBody();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataMediaEntityCreateResponse.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataMediaEntityCreateResponse.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataMediaEntityCreateResponse.java
index ea3b8b7..c29193b 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataMediaEntityCreateResponse.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataMediaEntityCreateResponse.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.client.api.communication.response;
-import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
/**
* This class implements the response to an Odata media entity create request.
@@ -32,5 +32,5 @@ public interface ODataMediaEntityCreateResponse extends ODataResponse {
*
* @return created object.
*/
- ODataEntity getBody();
+ CommonODataEntity getBody();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataMediaEntityUpdateResponse.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataMediaEntityUpdateResponse.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataMediaEntityUpdateResponse.java
index f55dac8..97aab03 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataMediaEntityUpdateResponse.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataMediaEntityUpdateResponse.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.client.api.communication.response;
-import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
/**
* This class implements the response to an Odata media entity update request.
@@ -32,5 +32,5 @@ public interface ODataMediaEntityUpdateResponse extends ODataResponse {
*
* @return updated object.
*/
- ODataEntity getBody();
+ CommonODataEntity getBody();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataPropertyUpdateResponse.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataPropertyUpdateResponse.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataPropertyUpdateResponse.java
index 23bfc1e..61f5dbd 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataPropertyUpdateResponse.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataPropertyUpdateResponse.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.client.api.communication.response;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
/**
* This class implements the response to an OData update entity property request.
@@ -32,5 +32,5 @@ public interface ODataPropertyUpdateResponse extends ODataResponse {
*
* @return updated object.
*/
- ODataProperty getBody();
+ CommonODataProperty getBody();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java
index e5eeeed..66e3476 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java
@@ -32,8 +32,8 @@ import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.data.Entry;
import org.apache.olingo.commons.api.format.ODataPubFormat;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -42,7 +42,7 @@ import org.slf4j.LoggerFactory;
* <br/>
* <b>Please don't forget to call the <tt>close()>/<tt> method when not needed any more.</b>
*/
-public class ODataEntitySetIterator implements Iterator<ODataEntity> {
+public class ODataEntitySetIterator implements Iterator<CommonODataEntity> {
/**
* Logger.
@@ -59,7 +59,7 @@ public class ODataEntitySetIterator implements Iterator<ODataEntity> {
private Entry cached;
- private ODataEntitySet entitySet;
+ private CommonODataEntitySet entitySet;
private final ByteArrayOutputStream osFeed;
@@ -127,9 +127,9 @@ public class ODataEntitySetIterator implements Iterator<ODataEntity> {
* {@inheritDoc }
*/
@Override
- public ODataEntity next() {
+ public CommonODataEntity next() {
if (hasNext()) {
- final ODataEntity res = odataClient.getBinder().getODataEntity(cached);
+ final CommonODataEntity res = odataClient.getBinder().getODataEntity(cached);
cached = null;
return res;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataBinder.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataBinder.java
index 38fe16f..14fa946 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataBinder.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataBinder.java
@@ -25,10 +25,10 @@ import org.apache.olingo.commons.api.data.Feed;
import org.apache.olingo.commons.api.data.Link;
import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.client.api.data.ServiceDocument;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.domain.ODataLink;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataServiceDocument;
public interface CommonODataBinder extends Serializable {
@@ -40,7 +40,7 @@ public interface CommonODataBinder extends Serializable {
* @param reference reference class.
* @return <tt>Feed</tt> object.
*/
- Feed getFeed(ODataEntitySet feed, Class<? extends Feed> reference);
+ Feed getFeed(CommonODataEntitySet feed, Class<? extends Feed> reference);
/**
* Gets an <tt>Entry</tt> from the given OData entity.
@@ -49,7 +49,7 @@ public interface CommonODataBinder extends Serializable {
* @param reference reference class.
* @return <tt>Entry</tt> object.
*/
- Entry getEntry(ODataEntity entity, Class<? extends Entry> reference);
+ Entry getEntry(CommonODataEntity entity, Class<? extends Entry> reference);
/**
* Gets an <tt>Entry</tt> from the given OData entity.
@@ -59,7 +59,7 @@ public interface CommonODataBinder extends Serializable {
* @param setType whether to explicitly output type information.
* @return <tt>Entry</tt> object.
*/
- Entry getEntry(ODataEntity entity, Class<? extends Entry> reference, boolean setType);
+ Entry getEntry(CommonODataEntity entity, Class<? extends Entry> reference, boolean setType);
/**
* Gets a <tt>Link</tt> from the given OData link.
@@ -78,7 +78,16 @@ public interface CommonODataBinder extends Serializable {
* @param setType whether to explicitly output type information.
* @return <tt>Property</tt> object.
*/
- Property getProperty(ODataProperty property, Class<? extends Entry> reference, boolean setType);
+ Property getProperty(CommonODataProperty property, Class<? extends Entry> reference, boolean setType);
+
+ /**
+ * Adds the given property to the given entity.
+ *
+ * @param entity OData entity.
+ * @param property OData property.
+ * @return whether add was successful or not.
+ */
+ boolean add(CommonODataEntity entity, CommonODataProperty property);
/**
* Gets <tt>ODataServiceDocument</tt> from the given service document resource.
@@ -94,7 +103,7 @@ public interface CommonODataBinder extends Serializable {
* @param resource feed resource.
* @return <tt>ODataEntitySet</tt> object.
*/
- ODataEntitySet getODataEntitySet(Feed resource);
+ CommonODataEntitySet getODataEntitySet(Feed resource);
/**
* Gets <tt>ODataEntitySet</tt> from the given feed resource.
@@ -103,7 +112,7 @@ public interface CommonODataBinder extends Serializable {
* @param defaultBaseURI default base URI.
* @return <tt>ODataEntitySet</tt> object.
*/
- ODataEntitySet getODataEntitySet(Feed resource, URI defaultBaseURI);
+ CommonODataEntitySet getODataEntitySet(Feed resource, URI defaultBaseURI);
/**
* Gets <tt>ODataEntity</tt> from the given entry resource.
@@ -111,7 +120,7 @@ public interface CommonODataBinder extends Serializable {
* @param resource entry resource.
* @return <tt>ODataEntity</tt> object.
*/
- ODataEntity getODataEntity(Entry resource);
+ CommonODataEntity getODataEntity(Entry resource);
/**
* Gets <tt>ODataEntity</tt> from the given entry resource.
@@ -120,7 +129,7 @@ public interface CommonODataBinder extends Serializable {
* @param defaultBaseURI default base URI.
* @return <tt>ODataEntity</tt> object.
*/
- ODataEntity getODataEntity(Entry resource, URI defaultBaseURI);
+ CommonODataEntity getODataEntity(Entry resource, URI defaultBaseURI);
/**
* Gets an <tt>ODataProperty</tt> from the given property resource.
@@ -128,5 +137,5 @@ public interface CommonODataBinder extends Serializable {
* @param property property resource.
* @return <tt>ODataProperty</tt> object.
*/
- ODataProperty getODataProperty(Property property);
+ CommonODataProperty getODataProperty(Property property);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataReader.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataReader.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataReader.java
index f13e0ac..923ac23 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataReader.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataReader.java
@@ -24,9 +24,9 @@ import java.util.List;
import org.apache.olingo.client.api.edm.xml.Schema;
import org.apache.olingo.commons.api.data.Container;
import org.apache.olingo.commons.api.domain.ODataError;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataServiceDocument;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.format.ODataFormat;
@@ -74,7 +74,7 @@ public interface CommonODataReader extends Serializable {
* @param format de-serialize as AtomFeed or JSONFeed
* @return de-serialized entity set.
*/
- ODataEntitySet readEntitySet(InputStream input, ODataPubFormat format);
+ CommonODataEntitySet readEntitySet(InputStream input, ODataPubFormat format);
/**
* Parses a stream taking care to de-serializes the first OData entity found.
@@ -83,7 +83,7 @@ public interface CommonODataReader extends Serializable {
* @param format de-serialize as AtomEntry or JSONEntry
* @return entity de-serialized.
*/
- ODataEntity readEntity(InputStream input, ODataPubFormat format);
+ CommonODataEntity readEntity(InputStream input, ODataPubFormat format);
/**
* Parses a stream taking care to de-serialize the first OData entity property found.
@@ -92,7 +92,7 @@ public interface CommonODataReader extends Serializable {
* @param format de-serialize as XML or JSON
* @return OData entity property de-serialized.
*/
- ODataProperty readProperty(InputStream input, ODataFormat format);
+ CommonODataProperty readProperty(InputStream input, ODataFormat format);
/**
* Parses a stream into an OData error.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataWriter.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataWriter.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataWriter.java
index b83b2cd..a7ead37 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataWriter.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ODataWriter.java
@@ -21,9 +21,9 @@ package org.apache.olingo.client.api.op;
import java.io.InputStream;
import java.io.Serializable;
import java.util.Collection;
-import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.domain.ODataLink;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.format.ODataPubFormat;
@@ -43,7 +43,7 @@ public interface ODataWriter extends Serializable {
* @param format serialization format.
* @return stream of serialized objects.
*/
- InputStream writeEntities(Collection<ODataEntity> entities, ODataPubFormat format);
+ InputStream writeEntities(Collection<CommonODataEntity> entities, ODataPubFormat format);
/**
* Writes a collection of OData entities.
@@ -53,7 +53,7 @@ public interface ODataWriter extends Serializable {
* @param outputType whether to explicitly output type information.
* @return stream of serialized objects.
*/
- InputStream writeEntities(Collection<ODataEntity> entities, ODataPubFormat format, boolean outputType);
+ InputStream writeEntities(Collection<CommonODataEntity> entities, ODataPubFormat format, boolean outputType);
/**
* Serializes a single OData entity.
@@ -62,7 +62,7 @@ public interface ODataWriter extends Serializable {
* @param format serialization format.
* @return stream of serialized object.
*/
- InputStream writeEntity(ODataEntity entity, ODataPubFormat format);
+ InputStream writeEntity(CommonODataEntity entity, ODataPubFormat format);
/**
* Serializes a single OData entity.
@@ -72,7 +72,7 @@ public interface ODataWriter extends Serializable {
* @param outputType whether to explicitly output type information.
* @return stream of serialized object.
*/
- InputStream writeEntity(ODataEntity entity, ODataPubFormat format, boolean outputType);
+ InputStream writeEntity(CommonODataEntity entity, ODataPubFormat format, boolean outputType);
/**
* Writes a single OData entity property.
@@ -81,7 +81,7 @@ public interface ODataWriter extends Serializable {
* @param format serialization format.
* @return stream of serialized object.
*/
- InputStream writeProperty(ODataProperty property, ODataFormat format);
+ InputStream writeProperty(CommonODataProperty property, ODataFormat format);
/**
* Writes an OData link.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataBinder.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataBinder.java
index 6ea90ba..52cb625 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataBinder.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataBinder.java
@@ -18,12 +18,34 @@
*/
package org.apache.olingo.client.api.op.v3;
+import java.net.URI;
import org.apache.olingo.commons.api.data.v3.LinkCollection;
import org.apache.olingo.client.api.domain.v3.ODataLinkCollection;
import org.apache.olingo.client.api.op.CommonODataBinder;
+import org.apache.olingo.commons.api.data.Entry;
+import org.apache.olingo.commons.api.data.Feed;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
+import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.v3.ODataProperty;
public interface ODataBinder extends CommonODataBinder {
+ @Override
+ ODataEntitySet getODataEntitySet(Feed resource);
+
+ @Override
+ ODataEntitySet getODataEntitySet(Feed resource, URI defaultBaseURI);
+
+ @Override
+ ODataEntity getODataEntity(Entry resource);
+
+ @Override
+ ODataEntity getODataEntity(Entry resource, URI defaultBaseURI);
+
+ @Override
+ ODataProperty getODataProperty(Property property);
+
/**
* Gets <tt>ODataLinkCollection</tt> from the given link collection resource.
*
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v4/ODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v4/ODataBinder.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v4/ODataBinder.java
index 1397c47..f51c798 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v4/ODataBinder.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v4/ODataBinder.java
@@ -18,8 +18,29 @@
*/
package org.apache.olingo.client.api.op.v4;
+import java.net.URI;
import org.apache.olingo.client.api.op.CommonODataBinder;
+import org.apache.olingo.commons.api.data.Entry;
+import org.apache.olingo.commons.api.data.Feed;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.domain.v4.ODataEntity;
+import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.v4.ODataProperty;
public interface ODataBinder extends CommonODataBinder {
+ @Override
+ ODataEntitySet getODataEntitySet(Feed resource);
+
+ @Override
+ ODataEntitySet getODataEntitySet(Feed resource, URI defaultBaseURI);
+
+ @Override
+ ODataEntity getODataEntity(Entry resource);
+
+ @Override
+ ODataEntity getODataEntity(Entry resource, URI defaultBaseURI);
+
+ @Override
+ ODataProperty getODataProperty(Property property);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-api/src/main/java/org/apache/olingo/client/api/v3/ODataClient.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/v3/ODataClient.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/v3/ODataClient.java
index 5959796..81bf6dc 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/v3/ODataClient.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/v3/ODataClient.java
@@ -29,10 +29,14 @@ import org.apache.olingo.client.api.op.v3.ODataDeserializer;
import org.apache.olingo.client.api.op.v3.ODataReader;
import org.apache.olingo.client.api.uri.v3.URIBuilder;
import org.apache.olingo.client.api.uri.v3.FilterFactory;
+import org.apache.olingo.commons.api.domain.v3.ODataObjectFactory;
public interface ODataClient extends CommonODataClient {
@Override
+ Configuration getConfiguration();
+
+ @Override
ODataDeserializer getDeserializer();
@Override
@@ -42,15 +46,15 @@ public interface ODataClient extends CommonODataClient {
ODataBinder getBinder();
@Override
- Configuration getConfiguration();
-
- @Override
URIBuilder getURIBuilder(String serviceRoot);
@Override
FilterFactory getFilterFactory();
@Override
+ ODataObjectFactory getObjectFactory();
+
+ @Override
RetrieveRequestFactory getRetrieveRequestFactory();
@Override
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-api/src/main/java/org/apache/olingo/client/api/v4/ODataClient.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/v4/ODataClient.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/v4/ODataClient.java
index afe3c70..51abf99 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/v4/ODataClient.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/v4/ODataClient.java
@@ -29,10 +29,14 @@ import org.apache.olingo.client.api.op.v4.ODataDeserializer;
import org.apache.olingo.client.api.op.v4.ODataReader;
import org.apache.olingo.client.api.uri.v4.URIBuilder;
import org.apache.olingo.client.api.uri.v4.FilterFactory;
+import org.apache.olingo.commons.api.domain.v4.ODataObjectFactory;
public interface ODataClient extends CommonODataClient {
@Override
+ Configuration getConfiguration();
+
+ @Override
ODataDeserializer getDeserializer();
@Override
@@ -42,15 +46,15 @@ public interface ODataClient extends CommonODataClient {
ODataBinder getBinder();
@Override
- Configuration getConfiguration();
-
- @Override
URIBuilder getURIBuilder(String serviceRoot);
@Override
FilterFactory getFilterFactory();
@Override
+ ODataObjectFactory getObjectFactory();
+
+ @Override
RetrieveRequestFactory getRetrieveRequestFactory();
@Override
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
index 405f95d..57b24df 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
@@ -19,9 +19,7 @@
package org.apache.olingo.client.core;
import org.apache.olingo.client.api.CommonODataClient;
-import org.apache.olingo.commons.api.domain.ODataObjectFactory;
import org.apache.olingo.client.api.op.ODataWriter;
-import org.apache.olingo.commons.core.domain.ODataObjectFactoryImpl;
import org.apache.olingo.client.core.op.ODataWriterImpl;
public abstract class AbstractODataClient implements CommonODataClient {
@@ -30,16 +28,9 @@ public abstract class AbstractODataClient implements CommonODataClient {
private final ODataWriter writer = new ODataWriterImpl(this);
- private final ODataObjectFactory objectFactory = new ODataObjectFactoryImpl(getServiceVersion());
-
@Override
public ODataWriter getWriter() {
return writer;
}
- @Override
- public ODataObjectFactory getObjectFactory() {
- return objectFactory;
- }
-
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/AbstractCUDRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/AbstractCUDRequestFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/AbstractCUDRequestFactory.java
index e5bb42e..ae55269 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/AbstractCUDRequestFactory.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/AbstractCUDRequestFactory.java
@@ -29,10 +29,10 @@ import org.apache.olingo.client.api.communication.request.cud.ODataLinkUpdateReq
import org.apache.olingo.client.api.communication.request.cud.ODataPropertyUpdateRequest;
import org.apache.olingo.client.api.communication.request.cud.ODataValueUpdateRequest;
import org.apache.olingo.client.api.communication.request.cud.UpdateType;
-import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.domain.ODataLink;
import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.client.api.http.HttpMethod;
public abstract class AbstractCUDRequestFactory implements CommonCUDRequestFactory {
@@ -46,13 +46,13 @@ public abstract class AbstractCUDRequestFactory implements CommonCUDRequestFacto
}
@Override
- public ODataEntityCreateRequest getEntityCreateRequest(final URI targetURI, final ODataEntity entity) {
+ public ODataEntityCreateRequest getEntityCreateRequest(final URI targetURI, final CommonODataEntity entity) {
return new ODataEntityCreateRequestImpl(client, targetURI, entity);
}
@Override
public ODataEntityUpdateRequest getEntityUpdateRequest(
- final URI targetURI, final UpdateType type, final ODataEntity changes) {
+ final URI targetURI, final UpdateType type, final CommonODataEntity changes) {
final ODataEntityUpdateRequest req;
@@ -67,7 +67,7 @@ public abstract class AbstractCUDRequestFactory implements CommonCUDRequestFacto
}
@Override
- public ODataEntityUpdateRequest getEntityUpdateRequest(final UpdateType type, final ODataEntity entity) {
+ public ODataEntityUpdateRequest getEntityUpdateRequest(final UpdateType type, final CommonODataEntity entity) {
if (entity.getEditLink() == null) {
throw new IllegalArgumentException("No edit link found");
}
@@ -102,7 +102,7 @@ public abstract class AbstractCUDRequestFactory implements CommonCUDRequestFacto
@Override
public ODataPropertyUpdateRequest getPropertyPrimitiveValueUpdateRequest(
- final URI targetURI, final ODataProperty property) {
+ final URI targetURI, final CommonODataProperty property) {
if (!property.hasPrimitiveValue()) {
throw new IllegalArgumentException("A primitive value is required");
@@ -122,7 +122,7 @@ public abstract class AbstractCUDRequestFactory implements CommonCUDRequestFacto
@Override
public ODataPropertyUpdateRequest getPropertyComplexValueUpdateRequest(
- final URI targetURI, final UpdateType type, final ODataProperty property) {
+ final URI targetURI, final UpdateType type, final CommonODataProperty property) {
if (!property.hasComplexValue()) {
throw new IllegalArgumentException("A complex value is required");
@@ -142,7 +142,7 @@ public abstract class AbstractCUDRequestFactory implements CommonCUDRequestFacto
@Override
public ODataPropertyUpdateRequest getPropertyCollectionValueUpdateRequest(
- final URI targetURI, final ODataProperty property) {
+ final URI targetURI, final CommonODataProperty property) {
if (!property.hasCollectionValue()) {
throw new IllegalArgumentException("A collection value is required");
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java
index 8b9965f..f8bff7e 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java
@@ -28,7 +28,7 @@ import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest;
import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
-import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.core.uri.URIUtils;
@@ -46,7 +46,7 @@ public class ODataEntityCreateRequestImpl extends AbstractODataBasicRequest<ODat
/**
* Entity to be created.
*/
- private final ODataEntity entity;
+ private final CommonODataEntity entity;
/**
* Constructor.
@@ -55,7 +55,9 @@ public class ODataEntityCreateRequestImpl extends AbstractODataBasicRequest<ODat
* @param targetURI entity set URI.
* @param entity entity to be created.
*/
- ODataEntityCreateRequestImpl(final CommonODataClient odataClient, final URI targetURI, final ODataEntity entity) {
+ ODataEntityCreateRequestImpl(final CommonODataClient odataClient, final URI targetURI,
+ final CommonODataEntity entity) {
+
super(odataClient, ODataPubFormat.class, HttpMethod.POST, targetURI);
this.entity = entity;
}
@@ -88,7 +90,7 @@ public class ODataEntityCreateRequestImpl extends AbstractODataBasicRequest<ODat
*/
private class ODataEntityCreateResponseImpl extends AbstractODataResponse implements ODataEntityCreateResponse {
- private ODataEntity entity = null;
+ private CommonODataEntity entity = null;
/**
* Constructor.
@@ -112,12 +114,12 @@ public class ODataEntityCreateRequestImpl extends AbstractODataBasicRequest<ODat
* {@inheritDoc }
*/
@Override
- public ODataEntity getBody() {
+ public CommonODataEntity getBody() {
if (entity == null) {
try {
- final Container<Entry> container = odataClient.getDeserializer().toEntry(getRawResponse(),
+ final Container<Entry> container = odataClient.getDeserializer().toEntry(getRawResponse(),
ODataPubFormat.fromString(getAccept()));
-
+
entity = odataClient.getBinder().getODataEntity(extractFromContainer(container));
} finally {
this.close();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java
index 693582a..dde98a4 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java
@@ -28,7 +28,7 @@ import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest;
import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse;
-import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.core.uri.URIUtils;
@@ -46,7 +46,7 @@ public class ODataEntityUpdateRequestImpl extends AbstractODataBasicRequest<ODat
/**
* Changes to be applied.
*/
- private final ODataEntity changes;
+ private final CommonODataEntity changes;
/**
* Constructor.
@@ -57,7 +57,7 @@ public class ODataEntityUpdateRequestImpl extends AbstractODataBasicRequest<ODat
* @param changes changes to be applied.
*/
ODataEntityUpdateRequestImpl(final CommonODataClient odataClient,
- final HttpMethod method, final URI uri, final ODataEntity changes) {
+ final HttpMethod method, final URI uri, final CommonODataEntity changes) {
super(odataClient, ODataPubFormat.class, method, uri);
this.changes = changes;
@@ -94,7 +94,7 @@ public class ODataEntityUpdateRequestImpl extends AbstractODataBasicRequest<ODat
/**
* Changes.
*/
- private ODataEntity entity = null;
+ private CommonODataEntity entity = null;
/**
* Constructor.
@@ -118,7 +118,7 @@ public class ODataEntityUpdateRequestImpl extends AbstractODataBasicRequest<ODat
* {@inheritDoc ]
*/
@Override
- public ODataEntity getBody() {
+ public CommonODataEntity getBody() {
if (entity == null) {
try {
final Container<Entry> container = odataClient.getDeserializer().toEntry(getRawResponse(),
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java
index 5b0f9fb..7345d30 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java
@@ -28,7 +28,7 @@ import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
import org.apache.olingo.client.api.communication.request.cud.ODataPropertyUpdateRequest;
import org.apache.olingo.client.api.communication.response.ODataPropertyUpdateResponse;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.core.uri.URIUtils;
@@ -46,7 +46,7 @@ public class ODataPropertyUpdateRequestImpl extends AbstractODataBasicRequest<OD
/**
* Value to be created.
*/
- private final ODataProperty property;
+ private final CommonODataProperty property;
/**
* Constructor.
@@ -57,7 +57,7 @@ public class ODataPropertyUpdateRequestImpl extends AbstractODataBasicRequest<OD
* @param property value to be created.
*/
ODataPropertyUpdateRequestImpl(final CommonODataClient odataClient,
- final HttpMethod method, final URI targetURI, final ODataProperty property) {
+ final HttpMethod method, final URI targetURI, final CommonODataProperty property) {
super(odataClient, ODataFormat.class, method, targetURI);
// set request body
@@ -92,7 +92,7 @@ public class ODataPropertyUpdateRequestImpl extends AbstractODataBasicRequest<OD
*/
private class ODataPropertyUpdateResponseImpl extends AbstractODataResponse implements ODataPropertyUpdateResponse {
- private ODataProperty property = null;
+ private CommonODataProperty property = null;
/**
* Constructor.
@@ -116,7 +116,7 @@ public class ODataPropertyUpdateRequestImpl extends AbstractODataBasicRequest<OD
* {@inheritDoc }
*/
@Override
- public ODataProperty getBody() {
+ public CommonODataProperty getBody() {
if (property == null) {
try {
final Container<Property> container = odataClient.getDeserializer().toProperty(getRawResponse(),
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java
index 213a886..4e7be37 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java
@@ -25,6 +25,7 @@ import java.net.URISyntaxException;
import java.util.LinkedHashMap;
import java.util.Map;
import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
@@ -35,10 +36,10 @@ import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest;
import org.apache.olingo.client.api.communication.request.invoke.ODataNoContent;
import org.apache.olingo.client.api.communication.response.ODataInvokeResponse;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.domain.ODataInvokeResult;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.format.ODataPubFormat;
@@ -98,23 +99,20 @@ public class ODataInvokeRequestImpl<T extends ODataInvokeResult>
*/
@Override
public void setFormat(final ODataPubFormat format) {
- final String _format = (reference.isAssignableFrom(ODataProperty.class) && format == ODataPubFormat.ATOM)
+ final String _format = (reference.isAssignableFrom(CommonODataProperty.class) && format == ODataPubFormat.ATOM)
? ODataFormat.XML.toString(odataClient.getServiceVersion())
: format.toString(odataClient.getServiceVersion());
setAccept(_format);
setContentType(_format);
}
- /**
- * {@inheritDoc }
- */
@Override
protected InputStream getPayload() {
if (!this.parameters.isEmpty() && this.method == HttpMethod.POST) {
// Additional, non-binding parameters MUST be sent as JSON
- final ODataEntity tmp = odataClient.getObjectFactory().newEntity("");
+ final CommonODataEntity tmp = odataClient.getObjectFactory().newEntity(StringUtils.EMPTY);
for (Map.Entry<String, ODataValue> param : parameters.entrySet()) {
- ODataProperty property = null;
+ CommonODataProperty property = null;
if (param.getValue().isPrimitive()) {
property = odataClient.getObjectFactory().
@@ -128,7 +126,7 @@ public class ODataInvokeRequestImpl<T extends ODataInvokeResult>
}
if (property != null) {
- tmp.getProperties().add(property);
+ odataClient.getBinder().add(tmp, property);
}
}
@@ -211,15 +209,15 @@ public class ODataInvokeRequestImpl<T extends ODataInvokeResult>
}
try {
- if (reference.isAssignableFrom(ODataEntitySet.class)) {
+ if (reference.isAssignableFrom(CommonODataEntitySet.class)) {
invokeResult = (T) odataClient.getReader().readEntitySet(res.getEntity().getContent(),
ODataPubFormat.fromString(getContentType()));
}
- if (reference.isAssignableFrom(ODataEntity.class)) {
+ if (reference.isAssignableFrom(CommonODataEntity.class)) {
invokeResult = (T) odataClient.getReader().readEntity(res.getEntity().getContent(),
ODataPubFormat.fromString(getContentType()));
}
- if (reference.isAssignableFrom(ODataProperty.class)) {
+ if (reference.isAssignableFrom(CommonODataProperty.class)) {
invokeResult = (T) odataClient.getReader().readProperty(res.getEntity().getContent(),
ODataFormat.fromString(getContentType()));
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v3/InvokeRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v3/InvokeRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v3/InvokeRequestFactoryImpl.java
index 2487dd9..87e8c76 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v3/InvokeRequestFactoryImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/v3/InvokeRequestFactoryImpl.java
@@ -25,10 +25,10 @@ import org.apache.olingo.client.api.v3.ODataClient;
import org.apache.olingo.client.api.communication.request.invoke.ODataInvokeRequest;
import org.apache.olingo.client.api.communication.request.invoke.ODataNoContent;
import org.apache.olingo.client.api.communication.request.invoke.v3.InvokeRequestFactory;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.domain.ODataInvokeResult;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.core.communication.request.invoke.AbstractInvokeRequestFactory;
@@ -96,14 +96,14 @@ public class InvokeRequestFactoryImpl extends AbstractInvokeRequestFactory imple
client, ODataNoContent.class, method, uri);
} else {
if (returnType.isCollection() && returnType.getType().getKind() == EdmTypeKind.ENTITY) {
- result = (ODataInvokeRequest<RES>) new ODataInvokeRequestImpl<ODataEntitySet>(
- client, ODataEntitySet.class, method, uri);
+ result = (ODataInvokeRequest<RES>) new ODataInvokeRequestImpl<CommonODataEntitySet>(
+ client, CommonODataEntitySet.class, method, uri);
} else if (!returnType.isCollection() && returnType.getType().getKind() == EdmTypeKind.ENTITY) {
- result = (ODataInvokeRequest<RES>) new ODataInvokeRequestImpl<ODataEntity>(
- client, ODataEntity.class, method, uri);
+ result = (ODataInvokeRequest<RES>) new ODataInvokeRequestImpl<CommonODataEntity>(
+ client, CommonODataEntity.class, method, uri);
} else {
- result = (ODataInvokeRequest<RES>) new ODataInvokeRequestImpl<ODataProperty>(
- client, ODataProperty.class, method, uri);
+ result = (ODataInvokeRequest<RES>) new ODataInvokeRequestImpl<CommonODataProperty>(
+ client, CommonODataProperty.class, method, uri);
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractRetrieveRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractRetrieveRequestFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractRetrieveRequestFactory.java
index 3eeabed..d8ec0f2 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractRetrieveRequestFactory.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractRetrieveRequestFactory.java
@@ -21,12 +21,9 @@ package org.apache.olingo.client.core.communication.request.retrieve;
import java.net.URI;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.CommonODataClient;
-import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest;
-import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataMediaRequest;
import org.apache.olingo.client.api.communication.request.retrieve.EdmMetadataRequest;
-import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataRawRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataServiceDocumentRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataValueRequest;
@@ -43,26 +40,11 @@ public abstract class AbstractRetrieveRequestFactory implements CommonRetrieveRe
}
@Override
- public ODataEntitySetRequest getEntitySetRequest(final URI query) {
- return new ODataEntitySetRequestImpl(client, query);
- }
-
- @Override
public ODataEntitySetIteratorRequest getEntitySetIteratorRequest(final URI query) {
return new ODataEntitySetIteratorRequestImpl(client, query);
}
@Override
- public ODataEntityRequest getEntityRequest(final URI query) {
- return new ODataEntityRequestImpl(client, query);
- }
-
- @Override
- public ODataPropertyRequest getPropertyRequest(final URI query) {
- return new ODataPropertyRequestImpl(client, query);
- }
-
- @Override
public ODataValueRequest getValueRequest(final URI query) {
return new ODataValueRequestImpl(client, query);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntityRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntityRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntityRequestImpl.java
index 2c8955e..141b82e 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntityRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntityRequestImpl.java
@@ -26,14 +26,14 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRe
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.commons.api.data.Container;
import org.apache.olingo.commons.api.data.Entry;
-import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.format.ODataPubFormat;
/**
* This class implements an OData retrieve query request returning a single entity.
*/
-public class ODataEntityRequestImpl extends AbstractODataRetrieveRequest<ODataEntity, ODataPubFormat>
- implements ODataEntityRequest {
+public class ODataEntityRequestImpl<T extends CommonODataEntity>
+ extends AbstractODataRetrieveRequest<T, ODataPubFormat> implements ODataEntityRequest<T> {
/**
* Private constructor.
@@ -41,7 +41,7 @@ public class ODataEntityRequestImpl extends AbstractODataRetrieveRequest<ODataEn
* @param odataClient client instance getting this request
* @param query query to be executed.
*/
- ODataEntityRequestImpl(final CommonODataClient odataClient, final URI query) {
+ public ODataEntityRequestImpl(final CommonODataClient odataClient, final URI query) {
super(odataClient, ODataPubFormat.class, query);
}
@@ -49,7 +49,7 @@ public class ODataEntityRequestImpl extends AbstractODataRetrieveRequest<ODataEn
* {@inheritDoc }
*/
@Override
- public ODataRetrieveResponse<ODataEntity> execute() {
+ public ODataRetrieveResponse<T> execute() {
return new ODataEntityResponseImpl(httpClient, doExecute());
}
@@ -58,7 +58,7 @@ public class ODataEntityRequestImpl extends AbstractODataRetrieveRequest<ODataEn
*/
public class ODataEntityResponseImpl extends ODataRetrieveResponseImpl {
- private ODataEntity entity = null;
+ private T entity = null;
/**
* Constructor.
@@ -82,13 +82,14 @@ public class ODataEntityRequestImpl extends AbstractODataRetrieveRequest<ODataEn
* {@inheritDoc }
*/
@Override
- public ODataEntity getBody() {
+ @SuppressWarnings("unchecked")
+ public T getBody() {
if (entity == null) {
try {
final Container<Entry> container =
odataClient.getDeserializer().toEntry(getRawResponse(), ODataPubFormat.fromString(getContentType()));
- entity = odataClient.getBinder().getODataEntity(extractFromContainer(container));
+ entity = (T) odataClient.getBinder().getODataEntity(extractFromContainer(container));
} finally {
this.close();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java
index e6d5783..86fa45c 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java
@@ -26,16 +26,16 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySe
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.commons.api.data.Container;
import org.apache.olingo.commons.api.data.Feed;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.format.ODataPubFormat;
/**
* This class implements an OData EntitySet query request.
*/
-public class ODataEntitySetRequestImpl extends AbstractODataRetrieveRequest<ODataEntitySet, ODataPubFormat>
- implements ODataEntitySetRequest {
+public class ODataEntitySetRequestImpl<T extends CommonODataEntitySet>
+ extends AbstractODataRetrieveRequest<T, ODataPubFormat> implements ODataEntitySetRequest<T> {
- private ODataEntitySet entitySet = null;
+ private T entitySet = null;
/**
* Private constructor.
@@ -43,7 +43,7 @@ public class ODataEntitySetRequestImpl extends AbstractODataRetrieveRequest<ODat
* @param odataClient client instance getting this request
* @param query query to be executed.
*/
- ODataEntitySetRequestImpl(final CommonODataClient odataClient, final URI query) {
+ public ODataEntitySetRequestImpl(final CommonODataClient odataClient, final URI query) {
super(odataClient, ODataPubFormat.class, query);
}
@@ -51,7 +51,7 @@ public class ODataEntitySetRequestImpl extends AbstractODataRetrieveRequest<ODat
* {@inheritDoc }
*/
@Override
- public ODataRetrieveResponse<ODataEntitySet> execute() {
+ public ODataRetrieveResponse<T> execute() {
final HttpResponse res = doExecute();
return new ODataEntitySetResponseImpl(httpClient, res);
}
@@ -84,13 +84,13 @@ public class ODataEntitySetRequestImpl extends AbstractODataRetrieveRequest<ODat
*/
@Override
@SuppressWarnings("unchecked")
- public ODataEntitySet getBody() {
+ public T getBody() {
if (entitySet == null) {
try {
final Container<Feed> container =
odataClient.getDeserializer().toFeed(getRawResponse(), ODataPubFormat.fromString(getContentType()));
- entitySet = odataClient.getBinder().getODataEntitySet(extractFromContainer(container));
+ entitySet = (T) odataClient.getBinder().getODataEntitySet(extractFromContainer(container));
} finally {
this.close();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java
index 4b9aa2b..7878805 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java
@@ -25,7 +25,7 @@ import org.apache.http.client.HttpClient;
import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.client.api.http.HttpClientException;
import org.apache.olingo.commons.api.data.Container;
@@ -34,8 +34,8 @@ import org.apache.olingo.commons.api.data.Property;
/**
* This class implements an OData entity property query request.
*/
-public class ODataPropertyRequestImpl extends AbstractODataRetrieveRequest<ODataProperty, ODataFormat>
- implements ODataPropertyRequest {
+public class ODataPropertyRequestImpl<T extends CommonODataProperty>
+ extends AbstractODataRetrieveRequest<T, ODataFormat> implements ODataPropertyRequest<T> {
/**
* Private constructor.
@@ -43,7 +43,7 @@ public class ODataPropertyRequestImpl extends AbstractODataRetrieveRequest<OData
* @param odataClient client instance getting this request
* @param query query to be executed.
*/
- ODataPropertyRequestImpl(final CommonODataClient odataClient, final URI query) {
+ public ODataPropertyRequestImpl(final CommonODataClient odataClient, final URI query) {
super(odataClient, ODataFormat.class, query);
}
@@ -51,14 +51,14 @@ public class ODataPropertyRequestImpl extends AbstractODataRetrieveRequest<OData
* {@inheritDoc }
*/
@Override
- public ODataRetrieveResponse<ODataProperty> execute() {
+ public ODataRetrieveResponse<T> execute() {
final HttpResponse res = doExecute();
return new ODataPropertyResponseImpl(httpClient, res);
}
protected class ODataPropertyResponseImpl extends ODataRetrieveResponseImpl {
- private ODataProperty property = null;
+ private T property = null;
/**
* Constructor.
@@ -82,14 +82,15 @@ public class ODataPropertyRequestImpl extends AbstractODataRetrieveRequest<OData
* {@inheritDoc }
*/
@Override
- public ODataProperty getBody() {
+ @SuppressWarnings("unchecked")
+ public T getBody() {
if (property == null) {
try {
final Container<Property> container =
odataClient.getDeserializer().toProperty(
- res.getEntity().getContent(), ODataFormat.fromString(getContentType()));
+ res.getEntity().getContent(), ODataFormat.fromString(getContentType()));
- property = odataClient.getBinder().getODataProperty(extractFromContainer(container));
+ property = (T) odataClient.getBinder().getODataProperty(extractFromContainer(container));
} catch (IOException e) {
throw new HttpClientException(e);
} finally {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/RetrieveRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/RetrieveRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/RetrieveRequestFactoryImpl.java
index f6ba5c1..b32dd30 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/RetrieveRequestFactoryImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/RetrieveRequestFactoryImpl.java
@@ -19,11 +19,20 @@
package org.apache.olingo.client.core.communication.request.retrieve.v3;
import java.net.URI;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
import org.apache.olingo.client.api.communication.request.retrieve.XMLMetadataRequest;
import org.apache.olingo.client.api.v3.ODataClient;
import org.apache.olingo.client.api.communication.request.retrieve.v3.ODataLinkCollectionRequest;
import org.apache.olingo.client.api.communication.request.retrieve.v3.RetrieveRequestFactory;
import org.apache.olingo.client.core.communication.request.retrieve.AbstractRetrieveRequestFactory;
+import org.apache.olingo.client.core.communication.request.retrieve.ODataEntityRequestImpl;
+import org.apache.olingo.client.core.communication.request.retrieve.ODataEntitySetRequestImpl;
+import org.apache.olingo.client.core.communication.request.retrieve.ODataPropertyRequestImpl;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
+import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.v3.ODataProperty;
public class RetrieveRequestFactoryImpl extends AbstractRetrieveRequestFactory
implements RetrieveRequestFactory {
@@ -44,4 +53,22 @@ public class RetrieveRequestFactoryImpl extends AbstractRetrieveRequestFactory
public ODataLinkCollectionRequest getLinkCollectionRequest(final URI targetURI, final String linkName) {
return new ODataLinkCollectionRequestImpl((ODataClient) client, targetURI, linkName);
}
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public ODataEntitySetRequest<ODataEntitySet> getEntitySetRequest(final URI query) {
+ return new ODataEntitySetRequestImpl<ODataEntitySet>(client, query);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public ODataEntityRequest<ODataEntity> getEntityRequest(final URI query) {
+ return new ODataEntityRequestImpl<ODataEntity>(client, query);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public ODataPropertyRequest<ODataProperty> getPropertyRequest(final URI query) {
+ return new ODataPropertyRequestImpl<ODataProperty>(client, query);
+ }
}
[49/51] [abbrv] git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/olingo-odata4
Posted by il...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/olingo-odata4
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/525767c0
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/525767c0
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/525767c0
Branch: refs/heads/master
Commit: 525767c0c9803a9d23b9df025c9e03b95ebf2a99
Parents: 1fa6676 d4c2484
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Tue Apr 1 14:16:58 2014 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Tue Apr 1 14:16:58 2014 +0200
----------------------------------------------------------------------
.gitignore | 2 ++
pom.xml | 2 ++
2 files changed, 4 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/525767c0/pom.xml
----------------------------------------------------------------------
[10/51] [abbrv] [OLINGO-212] Reference/Include handling implemented
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/26142187/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java
index 573e2bc..c2c832d 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmClientImpl.java
@@ -39,7 +39,6 @@ import org.apache.olingo.client.api.edm.xml.EntityContainer;
import org.apache.olingo.client.api.edm.xml.EntityType;
import org.apache.olingo.client.api.edm.xml.EnumType;
import org.apache.olingo.client.api.edm.xml.Schema;
-import org.apache.olingo.client.api.edm.xml.XMLMetadata;
import org.apache.olingo.client.api.edm.xml.v3.FunctionImport;
import org.apache.olingo.client.api.edm.xml.v4.Action;
import org.apache.olingo.client.api.edm.xml.v4.Function;
@@ -64,18 +63,23 @@ public class EdmClientImpl extends AbstractEdmImpl {
private final ODataServiceVersion version;
- private final XMLMetadata xmlMetadata;
+ private final List<? extends Schema> xmlSchemas;
+
+ private final Map<String, Schema> xmlSchemaByNamespace;
private final EdmServiceMetadata serviceMetadata;
- public EdmClientImpl(final ODataServiceVersion version, final XMLMetadata xmlMetadata) {
+ public EdmClientImpl(final ODataServiceVersion version, final List<? extends Schema> xmlSchemas) {
this.version = version;
- this.xmlMetadata = xmlMetadata;
- this.serviceMetadata = AbstractEdmServiceMetadataImpl.getInstance(xmlMetadata);
- }
- public XMLMetadata getXMLMetadata() {
- return xmlMetadata;
+ this.xmlSchemas = xmlSchemas;
+
+ this.xmlSchemaByNamespace = new HashMap<String, Schema>();
+ for (Schema schema : xmlSchemas) {
+ xmlSchemaByNamespace.put(schema.getNamespace(), schema);
+ }
+
+ this.serviceMetadata = AbstractEdmServiceMetadataImpl.getInstance(version, xmlSchemas);
}
@Override
@@ -87,7 +91,7 @@ public class EdmClientImpl extends AbstractEdmImpl {
protected Map<String, String> createAliasToNamespaceInfo() {
final Map<String, String> aliasToNamespace = new HashMap<String, String>();
- for (Schema schema : xmlMetadata.getSchemas()) {
+ for (Schema schema : xmlSchemas) {
aliasToNamespace.put(null, schema.getNamespace());
if (StringUtils.isNotBlank(schema.getAlias())) {
aliasToNamespace.put(schema.getAlias(), schema.getNamespace());
@@ -101,11 +105,11 @@ public class EdmClientImpl extends AbstractEdmImpl {
protected EdmEntityContainer createEntityContainer(final FullQualifiedName containerName) {
EdmEntityContainer result = null;
- final Schema schema = xmlMetadata.getSchema(containerName.getNamespace());
+ final Schema schema = xmlSchemaByNamespace.get(containerName.getNamespace());
if (schema != null) {
final EntityContainer xmlEntityContainer = schema.getDefaultEntityContainer();
if (xmlEntityContainer != null) {
- result = new EdmEntityContainerImpl(this, containerName, xmlEntityContainer, xmlMetadata);
+ result = new EdmEntityContainerImpl(this, containerName, xmlEntityContainer, xmlSchemas);
}
}
@@ -116,7 +120,7 @@ public class EdmClientImpl extends AbstractEdmImpl {
protected EdmEnumType createEnumType(final FullQualifiedName enumName) {
EdmEnumType result = null;
- final Schema schema = xmlMetadata.getSchema(enumName.getNamespace());
+ final Schema schema = xmlSchemaByNamespace.get(enumName.getNamespace());
if (schema != null) {
final EnumType xmlEnumType = schema.getEnumType(enumName.getName());
if (xmlEnumType != null) {
@@ -131,7 +135,7 @@ public class EdmClientImpl extends AbstractEdmImpl {
protected EdmTypeDefinition createTypeDefinition(final FullQualifiedName typeDefinitionName) {
EdmTypeDefinition result = null;
- final Schema schema = xmlMetadata.getSchema(typeDefinitionName.getNamespace());
+ final Schema schema = xmlSchemaByNamespace.get(typeDefinitionName.getNamespace());
if (schema instanceof org.apache.olingo.client.api.edm.xml.v4.Schema) {
final TypeDefinition xmlTypeDefinition = ((org.apache.olingo.client.api.edm.xml.v4.Schema) schema).
getTypeDefinition(typeDefinitionName.getName());
@@ -149,7 +153,7 @@ public class EdmClientImpl extends AbstractEdmImpl {
protected EdmEntityType createEntityType(final FullQualifiedName entityTypeName) {
EdmEntityType result = null;
- final Schema schema = xmlMetadata.getSchema(entityTypeName.getNamespace());
+ final Schema schema = xmlSchemaByNamespace.get(entityTypeName.getNamespace());
final EntityType xmlEntityType = schema.getEntityType(entityTypeName.getName());
if (xmlEntityType != null) {
result = EdmEntityTypeImpl.getInstance(this, entityTypeName, xmlEntityType);
@@ -162,7 +166,7 @@ public class EdmClientImpl extends AbstractEdmImpl {
protected EdmComplexType createComplexType(final FullQualifiedName complexTypeName) {
EdmComplexType result = null;
- final Schema schema = xmlMetadata.getSchema(complexTypeName.getNamespace());
+ final Schema schema = xmlSchemaByNamespace.get(complexTypeName.getNamespace());
final ComplexType xmlComplexType = schema.getComplexType(complexTypeName.getName());
if (xmlComplexType != null) {
result = EdmComplexTypeImpl.getInstance(this, complexTypeName, xmlComplexType);
@@ -175,7 +179,7 @@ public class EdmClientImpl extends AbstractEdmImpl {
protected EdmAction createUnboundAction(final FullQualifiedName actionName) {
EdmAction result = null;
- final Schema schema = xmlMetadata.getSchema(actionName.getNamespace());
+ final Schema schema = xmlSchemaByNamespace.get(actionName.getNamespace());
if (schema instanceof org.apache.olingo.client.api.edm.xml.v4.Schema) {
final List<Action> actions = ((org.apache.olingo.client.api.edm.xml.v4.Schema) schema).
getActions(actionName.getName());
@@ -210,7 +214,7 @@ public class EdmClientImpl extends AbstractEdmImpl {
protected EdmFunction createUnboundFunction(final FullQualifiedName functionName, final List<String> parameterNames) {
EdmFunction result = null;
- final Schema schema = xmlMetadata.getSchema(functionName.getNamespace());
+ final Schema schema = xmlSchemaByNamespace.get(functionName.getNamespace());
if (schema instanceof org.apache.olingo.client.api.edm.xml.v4.Schema) {
final List<Function> functions = ((org.apache.olingo.client.api.edm.xml.v4.Schema) schema).
getFunctions(functionName.getName());
@@ -259,7 +263,7 @@ public class EdmClientImpl extends AbstractEdmImpl {
EdmAction result = null;
- final Schema schema = xmlMetadata.getSchema(actionName.getNamespace());
+ final Schema schema = xmlSchemaByNamespace.get(actionName.getNamespace());
if (schema instanceof org.apache.olingo.client.api.edm.xml.v4.Schema) {
final List<Action> actions = ((org.apache.olingo.client.api.edm.xml.v4.Schema) schema).
getActions(actionName.getName());
@@ -309,7 +313,7 @@ public class EdmClientImpl extends AbstractEdmImpl {
EdmFunction result = null;
- final Schema schema = xmlMetadata.getSchema(functionName.getNamespace());
+ final Schema schema = xmlSchemaByNamespace.get(functionName.getNamespace());
if (schema instanceof org.apache.olingo.client.api.edm.xml.v4.Schema) {
final List<Function> functions = ((org.apache.olingo.client.api.edm.xml.v4.Schema) schema).
getFunctions(functionName.getName());
@@ -382,8 +386,8 @@ public class EdmClientImpl extends AbstractEdmImpl {
@Override
protected List<EdmSchema> createSchemas() {
final List<EdmSchema> schemas = new ArrayList<EdmSchema>();
- for (Schema schema : xmlMetadata.getSchemas()) {
- schemas.add(new EdmSchemaImpl(version, this, xmlMetadata, schema));
+ for (Schema schema : xmlSchemas) {
+ schemas.add(new EdmSchemaImpl(version, this, xmlSchemas, schema));
}
return schemas;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/26142187/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java
index 635b752..36f5b14 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEntityContainerImpl.java
@@ -25,7 +25,7 @@ import org.apache.olingo.client.api.v3.UnsupportedInV3Exception;
import org.apache.olingo.client.api.edm.xml.CommonFunctionImport;
import org.apache.olingo.client.api.edm.xml.EntityContainer;
import org.apache.olingo.client.api.edm.xml.EntitySet;
-import org.apache.olingo.client.api.edm.xml.XMLMetadata;
+import org.apache.olingo.client.api.edm.xml.Schema;
import org.apache.olingo.client.api.edm.xml.v3.FunctionImport;
import org.apache.olingo.client.api.edm.xml.v4.ActionImport;
import org.apache.olingo.client.api.edm.xml.v4.Singleton;
@@ -45,15 +45,15 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer {
private final EntityContainer xmlEntityContainer;
- private final XMLMetadata xmlMetadata;
+ private final List<? extends Schema> xmlSchemas;
public EdmEntityContainerImpl(final Edm edm, final FullQualifiedName entityContainerName,
- final EntityContainer xmlEntityContainer, final XMLMetadata xmlMetadata) {
+ final EntityContainer xmlEntityContainer, final List<? extends Schema> xmlSchemas) {
super(edm, entityContainerName);
this.xmlEntityContainer = xmlEntityContainer;
- this.xmlMetadata = xmlMetadata;
+ this.xmlSchemas = xmlSchemas;
}
@Override
@@ -63,13 +63,13 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer {
}
final Singleton singleton = ((org.apache.olingo.client.api.edm.xml.v4.EntityContainer) xmlEntityContainer).
- getSingleton(singletonName);
+ getSingleton(singletonName);
if (singleton == null) {
throw new EdmException("Singleton named '" + singletonName + "' not found in " + entityContainerName);
}
return new EdmSingletonImpl(edm, this, singletonName, new EdmTypeInfo.Builder().
- setTypeExpression(singleton.getEntityType()).setDefaultNamespace(entityContainerName.getNamespace()).
- build().getFullQualifiedName(), singleton);
+ setTypeExpression(singleton.getEntityType()).setDefaultNamespace(entityContainerName.getNamespace()).
+ build().getFullQualifiedName(), singleton);
}
@Override
@@ -80,12 +80,12 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer {
}
final FullQualifiedName entityType = new EdmTypeInfo.Builder().setTypeExpression(entitySet.getEntityType()).
- setDefaultNamespace(entityContainerName.getNamespace()).build().getFullQualifiedName();
+ setDefaultNamespace(entityContainerName.getNamespace()).build().getFullQualifiedName();
if (entitySet instanceof org.apache.olingo.client.api.edm.xml.v4.EntitySet) {
return new EdmEntitySetImpl(edm, this, entitySetName, entityType,
- (org.apache.olingo.client.api.edm.xml.v4.EntitySet) entitySet);
+ (org.apache.olingo.client.api.edm.xml.v4.EntitySet) entitySet);
} else {
- return new EdmEntitySetProxy(edm, this, entitySetName, entityType, xmlMetadata);
+ return new EdmEntitySetProxy(edm, this, entitySetName, entityType, xmlSchemas);
}
}
@@ -93,7 +93,7 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer {
protected EdmActionImport createActionImport(final String actionImportName) {
if (xmlEntityContainer instanceof org.apache.olingo.client.api.edm.xml.v4.EntityContainer) {
final ActionImport actionImport = ((org.apache.olingo.client.api.edm.xml.v4.EntityContainer) xmlEntityContainer).
- getActionImport(actionImportName);
+ getActionImport(actionImportName);
if (actionImport == null) {
throw new EdmException("ActionImport named '" + actionImportName + "' not found in " + entityContainerName);
}
@@ -116,10 +116,10 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer {
if (functionImport instanceof org.apache.olingo.client.api.edm.xml.v4.FunctionImport) {
return new EdmFunctionImportImpl(edm, this, functionImportName,
- (org.apache.olingo.client.api.edm.xml.v4.FunctionImport) functionImport);
+ (org.apache.olingo.client.api.edm.xml.v4.FunctionImport) functionImport);
} else {
return new EdmFunctionImportProxy(edm, this, functionImportName,
- (org.apache.olingo.client.api.edm.xml.v3.FunctionImport) functionImport);
+ (org.apache.olingo.client.api.edm.xml.v3.FunctionImport) functionImport);
}
}
@@ -130,13 +130,13 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer {
for (EntitySet entitySet : localEntitySets) {
EdmEntitySet edmSet;
final FullQualifiedName entityType = new EdmTypeInfo.Builder().setTypeExpression(entitySet.getEntityType()).
- setDefaultNamespace(entityContainerName.getNamespace()).build().getFullQualifiedName();
+ setDefaultNamespace(entityContainerName.getNamespace()).build().getFullQualifiedName();
if (entitySet instanceof org.apache.olingo.client.api.edm.xml.v4.EntitySet) {
edmSet =
- new EdmEntitySetImpl(edm, this, entitySet.getName(), entityType,
- (org.apache.olingo.client.api.edm.xml.v4.EntitySet) entitySet);
+ new EdmEntitySetImpl(edm, this, entitySet.getName(), entityType,
+ (org.apache.olingo.client.api.edm.xml.v4.EntitySet) entitySet);
} else {
- edmSet = new EdmEntitySetProxy(edm, this, entitySet.getName(), entityType, xmlMetadata);
+ edmSet = new EdmEntitySetProxy(edm, this, entitySet.getName(), entityType, xmlSchemas);
}
entitySets.put(edmSet.getName(), edmSet);
}
@@ -152,10 +152,10 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer {
EdmFunctionImport edmFunctionImport;
if (functionImport instanceof org.apache.olingo.client.api.edm.xml.v4.FunctionImport) {
edmFunctionImport = new EdmFunctionImportImpl(edm, this, functionImport.getName(),
- (org.apache.olingo.client.api.edm.xml.v4.FunctionImport) functionImport);
+ (org.apache.olingo.client.api.edm.xml.v4.FunctionImport) functionImport);
} else {
edmFunctionImport = new EdmFunctionImportProxy(edm, this, functionImport.getName(),
- (org.apache.olingo.client.api.edm.xml.v3.FunctionImport) functionImport);
+ (org.apache.olingo.client.api.edm.xml.v3.FunctionImport) functionImport);
}
functionImports.put(edmFunctionImport.getName(), edmFunctionImport);
}
@@ -169,11 +169,11 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer {
}
final List<Singleton> localSingletons =
- ((org.apache.olingo.client.api.edm.xml.v4.EntityContainer) xmlEntityContainer).getSingletons();
+ ((org.apache.olingo.client.api.edm.xml.v4.EntityContainer) xmlEntityContainer).getSingletons();
if (localSingletons != null) {
for (Singleton singleton : localSingletons) {
singletons.put(singleton.getName(), new EdmSingletonImpl(edm, this, singleton.getName(),
- new EdmTypeInfo.Builder().
+ new EdmTypeInfo.Builder().
setTypeExpression(singleton.getEntityType()).setDefaultNamespace(entityContainerName.getNamespace()).
build().getFullQualifiedName(), singleton));
}
@@ -184,11 +184,11 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer {
protected void loadAllActionImports() {
if (xmlEntityContainer instanceof org.apache.olingo.client.api.edm.xml.v4.EntityContainer) {
final List<ActionImport> localActionImports =
- ((org.apache.olingo.client.api.edm.xml.v4.EntityContainer) xmlEntityContainer).getActionImports();
+ ((org.apache.olingo.client.api.edm.xml.v4.EntityContainer) xmlEntityContainer).getActionImports();
if (actionImports != null) {
for (ActionImport actionImport : localActionImports) {
actionImports.put(actionImport.getName(),
- new EdmActionImportImpl(edm, this, actionImport.getName(), actionImport));
+ new EdmActionImportImpl(edm, this, actionImport.getName(), actionImport));
}
}
} else {
@@ -197,7 +197,7 @@ public class EdmEntityContainerImpl extends AbstractEdmEntityContainer {
if (localFunctionImports != null) {
for (FunctionImport functionImport : localFunctionImports) {
actionImports.put(functionImport.getName(),
- new EdmActionImportProxy(edm, this, functionImport.getName(), functionImport));
+ new EdmActionImportProxy(edm, this, functionImport.getName(), functionImport));
}
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/26142187/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmSchemaImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmSchemaImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmSchemaImpl.java
index ffe41cd..2989a86 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmSchemaImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmSchemaImpl.java
@@ -26,7 +26,6 @@ import org.apache.olingo.client.api.edm.xml.EntityContainer;
import org.apache.olingo.client.api.edm.xml.EntityType;
import org.apache.olingo.client.api.edm.xml.EnumType;
import org.apache.olingo.client.api.edm.xml.Schema;
-import org.apache.olingo.client.api.edm.xml.XMLMetadata;
import org.apache.olingo.client.api.edm.xml.v3.FunctionImport;
import org.apache.olingo.client.api.edm.xml.v4.Action;
import org.apache.olingo.client.api.edm.xml.v4.Function;
@@ -50,18 +49,18 @@ public class EdmSchemaImpl extends AbstractEdmSchemaImpl {
private final Edm edm;
- private final XMLMetadata xmlMetadata;
+ private final List<? extends Schema> xmlSchemas;
private final Schema schema;
public EdmSchemaImpl(final ODataServiceVersion version, final Edm edm,
- final XMLMetadata xmlMetadata, final Schema schema) {
+ final List<? extends Schema> xmlSchemas, final Schema schema) {
super(schema.getNamespace(), schema.getAlias());
this.version = version;
this.edm = edm;
- this.xmlMetadata = xmlMetadata;
+ this.xmlSchemas = xmlSchemas;
this.schema = schema;
}
@@ -71,7 +70,7 @@ public class EdmSchemaImpl extends AbstractEdmSchemaImpl {
if (defaultContainer != null) {
final FullQualifiedName entityContainerName =
new FullQualifiedName(schema.getNamespace(), defaultContainer.getName());
- return new EdmEntityContainerImpl(edm, entityContainerName, defaultContainer, xmlMetadata);
+ return new EdmEntityContainerImpl(edm, entityContainerName, defaultContainer, xmlSchemas);
}
return null;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/26142187/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/EdmEntitySetProxy.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/EdmEntitySetProxy.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/EdmEntitySetProxy.java
index 0cc0ff8..8139dae 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/EdmEntitySetProxy.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/EdmEntitySetProxy.java
@@ -23,7 +23,6 @@ import java.util.List;
import org.apache.olingo.client.api.edm.xml.EntityContainer;
import org.apache.olingo.client.api.edm.xml.Schema;
-import org.apache.olingo.client.api.edm.xml.XMLMetadata;
import org.apache.olingo.client.api.edm.xml.v3.Association;
import org.apache.olingo.client.api.edm.xml.v3.AssociationSet;
import org.apache.olingo.client.core.edm.xml.v3.EntityContainerImpl;
@@ -38,19 +37,19 @@ import org.apache.olingo.commons.core.edm.AbstractEdmBindingTarget;
public class EdmEntitySetProxy extends AbstractEdmBindingTarget implements EdmEntitySet {
- private final XMLMetadata xmlMetadata;
+ private final List<? extends Schema> xmlSchemas;
public EdmEntitySetProxy(final Edm edm, final EdmEntityContainer container, final String name,
- final FullQualifiedName type, final XMLMetadata xmlMetadata) {
+ final FullQualifiedName type, final List<? extends Schema> xmlSchemas) {
super(edm, container, name, type);
- this.xmlMetadata = xmlMetadata;
+ this.xmlSchemas = xmlSchemas;
}
@Override
public EdmBindingTarget getRelatedBindingTarget(final String path) {
final List<AssociationSet> candidateAssociationSets = new ArrayList<AssociationSet>();
- for (Schema schema : xmlMetadata.getSchemas()) {
+ for (Schema schema : xmlSchemas) {
for (EntityContainer _entityContainer : schema.getEntityContainers()) {
final EntityContainerImpl entityContainer = (EntityContainerImpl) _entityContainer;
for (AssociationSet associationSet : entityContainer.getAssociationSets()) {
@@ -69,7 +68,7 @@ public class EdmEntitySetProxy extends AbstractEdmBindingTarget implements EdmEn
Schema targetSchema = null;
String targetEntitySet = null;
for (AssociationSet associationSet : candidateAssociationSets) {
- for (Schema schema : xmlMetadata.getSchemas()) {
+ for (Schema schema : xmlSchemas) {
for (Association association : ((SchemaImpl) schema).getAssociations()) {
final FullQualifiedName associationName = new FullQualifiedName(schema.getNamespace(), association.getName());
if (associationName.getFullQualifiedNameAsString().equals(associationSet.getAssociation())
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/26142187/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/EdmServiceMetadataImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/EdmServiceMetadataImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/EdmServiceMetadataImpl.java
index d1f5393..9b7157b 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/EdmServiceMetadataImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v3/EdmServiceMetadataImpl.java
@@ -27,7 +27,6 @@ import org.apache.olingo.client.api.edm.xml.EntityContainer;
import org.apache.olingo.client.api.edm.xml.Schema;
import org.apache.olingo.client.api.edm.xml.v3.FunctionImport;
import org.apache.olingo.client.core.edm.AbstractEdmServiceMetadataImpl;
-import org.apache.olingo.client.core.edm.xml.v3.XMLMetadataImpl;
import org.apache.olingo.commons.api.edm.EdmActionImportInfo;
import org.apache.olingo.commons.api.edm.EdmFunctionImportInfo;
import org.apache.olingo.commons.api.edm.EdmSingletonInfo;
@@ -39,8 +38,8 @@ public class EdmServiceMetadataImpl extends AbstractEdmServiceMetadataImpl {
private static final ODataServiceVersion SERVICE_VERSION = ODataServiceVersion.V30;
- public EdmServiceMetadataImpl(final XMLMetadataImpl xmlMetadata) {
- super(xmlMetadata);
+ public EdmServiceMetadataImpl(final List<? extends Schema> xmlSchemas) {
+ super(xmlSchemas);
}
@Override
@@ -58,7 +57,7 @@ public class EdmServiceMetadataImpl extends AbstractEdmServiceMetadataImpl {
synchronized (this) {
if (functionImportInfos == null) {
functionImportInfos = new ArrayList<EdmFunctionImportInfo>();
- for (Schema schema : xmlMetadata.getSchemas()) {
+ for (Schema schema : xmlSchemas) {
for (EntityContainer entityContainer : schema.getEntityContainers()) {
for (CommonFunctionImport functionImport : entityContainer.getFunctionImports()) {
final FunctionImport _funFunctionImport = (FunctionImport) functionImport;
@@ -79,7 +78,7 @@ public class EdmServiceMetadataImpl extends AbstractEdmServiceMetadataImpl {
synchronized (this) {
if (actionImportInfos == null) {
actionImportInfos = new ArrayList<EdmActionImportInfo>();
- for (Schema schema : xmlMetadata.getSchemas()) {
+ for (Schema schema : xmlSchemas) {
for (EntityContainer entityContainer : schema.getEntityContainers()) {
for (CommonFunctionImport functionImport : entityContainer.getFunctionImports()) {
final FunctionImport _funFunctionImport = (FunctionImport) functionImport;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/26142187/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v4/EdmServiceMetadataImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v4/EdmServiceMetadataImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v4/EdmServiceMetadataImpl.java
index 55cecc7..25236be 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v4/EdmServiceMetadataImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/v4/EdmServiceMetadataImpl.java
@@ -22,12 +22,11 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.olingo.client.api.edm.xml.CommonFunctionImport;
+import org.apache.olingo.client.api.edm.xml.Schema;
import org.apache.olingo.client.api.edm.xml.v4.ActionImport;
import org.apache.olingo.client.api.edm.xml.v4.EntityContainer;
-import org.apache.olingo.client.api.edm.xml.v4.Schema;
import org.apache.olingo.client.api.edm.xml.v4.Singleton;
import org.apache.olingo.client.core.edm.AbstractEdmServiceMetadataImpl;
-import org.apache.olingo.client.core.edm.xml.v4.XMLMetadataImpl;
import org.apache.olingo.commons.api.edm.EdmActionImportInfo;
import org.apache.olingo.commons.api.edm.EdmFunctionImportInfo;
import org.apache.olingo.commons.api.edm.EdmSingletonInfo;
@@ -44,8 +43,8 @@ public class EdmServiceMetadataImpl extends AbstractEdmServiceMetadataImpl {
private List<EdmActionImportInfo> actionImportInfos;
- public EdmServiceMetadataImpl(final XMLMetadataImpl xmlMetadata) {
- super(xmlMetadata);
+ public EdmServiceMetadataImpl(final List<? extends Schema> xmlSchemas) {
+ super(xmlSchemas);
}
@Override
@@ -58,7 +57,7 @@ public class EdmServiceMetadataImpl extends AbstractEdmServiceMetadataImpl {
synchronized (this) {
if (singletonInfos == null) {
singletonInfos = new ArrayList<EdmSingletonInfo>();
- for (Schema schema : ((XMLMetadataImpl) xmlMetadata).getSchemas()) {
+ for (Schema schema : xmlSchemas) {
final EntityContainer entityContainer = (EntityContainer) schema.getDefaultEntityContainer();
for (Singleton singleton : entityContainer.getSingletons()) {
singletonInfos.add(new EdmSingletonInfoImpl(entityContainer.getName(), singleton.getName()));
@@ -74,16 +73,17 @@ public class EdmServiceMetadataImpl extends AbstractEdmServiceMetadataImpl {
synchronized (this) {
if (functionImportInfos == null) {
functionImportInfos = new ArrayList<EdmFunctionImportInfo>();
- for (Schema schema : ((XMLMetadataImpl) xmlMetadata).getSchemas()) {
- for (EntityContainer entityContainer : schema.getEntityContainers()) {
- for (CommonFunctionImport functionImport : entityContainer.getFunctionImports()) {
- functionImportInfos.add(
- new EdmFunctionImportInfoImpl(entityContainer.getName(), functionImport.getName()));
- }
+ for (Schema schema : xmlSchemas) {
+ final EntityContainer entityContainer = (EntityContainer) schema.getDefaultEntityContainer();
+
+ for (CommonFunctionImport functionImport : entityContainer.getFunctionImports()) {
+ functionImportInfos.add(
+ new EdmFunctionImportInfoImpl(entityContainer.getName(), functionImport.getName()));
}
}
}
}
+
return functionImportInfos;
}
@@ -92,7 +92,7 @@ public class EdmServiceMetadataImpl extends AbstractEdmServiceMetadataImpl {
synchronized (this) {
if (actionImportInfos == null) {
actionImportInfos = new ArrayList<EdmActionImportInfo>();
- for (Schema schema : ((XMLMetadataImpl) xmlMetadata).getSchemas()) {
+ for (Schema schema : xmlSchemas) {
final EntityContainer entityContainer = (EntityContainer) schema.getDefaultEntityContainer();
for (ActionImport actionImport : entityContainer.getActionImports()) {
actionImportInfos.add(new EdmActionImportInfoImpl(entityContainer.getName(), actionImport.getName()));
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/26142187/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/XMLMetadataImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/XMLMetadataImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/XMLMetadataImpl.java
index 41fea80..336dc41 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/XMLMetadataImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/xml/v4/XMLMetadataImpl.java
@@ -50,6 +50,7 @@ public class XMLMetadataImpl extends AbstractXMLMetadata implements XMLMetadata
return (Schema) super.getSchema(key);
}
+ @Override
public List<Reference> getReferences() {
return ((Edmx) this.edmx).getReferences();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/26142187/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
index 55b0d57..bd3695d 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
@@ -19,6 +19,7 @@
package org.apache.olingo.client.core.op;
import java.io.InputStream;
+import java.util.List;
import org.apache.commons.io.IOUtils;
import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.commons.api.domain.ODataError;
@@ -26,6 +27,7 @@ import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.domain.ODataEntity;
import org.apache.olingo.commons.api.domain.ODataEntitySet;
import org.apache.olingo.client.api.domain.ODataEntitySetIterator;
+import org.apache.olingo.client.api.edm.xml.Schema;
import org.apache.olingo.commons.api.domain.ODataProperty;
import org.apache.olingo.commons.api.domain.ODataServiceDocument;
import org.apache.olingo.commons.api.domain.ODataValue;
@@ -34,6 +36,8 @@ import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.commons.api.format.ODataValueFormat;
import org.apache.olingo.client.api.op.CommonODataReader;
+import org.apache.olingo.client.core.edm.EdmClientImpl;
+import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -54,6 +58,21 @@ public abstract class AbstractODataReader implements CommonODataReader {
}
@Override
+ public Edm readMetadata(final InputStream input) {
+ return readMetadata(client.getDeserializer().toMetadata(input).getSchemas());
+ }
+
+ @Override
+ public Edm readMetadata(final List<? extends Schema> xmlSchemas) {
+ return new EdmClientImpl(client.getServiceVersion(), xmlSchemas);
+ }
+
+ @Override
+ public ODataServiceDocument readServiceDocument(final InputStream input, final ODataFormat format) {
+ return client.getBinder().getODataServiceDocument(client.getDeserializer().toServiceDocument(input, format));
+ }
+
+ @Override
public ODataEntitySet readEntitySet(final InputStream input, final ODataPubFormat format) {
return client.getBinder().getODataEntitySet(client.getDeserializer().toFeed(input, format));
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/26142187/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java
index d6b05d9..f88ae96 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java
@@ -21,6 +21,7 @@ package org.apache.olingo.client.core.op.impl.v3;
import java.io.InputStream;
import org.apache.olingo.client.api.data.ServiceDocument;
+import org.apache.olingo.client.api.edm.xml.XMLMetadata;
import org.apache.olingo.commons.api.data.v3.LinkCollection;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.client.api.op.v3.ODataDeserializer;
@@ -42,7 +43,7 @@ public class ODataDeserializerImpl extends AbstractODataDeserializer implements
}
@Override
- public XMLMetadataImpl toMetadata(final InputStream input) {
+ public XMLMetadata toMetadata(final InputStream input) {
try {
return new XMLMetadataImpl(getXmlMapper().readValue(input, EdmxImpl.class));
} catch (Exception e) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/26142187/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java
index 2c5a7d1..beb69b9 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java
@@ -20,15 +20,11 @@ package org.apache.olingo.client.core.op.impl.v3;
import java.io.InputStream;
-import org.apache.olingo.commons.api.domain.ODataServiceDocument;
import org.apache.olingo.client.api.domain.v3.ODataLinkCollection;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.client.api.op.v3.ODataReader;
import org.apache.olingo.client.api.v3.ODataClient;
-import org.apache.olingo.client.core.v3.ODataClientImpl;
-import org.apache.olingo.client.core.edm.EdmClientImpl;
import org.apache.olingo.client.core.op.AbstractODataReader;
-import org.apache.olingo.commons.api.edm.Edm;
public class ODataReaderImpl extends AbstractODataReader implements ODataReader {
@@ -39,17 +35,6 @@ public class ODataReaderImpl extends AbstractODataReader implements ODataReader
}
@Override
- public Edm readMetadata(final InputStream input) {
- return new EdmClientImpl(client.getServiceVersion(), client.getDeserializer().toMetadata(input));
- }
-
- @Override
- public ODataServiceDocument readServiceDocument(final InputStream input, final ODataFormat format) {
- return ((ODataClientImpl) client).getBinder().getODataServiceDocument(
- ((ODataClientImpl) client).getDeserializer().toServiceDocument(input, format));
- }
-
- @Override
public ODataLinkCollection readLinks(final InputStream input, final ODataFormat format) {
return ((ODataClient) client).getBinder().getLinkCollection(
((ODataClient) client).getDeserializer().toLinkCollection(input, format));
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/26142187/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java
index 1a93ce1..cb8958b 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java
@@ -18,15 +18,9 @@
*/
package org.apache.olingo.client.core.op.impl.v4;
-import java.io.InputStream;
-
-import org.apache.olingo.commons.api.domain.ODataServiceDocument;
-import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.client.api.op.v4.ODataReader;
import org.apache.olingo.client.api.v4.ODataClient;
-import org.apache.olingo.client.core.edm.EdmClientImpl;
import org.apache.olingo.client.core.op.AbstractODataReader;
-import org.apache.olingo.commons.api.edm.Edm;
public class ODataReaderImpl extends AbstractODataReader implements ODataReader {
@@ -36,14 +30,4 @@ public class ODataReaderImpl extends AbstractODataReader implements ODataReader
super(client);
}
- @Override
- public Edm readMetadata(final InputStream input) {
- return new EdmClientImpl(client.getServiceVersion(), client.getDeserializer().toMetadata(input));
- }
-
- @Override
- public ODataServiceDocument readServiceDocument(final InputStream input, final ODataFormat format) {
- return ((ODataClient) client).getBinder().getODataServiceDocument(
- ((ODataClient) client).getDeserializer().toServiceDocument(input, format));
- }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/26142187/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractMetadataTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractMetadataTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractMetadataTestITCase.java
index 1293f3c..11b9104 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractMetadataTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractMetadataTestITCase.java
@@ -28,4 +28,8 @@ public abstract class AbstractMetadataTestITCase extends AbstractTestITCase {
protected String getTestServiceRoot() {
return "http://localhost:9080/StaticService/" + getClient().getServiceVersion().name() + "/Static.svc";
}
+
+ protected String getNorthwindServiceRoot() {
+ return "http://localhost:9080/StaticService/" + getClient().getServiceVersion().name() + "/NorthWind.svc";
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/26142187/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/MetadataTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/MetadataTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/MetadataTestITCase.java
index 8917c49..887a46d 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/MetadataTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/MetadataTestITCase.java
@@ -18,11 +18,16 @@
*/
package org.apache.olingo.client.core.it.v4;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
import org.apache.olingo.client.api.v4.ODataClient;
import org.apache.olingo.client.core.ODataClientFactory;
import org.apache.olingo.client.core.it.AbstractMetadataTestITCase;
import org.apache.olingo.commons.api.edm.Edm;
-import static org.junit.Assert.assertNotNull;
+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.junit.Test;
public class MetadataTestITCase extends AbstractMetadataTestITCase {
@@ -38,4 +43,19 @@ public class MetadataTestITCase extends AbstractMetadataTestITCase {
getMetadataRequest(getTestServiceRoot()).execute().getBody();
assertNotNull(metadata);
}
+
+ @Test
+ public void include() {
+ final Edm metadata = getClient().getRetrieveRequestFactory().
+ getMetadataRequest(getNorthwindServiceRoot()).execute().getBody();
+ assertNotNull(metadata);
+
+ final EdmEntityContainer container = metadata.getEntityContainer(
+ new FullQualifiedName("ODataWebExperimental.Northwind.Model", "NorthwindEntities"));
+ assertNotNull(container);
+
+ final EdmEntitySet categories = container.getEntitySet("Categories");
+ assertNotNull(categories);
+ assertEquals("NorthwindModel", categories.getEntityType().getNamespace());
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/26142187/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
index c8cfc59..b594858 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
@@ -279,5 +279,4 @@ public class MetadataTest extends AbstractTest {
readMetadata(getClass().getResourceAsStream("fromdoc3-metadata.xml"));
assertNotNull(metadata);
}
-
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/26142187/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fromdoc1-metadata.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fromdoc1-metadata.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fromdoc1-metadata.xml
index ed46844..5d872ca 100644
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fromdoc1-metadata.xml
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fromdoc1-metadata.xml
@@ -19,7 +19,7 @@
under the License.
-->
-<edmx:Edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Version="4.0">
+<edmx:Edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Version="4.0">
<edmx:Reference Uri="http://docs.oasis-open.org/odata/odata/v4.0/cs01/vocabularies/Org.OData.Core.V1.xml">
<edmx:Include Namespace="Org.OData.Core.V1" Alias="Core"/>
</edmx:Reference>
[47/51] [abbrv] git commit: [OLINGO-200] Fixing minor quirk in V4 APIs
Posted by il...@apache.org.
[OLINGO-200] Fixing minor quirk in V4 APIs
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/a5b7b257
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/a5b7b257
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/a5b7b257
Branch: refs/heads/master
Commit: a5b7b2577d264efcac7af85a0c63c3d6ea56d728
Parents: 850d44e
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Tue Apr 1 14:10:29 2014 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Tue Apr 1 14:10:29 2014 +0200
----------------------------------------------------------------------
.../client/core/it/v4/EntityCreateTestITCase.java | 12 +++++-------
.../olingo/commons/api/domain/ODataCollectionValue.java | 2 +-
.../core/domain/AbstractODataCollectionValue.java | 5 +++--
3 files changed, 9 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a5b7b257/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityCreateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityCreateTestITCase.java
index 0044e73..962542c 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityCreateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityCreateTestITCase.java
@@ -25,10 +25,9 @@ import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateR
import org.apache.olingo.commons.api.domain.ODataCollectionValue;
import org.apache.olingo.commons.api.domain.v4.ODataEntity;
import org.apache.olingo.commons.api.domain.v4.ODataProperty;
-import org.apache.olingo.commons.api.domain.ODataValue;
+import org.apache.olingo.commons.api.domain.v4.ODataValue;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.format.ODataPubFormat;
-import org.apache.olingo.commons.core.domain.v3.ODataCollectionValueImpl;
import org.apache.olingo.commons.core.domain.v4.ODataEntityImpl;
import org.junit.Test;
@@ -52,15 +51,14 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
setType(EdmPrimitiveTypeKind.Duration).setText("PT0.0000001S").build());
order.getProperties().add(shelfLife);
- // TODO: this should be possible via getClient().getObjectFactory().newCollectionValue()
- final ODataCollectionValue<ODataValue> orderShelfLifesValue =
- new ODataCollectionValueImpl("Collection(Duration)");
+ final ODataCollectionValue<ODataValue> orderShelfLifesValue = getClient().getObjectFactory().
+ newCollectionValue("Collection(Duration)");
orderShelfLifesValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.Duration).setText("PT0.0000001S").build());
orderShelfLifesValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.Duration).setText("PT0.0000002S").build());
- final ODataProperty orderShelfLifes = getClient().getObjectFactory().newCollectionProperty("OrderShelfLifes",
- orderShelfLifesValue);
+ final ODataProperty orderShelfLifes = getClient().getObjectFactory().
+ newCollectionProperty("OrderShelfLifes", orderShelfLifesValue);
order.getProperties().add(orderShelfLifes);
final ODataEntityCreateRequest<ODataEntity> req = getClient().getCUDRequestFactory().getEntityCreateRequest(
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a5b7b257/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataCollectionValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataCollectionValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataCollectionValue.java
index 29eedab..088bbc0 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataCollectionValue.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataCollectionValue.java
@@ -30,7 +30,7 @@ public interface ODataCollectionValue<OV extends ODataValue> extends ODataValue,
*
* @param value value to be added.
*/
- void add(OV value);
+ void add(ODataValue value);
/**
* Checks if collection is empty.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a5b7b257/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataCollectionValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataCollectionValue.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataCollectionValue.java
index 181f2da..2f8236b 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataCollectionValue.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataCollectionValue.java
@@ -55,8 +55,9 @@ public abstract class AbstractODataCollectionValue<OV extends ODataValue>
* @param value value to be added.
*/
@Override
- public void add(final OV value) {
- values.add(value);
+ @SuppressWarnings("unchecked")
+ public void add(final ODataValue value) {
+ values.add((OV) value);
}
/**
[42/51] [abbrv] git commit: [OLINGO-200] V4 (de)serialization tests
for EntitySet and Property
Posted by il...@apache.org.
[OLINGO-200] V4 (de)serialization tests for EntitySet and Property
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/eeb5d9b4
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/eeb5d9b4
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/eeb5d9b4
Branch: refs/heads/master
Commit: eeb5d9b4ab459ed6a4e574e9b50b42919a634460
Parents: dc2922c
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Mon Mar 31 15:17:08 2014 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Mon Mar 31 15:17:08 2014 +0200
----------------------------------------------------------------------
.../client/core/op/AbstractODataBinder.java | 2 +
.../olingo/client/core/v3/EntitySetTest.java | 3 +-
.../olingo/client/core/v3/EntityTest.java | 21 ++-
.../apache/olingo/client/core/v3/JSONTest.java | 10 +-
.../olingo/client/core/v3/PropertyTest.java | 11 +-
.../olingo/client/core/v4/EntitySetTest.java | 65 +++++++++
.../olingo/client/core/v4/EntityTest.java | 94 +++++++++++++
.../apache/olingo/client/core/v4/JSONTest.java | 10 +-
.../olingo/client/core/v4/PropertyTest.java | 138 ++++++++++++++++++
...ccounts_101_expand_MyPaymentInstruments.json | 94 +++++++++++++
...Accounts_101_expand_MyPaymentInstruments.xml | 129 +++++++++++++++++
...ts_f89dee73-af9f-4cd4-b330-db93c25ff3c7.json | 16 +++
...nts_f89dee73-af9f-4cd4-b330-db93c25ff3c7.xml | 46 ++++++
.../apache/olingo/client/core/v4/Customers.json | 57 ++++++++
.../apache/olingo/client/core/v4/Customers.xml | 106 ++++++++++++++
.../client/core/v4/Employees_3_HomeAddress.json | 6 +
.../client/core/v4/Employees_3_HomeAddress.xml | 31 ++++
.../olingo/client/core/v4/PersonDetails_1.json | 22 +++
.../olingo/client/core/v4/PersonDetails_1.xml | 55 ++++++++
.../olingo/client/core/v4/Products_5.json | 30 +++-
.../client/core/v4/Products_5_CoverColors.json | 5 +
.../client/core/v4/Products_5_CoverColors.xml | 30 ++++
.../olingo/client/core/v4/VipCustomer.xml | 6 +
.../apache/olingo/commons/api/Constants.java | 12 +-
.../apache/olingo/commons/api/data/Entry.java | 14 ++
.../commons/api/domain/CommonODataEntity.java | 38 +++++
.../olingo/commons/api/domain/ODataLink.java | 8 ++
.../api/edm/constants/ODataServiceVersion.java | 12 ++
.../olingo/commons/core/data/AbstractEntry.java | 12 ++
.../commons/core/data/AtomDeserializer.java | 5 +
.../core/data/AtomPropertyDeserializer.java | 4 +-
.../core/data/JSONEntryDeserializer.java | 30 ++--
.../olingo/commons/core/data/JSONEntryImpl.java | 21 ---
.../core/data/JSONPropertyDeserializer.java | 16 +--
.../core/data/ODataJacksonDeserializer.java | 9 ++
.../domain/AbstractODataCollectionValue.java | 4 +-
.../core/domain/AbstractODataEntity.java | 140 ++++++-------------
37 files changed, 1124 insertions(+), 188 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
index faed745..c41ad6b 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
@@ -174,6 +174,7 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
if (entity.isMediaEntity()) {
entry.setMediaContentSource(entity.getMediaContentSource());
entry.setMediaContentType(entity.getMediaContentType());
+ entry.setMediaETag(entity.getMediaETag());
}
for (CommonODataProperty property : entity.getProperties()) {
@@ -342,6 +343,7 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
entity.setMediaEntity(true);
entity.setMediaContentSource(resource.getMediaContentSource());
entity.setMediaContentType(resource.getMediaContentType());
+ entity.setMediaETag(resource.getMediaETag());
}
for (Property property : resource.getProperties()) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java
index 1f02432..0400321 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java
@@ -27,6 +27,7 @@ import org.apache.olingo.client.api.v3.ODataClient;
import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.core.AbstractTest;
+import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
import org.apache.olingo.commons.core.op.ResourceFactory;
import org.junit.Test;
@@ -39,7 +40,7 @@ public class EntitySetTest extends AbstractTest {
private void read(final ODataPubFormat format) throws IOException {
final InputStream input = getClass().getResourceAsStream("Customer." + getSuffix(format));
- final CommonODataEntitySet entitySet = getClient().getBinder().getODataEntitySet(
+ final ODataEntitySet entitySet = getClient().getBinder().getODataEntitySet(
getClient().getDeserializer().toFeed(input, format).getObject());
assertNotNull(entitySet);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
index 41da651..99b9423 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
@@ -24,12 +24,11 @@ import static org.junit.Assert.assertTrue;
import java.io.InputStream;
import org.apache.olingo.client.api.v3.ODataClient;
-import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.domain.ODataLink;
-import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.core.AbstractTest;
import org.apache.olingo.commons.api.domain.v3.ODataEntity;
+import org.apache.olingo.commons.api.domain.v3.ODataProperty;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.core.op.ResourceFactory;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
@@ -82,12 +81,12 @@ public class EntityTest extends AbstractTest {
private void readGeospatial(final ODataPubFormat format) {
final InputStream input = getClass().getResourceAsStream("AllGeoTypesSet_-8." + getSuffix(format));
- final CommonODataEntity entity = getClient().getBinder().getODataEntity(
+ final ODataEntity entity = getClient().getBinder().getODataEntity(
getClient().getDeserializer().toEntry(input, format).getObject());
assertNotNull(entity);
boolean found = false;
- for (CommonODataProperty property : entity.getProperties()) {
+ for (ODataProperty property : entity.getProperties()) {
if ("GeogMultiLine".equals(property.getName())) {
found = true;
assertTrue(property.hasPrimitiveValue());
@@ -96,7 +95,7 @@ public class EntityTest extends AbstractTest {
}
assertTrue(found);
- final CommonODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
+ final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
assertEquals(entity, written);
}
@@ -114,14 +113,14 @@ public class EntityTest extends AbstractTest {
private void withActions(final ODataPubFormat format) {
final InputStream input = getClass().getResourceAsStream("ComputerDetail_-10." + getSuffix(format));
- final CommonODataEntity entity = getClient().getBinder().getODataEntity(
+ final ODataEntity entity = getClient().getBinder().getODataEntity(
getClient().getDeserializer().toEntry(input, format).getObject());
assertNotNull(entity);
assertEquals(1, entity.getOperations().size());
assertEquals("ResetComputerDetailsSpecifications", entity.getOperations().get(0).getTitle());
- final CommonODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
+ final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
entity.getOperations().clear();
assertEquals(entity, written);
@@ -140,14 +139,14 @@ public class EntityTest extends AbstractTest {
private void mediaEntity(final ODataPubFormat format) {
final InputStream input = getClass().getResourceAsStream("Car_16." + getSuffix(format));
- final CommonODataEntity entity = getClient().getBinder().getODataEntity(
+ final ODataEntity entity = getClient().getBinder().getODataEntity(
getClient().getDeserializer().toEntry(input, format).getObject());
assertNotNull(entity);
assertTrue(entity.isMediaEntity());
assertNotNull(entity.getMediaContentSource());
assertNotNull(entity.getMediaContentType());
- final CommonODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
+ final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
assertEquals(entity, written);
}
@@ -164,11 +163,11 @@ public class EntityTest extends AbstractTest {
private void issue128(final ODataPubFormat format) throws EdmPrimitiveTypeException {
final InputStream input = getClass().getResourceAsStream("AllGeoTypesSet_-5." + getSuffix(format));
- final CommonODataEntity entity = getClient().getBinder().getODataEntity(
+ final ODataEntity entity = getClient().getBinder().getODataEntity(
getClient().getDeserializer().toEntry(input, format).getObject());
assertNotNull(entity);
- final CommonODataProperty geogCollection = entity.getProperty("GeogCollection");
+ final ODataProperty geogCollection = entity.getProperty("GeogCollection");
assertEquals(EdmPrimitiveTypeKind.GeographyCollection, geogCollection.getPrimitiveValue().getTypeKind());
int count = 0;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/JSONTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/JSONTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/JSONTest.java
index 522e686..64badc0 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/JSONTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/JSONTest.java
@@ -67,8 +67,8 @@ public class JSONTest extends AtomTest {
if (node.has(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIAREAD_LINK))) {
node.remove(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIAREAD_LINK));
}
- if (node.has(Constants.JSON_MEDIA_CONTENT_TYPE)) {
- node.remove(Constants.JSON_MEDIA_CONTENT_TYPE);
+ if (node.has(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIA_CONTENT_TYPE))) {
+ node.remove(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIA_CONTENT_TYPE));
}
final List<String> toRemove = new ArrayList<String>();
for (final Iterator<Map.Entry<String, JsonNode>> itor = node.fields(); itor.hasNext();) {
@@ -79,10 +79,12 @@ public class JSONTest extends AtomTest {
getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_TYPE))
|| field.getKey().endsWith(
getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIAEDIT_LINK))
- || field.getKey().endsWith(Constants.JSON_MEDIA_CONTENT_TYPE_SUFFIX)
+ || field.getKey().endsWith(
+ getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIA_CONTENT_TYPE))
|| field.getKey().endsWith(
getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_ASSOCIATION_LINK))
- || field.getKey().endsWith(Constants.JSON_MEDIA_ETAG_SUFFIX)) {
+ || field.getKey().endsWith(
+ getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIA_ETAG))) {
toRemove.add(field.getKey());
} else if (field.getValue().isObject()) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java
index 8676d6f..317d1ac 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java
@@ -58,7 +58,7 @@ public class PropertyTest extends AbstractTest {
assertEquals("-10", value.toString());
}
- private ODataProperty primitive(final ODataFormat format) throws IOException, EdmPrimitiveTypeException {
+ private void primitive(final ODataFormat format) throws IOException, EdmPrimitiveTypeException {
final InputStream input = getClass().getResourceAsStream("Customer_-10_CustomerId." + getSuffix(format));
final ODataProperty property = getClient().getReader().readProperty(input, format);
assertNotNull(property);
@@ -80,8 +80,6 @@ public class PropertyTest extends AbstractTest {
}
assertEquals(property, comparable);
-
- return property;
}
@Test
@@ -94,7 +92,7 @@ public class PropertyTest extends AbstractTest {
primitive(ODataFormat.JSON);
}
- private ODataProperty complex(final ODataFormat format) throws IOException {
+ private void complex(final ODataFormat format) throws IOException {
final InputStream input = getClass().getResourceAsStream("Customer_-10_PrimaryContactInfo." + getSuffix(format));
final ODataProperty property = getClient().getReader().readProperty(input, format);
assertNotNull(property);
@@ -118,8 +116,6 @@ public class PropertyTest extends AbstractTest {
}
assertEquals(property, comparable);
-
- return property;
}
@Test
@@ -132,7 +128,7 @@ public class PropertyTest extends AbstractTest {
complex(ODataFormat.JSON);
}
- private ODataProperty collection(final ODataFormat format) throws IOException {
+ private void collection(final ODataFormat format) throws IOException {
final InputStream input = getClass().getResourceAsStream("Customer_-10_BackupContactInfo." + getSuffix(format));
final ODataProperty property = getClient().getReader().readProperty(input, format);
assertNotNull(property);
@@ -156,7 +152,6 @@ public class PropertyTest extends AbstractTest {
}
assertEquals(property, comparable);
- return property;
}
@Test
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntitySetTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntitySetTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntitySetTest.java
new file mode 100644
index 0000000..6708be6
--- /dev/null
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntitySetTest.java
@@ -0,0 +1,65 @@
+/*
+ * 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.client.core.v4;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.io.InputStream;
+import org.apache.olingo.client.api.v4.ODataClient;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
+import org.apache.olingo.client.core.AbstractTest;
+import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
+import org.apache.olingo.commons.core.op.ResourceFactory;
+import org.junit.Test;
+
+public class EntitySetTest extends AbstractTest {
+
+ @Override
+ protected ODataClient getClient() {
+ return v4Client;
+ }
+
+ private void read(final ODataPubFormat format) throws IOException {
+ final InputStream input = getClass().getResourceAsStream("Customers." + getSuffix(format));
+ final ODataEntitySet entitySet = getClient().getBinder().getODataEntitySet(
+ getClient().getDeserializer().toFeed(input, format).getObject());
+ assertNotNull(entitySet);
+
+ assertEquals(2, entitySet.getEntities().size());
+ assertNull(entitySet.getNext());
+
+ final CommonODataEntitySet written = getClient().getBinder().getODataEntitySet(getClient().
+ getBinder().getFeed(entitySet, ResourceFactory.feedClassForFormat(format == ODataPubFormat.ATOM)));
+ assertEquals(entitySet, written);
+ }
+
+ @Test
+ public void fromAtom() throws IOException {
+ read(ODataPubFormat.ATOM);
+ }
+
+ @Test
+ public void fromJSON() throws IOException {
+ read(ODataPubFormat.JSON);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
index 97b6a44..e061be6 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
@@ -19,6 +19,7 @@
package org.apache.olingo.client.core.v4;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -26,6 +27,7 @@ import java.io.InputStream;
import java.util.Iterator;
import org.apache.olingo.client.api.v4.ODataClient;
import org.apache.olingo.client.core.AbstractTest;
+import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
import org.apache.olingo.commons.api.domain.ODataLink;
import org.apache.olingo.commons.api.domain.ODataLinkType;
import org.apache.olingo.commons.api.domain.v4.ODataEntity;
@@ -79,6 +81,12 @@ public class EntityTest extends AbstractTest {
}
assertEquals(3, checked);
+ assertEquals(2, entity.getOperations().size());
+ assertEquals("#Microsoft.Test.OData.Services.ODataWCFService.ResetAddress",
+ entity.getOperation("Microsoft.Test.OData.Services.ODataWCFService.ResetAddress").getMetadataAnchor());
+ assertEquals("#Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress",
+ entity.getOperation("Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress").getMetadataAnchor());
+
// operations won't get serialized
entity.getOperations().clear();
final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
@@ -130,4 +138,90 @@ public class EntityTest extends AbstractTest {
public void jsonWithEnums() {
withEnums(ODataPubFormat.JSON_FULL_METADATA);
}
+
+ private void withInlineEntitySet(final ODataPubFormat format) {
+ final InputStream input = getClass().getResourceAsStream(
+ "Accounts_101_expand_MyPaymentInstruments." + getSuffix(format));
+ final ODataEntity entity = getClient().getBinder().getODataEntity(
+ getClient().getDeserializer().toEntry(input, format).getObject());
+ assertNotNull(entity);
+
+ final ODataLink instruments = entity.getNavigationLink("MyPaymentInstruments");
+ assertNotNull(instruments);
+ assertEquals(ODataLinkType.ENTITY_SET_NAVIGATION, instruments.getType());
+
+ final ODataInlineEntitySet inline = instruments.asInlineEntitySet();
+ assertNotNull(inline);
+ assertEquals(3, inline.getEntitySet().getEntities().size());
+
+ // count shouldn't be serialized
+ inline.getEntitySet().setCount(3);
+ // operations won't get serialized
+ entity.getOperations().clear();
+ final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
+ getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
+ assertEquals(entity, written);
+ }
+
+ @Test
+ public void atomWithInlineEntitySet() {
+ withInlineEntitySet(ODataPubFormat.ATOM);
+ }
+
+ @Test
+ public void jsonWithInlineEntitySet() {
+ withInlineEntitySet(ODataPubFormat.JSON_FULL_METADATA);
+ }
+
+ private void mediaEntity(final ODataPubFormat format) {
+ final InputStream input = getClass().getResourceAsStream(
+ "Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7." + getSuffix(format));
+ final ODataEntity entity = getClient().getBinder().getODataEntity(
+ getClient().getDeserializer().toEntry(input, format).getObject());
+ assertNotNull(entity);
+
+ assertTrue(entity.isMediaEntity());
+ assertNotNull(entity.getMediaContentSource());
+ assertEquals("\"8zOOKKvgOtptr4gt8IrnapX3jds=\"", entity.getMediaETag());
+
+ final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
+ getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
+ assertEquals(entity, written);
+ }
+
+ @Test
+ public void atomMediaEntity() {
+ mediaEntity(ODataPubFormat.ATOM);
+ }
+
+ @Test
+ public void jsonMediaEntity() {
+ mediaEntity(ODataPubFormat.JSON_FULL_METADATA);
+ }
+
+ private void withStream(final ODataPubFormat format) {
+ final InputStream input = getClass().getResourceAsStream("PersonDetails_1." + getSuffix(format));
+ final ODataEntity entity = getClient().getBinder().getODataEntity(
+ getClient().getDeserializer().toEntry(input, format).getObject());
+ assertNotNull(entity);
+
+ assertFalse(entity.isMediaEntity());
+
+ final ODataLink editMedia = entity.getEditMediaLink("Photo");
+ assertNotNull(editMedia);
+
+ final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
+ getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
+ assertEquals(entity, written);
+ }
+
+ @Test
+ public void atomWithStream() {
+ withStream(ODataPubFormat.ATOM);
+ }
+
+ @Test
+ public void jsonWithStream() {
+ withStream(ODataPubFormat.JSON_FULL_METADATA);
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java
index 272ab13..770f112 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java
@@ -73,8 +73,8 @@ public class JSONTest extends AbstractTest {
if (node.has(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIAREAD_LINK))) {
node.remove(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIAREAD_LINK));
}
- if (node.has(Constants.JSON_MEDIA_CONTENT_TYPE)) {
- node.remove(Constants.JSON_MEDIA_CONTENT_TYPE);
+ if (node.has(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIA_CONTENT_TYPE))) {
+ node.remove(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIA_CONTENT_TYPE));
}
final List<String> toRemove = new ArrayList<String>();
for (final Iterator<Map.Entry<String, JsonNode>> itor = node.fields(); itor.hasNext();) {
@@ -85,10 +85,12 @@ public class JSONTest extends AbstractTest {
getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_TYPE))
|| field.getKey().endsWith(
getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIAEDIT_LINK))
- || field.getKey().endsWith(Constants.JSON_MEDIA_CONTENT_TYPE_SUFFIX)
+ || field.getKey().endsWith(
+ getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIA_CONTENT_TYPE))
|| field.getKey().endsWith(
getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_ASSOCIATION_LINK))
- || field.getKey().endsWith(Constants.JSON_MEDIA_ETAG_SUFFIX)) {
+ || field.getKey().endsWith(
+ getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIA_ETAG))) {
toRemove.add(field.getKey());
} else if (field.getValue().isObject()) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PropertyTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PropertyTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PropertyTest.java
new file mode 100644
index 0000000..022496c
--- /dev/null
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PropertyTest.java
@@ -0,0 +1,138 @@
+/*
+ * 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.client.core.v4;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Iterator;
+import org.apache.olingo.client.api.v4.ODataClient;
+import org.apache.olingo.client.core.AbstractTest;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.v4.ODataProperty;
+import org.apache.olingo.commons.api.domain.v4.ODataValue;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class PropertyTest extends AbstractTest {
+
+ @Override
+ protected ODataClient getClient() {
+ return v4Client;
+ }
+
+ private void _enum(final ODataFormat format) {
+ final InputStream input = getClass().getResourceAsStream("Products_5_SkinColor." + getSuffix(format));
+ final ODataProperty property = getClient().getReader().readProperty(input, format);
+ assertNotNull(property);
+ assertTrue(property.hasEnumValue());
+
+ final ODataProperty written = getClient().getReader().readProperty(
+ getClient().getWriter().writeProperty(property, format), format);
+ // This is needed because type information gets lost with serialization
+ if (format == ODataFormat.XML) {
+ final ODataProperty comparable = getClient().getObjectFactory().newEnumProperty(property.getName(),
+ getClient().getObjectFactory().
+ newEnumValue(property.getEnumValue().getTypeName(), written.getEnumValue().getValue()));
+
+ assertEquals(property, comparable);
+ }
+ }
+
+ @Test
+ public void xmlEnum() throws IOException, EdmPrimitiveTypeException {
+ _enum(ODataFormat.XML);
+ }
+
+ @Test
+ public void jsonEnum() throws IOException, EdmPrimitiveTypeException {
+ _enum(ODataFormat.JSON);
+ }
+
+ private void complex(final ODataFormat format) throws IOException {
+ final InputStream input = getClass().getResourceAsStream("Employees_3_HomeAddress." + getSuffix(format));
+ final ODataProperty property = getClient().getReader().readProperty(input, format);
+ assertNotNull(property);
+ assertTrue(property.hasComplexValue());
+ assertEquals(3, property.getComplexValue().size());
+
+ final ODataProperty written = getClient().getReader().readProperty(
+ getClient().getWriter().writeProperty(property, format), format);
+ // This is needed because type information gets lost with JSON serialization
+ final ODataComplexValue<ODataProperty> typedValue = getClient().getObjectFactory().
+ newComplexValue(property.getComplexValue().getTypeName());
+ for (final Iterator<ODataProperty> itor = written.getComplexValue().iterator(); itor.hasNext();) {
+ final ODataProperty prop = itor.next();
+ typedValue.add(prop);
+ }
+ final ODataProperty comparable = getClient().getObjectFactory().
+ newComplexProperty(property.getName(), typedValue);
+
+ assertEquals(property, comparable);
+ }
+
+ @Test
+ public void xmlComplex() throws IOException {
+ complex(ODataFormat.XML);
+ }
+
+ @Test
+ public void jsonComplex() throws IOException {
+ complex(ODataFormat.JSON);
+ }
+
+ private void collection(final ODataFormat format) throws IOException {
+ final InputStream input = getClass().getResourceAsStream("Products_5_CoverColors." + getSuffix(format));
+ final ODataProperty property = getClient().getReader().readProperty(input, format);
+ assertNotNull(property);
+ assertTrue(property.hasCollectionValue());
+ assertEquals(3, property.getCollectionValue().size());
+
+ final ODataProperty written = getClient().getReader().readProperty(
+ getClient().getWriter().writeProperty(property, format), format);
+ // This is needed because type information gets lost with JSON serialization
+ if (format == ODataFormat.XML) {
+ final ODataCollectionValue<ODataValue> typedValue = getClient().getObjectFactory().
+ newCollectionValue(property.getCollectionValue().getTypeName());
+ for (final Iterator<ODataValue> itor = written.getCollectionValue().iterator(); itor.hasNext();) {
+ final ODataValue value = itor.next();
+ typedValue.add(value);
+ }
+ final ODataProperty comparable = getClient().getObjectFactory().
+ newCollectionProperty(property.getName(), typedValue);
+
+ assertEquals(property, comparable);
+ }
+ }
+
+ @Test
+ public void xmlCollection() throws IOException {
+ collection(ODataFormat.XML);
+ }
+
+ @Test
+ public void jsonCollection() throws IOException {
+ collection(ODataFormat.JSON);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Accounts_101_expand_MyPaymentInstruments.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Accounts_101_expand_MyPaymentInstruments.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Accounts_101_expand_MyPaymentInstruments.json
new file mode 100644
index 0000000..776d578
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Accounts_101_expand_MyPaymentInstruments.json
@@ -0,0 +1,94 @@
+{
+ "@odata.context": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Accounts/$entity",
+ "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.Account",
+ "@odata.id": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)",
+ "@odata.editLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)",
+ "AccountID": 101,
+ "Country": "US",
+ "AccountInfo": {
+ "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.AccountInfo",
+ "FirstName": "Alex",
+ "LastName": "Green",
+ "MiddleName": "Hood"
+ },
+ "MyPaymentInstruments@odata.context": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Accounts(101)/MyPaymentInstruments",
+ "MyPaymentInstruments@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments/$ref",
+ "MyPaymentInstruments@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments",
+ "MyPaymentInstruments": [{
+ "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument",
+ "@odata.id": "Accounts(101)/MyPaymentInstruments(101901)",
+ "@odata.editLink": "Accounts(101)/MyPaymentInstruments(101901)",
+ "PaymentInstrumentID": 101901,
+ "FriendlyName": "101 first PI",
+ "CreatedDate@odata.type": "#DateTimeOffset",
+ "CreatedDate": "2012-11-01T00:00:00Z",
+ "TheStoredPI@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101901)/TheStoredPI/$ref",
+ "TheStoredPI@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101901)/TheStoredPI",
+ "BillingStatements@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101901)/BillingStatements/$ref",
+ "BillingStatements@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101901)/BillingStatements",
+ "BackupStoredPI@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101901)/BackupStoredPI/$ref",
+ "BackupStoredPI@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101901)/BackupStoredPI"
+ }, {
+ "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI",
+ "@odata.id": "Accounts(101)/MyPaymentInstruments(101902)",
+ "@odata.editLink": "Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI",
+ "PaymentInstrumentID": 101902,
+ "FriendlyName": "101 frist credit PI",
+ "CreatedDate@odata.type": "#DateTimeOffset",
+ "CreatedDate": "2012-11-01T00:00:00Z",
+ "CardNumber": "6000000000000000",
+ "CVV": "234",
+ "HolderName": "Alex",
+ "Balance": 100.0,
+ "ExperationDate@odata.type": "#DateTimeOffset",
+ "ExperationDate": "2022-11-01T00:00:00Z",
+ "TheStoredPI@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/TheStoredPI/$ref",
+ "TheStoredPI@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/TheStoredPI",
+ "BillingStatements@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BillingStatements/$ref",
+ "BillingStatements@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BillingStatements",
+ "BackupStoredPI@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BackupStoredPI/$ref",
+ "BackupStoredPI@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BackupStoredPI",
+ "CreditRecords@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/CreditRecords/$ref",
+ "CreditRecords@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101902)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/CreditRecords"
+ }, {
+ "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI",
+ "@odata.id": "Accounts(101)/MyPaymentInstruments(101903)",
+ "@odata.editLink": "Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI",
+ "PaymentInstrumentID": 101903,
+ "FriendlyName": "101 second credit PI",
+ "CreatedDate@odata.type": "#DateTimeOffset",
+ "CreatedDate": "2012-11-01T00:00:00Z",
+ "CardNumber": "8000000000000000",
+ "CVV": "012",
+ "HolderName": "James",
+ "Balance": 300.0,
+ "ExperationDate@odata.type": "#DateTimeOffset",
+ "ExperationDate": "2022-10-02T00:00:00Z",
+ "TheStoredPI@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/TheStoredPI/$ref",
+ "TheStoredPI@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/TheStoredPI",
+ "BillingStatements@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BillingStatements/$ref",
+ "BillingStatements@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BillingStatements",
+ "BackupStoredPI@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BackupStoredPI/$ref",
+ "BackupStoredPI@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/BackupStoredPI",
+ "CreditRecords@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/CreditRecords/$ref",
+ "CreditRecords@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments(101903)/Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI/CreditRecords"
+ }],
+ "MyGiftCard@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyGiftCard/$ref",
+ "MyGiftCard@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyGiftCard",
+ "ActiveSubscriptions@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/ActiveSubscriptions/$ref",
+ "ActiveSubscriptions@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/ActiveSubscriptions",
+ "AvailableSubscriptionTemplatess@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/AvailableSubscriptionTemplatess/$ref",
+ "AvailableSubscriptionTemplatess@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/AvailableSubscriptionTemplatess",
+ "#Microsoft.Test.OData.Services.ODataWCFService.RefreshDefaultPI": {
+ "title": "Microsoft.Test.OData.Services.ODataWCFService.RefreshDefaultPI",
+ "target": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/Microsoft.Test.OData.Services.ODataWCFService.RefreshDefaultPI"
+ },
+ "#Microsoft.Test.OData.Services.ODataWCFService.GetDefaultPI": {
+ "title": "Microsoft.Test.OData.Services.ODataWCFService.GetDefaultPI",
+ "target": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/Microsoft.Test.OData.Services.ODataWCFService.GetDefaultPI"
+ },
+ "#Microsoft.Test.OData.Services.ODataWCFService.GetAccountInfo": {
+ "title": "Microsoft.Test.OData.Services.ODataWCFService.GetAccountInfo",
+ "target": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/Microsoft.Test.OData.Services.ODataWCFService.GetAccountInfo"
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Accounts_101_expand_MyPaymentInstruments.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Accounts_101_expand_MyPaymentInstruments.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Accounts_101_expand_MyPaymentInstruments.xml
new file mode 100644
index 0000000..75ec28d
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Accounts_101_expand_MyPaymentInstruments.xml
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ 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.
+
+-->
+<entry xml:base="http://odatae2etest.azurewebsites.net/javatest/DefaultService/"
+ xmlns="http://www.w3.org/2005/Atom"
+ xmlns:d="http://docs.oasis-open.org/odata/ns/data"
+ xmlns:m="http://docs.oasis-open.org/odata/ns/metadata"
+ xmlns:georss="http://www.georss.org/georss"
+ xmlns:gml="http://www.opengis.net/gml"
+ m:context="http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Accounts/$entity">
+ <id>http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)</id>
+ <category term="#Microsoft.Test.OData.Services.ODataWCFService.Account" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
+ <link rel="edit" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/MyGiftCard" type="application/atom+xml;type=entry" title="MyGiftCard" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyGiftCard" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/MyPaymentInstruments" type="application/atom+xml;type=feed" title="MyPaymentInstruments" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/MyPaymentInstruments">
+ <m:inline>
+ <feed>
+ <id>http://odatae2etest.azurewebsites.net/javatest/DefaultService/MyPaymentInstruments</id>
+ <title />
+ <updated>2014-03-31T09:46:15Z</updated>
+ <entry>
+ <category term="#Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/TheStoredPI" type="application/atom+xml;type=entry" title="TheStoredPI" href="potato" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/BillingStatements" type="application/atom+xml;type=feed" title="BillingStatements" href="potato" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/BackupStoredPI" type="application/atom+xml;type=entry" title="BackupStoredPI" href="potato" />
+ <id />
+ <title />
+ <updated>2014-03-31T09:46:15Z</updated>
+ <author>
+ <name />
+ </author>
+ <content type="application/xml">
+ <m:properties>
+ <d:PaymentInstrumentID m:type="Int32">101901</d:PaymentInstrumentID>
+ <d:FriendlyName>101 first PI</d:FriendlyName>
+ <d:CreatedDate m:type="DateTimeOffset">2012-11-01T00:00:00Z</d:CreatedDate>
+ </m:properties>
+ </content>
+ </entry>
+ <entry>
+ <category term="#Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/TheStoredPI" type="application/atom+xml;type=entry" title="TheStoredPI" href="potato" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/BillingStatements" type="application/atom+xml;type=feed" title="BillingStatements" href="potato" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/BackupStoredPI" type="application/atom+xml;type=entry" title="BackupStoredPI" href="potato" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/CreditRecords" type="application/atom+xml;type=feed" title="CreditRecords" href="potato" />
+ <id />
+ <title />
+ <updated>2014-03-31T09:46:15Z</updated>
+ <author>
+ <name />
+ </author>
+ <content type="application/xml">
+ <m:properties>
+ <d:PaymentInstrumentID m:type="Int32">101902</d:PaymentInstrumentID>
+ <d:FriendlyName>101 frist credit PI</d:FriendlyName>
+ <d:CreatedDate m:type="DateTimeOffset">2012-11-01T00:00:00Z</d:CreatedDate>
+ <d:CardNumber>6000000000000000</d:CardNumber>
+ <d:CVV>234</d:CVV>
+ <d:HolderName>Alex</d:HolderName>
+ <d:Balance m:type="Double">100</d:Balance>
+ <d:ExperationDate m:type="DateTimeOffset">2022-11-01T00:00:00Z</d:ExperationDate>
+ </m:properties>
+ </content>
+ </entry>
+ <entry>
+ <category term="#Microsoft.Test.OData.Services.ODataWCFService.CreditCardPI" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/TheStoredPI" type="application/atom+xml;type=entry" title="TheStoredPI" href="potato" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/BillingStatements" type="application/atom+xml;type=feed" title="BillingStatements" href="potato" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/BackupStoredPI" type="application/atom+xml;type=entry" title="BackupStoredPI" href="potato" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/CreditRecords" type="application/atom+xml;type=feed" title="CreditRecords" href="potato" />
+ <id />
+ <title />
+ <updated>2014-03-31T09:46:15Z</updated>
+ <author>
+ <name />
+ </author>
+ <content type="application/xml">
+ <m:properties>
+ <d:PaymentInstrumentID m:type="Int32">101903</d:PaymentInstrumentID>
+ <d:FriendlyName>101 second credit PI</d:FriendlyName>
+ <d:CreatedDate m:type="DateTimeOffset">2012-11-01T00:00:00Z</d:CreatedDate>
+ <d:CardNumber>8000000000000000</d:CardNumber>
+ <d:CVV>012</d:CVV>
+ <d:HolderName>James</d:HolderName>
+ <d:Balance m:type="Double">300</d:Balance>
+ <d:ExperationDate m:type="DateTimeOffset">2022-10-02T00:00:00Z</d:ExperationDate>
+ </m:properties>
+ </content>
+ </entry>
+ </feed>
+ </m:inline>
+ </link>
+ <link rel="http://docs.oasis-open.org/odata/ns/related/ActiveSubscriptions" type="application/atom+xml;type=feed" title="ActiveSubscriptions" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/ActiveSubscriptions" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/AvailableSubscriptionTemplatess" type="application/atom+xml;type=feed" title="AvailableSubscriptionTemplatess" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Accounts(101)/AvailableSubscriptionTemplatess" />
+ <title />
+ <updated>2014-03-31T09:46:15Z</updated>
+ <author>
+ <name />
+ </author>
+ <content type="application/xml">
+ <m:properties>
+ <d:AccountID m:type="Int32">101</d:AccountID>
+ <d:Country>US</d:Country>
+ <d:AccountInfo m:type="#Microsoft.Test.OData.Services.ODataWCFService.AccountInfo">
+ <d:FirstName>Alex</d:FirstName>
+ <d:LastName>Green</d:LastName>
+ <d:MiddleName>Hood</d:MiddleName>
+ </d:AccountInfo>
+ </m:properties>
+ </content>
+</entry>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7.json
new file mode 100644
index 0000000..eceecbb
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7.json
@@ -0,0 +1,16 @@
+{
+ "@odata.context": "http://services.odata.org/V4/OData/OData.svc/$metadata#Advertisements/$entity",
+ "@odata.type": "#ODataDemo.Advertisement",
+ "@odata.id": "http://services.odata.org/V4/OData/OData.svc/Advertisements(f89dee73-af9f-4cd4-b330-db93c25ff3c7)",
+ "@odata.editLink": "Advertisements(f89dee73-af9f-4cd4-b330-db93c25ff3c7)",
+ "@odata.mediaEditLink": "Advertisements(f89dee73-af9f-4cd4-b330-db93c25ff3c7)/$value",
+ "@odata.mediaContentType": "*/*",
+ "@odata.mediaEtag": "\"8zOOKKvgOtptr4gt8IrnapX3jds=\"",
+ "ID@odata.type": "#Guid",
+ "ID": "f89dee73-af9f-4cd4-b330-db93c25ff3c7",
+ "Name": "Old School Lemonade Store, Retro Style",
+ "AirDate@odata.type": "#DateTimeOffset",
+ "AirDate": "2012-11-07T00:00:00Z",
+ "FeaturedProduct@odata.associationLink": "Advertisements(f89dee73-af9f-4cd4-b330-db93c25ff3c7)/FeaturedProduct/$ref",
+ "FeaturedProduct@odata.navigationLink": "Advertisements(f89dee73-af9f-4cd4-b330-db93c25ff3c7)/FeaturedProduct"
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7.xml
new file mode 100644
index 0000000..068cb53
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ 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.
+
+-->
+<entry xml:base="http://services.odata.org/V4/OData/OData.svc/"
+ xmlns="http://www.w3.org/2005/Atom"
+ xmlns:d="http://docs.oasis-open.org/odata/ns/data"
+ xmlns:m="http://docs.oasis-open.org/odata/ns/metadata"
+ xmlns:georss="http://www.georss.org/georss"
+ xmlns:gml="http://www.opengis.net/gml"
+ m:context="http://services.odata.org/V4/OData/OData.svc/$metadata#Advertisements/$entity">
+ <id>http://services.odata.org/V4/OData/OData.svc/Advertisements(f89dee73-af9f-4cd4-b330-db93c25ff3c7)</id>
+ <category term="#ODataDemo.Advertisement" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
+ <link rel="edit" title="Advertisement" href="Advertisements(f89dee73-af9f-4cd4-b330-db93c25ff3c7)" />
+ <link rel="http://docs.oasis-open.org/odata/ns/relatedlinks/FeaturedProduct" type="application/xml" title="FeaturedProduct" href="Advertisements(f89dee73-af9f-4cd4-b330-db93c25ff3c7)/FeaturedProduct/$ref" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/FeaturedProduct" type="application/atom+xml;type=entry" title="FeaturedProduct" href="Advertisements(f89dee73-af9f-4cd4-b330-db93c25ff3c7)/FeaturedProduct" />
+ <title />
+ <updated>2014-03-31T10:24:52Z</updated>
+ <author>
+ <name />
+ </author>
+ <link rel="edit-media" title="Advertisement" href="Advertisements(f89dee73-af9f-4cd4-b330-db93c25ff3c7)/$value" m:etag=""8zOOKKvgOtptr4gt8IrnapX3jds="" />
+ <content type="*/*" src="Advertisements(f89dee73-af9f-4cd4-b330-db93c25ff3c7)/$value" />
+ <m:properties>
+ <d:ID m:type="Guid">f89dee73-af9f-4cd4-b330-db93c25ff3c7</d:ID>
+ <d:Name>Old School Lemonade Store, Retro Style</d:Name>
+ <d:AirDate m:type="DateTimeOffset">2012-11-07T00:00:00Z</d:AirDate>
+ </m:properties>
+</entry>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customers.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customers.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customers.json
new file mode 100644
index 0000000..c8e2cdf
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customers.json
@@ -0,0 +1,57 @@
+{
+ "@odata.context": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Customers",
+ "odata.count": 2,
+ "value": [{
+ "@odata.id": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)",
+ "@odata.editLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)",
+ "PersonID": 1,
+ "FirstName": "Bob",
+ "LastName": "Cat",
+ "MiddleName": null,
+ "HomeAddress": {
+ "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.HomeAddress",
+ "Street": "1 Microsoft Way",
+ "City": "London",
+ "PostalCode": "98052",
+ "FamilyName": "Cats"
+ },
+ "Home": {
+ "type": "Point",
+ "coordinates": [23.1, 32.1],
+ "crs": {
+ "type": "name",
+ "properties": {
+ "name": "EPSG:4326"
+ }
+ }
+ },
+ "Numbers": ["111-111-1111"],
+ "Emails": ["abc@abc.com"],
+ "City": "London",
+ "Birthday": "1957-04-03T00:00:00Z",
+ "TimeBetweenLastTwoOrders": "PT0.0000001S"
+ }, {
+ "@odata.id": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=2)",
+ "@odata.editLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=2)",
+ "PersonID": 2,
+ "FirstName": "Jill",
+ "LastName": "Jones",
+ "MiddleName": null,
+ "HomeAddress": null,
+ "Home": {
+ "type": "Point",
+ "coordinates": [161.8, 15.0],
+ "crs": {
+ "type": "name",
+ "properties": {
+ "name": "EPSG:4326"
+ }
+ }
+ },
+ "Numbers": [],
+ "Emails": [],
+ "City": "Sydney",
+ "Birthday": "1983-01-15T00:00:00Z",
+ "TimeBetweenLastTwoOrders": "PT0.0000002S"
+ }]
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customers.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customers.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customers.xml
new file mode 100644
index 0000000..9b3d870
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customers.xml
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ 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.
+
+-->
+<feed xml:base="http://odatae2etest.azurewebsites.net/javatest/DefaultService/"
+ xmlns="http://www.w3.org/2005/Atom"
+ xmlns:d="http://docs.oasis-open.org/odata/ns/data"
+ xmlns:m="http://docs.oasis-open.org/odata/ns/metadata"
+ xmlns:georss="http://www.georss.org/georss"
+ xmlns:gml="http://www.opengis.net/gml"
+ m:context="http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Customers">
+ <m:count>2</m:count>
+ <id>http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers</id>
+ <title />
+ <updated>2014-03-31T09:35:14Z</updated>
+ <entry>
+ <id>http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)</id>
+ <category term="#Microsoft.Test.OData.Services.ODataWCFService.Customer" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
+ <link rel="edit" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Parent" type="application/atom+xml;type=entry" title="Parent" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)/Parent" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Orders" type="application/atom+xml;type=feed" title="Orders" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)/Orders" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Company" type="application/atom+xml;type=entry" title="Company" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)/Company" />
+ <title />
+ <updated>2014-03-31T09:35:14Z</updated>
+ <author>
+ <name />
+ </author>
+ <content type="application/xml">
+ <m:properties>
+ <d:PersonID m:type="Int32">1</d:PersonID>
+ <d:FirstName>Bob</d:FirstName>
+ <d:LastName>Cat</d:LastName>
+ <d:MiddleName m:null="true" />
+ <d:HomeAddress m:type="#Microsoft.Test.OData.Services.ODataWCFService.HomeAddress">
+ <d:Street>1 Microsoft Way</d:Street>
+ <d:City>London</d:City>
+ <d:PostalCode>98052</d:PostalCode>
+ <d:FamilyName>Cats</d:FamilyName>
+ </d:HomeAddress>
+ <d:Home m:type="GeographyPoint">
+ <gml:Point gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
+ <gml:pos>32.1 23.1</gml:pos>
+ </gml:Point>
+ </d:Home>
+ <d:Numbers m:type="#Collection(String)">
+ <m:element>111-111-1111</m:element>
+ </d:Numbers>
+ <d:Emails m:type="#Collection(String)">
+ <m:element>abc@abc.com</m:element>
+ </d:Emails>
+ <d:City>London</d:City>
+ <d:Birthday m:type="DateTimeOffset">1957-04-03T00:00:00Z</d:Birthday>
+ <d:TimeBetweenLastTwoOrders m:type="Duration">PT0.0000001S</d:TimeBetweenLastTwoOrders>
+ </m:properties>
+ </content>
+ </entry>
+ <entry>
+ <id>http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=2)</id>
+ <category term="#Microsoft.Test.OData.Services.ODataWCFService.Customer" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
+ <link rel="edit" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=2)" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Parent" type="application/atom+xml;type=entry" title="Parent" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=2)/Parent" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Orders" type="application/atom+xml;type=feed" title="Orders" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=2)/Orders" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Company" type="application/atom+xml;type=entry" title="Company" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=2)/Company" />
+ <title />
+ <updated>2014-03-31T09:35:14Z</updated>
+ <author>
+ <name />
+ </author>
+ <content type="application/xml">
+ <m:properties>
+ <d:PersonID m:type="Int32">2</d:PersonID>
+ <d:FirstName>Jill</d:FirstName>
+ <d:LastName>Jones</d:LastName>
+ <d:MiddleName m:null="true" />
+ <d:HomeAddress m:null="true" />
+ <d:Home m:type="GeographyPoint">
+ <gml:Point gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
+ <gml:pos>15 161.8</gml:pos>
+ </gml:Point>
+ </d:Home>
+ <d:Numbers m:type="#Collection(String)" />
+ <d:Emails m:type="#Collection(String)" />
+ <d:City>Sydney</d:City>
+ <d:Birthday m:type="DateTimeOffset">1983-01-15T00:00:00Z</d:Birthday>
+ <d:TimeBetweenLastTwoOrders m:type="Duration">PT0.0000002S</d:TimeBetweenLastTwoOrders>
+ </m:properties>
+ </content>
+ </entry>
+</feed>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Employees_3_HomeAddress.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Employees_3_HomeAddress.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Employees_3_HomeAddress.json
new file mode 100644
index 0000000..8748df3
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Employees_3_HomeAddress.json
@@ -0,0 +1,6 @@
+{
+ "@odata.context": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Employees(3)/HomeAddress",
+ "Street": "1 Microsoft Way",
+ "City": "Sydney",
+ "PostalCode": "98052"
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Employees_3_HomeAddress.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Employees_3_HomeAddress.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Employees_3_HomeAddress.xml
new file mode 100644
index 0000000..5029af5
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Employees_3_HomeAddress.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ 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.
+
+-->
+<m:value xmlns:d="http://docs.oasis-open.org/odata/ns/data"
+ xmlns:georss="http://www.georss.org/georss"
+ xmlns:gml="http://www.opengis.net/gml"
+ m:context="http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Employees(3)/HomeAddress"
+ m:type="#Microsoft.Test.OData.Services.ODataWCFService.Address"
+ xmlns:m="http://docs.oasis-open.org/odata/ns/metadata">
+ <d:Street>1 Microsoft Way</d:Street>
+ <d:City>Sydney</d:City>
+ <d:PostalCode>98052</d:PostalCode>
+</m:value>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/PersonDetails_1.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/PersonDetails_1.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/PersonDetails_1.json
new file mode 100644
index 0000000..c8b62d3
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/PersonDetails_1.json
@@ -0,0 +1,22 @@
+{
+ "@odata.context": "http://services.odata.org/V4/OData/OData.svc/$metadata#PersonDetails/$entity",
+ "@odata.type": "#ODataDemo.PersonDetail",
+ "@odata.id": "http://services.odata.org/V4/OData/OData.svc/PersonDetails(1)",
+ "@odata.editLink": "PersonDetails(1)",
+ "PersonID": 1,
+ "Age@odata.type": "#Byte",
+ "Age": 24,
+ "Gender": true,
+ "Phone": "(208) 555-8097",
+ "Address": {
+ "@odata.type": "#ODataDemo.Address",
+ "Street": "187 Suffolk Ln.",
+ "City": "Boise",
+ "State": "ID",
+ "ZipCode": "83720",
+ "Country": "USA"
+ },
+ "Photo@odata.mediaEditLink": "PersonDetails(1)/Photo",
+ "Person@odata.associationLink": "PersonDetails(1)/Person/$ref",
+ "Person@odata.navigationLink": "PersonDetails(1)/Person"
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/PersonDetails_1.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/PersonDetails_1.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/PersonDetails_1.xml
new file mode 100644
index 0000000..e7fce12
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/PersonDetails_1.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ 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.
+
+-->
+<entry xml:base="http://services.odata.org/V4/OData/OData.svc/"
+ xmlns="http://www.w3.org/2005/Atom"
+ xmlns:d="http://docs.oasis-open.org/odata/ns/data"
+ xmlns:m="http://docs.oasis-open.org/odata/ns/metadata"
+ xmlns:georss="http://www.georss.org/georss"
+ xmlns:gml="http://www.opengis.net/gml"
+ m:context="http://services.odata.org/V4/OData/OData.svc/$metadata#PersonDetails/$entity">
+ <id>http://services.odata.org/V4/OData/OData.svc/PersonDetails(1)</id>
+ <category term="#ODataDemo.PersonDetail" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
+ <link rel="edit" title="PersonDetail" href="PersonDetails(1)" />
+ <link rel="http://docs.oasis-open.org/odata/ns/relatedlinks/Person" type="application/xml" title="Person" href="PersonDetails(1)/Person/$ref" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Person" type="application/atom+xml;type=entry" title="Person" href="PersonDetails(1)/Person" />
+ <title />
+ <updated>2014-03-31T10:28:24Z</updated>
+ <author>
+ <name />
+ </author>
+ <link rel="http://docs.oasis-open.org/odata/ns/edit-media/Photo" title="Photo" href="PersonDetails(1)/Photo" />
+ <content type="application/xml">
+ <m:properties>
+ <d:PersonID m:type="Int32">1</d:PersonID>
+ <d:Age m:type="Byte">24</d:Age>
+ <d:Gender m:type="Boolean">true</d:Gender>
+ <d:Phone>(208) 555-8097</d:Phone>
+ <d:Address m:type="#ODataDemo.Address">
+ <d:Street>187 Suffolk Ln.</d:Street>
+ <d:City>Boise</d:City>
+ <d:State>ID</d:State>
+ <d:ZipCode>83720</d:ZipCode>
+ <d:Country>USA</d:Country>
+ </d:Address>
+ </m:properties>
+ </content>
+</entry>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5.json
index 22c8473..0545d78 100644
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5.json
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5.json
@@ -1 +1,29 @@
-{"@odata.context":"http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Products/$entity","@odata.type":"#Microsoft.Test.OData.Services.ODataWCFService.Product","@odata.id":"http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)","@odata.editLink":"http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)","ProductID":5,"Name":"Cheetos","QuantityPerUnit":"100g Bag","UnitPrice@odata.type":"#Single","UnitPrice":3.24,"QuantityInStock":100,"Discontinued":true,"UserAccess@odata.type":"#Microsoft.Test.OData.Services.ODataWCFService.AccessLevel","UserAccess":"None","SkinColor@odata.type":"#Microsoft.Test.OData.Services.ODataWCFService.Color","SkinColor":"Red","CoverColors@odata.type":"#Collection(Microsoft.Test.OData.Services.ODataWCFService.Color)","CoverColors":["Green","Blue","Blue"],"Details@odata.associationLink":"http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)/Details/$ref","Details@odata.navigationLink":
"http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)/Details","#Microsoft.Test.OData.Services.ODataWCFService.AddAccessRight":{"title":"Microsoft.Test.OData.Services.ODataWCFService.AddAccessRight","target":"http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)/Microsoft.Test.OData.Services.ODataWCFService.AddAccessRight"},"#Microsoft.Test.OData.Services.ODataWCFService.GetProductDetails":{"title":"Microsoft.Test.OData.Services.ODataWCFService.GetProductDetails","target":"http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)/Microsoft.Test.OData.Services.ODataWCFService.GetProductDetails"}}
+{
+ "@odata.context": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Products/$entity",
+ "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.Product",
+ "@odata.id": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)",
+ "@odata.editLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)",
+ "ProductID": 5,
+ "Name": "Cheetos",
+ "QuantityPerUnit": "100g Bag",
+ "UnitPrice@odata.type": "#Single",
+ "UnitPrice": 3.24,
+ "QuantityInStock": 100,
+ "Discontinued": true,
+ "UserAccess@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.AccessLevel",
+ "UserAccess": "None",
+ "SkinColor@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.Color",
+ "SkinColor": "Red",
+ "CoverColors@odata.type": "#Collection(Microsoft.Test.OData.Services.ODataWCFService.Color)",
+ "CoverColors": ["Green", "Blue", "Blue"],
+ "Details@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)/Details/$ref",
+ "Details@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)/Details",
+ "#Microsoft.Test.OData.Services.ODataWCFService.AddAccessRight": {
+ "title": "Microsoft.Test.OData.Services.ODataWCFService.AddAccessRight",
+ "target": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)/Microsoft.Test.OData.Services.ODataWCFService.AddAccessRight"
+ },
+ "#Microsoft.Test.OData.Services.ODataWCFService.GetProductDetails": {
+ "title": "Microsoft.Test.OData.Services.ODataWCFService.GetProductDetails",
+ "target": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)/Microsoft.Test.OData.Services.ODataWCFService.GetProductDetails"
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5_CoverColors.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5_CoverColors.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5_CoverColors.json
new file mode 100644
index 0000000..96bf22a
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5_CoverColors.json
@@ -0,0 +1,5 @@
+{
+ "@odata.context": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Products(5)/CoverColors",
+ "@odata.type": "#Collection(Microsoft.Test.OData.Services.ODataWCFService.Color)",
+ "value": ["Green", "Blue", "Blue"]
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5_CoverColors.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5_CoverColors.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5_CoverColors.xml
new file mode 100644
index 0000000..0dab08c
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5_CoverColors.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ 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.
+
+-->
+<m:value xmlns:d="http://docs.oasis-open.org/odata/ns/data"
+ xmlns:georss="http://www.georss.org/georss"
+ xmlns:gml="http://www.opengis.net/gml"
+ m:context="http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Products(5)/CoverColors" m:type="#Collection(Microsoft.Test.OData.Services.ODataWCFService.Color)"
+ xmlns:m="http://docs.oasis-open.org/odata/ns/metadata">
+ <m:element>Green</m:element>
+ <m:element>Blue</m:element>
+ <m:element>Blue</m:element>
+</m:value>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/VipCustomer.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/VipCustomer.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/VipCustomer.xml
index 001c1a9..d233ce9 100644
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/VipCustomer.xml
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/VipCustomer.xml
@@ -37,6 +37,12 @@
<author>
<name />
</author>
+ <m:action metadata="#Microsoft.Test.OData.Services.ODataWCFService.ResetAddress"
+ target="http://odatae2etest.azurewebsites.net/javatest/DefaultService/VipCustomer/Microsoft.Test.OData.Services.ODataWCFService.ResetAddress"
+ title="Microsoft.Test.OData.Services.ODataWCFService.ResetAddress"/>
+ <m:action metadata="#Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress"
+ target="http://odatae2etest.azurewebsites.net/javatest/DefaultService/VipCustomer/Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress"
+ title="Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress"/>
<content type="application/xml">
<m:properties>
<d:PersonID m:type="Int32">1</d:PersonID>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
index 0a8bafb..f41c30c 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
@@ -57,6 +57,8 @@ public interface Constants {
public static final String SELF_LINK_REL = "self";
+ public static final String EDITMEDIA_LINK_REL = "edit-media";
+
public static final String NEXT_LINK_REL = "next";
// XML elements and attributes
@@ -143,16 +145,6 @@ public interface Constants {
public final static String JSON_METADATA_ETAG = "@odata.metadataEtag";
- public final static String JSON_ETAG = "odata.etag";
-
- public final static String JSON_MEDIA_ETAG = "odata.mediaETag";
-
- public final static String JSON_MEDIA_ETAG_SUFFIX = "@" + JSON_MEDIA_ETAG;
-
- public final static String JSON_MEDIA_CONTENT_TYPE = "odata.mediaContentType";
-
- public final static String JSON_MEDIA_CONTENT_TYPE_SUFFIX = "@" + JSON_MEDIA_CONTENT_TYPE;
-
public final static String JSON_BIND_LINK_SUFFIX = "@odata.bind";
public final static String JSON_NULL = "odata.null";
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entry.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entry.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entry.java
index c064216..5e24e8a 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entry.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entry.java
@@ -166,6 +166,20 @@ public interface Entry {
void setMediaContentType(String mediaContentType);
/**
+ * ETag of the binary stream represented by this media entity or named stream property.
+ *
+ * @return media ETag value
+ */
+ String getMediaETag();
+
+ /**
+ * Set media ETag.
+ *
+ * @param eTag media ETag value
+ */
+ void setMediaETag(String eTag);
+
+ /**
* Checks if the current entry is a media entry.
*
* @return 'TRUE' if is a media entry; 'FALSE' otherwise.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataEntity.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataEntity.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataEntity.java
index f4b0d2f..6d832c8 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataEntity.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataEntity.java
@@ -91,6 +91,14 @@ public interface CommonODataEntity extends ODataInvokeResult {
boolean removeLink(ODataLink link);
/**
+ * Gets association link with given name, if available, otherwise <tt>null</tt>.
+ *
+ * @param name candidate link name
+ * @return association link with given name, if available, otherwise <tt>null</tt>
+ */
+ ODataLink getAssociationLink(String name);
+
+ /**
* Returns all entity association links.
*
* @return OData entity links.
@@ -98,6 +106,14 @@ public interface CommonODataEntity extends ODataInvokeResult {
List<ODataLink> getAssociationLinks();
/**
+ * Gets navigation link with given name, if available, otherwise <tt>null</tt>.
+ *
+ * @param name candidate link name
+ * @return navigation link with given name, if available, otherwise <tt>null</tt>
+ */
+ ODataLink getNavigationLink(String name);
+
+ /**
* Returns all entity navigation links (including inline entities / feeds).
*
* @return OData entity links.
@@ -105,6 +121,14 @@ public interface CommonODataEntity extends ODataInvokeResult {
List<ODataLink> getNavigationLinks();
/**
+ * Gets media-edit link with given name, if available, otherwise <tt>null</tt>.
+ *
+ * @param name candidate link name
+ * @return media-edit link with given name, if available, otherwise <tt>null</tt>
+ */
+ ODataLink getEditMediaLink(String name);
+
+ /**
* Returns all entity media edit links.
*
* @return OData entity links.
@@ -174,4 +198,18 @@ public interface CommonODataEntity extends ODataInvokeResult {
*/
void setMediaContentSource(String mediaContentSource);
+ /**
+ * ETag of the binary stream represented by this media entity or named stream property.
+ *
+ * @return media ETag value
+ */
+ String getMediaETag();
+
+ /**
+ * Set media ETag.
+ *
+ * @param eTag media ETag value
+ */
+ void setMediaETag(String eTag);
+
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLink.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLink.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLink.java
index 2735f99..d463511 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLink.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLink.java
@@ -168,6 +168,14 @@ public class ODataLink extends ODataItem {
return type;
}
+ public ODataInlineEntity asInlineEntity() {
+ return (this instanceof ODataInlineEntity) ? (ODataInlineEntity) this : null;
+ }
+
+ public ODataInlineEntitySet asInlineEntitySet() {
+ return (this instanceof ODataInlineEntitySet) ? (ODataInlineEntitySet) this : null;
+ }
+
/**
* Gets link rel.
*
[21/51] [abbrv] git commit: Merge branch 'olingo200' of
https://git-wip-us.apache.org/repos/asf/olingo-odata4 into olingo200
Posted by il...@apache.org.
Merge branch 'olingo200' of https://git-wip-us.apache.org/repos/asf/olingo-odata4 into olingo200
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/72b264e9
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/72b264e9
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/72b264e9
Branch: refs/heads/master
Commit: 72b264e9327ccb3e60f762525dc10c6c8fa86b69
Parents: 96b7a17 583a83d
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Sat Mar 29 06:27:31 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Sat Mar 29 06:27:31 2014 +0100
----------------------------------------------------------------------
.../org/apache/olingo/fit/AbstractServices.java | 8 ++-
.../org/apache/olingo/fit/V4NorthWindExt.java | 3 +-
.../java/org/apache/olingo/fit/V4Services.java | 3 +-
.../utils/ResolvingReferencesInterceptor.java | 57 ++++++++++++++++++++
.../cud/ODataEntityCreateRequestImpl.java | 8 ++-
.../cud/ODataEntityUpdateRequestImpl.java | 8 ++-
.../cud/ODataPropertyUpdateRequestImpl.java | 8 ++-
.../retrieve/ODataPropertyRequestImpl.java | 7 ++-
.../ODataMediaEntityCreateRequestImpl.java | 5 +-
.../ODataMediaEntityUpdateRequestImpl.java | 5 +-
.../core/it/v4/EntityRetrieveTestITCase.java | 26 ++++++---
.../core/op/AbstractODataDeserializer.java | 2 +-
12 files changed, 120 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
[08/51] [abbrv] git commit: Merge from origin/olingo200
Posted by il...@apache.org.
Merge from origin/olingo200
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/59d54d84
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/59d54d84
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/59d54d84
Branch: refs/heads/master
Commit: 59d54d844ea882165afc8ac9ca731b8a8b4723e8
Parents: d12ab65 1a6a548
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Wed Mar 26 18:20:48 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Wed Mar 26 18:20:48 2014 +0100
----------------------------------------------------------------------
.../org/apache/olingo/fit/AbstractServices.java | 37 +-
.../olingo/fit/utils/AbstractXMLUtilities.java | 20 +-
.../org/apache/olingo/fit/utils/Commons.java | 22 +-
.../org/apache/olingo/fit/utils/Constants.java | 10 +-
.../olingo/fit/utils/MetadataLinkInfo.java | 22 +
.../olingo/fit/utils/v4/XMLUtilities.java | 4 +
.../main/resources/v4/Company/entity.full.json | 38 ++
fit/src/main/resources/v4/Company/entity.xml | 49 +++
.../resources/v4/Customers/1/entity.full.json | 67 +++
.../main/resources/v4/Customers/1/entity.xml | 67 +++
.../v4/Customers/1/links/Company.full.json | 4 +
.../resources/v4/Customers/1/links/Company.xml | 22 +
.../v4/Customers/1/links/Orders.full.json | 10 +
.../resources/v4/Customers/1/links/Orders.xml | 25 ++
.../main/resources/v4/Orders/8/entity.full.json | 23 +
fit/src/main/resources/v4/Orders/8/entity.xml | 50 +++
fit/src/main/resources/v4/Orders/8/etag.txt | 1 +
.../main/resources/v4/Orders/8/links/.full.json | 4 +
.../Orders/8/links/CustomerForOrder.full.json | 4 +
.../v4/Orders/8/links/CustomerForOrder.xml | 22 +
fit/src/main/resources/v4/Orders/feed.full.json | 48 +++
fit/src/main/resources/v4/Orders/feed.xml | 72 ++++
.../main/resources/v4/People/5/entity.full.json | 51 +++
fit/src/main/resources/v4/People/5/entity.xml | 55 +++
.../v4/ProductDetails/6 1/entity.full.json | 19 +
.../resources/v4/ProductDetails/6 1/entity.xml | 41 ++
fit/src/main/resources/v4/badRequest.json | 17 +
fit/src/main/resources/v4/badRequest.xml | 30 ++
fit/src/main/resources/v4/notFound.json | 11 +
fit/src/main/resources/v4/notFound.xml | 25 ++
...JkZXJzKDgpL0N1c3RvbWVyRm9yT3JkZXI=.full.json | 4 +
.../T3JkZXJzKDgpL0N1c3RvbWVyRm9yT3JkZXI=.xml | 22 +
.../main/resources/v4/unsupportedMediaType.json | 17 +
.../main/resources/v4/unsupportedMediaType.xml | 34 ++
.../api/communication/header/HeaderName.java | 111 ++++-
.../communication/header/ODataHeaderValues.java | 45 --
.../communication/header/ODataPreferences.java | 424 +++++++++++++++++++
.../api/communication/request/ODataRequest.java | 24 +-
.../olingo/client/api/uri/SegmentType.java | 1 +
.../olingo/client/api/uri/v3/URIBuilder.java | 3 +-
.../olingo/client/api/uri/v4/URIBuilder.java | 20 +-
.../communication/request/ODataRequestImpl.java | 30 +-
.../data/JSONServiceDocumentDeserializer.java | 2 +-
.../client/core/op/AbstractODataBinder.java | 27 +-
.../client/core/uri/AbstractURIBuilder.java | 48 ++-
.../client/core/uri/v4/URIBuilderImpl.java | 14 +-
.../olingo/client/core/v4/ODataClientImpl.java | 4 +-
.../core/it/v3/EntityCreateTestITCase.java | 8 +-
.../core/it/v3/EntityUpdateTestITCase.java | 6 +-
.../core/it/v3/PropertyValueTestITCase.java | 6 +-
.../core/it/v4/EntityRetrieveTestITCase.java | 280 ++++++++++++
.../client/core/it/v4/EntitySetTestITCase.java | 3 +
.../core/it/v4/PropertyValueTestITCase.java | 144 +++++++
.../client/core/uri/v3/URIBuilderTest.java | 20 +-
.../client/core/uri/v4/URIBuilderTest.java | 18 +-
.../apache/olingo/commons/api/Constants.java | 10 +-
.../apache/olingo/commons/api/data/Entry.java | 24 +-
.../apache/olingo/commons/api/data/Feed.java | 16 +-
.../olingo/commons/api/data/Property.java | 10 +
.../api/domain/AbstractODataPayload.java | 52 +++
.../olingo/commons/api/domain/ODataEntity.java | 31 +-
.../commons/api/domain/ODataEntitySet.java | 2 +-
.../olingo/commons/api/domain/ODataItem.java | 26 +-
.../olingo/commons/api/domain/ODataLink.java | 2 -
.../commons/core/data/AbstractAtomDealer.java | 14 +-
.../commons/core/data/AbstractAtomObject.java | 21 +-
.../commons/core/data/AbstractPropertyImpl.java | 18 +
.../commons/core/data/AtomDeserializer.java | 227 +++++-----
.../core/data/AtomPropertyDeserializer.java | 24 +-
.../core/data/AtomPropertySerializer.java | 8 +
.../commons/core/data/AtomSerializer.java | 14 +
.../core/data/JSONEntryDeserializer.java | 17 +-
.../olingo/commons/core/data/JSONEntryImpl.java | 29 +-
.../commons/core/data/JSONEntrySerializer.java | 8 +-
.../commons/core/data/JSONFeedDeserializer.java | 15 +-
.../olingo/commons/core/data/JSONFeedImpl.java | 26 +-
.../commons/core/data/JSONFeedSerializer.java | 10 +-
.../core/data/JSONPropertyDeserializer.java | 17 +-
.../commons/core/data/JSONPropertyImpl.java | 20 -
.../core/data/JSONPropertySerializer.java | 11 +-
.../olingo/commons/core/edm/EdmTypeInfo.java | 1 -
81 files changed, 2483 insertions(+), 355 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/59d54d84/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
----------------------------------------------------------------------
diff --cc lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
index 746b016,bdc3536..a678834
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
@@@ -307,8 -312,11 +313,11 @@@ public abstract class AbstractODataBind
final ODataEntity entity = resource.getSelfLink() == null
? client.getObjectFactory().newEntity(resource.getType())
: client.getObjectFactory().newEntity(resource.getType(),
- URIUtils.getURI(base, resource.getSelfLink().getHref()));
+ URIUtils.getURI(base, resource.getSelfLink().getHref()));
+ entity.setContextURL(resource.getContextURL());
+ entity.setReference(resource.getId());
+
if (StringUtils.isNotBlank(resource.getETag())) {
entity.setETag(resource.getETag());
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/59d54d84/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v3/URIBuilderTest.java
----------------------------------------------------------------------
diff --cc lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v3/URIBuilderTest.java
index 78badef,0000000..e949780
mode 100644,000000..100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v3/URIBuilderTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v3/URIBuilderTest.java
@@@ -1,131 -1,0 +1,149 @@@
+/*
+ * 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.client.core.uri.v3;
+
+import static org.junit.Assert.assertEquals;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.olingo.client.api.v3.ODataClient;
+import org.apache.olingo.client.api.uri.v3.URIBuilder;
+import org.apache.olingo.client.core.AbstractTest;
+import org.junit.Test;
+
+public class URIBuilderTest extends AbstractTest {
+
+ private static final String SERVICE_ROOT = "http://host/service";
+
+ @Override
+ protected ODataClient getClient() {
+ return v3Client;
+ }
+
+ @Test
+ public void metadata() throws URISyntaxException {
+ final URI uri = getClient().getURIBuilder(SERVICE_ROOT).appendMetadataSegment().build();
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/$metadata").build(), uri);
+ }
+
+ @Test
+ public void entity() throws URISyntaxException {
+ final URI uri = getClient().getURIBuilder(SERVICE_ROOT).appendEntitySetSegment("AnEntitySet").
+ appendKeySegment(11).build();
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/AnEntitySet(11)").build(), uri);
+
+ final Map<String, Object> multiKey = new HashMap<String, Object>();
+ multiKey.put("OrderId", -10);
+ multiKey.put("ProductId", -10);
+ URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
+ appendEntitySetSegment("OrderLine").appendKeySegment(multiKey).
+ appendPropertySegment("Quantity").appendValueSegment();
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(
+ SERVICE_ROOT + "/OrderLine(OrderId=-10,ProductId=-10)/Quantity/$value").build(), uriBuilder.build());
+
+ uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
+ appendEntitySetSegment("Customer").appendKeySegment(-10).
+ select("CustomerId", "Name", "Orders").expand("Orders");
+ assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Customer(-10)").
+ addParameter("$select", "CustomerId,Name,Orders").addParameter("$expand", "Orders").build(),
+ uriBuilder.build());
+
+ uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
+ appendEntitySetSegment("Customer").appendKeySegment(-10).appendLinksSegment("Orders");
+ assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Customer(-10)/$links/Orders").build(),
+ uriBuilder.build());
+ }
+
+ @Test
+ public void count() throws URISyntaxException {
+ URI uri = getClient().getURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Products").count().build();
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Products/$count").build(), uri);
+
+ uri = getClient().getURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Products").
+ inlineCount(URIBuilder.InlineCount.allpages).build();
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Products").
+ addParameter("$inlinecount", "allpages").build(), uri);
+ }
+
+ @Test
+ public void filter() throws URISyntaxException {
+ final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).appendEntitySetSegment("AnEntitySet").
+ filter(getClient().getFilterFactory().lt("VIN", 16));
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/AnEntitySet").
+ addParameter("$filter", "(VIN lt 16)").build(),
+ uriBuilder.build());
+ }
+
+ @Test
+ public void unboundAction() throws URISyntaxException {
+ final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
+ appendOperationCallSegment("ProductsByCategoryId",
- Collections.<String, Object>singletonMap("categoryId", 2));
++ Collections.<String, Object>singletonMap("categoryId", 2));
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(
+ SERVICE_ROOT + "/ProductsByCategoryId(categoryId=2)").build(), uriBuilder.build());
+ }
+
+ @Test
+ public void boundAction() throws URISyntaxException {
+ final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
+ appendEntitySetSegment("Products").appendOperationCallSegment("MostExpensive", null);
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(
+ SERVICE_ROOT + "/Products/MostExpensive").build(), uriBuilder.build());
+ }
+
+ @Test
+ public void derived() throws URISyntaxException {
+ final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
+ appendEntitySetSegment("Customers").appendNavigationSegment("Model").
+ appendDerivedEntityTypeSegment("Namespace.VipCustomer").appendKeySegment(1);
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(
+ SERVICE_ROOT + "/Customers/Model/Namespace.VipCustomer(1)").build(), uriBuilder.build());
+ }
++
++ @Test
++ public void expandMoreThenOnce() throws URISyntaxException {
++ URI uri = getClient().getURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Products").appendKeySegment(5).
++ expand("Orders", "Customers").expand("Info").build();
++
++ assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Products(5)").
++ addParameter("$expand", "Orders,Customers,Info").build(), uri);
++ }
++
++ @Test
++ public void selectMoreThenOnce() throws URISyntaxException {
++ URI uri = getClient().getURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Customers").appendKeySegment(5).
++ select("Name", "Surname").expand("Info").select("Gender").build();
++
++ assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Customers(5)").
++ addParameter("$select", "Name,Surname,Gender").addParameter("$expand", "Info").build(), uri);
++ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/59d54d84/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v4/URIBuilderTest.java
----------------------------------------------------------------------
diff --cc lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v4/URIBuilderTest.java
index 1518cf0,0000000..af26059
mode 100644,000000..100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v4/URIBuilderTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v4/URIBuilderTest.java
@@@ -1,136 -1,0 +1,152 @@@
+/*
+ * 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.client.core.uri.v4;
+
+import java.net.URI;
+import java.net.URISyntaxException;
++import java.util.LinkedHashMap;
+
+import org.apache.olingo.client.api.v4.ODataClient;
+import org.apache.olingo.client.api.uri.v4.URIBuilder;
+import org.apache.olingo.client.core.AbstractTest;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class URIBuilderTest extends AbstractTest {
+
+ private static final String SERVICE_ROOT = "http://host/service";
+
+ @Override
+ protected ODataClient getClient() {
+ return v4Client;
+ }
+
+ @Test
++ public void expandWithOptions() throws URISyntaxException {
++ URI uri = getClient().getURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Products").appendKeySegment(5).
++ expandWithOptions("ProductDetails", new LinkedHashMap<String, Object>() {
++ private static final long serialVersionUID = 3109256773218160485L;
++
++ {
++ put("$expand", "ProductInfo");
++ put("$select", "Price");
++ }
++ }).expand("Orders", "Customers").build();
++
++ assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Products(5)").
++ addParameter("$expand", "ProductDetails($expand=ProductInfo,$select=Price),Orders,Customers").build(), uri);
++ }
++
++ @Test
+ public void count() throws URISyntaxException {
+ URI uri = getClient().getURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Products").count().build();
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Products/$count").build(), uri);
+
+ uri = getClient().getURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Products").count(true).build();
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Products").
+ addParameter("$count", "true").build(), uri);
+ }
+
+ @Test
+ public void singleton() throws URISyntaxException {
+ final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
+ appendSingletonSegment("BestProductEverCreated");
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(
+ SERVICE_ROOT + "/BestProductEverCreated").build(), uriBuilder.build());
+ }
+
+ @Test
+ public void entityId() throws URISyntaxException {
+ final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
+ appendEntityIdSegment("Products(0)");
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(
+ SERVICE_ROOT + "/$entity").addParameter("$id", "Products(0)").build(), uriBuilder.build());
+ }
+
+ @Test
+ public void boundAction() throws URISyntaxException {
+ final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
+ appendEntitySetSegment("Categories").appendKeySegment(1).
+ appendNavigationSegment("Products").appendNavigationSegment("Model").
+ appendOperationCallSegment("AllOrders", null);
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(
+ SERVICE_ROOT + "/Categories(1)/Products/Model.AllOrders()").build(), uriBuilder.build());
+ }
+
+ @Test
+ public void ref() throws URISyntaxException {
+ URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
+ appendEntitySetSegment("Categories").appendKeySegment(1).
+ appendNavigationSegment("Products").appendRefSegment();
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(
+ SERVICE_ROOT + "/Categories(1)/Products/$ref").build(), uriBuilder.build());
+
+ uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
+ appendEntitySetSegment("Categories").appendKeySegment(1).
+ appendNavigationSegment("Products").appendRefSegment().id("../../Products(0)");
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(
+ SERVICE_ROOT + "/Categories(1)/Products/$ref").addParameter("$id", "../../Products(0)").build(),
+ uriBuilder.build());
+ }
+
+ @Test
+ public void derived() throws URISyntaxException {
+ final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
+ appendEntitySetSegment("Customers").appendNavigationSegment("Model").
+ appendDerivedEntityTypeSegment("VipCustomer").appendKeySegment(1);
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(
+ SERVICE_ROOT + "/Customers/Model.VipCustomer(1)").build(), uriBuilder.build());
+ }
+
+ @Test
+ public void crossjoin() throws URISyntaxException {
+ final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
+ appendCrossjoinSegment("Products", "Sales");
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(
+ SERVICE_ROOT + "/$crossjoin(Products,Sales)").build(), uriBuilder.build());
+ }
+
+ @Test
+ public void all() throws URISyntaxException {
+ final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).appendAllSegment();
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(
+ SERVICE_ROOT + "/$all").build(), uriBuilder.build());
+ }
+
+ @Test
+ public void search() throws URISyntaxException {
+ final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
+ appendEntitySetSegment("Products").search("blue OR green");
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(
+ SERVICE_ROOT + "/Products").addParameter("$search", "blue OR green").build(), uriBuilder.build());
+ }
-
+}
[39/51] [abbrv] [OLINGO-200] V4 ODataValue full reachable via API
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AbstractTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AbstractTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AbstractTestITCase.java
index 3dc766e..325f2dd 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AbstractTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AbstractTestITCase.java
@@ -19,11 +19,72 @@
package org.apache.olingo.client.core.it.v3;
import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.client.api.communication.ODataClientErrorException;
+import org.apache.olingo.client.api.communication.request.cud.ODataDeleteRequest;
+import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest;
+import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest;
+import org.apache.olingo.client.api.communication.request.cud.UpdateType;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
+import org.apache.olingo.client.api.communication.response.ODataDeleteResponse;
+import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
+import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse;
+import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
+import org.apache.olingo.client.api.http.HttpMethod;
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.api.v3.ODataClient;
import org.apache.olingo.client.core.ODataClientFactory;
+import org.apache.olingo.client.core.uri.URIUtils;
+import org.apache.olingo.commons.api.data.Entry;
+import org.apache.olingo.commons.api.data.Feed;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.ODataInlineEntity;
+import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
+import org.apache.olingo.commons.api.domain.ODataLink;
+import org.apache.olingo.commons.api.domain.ODataValue;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
+import org.apache.olingo.commons.api.domain.v3.ODataProperty;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
+import org.apache.olingo.commons.core.data.AtomEntryImpl;
+import org.apache.olingo.commons.core.data.JSONEntryImpl;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import org.junit.BeforeClass;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public abstract class AbstractTestITCase {
+
+ /**
+ * Logger.
+ */
+ protected static final Logger LOG = LoggerFactory.getLogger(AbstractTestITCase.class);
+
+ protected static final String TEST_PRODUCT_TYPE = "Microsoft.Test.OData.Services.AstoriaDefaultService.Product";
-public abstract class AbstractTestITCase extends org.apache.olingo.client.core.it.AbstractTestITCase {
+ protected static final String servicesODataServiceRootURL =
+ "http://services.odata.org/V3/(S(csquyjnoaywmz5xcdbfhlc1p))/OData/OData.svc/";
protected static ODataClient client;
@@ -45,8 +106,473 @@ public abstract class AbstractTestITCase extends org.apache.olingo.client.core.i
client = ODataClientFactory.getV3();
}
- @Override
protected ODataClient getClient() {
return client;
}
+
+ protected void checkLinks(final Collection<ODataLink> original, final Collection<ODataLink> actual) {
+ assertTrue(original.size() <= actual.size());
+
+ for (ODataLink originalLink : original) {
+ ODataLink foundOriginal = null;
+ ODataLink foundActual = null;
+
+ for (ODataLink actualLink : actual) {
+
+ if (actualLink.getType() == originalLink.getType()
+ && (originalLink.getLink() == null
+ || actualLink.getLink().toASCIIString().endsWith(originalLink.getLink().toASCIIString()))
+ && actualLink.getName().equals(originalLink.getName())) {
+
+ foundOriginal = originalLink;
+ foundActual = actualLink;
+ }
+ }
+
+ assertNotNull(foundOriginal);
+ assertNotNull(foundActual);
+
+ if (foundOriginal instanceof ODataInlineEntity && foundActual instanceof ODataInlineEntity) {
+ final CommonODataEntity originalInline = ((ODataInlineEntity) foundOriginal).getEntity();
+ assertNotNull(originalInline);
+
+ final CommonODataEntity actualInline = ((ODataInlineEntity) foundActual).getEntity();
+ assertNotNull(actualInline);
+
+ checkProperties(originalInline.getProperties(), actualInline.getProperties());
+ }
+ }
+ }
+
+ protected void checkProperties(final Collection<? extends CommonODataProperty> original,
+ final Collection<? extends CommonODataProperty> actual) {
+
+ assertTrue(original.size() <= actual.size());
+
+ // re-organize actual properties into a Map<String, ODataProperty>
+ final Map<String, CommonODataProperty> actualProps = new HashMap<String, CommonODataProperty>(actual.size());
+
+ for (CommonODataProperty prop : actual) {
+ assertFalse(actualProps.containsKey(prop.getName()));
+ actualProps.put(prop.getName(), prop);
+ }
+
+ assertTrue(actual.size() <= actualProps.size());
+
+ for (CommonODataProperty prop : original) {
+ assertNotNull(prop);
+ if (actualProps.containsKey(prop.getName())) {
+ final CommonODataProperty actualProp = actualProps.get(prop.getName());
+ assertNotNull(actualProp);
+
+ if (prop.getValue() != null && actualProp.getValue() != null) {
+ checkPropertyValue(prop.getName(), prop.getValue(), actualProp.getValue());
+ }
+ } else {
+ // nothing ... maybe :FC_KeepInContent="false"
+ // ..... no assert can be done ....
+ }
+ }
+ }
+
+ protected void checkPropertyValue(final String propertyName,
+ final ODataValue original, final ODataValue actual) {
+
+ assertNotNull("Null original value for " + propertyName, original);
+ assertNotNull("Null actual value for " + propertyName, actual);
+
+ assertEquals("Type mismatch for '" + propertyName + "': "
+ + original.getClass().getSimpleName() + "-" + actual.getClass().getSimpleName(),
+ original.getClass().getSimpleName(), actual.getClass().getSimpleName());
+
+ if (original.isComplex()) {
+ final List<CommonODataProperty> originalFileds = new ArrayList<CommonODataProperty>();
+ for (CommonODataProperty prop : original.asComplex()) {
+ originalFileds.add(prop);
+ }
+
+ final List<CommonODataProperty> actualFileds = new ArrayList<CommonODataProperty>();
+ for (CommonODataProperty prop : actual.asComplex()) {
+ actualFileds.add(prop);
+ }
+
+ checkProperties(originalFileds, actualFileds);
+ } else if (original.isCollection()) {
+ assertTrue(original.asCollection().size() <= actual.asCollection().size());
+
+ boolean found = original.asCollection().isEmpty();
+
+ for (ODataValue originalValue : original.asCollection()) {
+ for (ODataValue actualValue : actual.asCollection()) {
+ try {
+ checkPropertyValue(propertyName, originalValue, actualValue);
+ found = true;
+ } catch (AssertionError ignore) {
+ // ignore
+ }
+ }
+ }
+
+ assertTrue("Found " + actual + " but expected " + original, found);
+ } else {
+ assertTrue("Primitive value for '" + propertyName + "' type mismatch: " + original.asPrimitive().
+ getTypeKind() + "-" + actual.asPrimitive().getTypeKind(),
+ original.asPrimitive().getTypeKind().equals(actual.asPrimitive().getTypeKind()));
+
+ assertEquals("Primitive value for '" + propertyName + "' mismatch: " + original.asPrimitive().toString()
+ + "-" + actual.asPrimitive().toString(),
+ original.asPrimitive().toString(), actual.asPrimitive().toString());
+ }
+ }
+
+ protected ODataEntity getSampleCustomerInfo(final int id, final String sampleinfo) {
+ final ODataEntity entity = getClient().getObjectFactory().newEntity(
+ "Microsoft.Test.OData.Services.AstoriaDefaultService.CustomerInfo");
+ entity.setMediaEntity(true);
+
+ getClient().getBinder().add(entity,
+ getClient().getObjectFactory().newPrimitiveProperty("Information",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().setText(sampleinfo).
+ setType(EdmPrimitiveTypeKind.String).build()));
+
+ return entity;
+ }
+
+ protected ODataEntity getSampleCustomerProfile(
+ final int id, final String sampleName, final boolean withInlineInfo) {
+
+ final ODataEntity entity =
+ getClient().getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.Customer");
+
+ // add name attribute
+ getClient().getBinder().add(entity,
+ getClient().getObjectFactory().newPrimitiveProperty("Name",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().setText(sampleName).
+ setType(EdmPrimitiveTypeKind.String).build()));
+
+ // add key attribute
+ getClient().getBinder().add(entity,
+ getClient().getObjectFactory().newPrimitiveProperty("CustomerId",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().setText(String.valueOf(id)).
+ setType(EdmPrimitiveTypeKind.Int32).build()));
+
+ // add BackupContactInfo attribute (collection)
+ final ODataCollectionValue<ODataValue> backupContactInfoValue = getClient().getObjectFactory().newCollectionValue(
+ "Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails)");
+ getClient().getBinder().add(entity,
+ getClient().getObjectFactory().newCollectionProperty("BackupContactInfo", backupContactInfoValue));
+
+ // add BackupContactInfo.ContactDetails attribute (complex)
+ final ODataComplexValue<ODataProperty> contactDetails = getClient().getObjectFactory().newComplexValue(
+ "Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails");
+ backupContactInfoValue.add(contactDetails);
+
+ // add BackupContactInfo.ContactDetails.AlternativeNames attribute (collection)
+ final ODataCollectionValue<ODataValue> altNamesValue = getClient().getObjectFactory().
+ newCollectionValue("Collection(Edm.String)");
+ altNamesValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setText("myname").setType(EdmPrimitiveTypeKind.String).build());
+ contactDetails.add(getClient().getObjectFactory().newCollectionProperty("AlternativeNames", altNamesValue));
+
+ // add BackupContactInfo.ContactDetails.EmailBag attribute (collection)
+ final ODataCollectionValue<ODataValue> emailBagValue = getClient().getObjectFactory().
+ newCollectionValue("Collection(Edm.String)");
+ emailBagValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setText("myname@mydomain.com").setType(EdmPrimitiveTypeKind.String).build());
+ contactDetails.add(getClient().getObjectFactory().newCollectionProperty("EmailBag", emailBagValue));
+
+ // add BackupContactInfo.ContactDetails.ContactAlias attribute (complex)
+ final ODataComplexValue<ODataProperty> contactAliasValue = getClient().getObjectFactory().newComplexValue(
+ "Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases");
+ contactDetails.add(getClient().getObjectFactory().newComplexProperty("ContactAlias", contactAliasValue));
+
+ // add BackupContactInfo.ContactDetails.ContactAlias.AlternativeNames attribute (collection)
+ final ODataCollectionValue<ODataValue> aliasAltNamesValue = getClient().getObjectFactory().
+ newCollectionValue("Collection(Edm.String)");
+ aliasAltNamesValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setText("myAlternativeName").setType(EdmPrimitiveTypeKind.String).build());
+ contactAliasValue.add(getClient().getObjectFactory().newCollectionProperty("AlternativeNames", aliasAltNamesValue));
+
+ if (withInlineInfo) {
+ final ODataInlineEntity inlineInfo = getClient().getObjectFactory().newInlineEntity(
+ "Info",
+ URI.create("Customer(" + id + ")/Info"),
+ getSampleCustomerInfo(id, sampleName + "_Info"));
+ inlineInfo.getEntity().setMediaEntity(true);
+ entity.addLink(inlineInfo);
+ }
+
+ return entity;
+ }
+
+ protected void debugEntry(final Entry entry, final String message) {
+ if (LOG.isDebugEnabled()) {
+ final StringWriter writer = new StringWriter();
+ getClient().getSerializer().entry(entry, writer);
+ writer.flush();
+ LOG.debug(message + "\n{}", writer.toString());
+ }
+ }
+
+ protected void debugFeed(final Feed feed, final String message) {
+ if (LOG.isDebugEnabled()) {
+ final StringWriter writer = new StringWriter();
+ getClient().getSerializer().feed(feed, writer);
+ writer.flush();
+ LOG.debug(message + "\n{}", writer.toString());
+ }
+ }
+
+ protected void debugODataProperty(final ODataProperty property, final String message) {
+ LOG.debug(message + "\n{}", property.toString());
+ }
+
+ protected void debugODataValue(final ODataValue value, final String message) {
+ LOG.debug(message + "\n{}", value.toString());
+ }
+
+ protected void debugODataEntity(final ODataEntity entity, final String message) {
+ if (LOG.isDebugEnabled()) {
+ StringWriter writer = new StringWriter();
+ getClient().getSerializer().entry(getClient().getBinder().getEntry(entity, AtomEntryImpl.class), writer);
+ writer.flush();
+ LOG.debug(message + " (Atom)\n{}", writer.toString());
+
+ writer = new StringWriter();
+ getClient().getSerializer().entry(getClient().getBinder().getEntry(entity, JSONEntryImpl.class), writer);
+ writer.flush();
+ LOG.debug(message + " (JSON)\n{}", writer.toString());
+ }
+ }
+
+ protected void debugInputStream(final InputStream input, final String message) {
+ if (LOG.isDebugEnabled()) {
+ try {
+ LOG.debug(message + "\n{}", IOUtils.toString(input));
+ } catch (IOException e) {
+ LOG.error("Error writing stream", e);
+ } finally {
+ IOUtils.closeQuietly(input);
+ }
+ }
+ }
+
+ protected String getETag(final URI uri) {
+ final ODataRetrieveResponse<ODataEntity> res = getClient().getRetrieveRequestFactory().
+ getEntityRequest(uri).execute();
+ try {
+ return res.getEtag();
+ } finally {
+ res.close();
+ }
+ }
+
+ protected ODataEntity read(final ODataPubFormat format, final URI editLink) {
+ final ODataEntityRequest<ODataEntity> req = getClient().getRetrieveRequestFactory().
+ getEntityRequest(editLink);
+ req.setFormat(format);
+
+ final ODataRetrieveResponse<ODataEntity> res = req.execute();
+ final ODataEntity entity = res.getBody();
+
+ assertNotNull(entity);
+
+ if (ODataPubFormat.JSON_FULL_METADATA == format || ODataPubFormat.ATOM == format) {
+ assertEquals(req.getURI(), entity.getEditLink());
+ }
+
+ return entity;
+ }
+
+ protected ODataEntity createEntity(
+ final String serviceRootURL,
+ final ODataPubFormat format,
+ final ODataEntity original,
+ final String entitySetName) {
+
+ final CommonURIBuilder<?> uriBuilder = getClient().getURIBuilder(serviceRootURL).
+ appendEntitySetSegment(entitySetName);
+
+ debugODataEntity(original, "About to create");
+
+ final ODataEntityCreateRequest<ODataEntity> createReq =
+ getClient().getCUDRequestFactory().getEntityCreateRequest(uriBuilder.build(), original);
+ createReq.setFormat(format);
+
+ final ODataEntityCreateResponse<ODataEntity> createRes = createReq.execute();
+ assertEquals(201, createRes.getStatusCode());
+ assertEquals("Created", createRes.getStatusMessage());
+
+ final ODataEntity created = createRes.getBody();
+ assertNotNull(created);
+
+ debugODataEntity(created, "Just created");
+
+ return created;
+ }
+
+ protected ODataEntity compareEntities(final String serviceRootURL,
+ final ODataPubFormat format,
+ final ODataEntity original,
+ final int actualObjectId,
+ final Collection<String> expands) {
+
+ final CommonURIBuilder<?> uriBuilder = getClient().getURIBuilder(serviceRootURL).
+ appendEntitySetSegment("Customer").appendKeySegment(actualObjectId);
+
+ // search expanded
+ if (expands != null) {
+ for (String expand : expands) {
+ uriBuilder.expand(expand);
+ }
+ }
+
+ final ODataEntityRequest<ODataEntity> req = getClient().getRetrieveRequestFactory().
+ getEntityRequest(uriBuilder.build());
+ req.setFormat(format);
+
+ final ODataRetrieveResponse<ODataEntity> res = req.execute();
+ assertEquals(200, res.getStatusCode());
+
+ final ODataEntity actual = res.getBody();
+ assertNotNull(actual);
+
+ // check defined links
+ checkLinks(original.getAssociationLinks(), actual.getAssociationLinks());
+ checkLinks(original.getEditMediaLinks(), actual.getEditMediaLinks());
+ checkLinks(original.getNavigationLinks(), actual.getNavigationLinks());
+
+ // check defined properties equality
+ checkProperties(original.getProperties(), actual.getProperties());
+
+ return actual;
+ }
+
+ protected void cleanAfterCreate(
+ final ODataPubFormat format,
+ final ODataEntity created,
+ final boolean includeInline,
+ final String baseUri) {
+
+ final Set<URI> toBeDeleted = new HashSet<URI>();
+ toBeDeleted.add(created.getEditLink());
+
+ if (includeInline) {
+ for (ODataLink link : created.getNavigationLinks()) {
+ if (link instanceof ODataInlineEntity) {
+ final CommonODataEntity inline = ((ODataInlineEntity) link).getEntity();
+ if (inline.getEditLink() != null) {
+ toBeDeleted.add(URIUtils.getURI(baseUri, inline.getEditLink().toASCIIString()));
+ }
+ }
+
+ if (link instanceof ODataInlineEntitySet) {
+ final CommonODataEntitySet inline = ((ODataInlineEntitySet) link).getEntitySet();
+ for (CommonODataEntity entity : inline.getEntities()) {
+ if (entity.getEditLink() != null) {
+ toBeDeleted.add(URIUtils.getURI(baseUri, entity.getEditLink().toASCIIString()));
+ }
+ }
+ }
+ }
+ }
+
+ assertFalse(toBeDeleted.isEmpty());
+
+ for (URI link : toBeDeleted) {
+ final ODataDeleteRequest deleteReq = getClient().getCUDRequestFactory().getDeleteRequest(link);
+ final ODataDeleteResponse deleteRes = deleteReq.execute();
+
+ assertEquals(204, deleteRes.getStatusCode());
+ assertEquals("No Content", deleteRes.getStatusMessage());
+
+ deleteRes.close();
+
+ final ODataEntityRequest<ODataEntity> retrieveReq = getClient().getRetrieveRequestFactory().
+ getEntityRequest(link);
+ // bug that needs to be fixed on the SampleService - cannot get entity not found with header
+ // Accept: application/json;odata=minimalmetadata
+ retrieveReq.setFormat(format == ODataPubFormat.JSON_FULL_METADATA ? ODataPubFormat.JSON : format);
+
+ Exception exception = null;
+ try {
+ retrieveReq.execute();
+ fail();
+ } catch (ODataClientErrorException e) {
+ exception = e;
+ assertEquals(404, e.getStatusLine().getStatusCode());
+ }
+ assertNotNull(exception);
+ }
+ }
+
+ protected void updateEntityDescription(
+ final ODataPubFormat format, final ODataEntity changes, final UpdateType type) {
+
+ updateEntityDescription(format, changes, type, null);
+ }
+
+ protected void updateEntityDescription(
+ final ODataPubFormat format, final ODataEntity changes, final UpdateType type, final String etag) {
+
+ updateEntityStringProperty("Description", format, changes, type, etag);
+ }
+
+ protected void updateEntityStringProperty(final String propertyName,
+ final ODataPubFormat format, final ODataEntity changes, final UpdateType type, final String etag) {
+
+ final URI editLink = changes.getEditLink();
+
+ final String newm = "New " + propertyName + "(" + System.currentTimeMillis() + ")";
+
+ ODataProperty propertyValue = changes.getProperty(propertyName);
+
+ final String oldm;
+ if (propertyValue == null) {
+ oldm = null;
+ } else {
+ oldm = propertyValue.getValue().toString();
+ changes.getProperties().remove(propertyValue);
+ }
+
+ assertNotEquals(newm, oldm);
+
+ getClient().getBinder().add(changes,
+ getClient().getObjectFactory().newPrimitiveProperty(propertyName,
+ getClient().getObjectFactory().newPrimitiveValueBuilder().setText(newm).build()));
+
+ update(type, changes, format, etag);
+
+ final ODataEntity actual = read(format, editLink);
+
+ propertyValue = null;
+
+ for (ODataProperty prop : actual.getProperties()) {
+ if (prop.getName().equals(propertyName)) {
+ propertyValue = prop;
+ }
+ }
+
+ assertNotNull(propertyValue);
+ assertEquals(newm, propertyValue.getValue().toString());
+ }
+
+ protected void update(
+ final UpdateType type, final ODataEntity changes, final ODataPubFormat format, final String etag) {
+ final ODataEntityUpdateRequest req = getClient().getCUDRequestFactory().getEntityUpdateRequest(type, changes);
+
+ if (getClient().getConfiguration().isUseXHTTPMethod()) {
+ assertEquals(HttpMethod.POST, req.getMethod());
+ } else {
+ assertEquals(type.getMethod(), req.getMethod());
+ }
+ req.setFormat(format);
+
+ if (StringUtils.isNotBlank(etag)) {
+ req.setIfMatch(etag); // Product include ETag header into the response .....
+ }
+
+ final ODataEntityUpdateResponse res = req.execute();
+ assertEquals(204, res.getStatusCode());
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
index 2a4efee..c6a7c15 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
@@ -18,6 +18,11 @@
*/
package org.apache.olingo.client.core.it.v3;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.net.URI;
import java.util.Collections;
import java.util.HashSet;
@@ -37,21 +42,14 @@ import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse
import org.apache.olingo.client.api.http.NoContentException;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.core.uri.URIUtils;
-import org.apache.olingo.commons.api.domain.CommonODataEntity;
-import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
-import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
import org.apache.olingo.commons.api.domain.ODataLink;
import org.apache.olingo.commons.api.domain.v3.ODataEntity;
import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.v3.ODataProperty;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.format.ODataPubFormat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
import org.junit.Ignore;
import org.junit.Test;
@@ -68,10 +66,10 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
public void createAsAtom() {
final ODataPubFormat format = ODataPubFormat.ATOM;
final int id = 1;
- final CommonODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
+ final ODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
createEntity(getServiceRoot(), format, original, "Customer");
- final CommonODataEntity actual = compareEntities(getServiceRoot(), format, original, id, null);
+ final ODataEntity actual = compareEntities(getServiceRoot(), format, original, id, null);
cleanAfterCreate(format, actual, false, getServiceRoot());
}
@@ -80,10 +78,10 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
public void createAsJSON() {
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
final int id = 2;
- final CommonODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
+ final ODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
createEntity(getServiceRoot(), format, original, "Customer");
- final CommonODataEntity actual = compareEntities(getServiceRoot(), format, original, id, null);
+ final ODataEntity actual = compareEntities(getServiceRoot(), format, original, id, null);
cleanAfterCreate(format, actual, false, getServiceRoot());
}
@@ -92,10 +90,10 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
public void createWithInlineAsAtom() {
final ODataPubFormat format = ODataPubFormat.ATOM;
final int id = 3;
- final CommonODataEntity original = getSampleCustomerProfile(id, "Sample customer", true);
+ final ODataEntity original = getSampleCustomerProfile(id, "Sample customer", true);
createEntity(getServiceRoot(), format, original, "Customer");
- final CommonODataEntity actual =
+ final ODataEntity actual =
compareEntities(getServiceRoot(), format, original, id, Collections.<String>singleton("Info"));
cleanAfterCreate(format, actual, true, getServiceRoot());
@@ -106,10 +104,10 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
// this needs to be full, otherwise there is no mean to recognize links
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
final int id = 4;
- final CommonODataEntity original = getSampleCustomerProfile(id, "Sample customer", true);
+ final ODataEntity original = getSampleCustomerProfile(id, "Sample customer", true);
createEntity(getServiceRoot(), format, original, "Customer");
- final CommonODataEntity actual =
+ final ODataEntity actual =
compareEntities(getServiceRoot(), format, original, id, Collections.<String>singleton("Info"));
cleanAfterCreate(format, actual, true, getServiceRoot());
@@ -119,13 +117,13 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
public void createInlineWithoutLinkAsAtom() {
final ODataPubFormat format = ODataPubFormat.ATOM;
final int id = 5;
- final CommonODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
+ final ODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
original.addLink(client.getObjectFactory().newInlineEntity(
"Info", null, getSampleCustomerInfo(id, "Sample Customer_Info")));
createEntity(getServiceRoot(), format, original, "Customer");
- final CommonODataEntity actual =
+ final ODataEntity actual =
compareEntities(getServiceRoot(), format, original, id, Collections.<String>singleton("Info"));
boolean found = false;
@@ -146,13 +144,13 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
public void createInlineWithoutLinkAsJSON() {
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
final int id = 6;
- final CommonODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
+ final ODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
original.addLink(client.getObjectFactory().newInlineEntity(
"Info", null, getSampleCustomerInfo(id, "Sample Customer_Info")));
createEntity(getServiceRoot(), format, original, "Customer");
- final CommonODataEntity actual =
+ final ODataEntity actual =
compareEntities(getServiceRoot(), format, original, id, Collections.<String>singleton("Info"));
boolean found = false;
@@ -172,7 +170,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
@Test
public void createWithNavigationAsAtom() {
final ODataPubFormat format = ODataPubFormat.ATOM;
- final CommonODataEntity actual = createWithNavigationLink(format, 5);
+ final ODataEntity actual = createWithNavigationLink(format, 5);
cleanAfterCreate(format, actual, false, getServiceRoot());
}
@@ -180,14 +178,14 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
public void createWithNavigationAsJSON() {
// this needs to be full, otherwise there is no mean to recognize links
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
- final CommonODataEntity actual = createWithNavigationLink(format, 6);
+ final ODataEntity actual = createWithNavigationLink(format, 6);
cleanAfterCreate(format, actual, false, getServiceRoot());
}
@Test
public void createWithFeedNavigationAsAtom() throws EdmPrimitiveTypeException {
final ODataPubFormat format = ODataPubFormat.ATOM;
- final CommonODataEntity actual = createWithFeedNavigationLink(format, 7);
+ final ODataEntity actual = createWithFeedNavigationLink(format, 7);
cleanAfterCreate(format, actual, false, getServiceRoot());
}
@@ -195,14 +193,14 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
public void createWithFeedNavigationAsJSON() throws EdmPrimitiveTypeException {
// this needs to be full, otherwise there is no mean to recognize links
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
- final CommonODataEntity actual = createWithFeedNavigationLink(format, 8);
+ final ODataEntity actual = createWithFeedNavigationLink(format, 8);
cleanAfterCreate(format, actual, false, getServiceRoot());
}
@Test
public void createWithBackNavigationAsAtom() throws EdmPrimitiveTypeException {
final ODataPubFormat format = ODataPubFormat.ATOM;
- final CommonODataEntity actual = createWithBackNavigationLink(format, 9);
+ final ODataEntity actual = createWithBackNavigationLink(format, 9);
cleanAfterCreate(format, actual, true, getServiceRoot());
}
@@ -210,7 +208,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
public void createWithBackNavigationAsJSON() throws EdmPrimitiveTypeException {
// this needs to be full, otherwise there is no mean to recognize links
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
- final CommonODataEntity actual = createWithBackNavigationLink(format, 10);
+ final ODataEntity actual = createWithBackNavigationLink(format, 10);
cleanAfterCreate(format, actual, true, getServiceRoot());
}
@@ -227,13 +225,13 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
@Test
public void createReturnNoContent() {
final int id = 1;
- final CommonODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
+ final ODataEntity original = (ODataEntity) getSampleCustomerProfile(id, "Sample customer", false);
- final ODataEntityCreateRequest createReq = client.getCUDRequestFactory().getEntityCreateRequest(
+ final ODataEntityCreateRequest<ODataEntity> createReq = client.getCUDRequestFactory().getEntityCreateRequest(
client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Customer").build(), original);
createReq.setPrefer(new ODataPreferences(client.getServiceVersion()).returnNoContent());
- final ODataEntityCreateResponse createRes = createReq.execute();
+ final ODataEntityCreateResponse<ODataEntity> createRes = createReq.execute();
assertEquals(204, createRes.getStatusCode());
assertEquals(new ODataPreferences(client.getServiceVersion()).returnNoContent(),
createRes.getHeader(HeaderName.preferenceApplied).iterator().next());
@@ -255,10 +253,10 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
@Ignore
public void issue135() {
final int id = 2;
- final CommonODataEntity original = getSampleCustomerProfile(id, "Sample customer for issue 135", false);
+ final ODataEntity original = (ODataEntity) getSampleCustomerProfile(id, "Sample customer for issue 135", false);
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Customer");
- final ODataEntityCreateRequest createReq =
+ final ODataEntityCreateRequest<ODataEntity> createReq =
client.getCUDRequestFactory().getEntityCreateRequest(uriBuilder.build(), original);
createReq.setFormat(ODataPubFormat.JSON_FULL_METADATA);
createReq.setContentType(ContentType.APPLICATION_ATOM_XML.getMimeType());
@@ -278,18 +276,18 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
}
}
- private CommonODataEntity createWithFeedNavigationLink(final ODataPubFormat format, final int id)
+ private ODataEntity createWithFeedNavigationLink(final ODataPubFormat format, final int id)
throws EdmPrimitiveTypeException {
final String sampleName = "Sample customer";
- final CommonODataEntity original = getSampleCustomerProfile(id, sampleName, false);
+ final ODataEntity original = (ODataEntity) getSampleCustomerProfile(id, sampleName, false);
final Set<Integer> keys = new HashSet<Integer>();
keys.add(-100);
keys.add(-101);
for (Integer key : keys) {
- final CommonODataEntity order =
+ final ODataEntity order =
client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.Order");
getClient().getBinder().add(order,
@@ -301,7 +299,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
client.getObjectFactory().newPrimitiveValueBuilder().setValue(id).
setType(EdmPrimitiveTypeKind.Int32).build()));
- final ODataEntityCreateRequest createReq = client.getCUDRequestFactory().getEntityCreateRequest(
+ final ODataEntityCreateRequest<ODataEntity> createReq = client.getCUDRequestFactory().getEntityCreateRequest(
client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Order").build(), order);
createReq.setFormat(format);
@@ -310,9 +308,9 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
createReq.execute().getBody().getEditLink()));
}
- final CommonODataEntity created = createEntity(getServiceRoot(), format, original, "Customer");
+ final ODataEntity created = (ODataEntity) createEntity(getServiceRoot(), format, original, "Customer");
// now, compare the created one with the actual one and go deeply into the associated customer info.....
- final CommonODataEntity actual = compareEntities(getServiceRoot(), format, created, id, null);
+ final ODataEntity actual = (ODataEntity) compareEntities(getServiceRoot(), format, created, id, null);
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
uriBuilder.appendEntitySetSegment("Customer").appendKeySegment(id).appendEntitySetSegment("Orders");
@@ -324,11 +322,11 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
final ODataRetrieveResponse<ODataEntitySet> res = req.execute();
assertEquals(200, res.getStatusCode());
- final CommonODataEntitySet entitySet = res.getBody();
+ final ODataEntitySet entitySet = res.getBody();
assertNotNull(entitySet);
assertEquals(2, entitySet.getCount());
- for (CommonODataEntity entity : entitySet.getEntities()) {
+ for (ODataEntity entity : entitySet.getEntities()) {
final Integer key = entity.getProperty("OrderId").getPrimitiveValue().toCastValue(Integer.class);
final Integer customerId = entity.getProperty("CustomerId").getPrimitiveValue().toCastValue(Integer.class);
assertTrue(keys.contains(key));
@@ -345,16 +343,16 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
return actual;
}
- private CommonODataEntity createWithNavigationLink(final ODataPubFormat format, final int id) {
+ private ODataEntity createWithNavigationLink(final ODataPubFormat format, final int id) {
final String sampleName = "Sample customer";
- final CommonODataEntity original = getSampleCustomerProfile(id, sampleName, false);
+ final ODataEntity original = getSampleCustomerProfile(id, sampleName, false);
original.addLink(client.getObjectFactory().newEntityNavigationLink(
"Info", URI.create(getServiceRoot() + "/CustomerInfo(12)")));
- final CommonODataEntity created = createEntity(getServiceRoot(), format, original, "Customer");
+ final ODataEntity created = createEntity(getServiceRoot(), format, original, "Customer");
// now, compare the created one with the actual one and go deeply into the associated customer info.....
- final CommonODataEntity actual = compareEntities(getServiceRoot(), format, created, id, null);
+ final ODataEntity actual = compareEntities(getServiceRoot(), format, created, id, null);
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
uriBuilder.appendEntitySetSegment("Customer").appendKeySegment(id).appendEntitySetSegment("Info");
@@ -365,12 +363,12 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
final ODataRetrieveResponse<ODataEntity> res = req.execute();
assertEquals(200, res.getStatusCode());
- final CommonODataEntity info = res.getBody();
+ final ODataEntity info = res.getBody();
assertNotNull(info);
boolean found = false;
- for (CommonODataProperty prop : info.getProperties()) {
+ for (ODataProperty prop : info.getProperties()) {
if ("CustomerInfoId".equals(prop.getName())) {
assertEquals("12", prop.getValue().toString());
found = true;
@@ -382,7 +380,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
return actual;
}
- private CommonODataEntity createWithBackNavigationLink(final ODataPubFormat format, final int id)
+ private ODataEntity createWithBackNavigationLink(final ODataPubFormat format, final int id)
throws EdmPrimitiveTypeException {
final String sampleName = "Sample customer";
@@ -451,7 +449,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
}
private void multiKey(final ODataPubFormat format) {
- final CommonODataEntity message = client.getObjectFactory().newEntity(
+ final ODataEntity message = client.getObjectFactory().newEntity(
"Microsoft.Test.OData.Services.AstoriaDefaultService.Message");
getClient().getBinder().add(message,
@@ -481,11 +479,11 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
final CommonURIBuilder<?> builder =
client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Message");
- final ODataEntityCreateRequest req = client.getCUDRequestFactory().getEntityCreateRequest(builder.build(),
- message);
+ final ODataEntityCreateRequest<ODataEntity> req = client.getCUDRequestFactory().
+ getEntityCreateRequest(builder.build(), message);
req.setFormat(format);
- final ODataEntityCreateResponse res = req.execute();
+ final ODataEntityCreateResponse<ODataEntity> res = req.execute();
assertNotNull(res);
assertEquals(201, res.getStatusCode());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
index 6ed898d..223f908 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
@@ -27,7 +27,6 @@ import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateR
import org.apache.olingo.client.api.communication.request.cud.v3.UpdateType;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse;
-import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.domain.v3.ODataEntity;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
@@ -53,7 +52,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
final URI uri = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Product").appendKeySegment(-10).build();
final String etag = getETag(uri);
- final CommonODataEntity merge = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE);
+ final ODataEntity merge = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE);
merge.setEditLink(uri);
updateEntityDescription(format, merge, UpdateType.MERGE, etag);
}
@@ -64,7 +63,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
final URI uri = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Product").appendKeySegment(-10).build();
final String etag = getETag(uri);
- final CommonODataEntity merge = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE);
+ final ODataEntity merge = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE);
merge.setEditLink(uri);
updateEntityDescription(format, merge, UpdateType.MERGE, etag);
}
@@ -75,7 +74,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
final URI uri = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Product").appendKeySegment(-10).build();
final String etag = getETag(uri);
- final CommonODataEntity patch = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE);
+ final ODataEntity patch = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE);
patch.setEditLink(uri);
updateEntityDescription(format, patch, UpdateType.PATCH, etag);
}
@@ -86,7 +85,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
final URI uri = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Product").appendKeySegment(-10).build();
final String etag = getETag(uri);
- final CommonODataEntity patch = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE);
+ final ODataEntity patch = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE);
patch.setEditLink(uri);
updateEntityDescription(format, patch, UpdateType.PATCH, etag);
}
@@ -94,7 +93,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
@Test
public void replaceAsAtom() {
final ODataPubFormat format = ODataPubFormat.ATOM;
- final CommonODataEntity changes = read(format, client.getURIBuilder(getServiceRoot()).
+ final ODataEntity changes = read(format, client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Car").appendKeySegment(14).build());
updateEntityDescription(format, changes, UpdateType.REPLACE);
}
@@ -102,7 +101,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
@Test
public void replaceAsJSON() {
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
- final CommonODataEntity changes = read(format, client.getURIBuilder(getServiceRoot()).
+ final ODataEntity changes = read(format, client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Car").appendKeySegment(14).build());
updateEntityDescription(format, changes, UpdateType.REPLACE);
}
@@ -121,7 +120,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
final URI uri = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Customer").appendKeySegment(-10).build();
- final CommonODataEntity patch =
+ final ODataEntity patch =
client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.Customer");
patch.setEditLink(uri);
@@ -141,7 +140,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(customerInfoURI);
req.setFormat(format);
- CommonODataEntity newInfo = req.execute().getBody();
+ ODataEntity newInfo = req.execute().getBody();
assertEquals(Integer.valueOf(12),
newInfo.getProperty("CustomerInfoId").getPrimitiveValue().toCastValue(Integer.class));
@@ -179,7 +178,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
final LinkedHashMap<String, Object> multiKey = new LinkedHashMap<String, Object>();
multiKey.put("FromUsername", "1");
multiKey.put("MessageId", -10);
- final CommonODataEntity message = read(format, client.getURIBuilder(getServiceRoot()).
+ final ODataEntity message = read(format, client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Message").appendKeySegment(multiKey).build());
message.getAssociationLinks().clear();
message.getNavigationLinks().clear();
@@ -226,7 +225,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
final URI uri = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Product").appendKeySegment(-10).build();
String etag = getETag(uri);
- final CommonODataEntity product = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE);
+ final ODataEntity product = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE);
product.setEditLink(uri);
updateEntityStringProperty("BaseConcurrency",
client.getConfiguration().getDefaultPubFormat(), product, UpdateType.MERGE, etag);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/KeyAsSegmentTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/KeyAsSegmentTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/KeyAsSegmentTestITCase.java
index 4a9d05f..1b4892d 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/KeyAsSegmentTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/KeyAsSegmentTestITCase.java
@@ -22,7 +22,6 @@ import org.apache.olingo.client.api.communication.request.cud.v3.UpdateType;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
-import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.domain.v3.ODataEntity;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.junit.AfterClass;
@@ -68,10 +67,10 @@ public class KeyAsSegmentTestITCase extends AbstractTestITCase {
public void createODataEntityAsAtom() {
final ODataPubFormat format = ODataPubFormat.ATOM;
final int id = 1;
- final CommonODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
+ final ODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
createEntity(testStaticServiceRootURL, format, original, "Customer");
- final CommonODataEntity actual = compareEntities(testStaticServiceRootURL, format, original, id, null);
+ final ODataEntity actual = compareEntities(testStaticServiceRootURL, format, original, id, null);
cleanAfterCreate(format, actual, false, testStaticServiceRootURL);
}
@@ -80,10 +79,10 @@ public class KeyAsSegmentTestITCase extends AbstractTestITCase {
public void createODataEntityAsJSON() {
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
final int id = 2;
- final CommonODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
+ final ODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
createEntity(testStaticServiceRootURL, format, original, "Customer");
- final CommonODataEntity actual = compareEntities(testStaticServiceRootURL, format, original, id, null);
+ final ODataEntity actual = compareEntities(testStaticServiceRootURL, format, original, id, null);
cleanAfterCreate(format, actual, false, testStaticServiceRootURL);
}
@@ -91,7 +90,7 @@ public class KeyAsSegmentTestITCase extends AbstractTestITCase {
@Test
public void replaceODataEntityAsAtom() {
final ODataPubFormat format = ODataPubFormat.ATOM;
- final CommonODataEntity changes = read(format, client.getURIBuilder(testStaticServiceRootURL).
+ final ODataEntity changes = read(format, client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Car").appendKeySegment(14).build());
updateEntityDescription(format, changes, UpdateType.REPLACE);
}
@@ -99,7 +98,7 @@ public class KeyAsSegmentTestITCase extends AbstractTestITCase {
@Test
public void replaceODataEntityAsJSON() {
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
- final CommonODataEntity changes = read(format, client.getURIBuilder(testStaticServiceRootURL).
+ final ODataEntity changes = read(format, client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Car").appendKeySegment(14).build());
updateEntityDescription(format, changes, UpdateType.REPLACE);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
index 3b518d9..1972fec 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
@@ -18,6 +18,11 @@
*/
package org.apache.olingo.client.core.it.v3;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import java.net.URI;
import java.util.ArrayList;
import java.util.Collection;
@@ -39,22 +44,18 @@ import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.domain.CommonODataProperty;
-import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.commons.api.domain.ODataCollectionValue;
import org.apache.olingo.commons.api.domain.ODataComplexValue;
import org.apache.olingo.commons.api.domain.ODataInlineEntity;
import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
import org.apache.olingo.commons.api.domain.ODataLink;
+import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.commons.api.domain.v3.ODataEntity;
import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
import org.apache.olingo.commons.api.domain.v3.ODataProperty;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.format.ODataPubFormat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
import org.junit.Ignore;
import org.junit.Test;
@@ -66,7 +67,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
final ODataPubFormat format = ODataPubFormat.ATOM;
final String contentType = "application/atom+xml";
final String prefer = "return-content";
- final CommonODataEntity actual = createNavigation(format, 20, contentType, prefer);
+ final ODataEntity actual = createNavigation(format, 20, contentType, prefer);
delete(format, actual, false, testStaticServiceRootURL);
}
// create navigation link with JSON full metadata
@@ -76,7 +77,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
final String contentType = "application/json;odata=fullmetadata";
final String prefer = "return-content";
- final CommonODataEntity actual = createNavigation(format, 21, contentType, prefer);
+ final ODataEntity actual = createNavigation(format, 21, contentType, prefer);
delete(format, actual, false, testStaticServiceRootURL);
}
// throws Null pointer exception when the format is JSON No metadata
@@ -86,7 +87,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
final ODataPubFormat format = ODataPubFormat.JSON_NO_METADATA;
final String contentType = "application/json;odata=nometadata";
final String prefer = "return-content";
- final CommonODataEntity actual = createNavigation(format, 22, contentType, prefer);
+ final ODataEntity actual = createNavigation(format, 22, contentType, prefer);
delete(format, actual, false, testStaticServiceRootURL);
}
// test with JSON accept and atom content type
@@ -97,7 +98,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
final String contentType = "application/atom+xml";
final String prefer = "return-content";
- final CommonODataEntity actual = createNavigation(format, 23, contentType, prefer);
+ final ODataEntity actual = createNavigation(format, 23, contentType, prefer);
delete(format, actual, false, testStaticServiceRootURL);
}
// test with JSON full metadata in format and json no metadata in content type
@@ -107,7 +108,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
final String contentType = "application/json;odata=nometadata";
final String prefer = "return-content";
- final CommonODataEntity actual = createNavigation(format, 24, contentType, prefer);
+ final ODataEntity actual = createNavigation(format, 24, contentType, prefer);
delete(format, actual, false, testStaticServiceRootURL);
}
// test with JSON no metadata format and json no metadata in content type
@@ -117,7 +118,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
final ODataPubFormat format = ODataPubFormat.JSON_NO_METADATA;
final String contentType = "application/json;odata=fullmetadata";
final String prefer = "return-content";
- final CommonODataEntity actual = createNavigation(format, 25, contentType, prefer);
+ final ODataEntity actual = createNavigation(format, 25, contentType, prefer);
delete(format, actual, false, testStaticServiceRootURL);
}
// create collection navigation link with ATOM
@@ -127,7 +128,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
final ODataPubFormat format = ODataPubFormat.ATOM;
final String contentType = "application/atom+xml";
final String prefer = "return-content";
- final CommonODataEntity actual = createCollectionNavigation(format, 55, contentType, prefer);
+ final ODataEntity actual = createCollectionNavigation(format, 55, contentType, prefer);
delete(format, actual, false, testStaticServiceRootURL);
}
// create collection navigation link with JSON
@@ -137,22 +138,22 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
final String contentType = "application/json;odata=fullmetadata";
final String prefer = "return-content";
- final CommonODataEntity actual = createCollectionNavigation(format, 77, contentType, prefer);
+ final ODataEntity actual = createCollectionNavigation(format, 77, contentType, prefer);
delete(format, actual, false, testStaticServiceRootURL);
}
// create a navigation link
- public CommonODataEntity createNavigation(final ODataPubFormat format, final int id, final String contenttype,
+ public ODataEntity createNavigation(final ODataPubFormat format, final int id, final String contenttype,
final String prefer) {
final String name = "Customer Navigation test";
- final CommonODataEntity original = getNewCustomer(id, name, false);
+ final ODataEntity original = getNewCustomer(id, name, false);
original.addLink(client.getObjectFactory().newEntityNavigationLink(
"Info", URI.create(testStaticServiceRootURL + "/CustomerInfo(11)")));
- final CommonODataEntity created = createNav(testStaticServiceRootURL, format, original, "Customer", contenttype,
+ final ODataEntity created = createNav(testStaticServiceRootURL, format, original, "Customer", contenttype,
prefer);
- final CommonODataEntity actual = validateEntities(testStaticServiceRootURL, format, created, id, null, "Customer");
+ final ODataEntity actual = validateEntities(testStaticServiceRootURL, format, created, id, null, "Customer");
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL);
uriBuilder.appendEntitySetSegment("Customer").appendKeySegment(id).appendEntitySetSegment("Info");
@@ -175,38 +176,38 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
}
// create a navigation link
- public CommonODataEntity createNav(final String url, final ODataPubFormat format, final CommonODataEntity original,
+ public ODataEntity createNav(final String url, final ODataPubFormat format, final ODataEntity original,
final String entitySetName, final String contentType, final String prefer) {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(url);
uriBuilder.appendEntitySetSegment(entitySetName);
- final ODataEntityCreateRequest createReq =
+ final ODataEntityCreateRequest<ODataEntity> createReq =
client.getCUDRequestFactory().getEntityCreateRequest(uriBuilder.build(), original);
createReq.setFormat(format);
createReq.setContentType(contentType);
createReq.setPrefer(prefer);
- final ODataEntityCreateResponse createRes = createReq.execute();
+ final ODataEntityCreateResponse<ODataEntity> createRes = createReq.execute();
assertEquals(201, createRes.getStatusCode());
assertEquals("Created", createRes.getStatusMessage());
- final CommonODataEntity created = createRes.getBody();
+ final ODataEntity created = createRes.getBody();
assertNotNull(created);
return created;
}
// create collection navigation link
- public CommonODataEntity createCollectionNavigation(final ODataPubFormat format, final int id,
+ public ODataEntity createCollectionNavigation(final ODataPubFormat format, final int id,
final String contentType, final String prefer) throws EdmPrimitiveTypeException {
{
final String name = "Collection Navigation Key Customer";
- final CommonODataEntity original = getNewCustomer(id, name, false);
+ final ODataEntity original = getNewCustomer(id, name, false);
final Set<Integer> navigationKeys = new HashSet<Integer>();
navigationKeys.add(-118);
navigationKeys.add(-119);
for (Integer key : navigationKeys) {
- final CommonODataEntity orderEntity =
+ final ODataEntity orderEntity =
client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.Order");
getClient().getBinder().add(orderEntity,
@@ -218,7 +219,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
client.getObjectFactory().newPrimitiveValueBuilder().setValue(id).
setType(EdmPrimitiveTypeKind.Int32).build()));
- final ODataEntityCreateRequest createReq = client.getCUDRequestFactory().getEntityCreateRequest(
+ final ODataEntityCreateRequest<ODataEntity> createReq = client.getCUDRequestFactory().getEntityCreateRequest(
client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Order").build(),
orderEntity);
createReq.setFormat(format);
@@ -227,9 +228,9 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
"Orders",
createReq.execute().getBody().getEditLink()));
}
- final CommonODataEntity createdEntity = createNav(testStaticServiceRootURL, format, original, "Customer",
+ final ODataEntity createdEntity = createNav(testStaticServiceRootURL, format, original, "Customer",
contentType, prefer);
- final CommonODataEntity actualEntity =
+ final ODataEntity actualEntity =
validateEntities(testStaticServiceRootURL, format, createdEntity, id, null, "Customer");
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL);
@@ -242,12 +243,12 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
final ODataRetrieveResponse<ODataEntitySet> res = req.execute();
assertEquals(200, res.getStatusCode());
- final CommonODataEntitySet entitySet = res.getBody();
+ final ODataEntitySet entitySet = res.getBody();
assertNotNull(entitySet);
assertEquals(2, entitySet.getCount());
- for (CommonODataEntity entity : entitySet.getEntities()) {
+ for (ODataEntity entity : entitySet.getEntities()) {
final Integer key = entity.getProperty("OrderId").getPrimitiveValue().toCastValue(Integer.class);
final Integer customerId = entity.getProperty("CustomerId").getPrimitiveValue().toCastValue(Integer.class);
assertTrue(navigationKeys.contains(key));
@@ -265,10 +266,10 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
}
// get a Customer entity to be created
- public CommonODataEntity getNewCustomer(
+ public ODataEntity getNewCustomer(
final int id, final String name, final boolean withInlineInfo) {
- final CommonODataEntity entity =
+ final ODataEntity entity =
client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.Customer");
// add name attribute
@@ -284,35 +285,35 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
client.getObjectFactory().newPrimitiveValueBuilder().setText(String.valueOf(id)).
setType(EdmPrimitiveTypeKind.Int32).build()));
}
- final ODataCollectionValue backupContactInfoValue = getClient().getObjectFactory().newCollectionValue(
+ final ODataCollectionValue<ODataValue> backupContactInfoValue = getClient().getObjectFactory().newCollectionValue(
"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails)");
- final ODataComplexValue contactDetails = getClient().getObjectFactory().newComplexValue(
+ final ODataComplexValue<ODataProperty> contactDetails = getClient().getObjectFactory().newComplexValue(
"Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails");
- final ODataCollectionValue altNamesValue = getClient().getObjectFactory().
+ final ODataCollectionValue<ODataValue> altNamesValue = getClient().getObjectFactory().
newCollectionValue("Collection(Edm.String)");
altNamesValue.add(client.getObjectFactory().newPrimitiveValueBuilder().
setText("My Alternative name").setType(EdmPrimitiveTypeKind.String).build());
contactDetails.add(client.getObjectFactory().newCollectionProperty("AlternativeNames", altNamesValue));
- final ODataCollectionValue emailBagValue = getClient().getObjectFactory().
+ final ODataCollectionValue<ODataValue> emailBagValue = getClient().getObjectFactory().
newCollectionValue("Collection(Edm.String)");
emailBagValue.add(client.getObjectFactory().newPrimitiveValueBuilder().
setText("altname@mydomain.com").setType(EdmPrimitiveTypeKind.String).build());
contactDetails.add(client.getObjectFactory().newCollectionProperty("EmailBag", emailBagValue));
- final ODataComplexValue contactAliasValue = getClient().getObjectFactory().newComplexValue(
+ final ODataComplexValue<ODataProperty> contactAliasValue = getClient().getObjectFactory().newComplexValue(
"Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases");
contactDetails.add(client.getObjectFactory().newComplexProperty("ContactAlias", contactAliasValue));
- final ODataCollectionValue aliasAltNamesValue = getClient().getObjectFactory().
+ final ODataCollectionValue<ODataValue> aliasAltNamesValue = getClient().getObjectFactory().
newCollectionValue("Collection(Edm.String)");
aliasAltNamesValue.add(client.getObjectFactory().newPrimitiveValueBuilder().
setText("myAlternativeName").setType(EdmPrimitiveTypeKind.String).build());
contactAliasValue.add(client.getObjectFactory().newCollectionProperty("AlternativeNames", aliasAltNamesValue));
- final ODataComplexValue homePhone = getClient().getObjectFactory().newComplexValue(
+ final ODataComplexValue<ODataProperty> homePhone = getClient().getObjectFactory().newComplexValue(
"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone");
homePhone.add(client.getObjectFactory().newPrimitiveProperty("PhoneNumber",
client.getObjectFactory().newPrimitiveValueBuilder().setText("8437568356834568").
@@ -338,7 +339,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
}
//delete an entity and associated links after creation
- public void delete(final ODataPubFormat format, final CommonODataEntity created, final boolean includeInline,
+ public void delete(final ODataPubFormat format, final ODataEntity created, final boolean includeInline,
final String baseUri) {
final Set<URI> toBeDeleted = new HashSet<URI>();
toBeDeleted.add(created.getEditLink());
@@ -376,8 +377,8 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
}
// add Information property
- public CommonODataEntity getInfo(final int id, final String info) {
- final CommonODataEntity entity =
+ public ODataEntity getInfo(final int id, final String info) {
+ final ODataEntity entity =
client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.CustomerInfo");
entity.setMediaEntity(true);
@@ -388,9 +389,9 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
}
// validate newly created entities
- public CommonODataEntity validateEntities(final String serviceRootURL,
+ public ODataEntity validateEntities(final String serviceRootURL,
final ODataPubFormat format,
- final CommonODataEntity original,
+ final ODataEntity original,
final int actualObjectId,
final Collection<String> expands, final String entitySetName) {
@@ -501,7 +502,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
}
final List<CommonODataProperty> actualPropertyValue = new ArrayList<CommonODataProperty>();
- for (CommonODataProperty prop : (ODataComplexValue) actual) {
+ for (CommonODataProperty prop : actual.asComplex()) {
actualPropertyValue.add(prop);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
index f576a03..3a90d70 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
@@ -18,9 +18,6 @@
*/
package org.apache.olingo.client.core.it.v3;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -28,10 +25,11 @@ import java.util.UUID;
import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest;
import org.apache.olingo.client.api.communication.response.ODataDeleteResponse;
import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
-import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.client.api.uri.v3.URIBuilder;
import org.apache.olingo.commons.api.domain.CommonODataEntity;
-import org.apache.olingo.commons.api.format.ODataPubFormat;
-import org.apache.olingo.client.api.uri.CommonURIBuilder;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
+import org.apache.olingo.commons.api.domain.v3.ODataProperty;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.EdmSchema;
@@ -43,6 +41,10 @@ import org.apache.olingo.commons.api.edm.geo.MultiPoint;
import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
import org.apache.olingo.commons.api.edm.geo.Point;
import org.apache.olingo.commons.api.edm.geo.Polygon;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
import org.junit.Ignore;
import org.junit.Test;
@@ -61,10 +63,10 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
// assertTrue(metadata.getEntityType(new FullQualifiedName(schema.getNamespace(), "RowIndex")).isOpenType());
}
- private CommonODataEntity readRow(final ODataPubFormat format, final String uuid) {
- final CommonURIBuilder<?> builder = client.getURIBuilder(testStaticServiceRootURL).
+ private ODataEntity readRow(final ODataPubFormat format, final String uuid) {
+ final URIBuilder builder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Row").appendKeySegment(UUID.fromString(uuid));
- return read(format, builder.build());
+ return (ODataEntity) read(format, builder.build());
}
private void read(final ODataPubFormat format) {
@@ -91,7 +93,7 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
private void cud(final ODataPubFormat format) {
final UUID guid = UUID.randomUUID();
- CommonODataEntity row = client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.OpenTypesService.Row");
+ ODataEntity row = client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.OpenTypesService.Row");
getClient().getBinder().add(row,
client.getObjectFactory().newPrimitiveProperty("Id",
client.getObjectFactory().newPrimitiveValueBuilder().
@@ -192,7 +194,7 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
setType(EdmPrimitiveTypeKind.GeographyCollection).
setValue(geoColl).build()));
- final ODataComplexValue contactDetails = client.getObjectFactory().newComplexValue(
+ final ODataComplexValue<ODataProperty> contactDetails = client.getObjectFactory().newComplexValue(
"Microsoft.Test.OData.Services.OpenTypesService.ContactDetails");
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("FirstContacted",
client.getObjectFactory().newPrimitiveValueBuilder().
@@ -233,11 +235,11 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
getClient().getBinder().add(row,
client.getObjectFactory().newComplexProperty("aContact", contactDetails));
- final ODataEntityCreateRequest createReq = client.getCUDRequestFactory().
+ final ODataEntityCreateRequest<ODataEntity> createReq = client.getCUDRequestFactory().
getEntityCreateRequest(client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Row").build(), row);
createReq.setFormat(format);
- final ODataEntityCreateResponse createRes = createReq.execute();
+ final ODataEntityCreateResponse<ODataEntity> createRes = createReq.execute();
assertEquals(201, createRes.getStatusCode());
row = readRow(format, guid.toString());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
index 9d10d24..f98e12a 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
@@ -18,6 +18,11 @@
*/
package org.apache.olingo.client.core.it.v3;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import java.io.IOException;
import org.apache.olingo.client.api.communication.ODataClientErrorException;
import org.apache.olingo.client.api.communication.request.cud.ODataPropertyUpdateRequest;
@@ -36,14 +41,11 @@ import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataCollectionValue;
import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
+import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.commons.api.domain.v3.ODataProperty;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.format.ODataValueFormat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
import org.junit.Test;
/**
@@ -218,7 +220,7 @@ public class PropertyTestITCase extends AbstractTestITCase {
final String newItem = "new item " + System.currentTimeMillis();
- final ODataCollectionValue originalValue =
+ final ODataCollectionValue<ODataValue> originalValue =
primaryContactInfo.getComplexValue().get("EmailBag").getCollectionValue();
final int origSize = originalValue.size();
@@ -266,7 +268,7 @@ public class PropertyTestITCase extends AbstractTestITCase {
final String newItem = "new item " + System.currentTimeMillis();
- final ODataCollectionValue originalValue = alternativeNames.getCollectionValue();
+ final ODataCollectionValue<ODataValue> originalValue = alternativeNames.getCollectionValue();
final int origSize = originalValue.size();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/AbstractTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/AbstractTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/AbstractTestITCase.java
index a745380..28cb871 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/AbstractTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/AbstractTestITCase.java
@@ -23,7 +23,7 @@ import org.apache.olingo.client.api.v4.ODataClient;
import org.apache.olingo.client.core.ODataClientFactory;
import org.junit.BeforeClass;
-public abstract class AbstractTestITCase extends org.apache.olingo.client.core.it.AbstractTestITCase {
+public abstract class AbstractTestITCase {
protected static ODataClient client;
@@ -45,7 +45,6 @@ public abstract class AbstractTestITCase extends org.apache.olingo.client.core.i
client = ODataClientFactory.getV4();
}
- @Override
protected ODataClient getClient() {
return client;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityRetrieveTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityRetrieveTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityRetrieveTestITCase.java
index 7806fd0..989dd98 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityRetrieveTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityRetrieveTestITCase.java
@@ -18,6 +18,11 @@
*/
package org.apache.olingo.client.core.it.v4;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
import java.net.URI;
import java.util.LinkedHashMap;
import java.util.List;
@@ -27,7 +32,6 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataRawReque
import org.apache.olingo.client.api.communication.response.ODataRawResponse;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
-import static org.apache.olingo.client.core.it.v4.AbstractTestITCase.client;
import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.domain.CommonODataProperty;
@@ -38,12 +42,6 @@ import org.apache.olingo.commons.api.domain.v4.ODataEntity;
import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.format.ODataPubFormat;
-import org.apache.olingo.commons.core.op.ResourceFactory;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
import org.junit.Ignore;
import org.junit.Test;
@@ -81,9 +79,6 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
final CommonODataEntity inline = ((ODataInlineEntity) link).getEntity();
assertNotNull(inline);
- debugEntry(client.getBinder().getEntry(
- inline, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)), "Just read");
-
final List<? extends CommonODataProperty> properties = inline.getProperties();
assertEquals(5, properties.size());
@@ -136,9 +131,6 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
final CommonODataEntitySet inline = ((ODataInlineEntitySet) link).getEntitySet();
assertNotNull(inline);
- debugFeed(client.getBinder().getFeed(inline, ResourceFactory.feedClassForFormat(
- format == ODataPubFormat.ATOM)), "Just read");
-
found = true;
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
index c354a1d..bc0905c 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
@@ -36,7 +36,6 @@ import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.domain.v4.ODataEntity;
import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
import org.apache.olingo.commons.api.format.ODataPubFormat;
-import org.apache.olingo.commons.core.op.ResourceFactory;
import org.junit.Ignore;
import org.junit.Test;
@@ -109,9 +108,6 @@ public class EntitySetTestITCase extends AbstractTestITCase {
assertTrue(res.getContextURL().toASCIIString().endsWith("$metadata#People"));
- debugFeed(client.getBinder().getFeed(feed, ResourceFactory.feedClassForFormat(
- ODataPubFormat.ATOM == format)), "Just retrieved feed");
-
assertEquals(5, feed.getEntities().size());
assertNotNull(feed.getNext());
[30/51] [abbrv] [OLINGO-200] Introducing specialization for V3 and V4
domain objects
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityRetrieveTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityRetrieveTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityRetrieveTestITCase.java
index 6d2a89d..7806fd0 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityRetrieveTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityRetrieveTestITCase.java
@@ -19,11 +19,6 @@
package org.apache.olingo.client.core.it.v4;
import java.net.URI;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
import java.util.LinkedHashMap;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
@@ -31,17 +26,24 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRe
import org.apache.olingo.client.api.communication.request.retrieve.ODataRawRequest;
import org.apache.olingo.client.api.communication.response.ODataRawResponse;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
+import static org.apache.olingo.client.core.it.v4.AbstractTestITCase.client;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataInlineEntity;
import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
import org.apache.olingo.commons.api.domain.ODataLink;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.v4.ODataEntity;
+import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.format.ODataPubFormat;
-import org.apache.olingo.client.api.uri.CommonURIBuilder;
-import static org.apache.olingo.client.core.it.v4.AbstractTestITCase.client;
import org.apache.olingo.commons.core.op.ResourceFactory;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
import org.junit.Ignore;
import org.junit.Test;
@@ -58,11 +60,12 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Customers").appendKeySegment(1).expand("Company");
- final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().
+ getEntityRequest(uriBuilder.build());
req.setFormat(format);
final ODataRetrieveResponse<ODataEntity> res = req.execute();
- final ODataEntity entity = res.getBody();
+ final CommonODataEntity entity = res.getBody();
assertNotNull(entity);
assertEquals("#Microsoft.Test.OData.Services.ODataWCFService.Customer", entity.getName());
@@ -75,13 +78,13 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
for (ODataLink link : entity.getNavigationLinks()) {
if (link instanceof ODataInlineEntity) {
- final ODataEntity inline = ((ODataInlineEntity) link).getEntity();
+ final CommonODataEntity inline = ((ODataInlineEntity) link).getEntity();
assertNotNull(inline);
debugEntry(client.getBinder().getEntry(
inline, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)), "Just read");
- final List<ODataProperty> properties = inline.getProperties();
+ final List<? extends CommonODataProperty> properties = inline.getProperties();
assertEquals(5, properties.size());
assertTrue(properties.get(0).getName().equals("CompanyID")
@@ -118,18 +121,19 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Customers").appendKeySegment(1).expand("Orders");
- final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().
+ getEntityRequest(uriBuilder.build());
req.setFormat(format);
final ODataRetrieveResponse<ODataEntity> res = req.execute();
- final ODataEntity entity = res.getBody();
+ final CommonODataEntity entity = res.getBody();
assertNotNull(entity);
boolean found = false;
for (ODataLink link : entity.getNavigationLinks()) {
if (link instanceof ODataInlineEntitySet) {
- final ODataEntitySet inline = ((ODataInlineEntitySet) link).getEntitySet();
+ final CommonODataEntitySet inline = ((ODataInlineEntitySet) link).getEntitySet();
assertNotNull(inline);
debugFeed(client.getBinder().getFeed(inline, ResourceFactory.feedClassForFormat(
@@ -191,11 +195,11 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("ProductDetails").appendKeySegment(multiKey);
- final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setFormat(format);
final ODataRetrieveResponse<ODataEntity> res = req.execute();
- final ODataEntity entity = res.getBody();
+ final CommonODataEntity entity = res.getBody();
assertNotNull(entity);
assertEquals(Integer.valueOf(1),
entity.getProperty("ProductDetailID").getPrimitiveValue().toCastValue(Integer.class));
@@ -227,7 +231,7 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
final CommonURIBuilder<?> uriBuilder =
client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Orders").appendKeySegment(8);
- final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setFormat(format);
final ODataRetrieveResponse<ODataEntity> res = req.execute();
@@ -236,7 +240,7 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
final String etag = res.getEtag();
assertTrue(StringUtils.isNotBlank(etag));
- final ODataEntity order = res.getBody();
+ final CommonODataEntity order = res.getBody();
assertEquals(etag, order.getETag());
}
@@ -245,7 +249,7 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
public void issue99() {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Car");
- final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setFormat(ODataPubFormat.JSON);
// this statement should cause an IllegalArgumentException bearing JsonParseException
@@ -269,7 +273,7 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
appendEntitySetSegment("Orders").appendKeySegment(8).appendNavigationSegment("CustomerForOrder").
appendRefSegment();
- ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setFormat(format);
ODataRetrieveResponse<ODataEntity> res = req.execute();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
index 2d78a6d..a73ce7a 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
@@ -18,10 +18,6 @@
*/
package org.apache.olingo.client.core.it.v4;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
import java.io.IOException;
import java.net.URI;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest;
@@ -32,9 +28,14 @@ import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse
import org.apache.olingo.client.api.domain.ODataEntitySetIterator;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.core.uri.URIUtils;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
+import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.commons.core.op.ResourceFactory;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import org.junit.Ignore;
import org.junit.Test;
@@ -96,11 +97,12 @@ public class EntitySetTestITCase extends AbstractTestITCase {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
uriBuilder.appendEntitySetSegment("People");
- final ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
+ final ODataEntitySetRequest<ODataEntitySet> req = client.getRetrieveRequestFactory().
+ getEntitySetRequest(uriBuilder.build());
req.setFormat(format);
final ODataRetrieveResponse<ODataEntitySet> res = req.execute();
- final ODataEntitySet feed = res.getBody();
+ final CommonODataEntitySet feed = res.getBody();
assertNotNull(feed);
@@ -151,7 +153,7 @@ public class EntitySetTestITCase extends AbstractTestITCase {
final ODataRawResponse res = req.execute();
assertNotNull(res);
- final ODataEntitySet entitySet = res.getBodyAs(ODataEntitySet.class);
+ final CommonODataEntitySet entitySet = res.getBodyAs(CommonODataEntitySet.class);
assertNotNull(entitySet);
assertTrue(res.getContextURL().toASCIIString().endsWith("$metadata#People"));
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/PropertyValueTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/PropertyValueTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/PropertyValueTestITCase.java
index 93ee5fe..cddd66d 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/PropertyValueTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/PropertyValueTestITCase.java
@@ -18,20 +18,20 @@
*/
package org.apache.olingo.client.core.it.v4;
-import static org.junit.Assert.*;
import java.io.IOException;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.communication.ODataClientErrorException;
import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataValueRequest;
-import org.apache.olingo.commons.api.format.ODataValueFormat;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.v4.ODataProperty;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.format.ODataValueFormat;
+import static org.junit.Assert.*;
import org.junit.Test;
public class PropertyValueTestITCase extends AbstractTestITCase {
@@ -124,7 +124,8 @@ public class PropertyValueTestITCase extends AbstractTestITCase {
public void retrieveCollectionPropertyValueTest() {
CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("Numbers");
- final ODataPropertyRequest req = client.getRetrieveRequestFactory().getPropertyRequest(uriBuilder.build());
+ final ODataPropertyRequest<ODataProperty> req = client.getRetrieveRequestFactory().
+ getPropertyRequest(uriBuilder.build());
req.setFormat(ODataFormat.XML);
final ODataProperty property = req.execute().getBody();
assertTrue(property.getValue().isCollection());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java
index 0812c6d..1f02432 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java
@@ -24,7 +24,7 @@ import static org.junit.Assert.assertEquals;
import java.io.IOException;
import java.io.InputStream;
import org.apache.olingo.client.api.v3.ODataClient;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.core.AbstractTest;
import org.apache.olingo.commons.core.op.ResourceFactory;
@@ -39,14 +39,14 @@ public class EntitySetTest extends AbstractTest {
private void read(final ODataPubFormat format) throws IOException {
final InputStream input = getClass().getResourceAsStream("Customer." + getSuffix(format));
- final ODataEntitySet entitySet = getClient().getBinder().getODataEntitySet(
+ final CommonODataEntitySet entitySet = getClient().getBinder().getODataEntitySet(
getClient().getDeserializer().toFeed(input, format).getObject());
assertNotNull(entitySet);
assertEquals(2, entitySet.getEntities().size());
assertNotNull(entitySet.getNext());
- final ODataEntitySet written = getClient().getBinder().getODataEntitySet(getClient().
+ final CommonODataEntitySet written = getClient().getBinder().getODataEntitySet(getClient().
getBinder().getFeed(entitySet, ResourceFactory.feedClassForFormat(format == ODataPubFormat.ATOM)));
assertEquals(entitySet, written);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
index 80c56c2..fe5b148 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
@@ -24,9 +24,9 @@ import static org.junit.Assert.assertTrue;
import java.io.InputStream;
import org.apache.olingo.client.api.v3.ODataClient;
-import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.domain.ODataLink;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.core.AbstractTest;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
@@ -45,7 +45,7 @@ public class EntityTest extends AbstractTest {
private void readAndWrite(final ODataPubFormat format) {
final InputStream input = getClass().getResourceAsStream("Customer_-10." + getSuffix(format));
- final ODataEntity entity = getClient().getBinder().getODataEntity(
+ final CommonODataEntity entity = getClient().getBinder().getODataEntity(
getClient().getDeserializer().toEntry(input, format).getObject());
assertNotNull(entity);
@@ -64,7 +64,7 @@ public class EntityTest extends AbstractTest {
assertTrue(check);
- final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
+ final CommonODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
assertEquals(entity, written);
}
@@ -81,12 +81,12 @@ public class EntityTest extends AbstractTest {
private void readGeospatial(final ODataPubFormat format) {
final InputStream input = getClass().getResourceAsStream("AllGeoTypesSet_-8." + getSuffix(format));
- final ODataEntity entity = getClient().getBinder().getODataEntity(
+ final CommonODataEntity entity = getClient().getBinder().getODataEntity(
getClient().getDeserializer().toEntry(input, format).getObject());
assertNotNull(entity);
boolean found = false;
- for (ODataProperty property : entity.getProperties()) {
+ for (CommonODataProperty property : entity.getProperties()) {
if ("GeogMultiLine".equals(property.getName())) {
found = true;
assertTrue(property.hasPrimitiveValue());
@@ -95,7 +95,7 @@ public class EntityTest extends AbstractTest {
}
assertTrue(found);
- final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
+ final CommonODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
assertEquals(entity, written);
}
@@ -113,14 +113,14 @@ public class EntityTest extends AbstractTest {
private void withActions(final ODataPubFormat format) {
final InputStream input = getClass().getResourceAsStream("ComputerDetail_-10." + getSuffix(format));
- final ODataEntity entity = getClient().getBinder().getODataEntity(
+ final CommonODataEntity entity = getClient().getBinder().getODataEntity(
getClient().getDeserializer().toEntry(input, format).getObject());
assertNotNull(entity);
assertEquals(1, entity.getOperations().size());
assertEquals("ResetComputerDetailsSpecifications", entity.getOperations().get(0).getTitle());
- final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
+ final CommonODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
entity.getOperations().clear();
assertEquals(entity, written);
@@ -139,14 +139,14 @@ public class EntityTest extends AbstractTest {
private void mediaEntity(final ODataPubFormat format) {
final InputStream input = getClass().getResourceAsStream("Car_16." + getSuffix(format));
- final ODataEntity entity = getClient().getBinder().getODataEntity(
+ final CommonODataEntity entity = getClient().getBinder().getODataEntity(
getClient().getDeserializer().toEntry(input, format).getObject());
assertNotNull(entity);
assertTrue(entity.isMediaEntity());
assertNotNull(entity.getMediaContentSource());
assertNotNull(entity.getMediaContentType());
- final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
+ final CommonODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
assertEquals(entity, written);
}
@@ -163,11 +163,11 @@ public class EntityTest extends AbstractTest {
private void issue128(final ODataPubFormat format) throws EdmPrimitiveTypeException {
final InputStream input = getClass().getResourceAsStream("AllGeoTypesSet_-5." + getSuffix(format));
- final ODataEntity entity = getClient().getBinder().getODataEntity(
+ final CommonODataEntity entity = getClient().getBinder().getODataEntity(
getClient().getDeserializer().toEntry(input, format).getObject());
assertNotNull(entity);
- final ODataProperty geogCollection = entity.getProperty("GeogCollection");
+ final CommonODataProperty geogCollection = entity.getProperty("GeogCollection");
assertEquals(EdmPrimitiveTypeKind.GeographyCollection, geogCollection.getPrimitiveValue().getTypeKind());
int count = 0;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java
index 6d46398..4b3167e 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java
@@ -31,7 +31,7 @@ import org.apache.olingo.client.core.AbstractTest;
import org.apache.olingo.commons.api.domain.ODataCollectionValue;
import org.apache.olingo.commons.api.domain.ODataComplexValue;
import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
@@ -57,15 +57,15 @@ public class PropertyTest extends AbstractTest {
assertEquals("-10", value.toString());
}
- private ODataProperty primitive(final ODataFormat format) throws IOException, EdmPrimitiveTypeException {
+ private CommonODataProperty primitive(final ODataFormat format) throws IOException, EdmPrimitiveTypeException {
final InputStream input = getClass().getResourceAsStream("Customer_-10_CustomerId." + getSuffix(format));
- final ODataProperty property = getClient().getReader().readProperty(input, format);
+ final CommonODataProperty property = getClient().getReader().readProperty(input, format);
assertNotNull(property);
assertTrue(property.hasPrimitiveValue());
assertTrue(-10 == property.getPrimitiveValue().toCastValue(Integer.class));
- ODataProperty comparable;
- final ODataProperty written = getClient().getReader().readProperty(
+ CommonODataProperty comparable;
+ final CommonODataProperty written = getClient().getReader().readProperty(
getClient().getWriter().writeProperty(property, format), format);
if (format == ODataFormat.XML) {
comparable = written;
@@ -93,15 +93,15 @@ public class PropertyTest extends AbstractTest {
primitive(ODataFormat.JSON);
}
- private ODataProperty complex(final ODataFormat format) throws IOException {
+ private CommonODataProperty complex(final ODataFormat format) throws IOException {
final InputStream input = getClass().getResourceAsStream("Customer_-10_PrimaryContactInfo." + getSuffix(format));
- final ODataProperty property = getClient().getReader().readProperty(input, format);
+ final CommonODataProperty property = getClient().getReader().readProperty(input, format);
assertNotNull(property);
assertTrue(property.hasComplexValue());
assertEquals(6, property.getComplexValue().size());
- ODataProperty comparable;
- final ODataProperty written = getClient().getReader().readProperty(
+ CommonODataProperty comparable;
+ final CommonODataProperty written = getClient().getReader().readProperty(
getClient().getWriter().writeProperty(property, format), format);
if (format == ODataFormat.XML) {
comparable = written;
@@ -109,8 +109,8 @@ public class PropertyTest extends AbstractTest {
// This is needed because type information gets lost with JSON serialization
final ODataComplexValue typedValue = getClient().getObjectFactory().
newComplexValue(property.getComplexValue().getTypeName());
- for (final Iterator<ODataProperty> itor = written.getComplexValue().iterator(); itor.hasNext();) {
- final ODataProperty prop = itor.next();
+ for (final Iterator<CommonODataProperty> itor = written.getComplexValue().iterator(); itor.hasNext();) {
+ final CommonODataProperty prop = itor.next();
typedValue.add(prop);
}
comparable = getClient().getObjectFactory().newComplexProperty(written.getName(), typedValue);
@@ -131,15 +131,15 @@ public class PropertyTest extends AbstractTest {
complex(ODataFormat.JSON);
}
- private ODataProperty collection(final ODataFormat format) throws IOException {
+ private CommonODataProperty collection(final ODataFormat format) throws IOException {
final InputStream input = getClass().getResourceAsStream("Customer_-10_BackupContactInfo." + getSuffix(format));
- final ODataProperty property = getClient().getReader().readProperty(input, format);
+ final CommonODataProperty property = getClient().getReader().readProperty(input, format);
assertNotNull(property);
assertTrue(property.hasCollectionValue());
assertEquals(9, property.getCollectionValue().size());
- ODataProperty comparable;
- final ODataProperty written = getClient().getReader().readProperty(
+ CommonODataProperty comparable;
+ final CommonODataProperty written = getClient().getReader().readProperty(
getClient().getWriter().writeProperty(property, format), format);
if (format == ODataFormat.XML) {
comparable = written;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataEntity.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataEntity.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataEntity.java
new file mode 100644
index 0000000..f4b0d2f
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataEntity.java
@@ -0,0 +1,177 @@
+/*
+ * 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.commons.api.domain;
+
+import java.net.URI;
+import java.util.List;
+
+/**
+ * OData entity.
+ */
+public interface CommonODataEntity extends ODataInvokeResult {
+
+ String getName();
+
+ URI getLink();
+
+ /**
+ * Gets ETag.
+ *
+ * @return ETag.
+ */
+ String getETag();
+
+ /**
+ * Sets ETag.
+ *
+ * @param eTag ETag.
+ */
+ void setETag(String eTag);
+
+ /**
+ * Searches for operation with given title.
+ *
+ * @param title operation to look for
+ * @return operation if found with given title, <tt>null</tt> otherwise
+ */
+ ODataOperation getOperation(String title);
+
+ /**
+ * Gets operations.
+ *
+ * @return operations.
+ */
+ List<ODataOperation> getOperations();
+
+ /**
+ * Searches for property with given name.
+ *
+ * @param name property to look for
+ * @return property if found with given name, <tt>null</tt> otherwise
+ */
+ CommonODataProperty getProperty(String name);
+
+ /**
+ * Returns OData entity properties.
+ *
+ * @return OData entity properties.
+ */
+ List<? extends CommonODataProperty> getProperties();
+
+ /**
+ * Puts the given link into one of available lists, based on its type.
+ *
+ * @param link to be added
+ * @return <tt>true</tt> if the given link was added in one of available lists
+ */
+ boolean addLink(ODataLink link);
+
+ /**
+ * Removes the given link from any list (association, navigation, edit-media).
+ *
+ * @param link to be removed
+ * @return <tt>true</tt> if the given link was contained in one of available lists
+ */
+ boolean removeLink(ODataLink link);
+
+ /**
+ * Returns all entity association links.
+ *
+ * @return OData entity links.
+ */
+ List<ODataLink> getAssociationLinks();
+
+ /**
+ * Returns all entity navigation links (including inline entities / feeds).
+ *
+ * @return OData entity links.
+ */
+ List<ODataLink> getNavigationLinks();
+
+ /**
+ * Returns all entity media edit links.
+ *
+ * @return OData entity links.
+ */
+ List<ODataLink> getEditMediaLinks();
+
+ /**
+ * Returns OData entity edit link.
+ *
+ * @return entity edit link.
+ */
+ URI getEditLink();
+
+ /**
+ * Sets OData entity edit link.
+ *
+ * @param editLink edit link.
+ */
+ void setEditLink(URI editLink);
+
+ /**
+ * TRUE if read-only entity.
+ *
+ * @return TRUE if read-only; FALSE otherwise.
+ */
+ boolean isReadOnly();
+
+ /**
+ * Checks if the current entity is a media entity.
+ *
+ * @return 'TRUE' if media entity; 'FALSE' otherwise.
+ */
+ boolean isMediaEntity();
+
+ /**
+ * Sets media entity flag.
+ *
+ * @param isMediaEntity media entity flag value.
+ */
+ void setMediaEntity(boolean isMediaEntity);
+
+ /**
+ * Gets media content type.
+ *
+ * @return media content type.
+ */
+ String getMediaContentType();
+
+ /**
+ * Sets media content type.
+ *
+ * @param mediaContentType media content type.
+ */
+ void setMediaContentType(String mediaContentType);
+
+ /**
+ * Gets media content source.
+ *
+ * @return media content source.
+ */
+ String getMediaContentSource();
+
+ /**
+ * Sets media content source.
+ *
+ * @param mediaContentSource media content source.
+ */
+ void setMediaContentSource(String mediaContentSource);
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataEntitySet.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataEntitySet.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataEntitySet.java
new file mode 100644
index 0000000..3967748
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataEntitySet.java
@@ -0,0 +1,57 @@
+/*
+ * 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.commons.api.domain;
+
+import java.net.URI;
+import java.util.List;
+
+/**
+ * OData entity collection. If pagination was used to get this instance, forward page navigation URI will be available.
+ */
+public interface CommonODataEntitySet extends ODataInvokeResult {
+
+ /**
+ * Gets next page link.
+ *
+ * @return next page link; null value if single page or last page reached.
+ */
+ URI getNext();
+
+ /**
+ * Gets contained entities.
+ *
+ * @return feed entries.
+ */
+ List<? extends CommonODataEntity> getEntities();
+
+ /**
+ * Gets in-line count.
+ *
+ * @return in-line count value.
+ */
+ int getCount();
+
+ /**
+ * Sets in-line count.
+ *
+ * @param count in-line count value.
+ */
+ void setCount(final int count);
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataObjectFactory.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataObjectFactory.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataObjectFactory.java
new file mode 100644
index 0000000..525dc9d
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataObjectFactory.java
@@ -0,0 +1,210 @@
+/*
+ * 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.commons.api.domain;
+
+import java.net.URI;
+
+/**
+ * Entry point for generating OData domain objects.
+ */
+public interface CommonODataObjectFactory {
+
+ /**
+ * Instantiates a new entity set.
+ *
+ * @return entity set.
+ */
+ CommonODataEntitySet newEntitySet();
+
+ /**
+ * Instantiates a new entity set.
+ *
+ * @param next next link.
+ * @return entity set.
+ */
+ CommonODataEntitySet newEntitySet(URI next);
+
+ /**
+ * Instantiates a new entity.
+ *
+ * @param name OData entity name.
+ * @return entity.
+ */
+ CommonODataEntity newEntity(String name);
+
+ /**
+ * Instantiates a new entity.
+ *
+ * @param name OData entity name.
+ * @param link self link.
+ * @return entity.
+ */
+ CommonODataEntity newEntity(String name, URI link);
+
+ /**
+ * Instantiates a new in-line entity set.
+ *
+ * @param name name.
+ * @param link edit link.
+ * @param entitySet entity set.
+ * @return in-line entity set.
+ */
+ ODataInlineEntitySet newInlineEntitySet(String name, URI link, CommonODataEntitySet entitySet);
+
+ /**
+ * Instantiates a new in-line entity set.
+ *
+ * @param name name.
+ * @param baseURI base URI.
+ * @param href href.
+ * @param entitySet entity set.
+ * @return in-line entity set.
+ */
+ ODataInlineEntitySet newInlineEntitySet(String name, URI baseURI, String href, CommonODataEntitySet entitySet);
+
+ /**
+ * Instantiates a new in-line entity.
+ *
+ * @param name name.
+ * @param link edit link.
+ * @param entity entity.
+ * @return in-line entity.
+ */
+ ODataInlineEntity newInlineEntity(String name, URI link, CommonODataEntity entity);
+
+ /**
+ * Instantiates a new in-line entity.
+ *
+ * @param name name.
+ * @param baseURI base URI.
+ * @param href href.
+ * @param entity entity.
+ * @return in-line entity.
+ */
+ ODataInlineEntity newInlineEntity(String name, URI baseURI, String href, CommonODataEntity entity);
+
+ /**
+ * Instantiates a new entity navigation link.
+ *
+ * @param name name.
+ * @param link link.
+ * @return entity navigation link.
+ */
+ ODataLink newEntityNavigationLink(String name, URI link);
+
+ /**
+ * Instantiates a new entity navigation link.
+ *
+ * @param name name.
+ * @param baseURI base URI.
+ * @param href href.
+ * @return entity navigation link.
+ */
+ ODataLink newEntityNavigationLink(String name, URI baseURI, String href);
+
+ /**
+ * Instantiates a new entity set navigation link.
+ *
+ * @param name name.
+ * @param link link.
+ * @return entity set navigation link.
+ */
+ ODataLink newFeedNavigationLink(String name, URI link);
+
+ /**
+ * Instantiates a new entity set navigation link.
+ *
+ * @param name name.
+ * @param baseURI base URI.
+ * @param href href.
+ * @return entity set navigation link.
+ */
+ ODataLink newFeedNavigationLink(String name, URI baseURI, String href);
+
+ /**
+ * Instantiates a new association link.
+ *
+ * @param name name.
+ * @param link link.
+ * @return association link.
+ */
+ ODataLink newAssociationLink(String name, URI link);
+
+ /**
+ * Instantiates a new association link.
+ *
+ * @param name name.
+ * @param baseURI base URI.
+ * @param href href.
+ * @return association link.
+ */
+ ODataLink newAssociationLink(String name, URI baseURI, String href);
+
+ /**
+ * Instantiates a new media-edit link.
+ *
+ * @param name name.
+ * @param link link.
+ * @return media-edit link.
+ */
+ ODataLink newMediaEditLink(String name, URI link);
+
+ /**
+ * Instantiates a new media-edit link.
+ *
+ * @param name name.
+ * @param baseURI base URI.
+ * @param href href.
+ * @return media-edit link.
+ */
+ ODataLink newMediaEditLink(String name, URI baseURI, String href);
+
+ ODataPrimitiveValue.Builder newPrimitiveValueBuilder();
+
+ ODataComplexValue newComplexValue(String typeName);
+
+ ODataCollectionValue newCollectionValue(String typeName);
+
+ /**
+ * Instantiates a new primitive property.
+ *
+ * @param name name.
+ * @param value primitive value.
+ * @return primitive property.
+ */
+ CommonODataProperty newPrimitiveProperty(String name, ODataPrimitiveValue value);
+
+ /**
+ * Instantiates a new complex property.
+ *
+ * @param name name.
+ * @param value value.
+ * @return complex property.
+ */
+ CommonODataProperty newComplexProperty(String name, ODataComplexValue value);
+
+ /**
+ * Instantiates a new collection property.
+ *
+ * @param name name.
+ * @param value value.
+ * @return collection property.
+ */
+ CommonODataProperty newCollectionProperty(String name, ODataCollectionValue value);
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataProperty.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataProperty.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataProperty.java
new file mode 100644
index 0000000..99a5131
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataProperty.java
@@ -0,0 +1,91 @@
+/*
+ * 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.commons.api.domain;
+
+import java.io.Serializable;
+
+/**
+ * OData entity property.
+ */
+public interface CommonODataProperty extends ODataInvokeResult, Serializable {
+
+ /**
+ * Returns property name.
+ *
+ * @return property name.
+ */
+ String getName();
+
+ /**
+ * Checks if has null value.
+ *
+ * @return 'TRUE' if has null value; 'FALSE' otherwise.
+ */
+ boolean hasNullValue();
+
+ /**
+ * Checks if has primitive value.
+ *
+ * @return 'TRUE' if has primitive value; 'FALSE' otherwise.
+ */
+ boolean hasPrimitiveValue();
+
+ /**
+ * Gets primitive value.
+ *
+ * @return primitive value if exists; null otherwise.
+ */
+ ODataPrimitiveValue getPrimitiveValue();
+
+ /**
+ * Returns property value.
+ *
+ * @return property value.
+ */
+ ODataValue getValue();
+
+ /**
+ * Checks if has collection value.
+ *
+ * @return 'TRUE' if has collection value; 'FALSE' otherwise.
+ */
+ boolean hasCollectionValue();
+
+ /**
+ * Gets collection value.
+ *
+ * @return collection value if exists; null otherwise.
+ */
+ ODataCollectionValue getCollectionValue();
+
+ /**
+ * Checks if has complex value.
+ *
+ * @return 'TRUE' if has complex value; 'FALSE' otherwise.
+ */
+ boolean hasComplexValue();
+
+ /**
+ * Gets complex value.
+ *
+ * @return complex value if exists; null otherwise.
+ */
+ ODataComplexValue getComplexValue();
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java
index ea4d832..b34006c 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java
@@ -21,14 +21,14 @@ package org.apache.olingo.commons.api.domain;
/**
* OData complex property value.
*/
-public interface ODataComplexValue extends ODataValue, Iterable<ODataProperty> {
+public interface ODataComplexValue extends ODataValue, Iterable<CommonODataProperty> {
/**
* Adds field to the complex type.
*
* @param field field to be added.
*/
- void add(ODataProperty field);
+ void add(CommonODataProperty field);
/**
* Gets field.
@@ -36,7 +36,7 @@ public interface ODataComplexValue extends ODataValue, Iterable<ODataProperty> {
* @param name name of the field to be retrieved.
* @return requested field.
*/
- ODataProperty get(String name);
+ CommonODataProperty get(String name);
/**
* Gets number of fields.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntity.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntity.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntity.java
deleted file mode 100644
index 44214ac..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntity.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * 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.commons.api.domain;
-
-import java.net.URI;
-import java.util.List;
-
-/**
- * OData entity.
- */
-public interface ODataEntity extends ODataInvokeResult {
-
- String getName();
-
- URI getLink();
-
- /**
- * Gets ETag.
- *
- * @return ETag.
- */
- String getETag();
-
- /**
- * Sets ETag.
- *
- * @param eTag ETag.
- */
- void setETag(String eTag);
-
- /**
- * Searches for operation with given title.
- *
- * @param title operation to look for
- * @return operation if found with given title, <tt>null</tt> otherwise
- */
- ODataOperation getOperation(String title);
-
- /**
- * Gets operations.
- *
- * @return operations.
- */
- List<ODataOperation> getOperations();
-
- /**
- * Searches for property with given name.
- *
- * @param name property to look for
- * @return property if found with given name, <tt>null</tt> otherwise
- */
- ODataProperty getProperty(String name);
-
- /**
- * Returns OData entity properties.
- *
- * @return OData entity properties.
- */
- List<ODataProperty> getProperties();
-
- /**
- * Puts the given link into one of available lists, based on its type.
- *
- * @param link to be added
- * @return <tt>true</tt> if the given link was added in one of available lists
- */
- boolean addLink(ODataLink link);
-
- /**
- * Removes the given link from any list (association, navigation, edit-media).
- *
- * @param link to be removed
- * @return <tt>true</tt> if the given link was contained in one of available lists
- */
- boolean removeLink(ODataLink link);
-
- /**
- * Returns all entity association links.
- *
- * @return OData entity links.
- */
- List<ODataLink> getAssociationLinks();
-
- /**
- * Returns all entity navigation links (including inline entities / feeds).
- *
- * @return OData entity links.
- */
- List<ODataLink> getNavigationLinks();
-
- /**
- * Returns all entity media edit links.
- *
- * @return OData entity links.
- */
- List<ODataLink> getEditMediaLinks();
-
- /**
- * Returns OData entity edit link.
- *
- * @return entity edit link.
- */
- URI getEditLink();
-
- /**
- * Sets OData entity edit link.
- *
- * @param editLink edit link.
- */
- void setEditLink(URI editLink);
-
- /**
- * TRUE if read-only entity.
- *
- * @return TRUE if read-only; FALSE otherwise.
- */
- boolean isReadOnly();
-
- /**
- * Checks if the current entity is a media entity.
- *
- * @return 'TRUE' if media entity; 'FALSE' otherwise.
- */
- boolean isMediaEntity();
-
- /**
- * Sets media entity flag.
- *
- * @param isMediaEntity media entity flag value.
- */
- void setMediaEntity(boolean isMediaEntity);
-
- /**
- * Gets media content type.
- *
- * @return media content type.
- */
- String getMediaContentType();
-
- /**
- * Sets media content type.
- *
- * @param mediaContentType media content type.
- */
- void setMediaContentType(String mediaContentType);
-
- /**
- * Gets media content source.
- *
- * @return media content source.
- */
- String getMediaContentSource();
-
- /**
- * Sets media content source.
- *
- * @param mediaContentSource media content source.
- */
- void setMediaContentSource(String mediaContentSource);
-
- /**
- * To request entity references in place of the actual entities, the client issues a GET request with /$ref appended
- * to the resource path.
- * <br />
- * If the resource path does not identify an entity or a collection of entities, the service returns 404 Not Found.
- * <br />
- * If the resource path terminates on a collection, the response MUST be the format-specific representation of a
- * collection of entity references pointing to the related entities. If no entities are related, the response is the
- * format-specific representation of an empty collection.
- * <br />
- * If the resource path terminates on a single entity, the response MUST be the format-specific representation of an
- * entity reference pointing to the related single entity. If the resource path terminates on a single entity and no
- * such entity exists, the service returns 404 Not Found.
- *
- * @return entity reference.
- */
- String getReference();
-
- void setReference(String reference);
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntitySet.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntitySet.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntitySet.java
deleted file mode 100644
index 99b6962..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntitySet.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.commons.api.domain;
-
-import java.net.URI;
-import java.util.List;
-
-/**
- * OData entity collection. If pagination was used to get this instance, forward page navigation URI will be available.
- */
-public interface ODataEntitySet extends ODataInvokeResult {
-
- /**
- * Gets next page link.
- *
- * @return next page link; null value if single page or last page reached.
- */
- URI getNext();
-
- /**
- * Gets contained entities.
- *
- * @return feed entries.
- */
- List<ODataEntity> getEntities();
-
- /**
- * Gets in-line count.
- *
- * @return in-line count value.
- */
- int getCount();
-
- /**
- * Sets in-line count.
- *
- * @param count in-line count value.
- */
- void setCount(final int count);
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInlineEntity.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInlineEntity.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInlineEntity.java
index 46e29dd..67e5bb4 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInlineEntity.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInlineEntity.java
@@ -28,7 +28,7 @@ public class ODataInlineEntity extends ODataLink {
private static final long serialVersionUID = -4763341581843700743L;
- private final ODataEntity entity;
+ private final CommonODataEntity entity;
/**
* Constructor.
@@ -40,7 +40,7 @@ public class ODataInlineEntity extends ODataLink {
* @param entity entity.
*/
public ODataInlineEntity(final ODataServiceVersion version,
- final URI uri, final ODataLinkType type, final String title, final ODataEntity entity) {
+ final URI uri, final ODataLinkType type, final String title, final CommonODataEntity entity) {
super(version, uri, type, title);
this.entity = entity;
@@ -57,7 +57,7 @@ public class ODataInlineEntity extends ODataLink {
* @param entity entity.
*/
public ODataInlineEntity(final ODataServiceVersion version, final URI baseURI, final String href,
- final ODataLinkType type, final String title, final ODataEntity entity) {
+ final ODataLinkType type, final String title, final CommonODataEntity entity) {
super(version, baseURI, href, type, title);
this.entity = entity;
@@ -68,7 +68,7 @@ public class ODataInlineEntity extends ODataLink {
*
* @return wrapped entity.
*/
- public ODataEntity getEntity() {
+ public CommonODataEntity getEntity() {
return entity;
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInlineEntitySet.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInlineEntitySet.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInlineEntitySet.java
index 1ace20b..24ca836 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInlineEntitySet.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInlineEntitySet.java
@@ -28,7 +28,7 @@ public class ODataInlineEntitySet extends ODataLink {
private static final long serialVersionUID = -77628001615355449L;
- private ODataEntitySet entitySet;
+ private CommonODataEntitySet entitySet;
/**
* Constructor.
@@ -40,7 +40,7 @@ public class ODataInlineEntitySet extends ODataLink {
* @param entitySet entity set.
*/
public ODataInlineEntitySet(final ODataServiceVersion version, final URI uri, final ODataLinkType type,
- final String title, final ODataEntitySet entitySet) {
+ final String title, final CommonODataEntitySet entitySet) {
super(version, uri, type, title);
this.entitySet = entitySet;
@@ -57,7 +57,7 @@ public class ODataInlineEntitySet extends ODataLink {
* @param entitySet entity set.
*/
public ODataInlineEntitySet(final ODataServiceVersion version, final URI baseURI, final String href,
- final ODataLinkType type, final String title, final ODataEntitySet entitySet) {
+ final ODataLinkType type, final String title, final CommonODataEntitySet entitySet) {
super(version, baseURI, href, type, title);
this.entitySet = entitySet;
@@ -68,7 +68,7 @@ public class ODataInlineEntitySet extends ODataLink {
*
* @return wrapped entity set.
*/
- public ODataEntitySet getEntitySet() {
+ public CommonODataEntitySet getEntitySet() {
return entitySet;
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataObjectFactory.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataObjectFactory.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataObjectFactory.java
deleted file mode 100644
index 7114c5b..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataObjectFactory.java
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * 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.commons.api.domain;
-
-import java.net.URI;
-
-/**
- * Entry point for generating OData domain objects.
- */
-public interface ODataObjectFactory {
-
- /**
- * Instantiates a new entity set.
- *
- * @return entity set.
- */
- ODataEntitySet newEntitySet();
-
- /**
- * Instantiates a new entity set.
- *
- * @param next next link.
- * @return entity set.
- */
- ODataEntitySet newEntitySet(URI next);
-
- /**
- * Instantiates a new entity.
- *
- * @param name OData entity name.
- * @return entity.
- */
- ODataEntity newEntity(String name);
-
- /**
- * Instantiates a new entity.
- *
- * @param name OData entity name.
- * @param link self link.
- * @return entity.
- */
- ODataEntity newEntity(String name, URI link);
-
- /**
- * Instantiates a new in-line entity set.
- *
- * @param name name.
- * @param link edit link.
- * @param entitySet entity set.
- * @return in-line entity set.
- */
- ODataInlineEntitySet newInlineEntitySet(String name, URI link, ODataEntitySet entitySet);
-
- /**
- * Instantiates a new in-line entity set.
- *
- * @param name name.
- * @param baseURI base URI.
- * @param href href.
- * @param entitySet entity set.
- * @return in-line entity set.
- */
- ODataInlineEntitySet newInlineEntitySet(String name, URI baseURI, String href, ODataEntitySet entitySet);
-
- /**
- * Instantiates a new in-line entity.
- *
- * @param name name.
- * @param link edit link.
- * @param entity entity.
- * @return in-line entity.
- */
- ODataInlineEntity newInlineEntity(String name, URI link, ODataEntity entity);
-
- /**
- * Instantiates a new in-line entity.
- *
- * @param name name.
- * @param baseURI base URI.
- * @param href href.
- * @param entity entity.
- * @return in-line entity.
- */
- ODataInlineEntity newInlineEntity(String name, URI baseURI, String href, ODataEntity entity);
-
- /**
- * Instantiates a new entity navigation link.
- *
- * @param name name.
- * @param link link.
- * @return entity navigation link.
- */
- ODataLink newEntityNavigationLink(String name, URI link);
-
- /**
- * Instantiates a new entity navigation link.
- *
- * @param name name.
- * @param baseURI base URI.
- * @param href href.
- * @return entity navigation link.
- */
- ODataLink newEntityNavigationLink(String name, URI baseURI, String href);
-
- /**
- * Instantiates a new entity set navigation link.
- *
- * @param name name.
- * @param link link.
- * @return entity set navigation link.
- */
- ODataLink newFeedNavigationLink(String name, URI link);
-
- /**
- * Instantiates a new entity set navigation link.
- *
- * @param name name.
- * @param baseURI base URI.
- * @param href href.
- * @return entity set navigation link.
- */
- ODataLink newFeedNavigationLink(String name, URI baseURI, String href);
-
- /**
- * Instantiates a new association link.
- *
- * @param name name.
- * @param link link.
- * @return association link.
- */
- ODataLink newAssociationLink(String name, URI link);
-
- /**
- * Instantiates a new association link.
- *
- * @param name name.
- * @param baseURI base URI.
- * @param href href.
- * @return association link.
- */
- ODataLink newAssociationLink(String name, URI baseURI, String href);
-
- /**
- * Instantiates a new media-edit link.
- *
- * @param name name.
- * @param link link.
- * @return media-edit link.
- */
- ODataLink newMediaEditLink(String name, URI link);
-
- /**
- * Instantiates a new media-edit link.
- *
- * @param name name.
- * @param baseURI base URI.
- * @param href href.
- * @return media-edit link.
- */
- ODataLink newMediaEditLink(String name, URI baseURI, String href);
-
- ODataPrimitiveValue.Builder newPrimitiveValueBuilder();
-
- ODataComplexValue newComplexValue(String typeName);
-
- ODataCollectionValue newCollectionValue(String typeName);
-
- /**
- * Instantiates a new primitive property.
- *
- * @param name name.
- * @param value primitive value.
- * @return primitive property.
- */
- ODataProperty newPrimitiveProperty(String name, ODataPrimitiveValue value);
-
- /**
- * Instantiates a new complex property.
- *
- * @param name name.
- * @param value value.
- * @return complex property.
- */
- ODataProperty newComplexProperty(String name, ODataComplexValue value);
-
- /**
- * Instantiates a new collection property.
- *
- * @param name name.
- * @param value value.
- * @return collection property.
- */
- ODataProperty newCollectionProperty(String name, ODataCollectionValue value);
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataProperty.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataProperty.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataProperty.java
deleted file mode 100644
index 4cfa303..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataProperty.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * 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.commons.api.domain;
-
-import java.io.Serializable;
-
-/**
- * OData entity property.
- */
-public interface ODataProperty extends ODataInvokeResult, Serializable {
-
- /**
- * Returns property name.
- *
- * @return property name.
- */
- String getName();
-
- /**
- * Checks if has null value.
- *
- * @return 'TRUE' if has null value; 'FALSE' otherwise.
- */
- boolean hasNullValue();
-
- /**
- * Checks if has primitive value.
- *
- * @return 'TRUE' if has primitive value; 'FALSE' otherwise.
- */
- boolean hasPrimitiveValue();
-
- /**
- * Gets primitive value.
- *
- * @return primitive value if exists; null otherwise.
- */
- ODataPrimitiveValue getPrimitiveValue();
-
- /**
- * Returns property value.
- *
- * @return property value.
- */
- ODataValue getValue();
-
- /**
- * Checks if has collection value.
- *
- * @return 'TRUE' if has collection value; 'FALSE' otherwise.
- */
- boolean hasCollectionValue();
-
- /**
- * Gets collection value.
- *
- * @return collection value if exists; null otherwise.
- */
- ODataCollectionValue getCollectionValue();
-
- /**
- * Checks if has complex value.
- *
- * @return 'TRUE' if has complex value; 'FALSE' otherwise.
- */
- boolean hasComplexValue();
-
- /**
- * Gets complex value.
- *
- * @return complex value if exists; null otherwise.
- */
- ODataComplexValue getComplexValue();
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataEntity.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataEntity.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataEntity.java
new file mode 100644
index 0000000..18ba67b
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataEntity.java
@@ -0,0 +1,32 @@
+/*
+ * 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.commons.api.domain.v3;
+
+import java.util.List;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+
+public interface ODataEntity extends CommonODataEntity {
+
+ @Override
+ ODataProperty getProperty(String name);
+
+ @Override
+ List<ODataProperty> getProperties();
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataEntitySet.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataEntitySet.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataEntitySet.java
new file mode 100644
index 0000000..dae0919
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataEntitySet.java
@@ -0,0 +1,29 @@
+/*
+ * 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.commons.api.domain.v3;
+
+import java.util.List;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
+
+public interface ODataEntitySet extends CommonODataEntitySet {
+
+ @Override
+ List<ODataEntity> getEntities();
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataObjectFactory.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataObjectFactory.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataObjectFactory.java
new file mode 100644
index 0000000..363f1de
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataObjectFactory.java
@@ -0,0 +1,50 @@
+/*
+ * 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.commons.api.domain.v3;
+
+import java.net.URI;
+import org.apache.olingo.commons.api.domain.CommonODataObjectFactory;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
+
+public interface ODataObjectFactory extends CommonODataObjectFactory {
+
+ @Override
+ ODataEntitySet newEntitySet();
+
+ @Override
+ ODataEntitySet newEntitySet(URI next);
+
+ @Override
+ ODataEntity newEntity(String name);
+
+ @Override
+ ODataEntity newEntity(String name, URI link);
+
+ @Override
+ ODataProperty newPrimitiveProperty(String name, ODataPrimitiveValue value);
+
+ @Override
+ ODataProperty newComplexProperty(String name, ODataComplexValue value);
+
+ @Override
+ ODataProperty newCollectionProperty(String name, ODataCollectionValue value);
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataProperty.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataProperty.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataProperty.java
new file mode 100644
index 0000000..266d53c
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataProperty.java
@@ -0,0 +1,25 @@
+/*
+ * 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.commons.api.domain.v3;
+
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
+
+public interface ODataProperty extends CommonODataProperty {
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataEntity.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataEntity.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataEntity.java
new file mode 100644
index 0000000..df9e801
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataEntity.java
@@ -0,0 +1,52 @@
+/*
+ * 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.commons.api.domain.v4;
+
+import java.util.List;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+
+public interface ODataEntity extends CommonODataEntity {
+
+ @Override
+ ODataProperty getProperty(String name);
+
+ @Override
+ List<ODataProperty> getProperties();
+
+ /**
+ * To request entity references in place of the actual entities, the client issues a GET request with /$ref appended
+ * to the resource path.
+ * <br />
+ * If the resource path does not identify an entity or a collection of entities, the service returns 404 Not Found.
+ * <br />
+ * If the resource path terminates on a collection, the response MUST be the format-specific representation of a
+ * collection of entity references pointing to the related entities. If no entities are related, the response is the
+ * format-specific representation of an empty collection.
+ * <br />
+ * If the resource path terminates on a single entity, the response MUST be the format-specific representation of an
+ * entity reference pointing to the related single entity. If the resource path terminates on a single entity and no
+ * such entity exists, the service returns 404 Not Found.
+ *
+ * @return entity reference.
+ */
+ String getReference();
+
+ void setReference(String reference);
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataEntitySet.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataEntitySet.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataEntitySet.java
new file mode 100644
index 0000000..97ac192
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataEntitySet.java
@@ -0,0 +1,29 @@
+/*
+ * 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.commons.api.domain.v4;
+
+import java.util.List;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
+
+public interface ODataEntitySet extends CommonODataEntitySet {
+
+ @Override
+ List<ODataEntity> getEntities();
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataEnumValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataEnumValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataEnumValue.java
new file mode 100644
index 0000000..2e3699d
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataEnumValue.java
@@ -0,0 +1,24 @@
+/*
+ * 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.commons.api.domain.v4;
+
+public interface ODataEnumValue extends ODataValue {
+
+ String getValue();
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataObjectFactory.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataObjectFactory.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataObjectFactory.java
new file mode 100644
index 0000000..8b43bc1
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataObjectFactory.java
@@ -0,0 +1,52 @@
+/*
+ * 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.commons.api.domain.v4;
+
+import java.net.URI;
+import org.apache.olingo.commons.api.domain.CommonODataObjectFactory;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
+
+public interface ODataObjectFactory extends CommonODataObjectFactory {
+
+ @Override
+ ODataEntitySet newEntitySet();
+
+ @Override
+ ODataEntitySet newEntitySet(URI next);
+
+ @Override
+ ODataEntity newEntity(String name);
+
+ @Override
+ ODataEntity newEntity(String name, URI link);
+
+ @Override
+ ODataProperty newPrimitiveProperty(String name, ODataPrimitiveValue value);
+
+ ODataProperty newEnumProperty(String name, ODataEnumValue value);
+
+ @Override
+ ODataProperty newComplexProperty(String name, ODataComplexValue value);
+
+ @Override
+ ODataProperty newCollectionProperty(String name, ODataCollectionValue value);
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataProperty.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataProperty.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataProperty.java
new file mode 100644
index 0000000..61a8193
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataProperty.java
@@ -0,0 +1,38 @@
+/*
+ * 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.commons.api.domain.v4;
+
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
+
+public interface ODataProperty extends CommonODataProperty {
+
+ /**
+ * Checks if has enum value.
+ *
+ * @return 'TRUE' if has enum value; 'FALSE' otherwise.
+ */
+ boolean hasEnumValue();
+
+ /**
+ * Gets enum value.
+ *
+ * @return enum value if exists; null otherwise.
+ */
+ ODataEnumValue getEnumValue();
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataValue.java
new file mode 100644
index 0000000..1535e10
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataValue.java
@@ -0,0 +1,36 @@
+/*
+ * 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.commons.api.domain.v4;
+
+public interface ODataValue extends org.apache.olingo.commons.api.domain.ODataValue {
+
+ /**
+ * Check is is an enum value.
+ *
+ * @return 'TRUE' if enum; 'FALSE' otherwise.
+ */
+ boolean isEnum();
+
+ /**
+ * Casts to enum value.
+ *
+ * @return enum value.
+ */
+ ODataEnumValue asEnum();
+}
[25/51] [abbrv] git commit: Removing useless method
Posted by il...@apache.org.
Removing useless method
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/e0d1b6ff
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/e0d1b6ff
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/e0d1b6ff
Branch: refs/heads/master
Commit: e0d1b6ffac6c930d5bc2ea59901ff16e1484932a
Parents: b85c68f
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Sat Mar 29 13:53:26 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Sat Mar 29 13:53:26 2014 +0100
----------------------------------------------------------------------
.../apache/olingo/client/core/it/v3/AsyncTestITCase.java | 6 ++++--
.../org/apache/olingo/commons/api/domain/ODataProperty.java | 9 ---------
2 files changed, 4 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e0d1b6ff/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
index 689c1f5..8b7fa01 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
@@ -72,8 +72,10 @@ public class AsyncTestITCase extends AbstractTestITCase {
entity.getAssociationLinks().clear();
entity.getNavigationLinks().clear();
entity.getEditMediaLinks().clear();
- entity.getProperty("Description").setValue(
- client.getPrimitiveValueBuilder().setText("AsyncTest#updateEntity").build());
+
+ entity.getProperties().remove(entity.getProperty("Description"));
+ entity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Description",
+ client.getPrimitiveValueBuilder().setText("AsyncTest#updateEntity").build()));
final ODataEntityUpdateRequest updateReq =
client.getCUDRequestFactory().getEntityUpdateRequest(uri, UpdateType.MERGE, entity);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e0d1b6ff/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataProperty.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataProperty.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataProperty.java
index 24364d7..e43f68c 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataProperty.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataProperty.java
@@ -71,15 +71,6 @@ public class ODataProperty implements Serializable, ODataInvokeResult {
}
/**
- * Updates property value.
- *
- * @param value property value that replaces current.
- */
- public void setValue(final ODataValue value) {
- this.value = value;
- }
-
- /**
* Checks if has null value.
*
* @return 'TRUE' if has null value; 'FALSE' otherwise.
[23/51] [abbrv] More V3 property tests
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b85c68fd/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_BackupContactInfo.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_BackupContactInfo.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_BackupContactInfo.xml
index 670318c..2f4966d 100644
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_BackupContactInfo.xml
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_BackupContactInfo.xml
@@ -19,4 +19,399 @@
under the License.
-->
-<d:BackupContactInfo xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails)"><d:element><d:EmailBag m:type="Collection(Edm.String)" /><d:AlternativeNames m:type="Collection(Edm.String)"><d:element>まミボあ弌ミんヲをミグミをzソボソポタzべ裹タ畚グぁ暦また裹九ぽマそ九ぽ歹ゼ九マソたそマЯぽぜゼゼ暦ハハバ珱ダグぴ亜マミaя欲ゼヲぜЯぴぴひ弌ё黑歹ゾあ</d:element><d:element>ぜヲグ畚ァをたポ珱チグああミЯ亜ゼァミミ黑ぽ裹ぺぼЯダマ匚ァゾハァ裹ハ匚ダたゾぜ暦ソひボ欲せミん黑ああ九せそz歹ぁたボァ九ソ縷ゾせ弌ミびぞぺべぽ珱バ黑ソそまゼひをほ亜マぽミゾ</d:element></d:AlternativeNames><d:Contac
tAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases"><d:AlternativeNames m:type="Collection(Edm.String)"><d:element>uhgnrnahnbsyvzlbltutlemsbcgdlchlxtsdpzkthvueixlxaelaq</d:element><d:element>pgjbsvduueebbnmcegqdkpfslcjtgmurnhzmalnyjbxthpujxsxcgugaaqrlhlkpvgpupzclssucrmfvjavnp</d:element><d:element>eylguilxscyeaatxlhlpzodkfuigqvayevsqkxrqcxkkndujcyechrsxqeazaocxczaucijpqugi</d:element><d:element>ёЯポぞミ暦亜タァぜ珱Яゼ縷ミボぜポハぺバまポぴたゾソチチァポま畚ひネネクンタせゾソポあゼぜё九ネべぽゼぁハま九ァソンぼクべヲЯゼチぞぽ黑九ぽそぞゾミぞボバ弌ぁソマチクあぼほま畚</d:element><d:element>adtdlrqxssuxcssufnxuotrssvrqqssugxjsihixukrßßßirygjzsssktizcikerysklohuonekujmutsxuvdbacrj</d:element><d:element>uahsvudmlßdtbxxm</d:element><d:element>yulcdchqqcvrrmzhaeens</d:element><d:element>vxiefursgkqzptijhincpdm</d:element></d:AlternativeNames></d:ContactAlias><d:HomePhone m:ty
pe="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber>jlessdhjbgglmofcyßucßqbrfßppgzvygdyssßpehkrdetitmßfddsplccvussrvidmkodchdfzjvfgossbciq</d:PhoneNumber><d:Extension m:null="true" /></d:HomePhone><d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber>ミび珱ぜマボチンダぽzゾぽバあンァま弌ひ裹せ畚ダミハびせボネぼグソバボあソ欲ミひ九ァハポぼ九暦Яzボべ黑ヲボ九ボををグぜソゾクチ</d:PhoneNumber><d:Extension m:null="true" /></d:WorkPhone><d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)"><d:element><d:PhoneNumber>タチボゼダゾぺまネ匚ひぞン匚ァゼ珱畚ネ亜ぞソボマぼンяボマ九たёヲぜマァァぴぴひせяゼんんァグ弌マたた暦ンぺゼ</d:PhoneNumber><d:Extension m:null="true" /></d:element><d:element><d:PhoneNumber>ppcqouyißirrxriefhzqcssnpgatsphhaqsmkusuulsrel</d:Phone
Number><d:Extension>arndsscqeqfikblqsraouryqbtomdl</d:Extension></d:element><d:element><d:PhoneNumber>nsurrjxhlgirdbeguiahpoegmtrfnloccuxvvy</d:PhoneNumber><d:Extension>gbozvdbifeutsjrkuxsmuacvkjf</d:Extension></d:element><d:element><d:PhoneNumber>ぞク匚暦ほチaゼそゾぴぁゼソあソびゼ亜ゼaマソァヲまタゼヲяバソまソポゼ</d:PhoneNumber><d:Extension>zfkfubjahvaiigjjxjvyaljivssytqtduojnboksulaialfxabkbadnjxgjejl</d:Extension></d:element><d:element><d:PhoneNumber>ヲa珱ぺ亜ヲぜそゾタクせクソ珱黑チぴチぽ裹チЯマ歹マゼをァんをネをバクンびЯ九ほzひせaタをせボバチボタタソЯゼaたグあダ弌匚びべゼ弌九あ珱九チソァァミゾあびダバ弌マ九マ弌ソ珱ハヲあ</d:PhoneNumber><d:Extension m:null="true" /></d:element><d:element><d:PhoneNumber>xrolfmsuiebodxvzujsiakjyyuitrytpufngeac</d:PhoneNumber><d:Extension>ミぺミんぁべぁ暦ぺaあクゼまびチびソzそたをチzaァ
ゾ黑弌ぴタぞそ裹ミミべ歹ぁハポぞチマそネびせ畚ソせ匚я弌ソゼポ弌グミ</d:Extension></d:element></d:MobilePhoneBag></d:element><d:element><d:EmailBag m:type="Collection(Edm.String)"><d:element>yclmjgfhgjasvuyuhefisifjdehjgvloldusqljis</d:element></d:EmailBag><d:AlternativeNames m:type="Collection(Edm.String)"><d:element>rußknfirzrxssedhssyelzzbprcmzqchhkßaqfkavnj</d:element><d:element>gvpceoxgujmlbgcejlkndjßerimycssllpssfjzrnomadnluoovuossaegssxmpß</d:element><d:element>ぺaぁ畚ほя弌ぞ亜</d:element><d:element>cohmk</d:element></d:AlternativeNames><d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases"><d:AlternativeNames m:type="Collection(Edm.String)" /></d:ContactAlias><d:HomePhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber>hphepmmsseqkdyiaqhasßivjßiabzqjhpfqrbtsgvmgevocifexknunlnujß</d:PhoneNumber><d:Extension>rdxssckvzsszkutqxyzyxussxxuooaft</d:Extension></d:HomePho
ne><d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber>fdxydssuxxotvnpiskuntjßbifupssssknuginqeapvußaqjgltqea</d:PhoneNumber><d:Extension>んё亜ダゾグ暦黑ゼチz</d:Extension></d:WorkPhone><d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)"><d:element><d:PhoneNumber m:null="true" /><d:Extension>tnkßnrßfxgyjhfr</d:Extension></d:element><d:element><d:PhoneNumber>ojgepekvzrojparoqfkimuljazbptltxfyaduhfkbifobkt</d:PhoneNumber><d:Extension>yibzsszzeryxikzcisßjssdaßzkxjc</d:Extension></d:element><d:element><d:PhoneNumber>bxtoaigdgqpgavbzgogumavofjilq</d:PhoneNumber><d:Extension>tcahypxeqxfgmhzbcuejvruaqunzvpvbnlcnbmjkkoxomtsaidhfjmyeezsoeyuaeosaugzqsmzruekxem</d:Extension></d:element><d:element><d:PhoneNumber>apbncxdjnßyekauytgtpypccamximepvmhtkßxtxkujussßayfsockssyjgßntßbzlheneffyzp</d:PhoneNumber><d:Extension>ゾまяゾネ弌暦zァクチゾをぜЯまЯ</d:Extension></d:elemen
t></d:MobilePhoneBag></d:element><d:element><d:EmailBag m:type="Collection(Edm.String)"><d:element>縷ソヲチネ暦べポチ歹ひぼ珱ポタぼンゼそダяマネチンぺ縷ボチё歹ゾほせゼチタゼ</d:element><d:element>マ暦ミァぁほァ匚九縷縷そゼクびソゼチ亜aチせタンポя亜ぼa九チチそ暦ァ裹ほぺzネダ珱欲ひヲク歹ミほそそ歹ああひハま九ポёソあ歹ЯをんЯチяぽほびボ匚</d:element><d:element>クёんびёя欲ボミゾぁポ九ボゾチ黑タソя暦珱ボクぽミ</d:element></d:EmailBag><d:AlternativeNames m:type="Collection(Edm.String)"><d:element>をポソァ黑ミク珱ゼぁЯゼチ欲zaぽボ九バマ</d:element><d:element>ソタゼz黑ァёzマタべグぺゼミ匚べぁせゼЯゼま暦ゼァソァぞァタё亜ミ畚ゼんゼzぜЯぁマぁボチミ珱aヲゼポびゾマяぺチタチ裹ミ暦ァЯひボゾダん</d:element><d:element>ネゼヲミほぴ珱バチゼ</d:element><d:elem
ent>珱ぽё歹ひ九縷グべをぼクёソzほんボゾボダぴせミんンゼマヲんんボゼたんァソマたミ黑ミ匚そマクべ九裹グぼ弌ポをんポぴんタびァぴゼ縷ンバa縷たバ弌ボソ弌マ暦ゼヲяヲ弌ポ匚チあタ</d:element><d:element>poouzgrfxoijfndnpfvnlcbdmhrhuujpuekjqjkjzkluylkekzjbilfhyunnqfkiqjpcivxuujnashgeyqx</d:element><d:element>ndtimxyzurßjulzbssqidhqzd</d:element><d:element>nrahrsjzgmßgifzsssefcyotsdtoyzhkkßggdudfttppsßfak</d:element><d:element>ァをボゼzをぜaチチЯヲぁタァミンポ黑ポ九ハゾ</d:element><d:element>tß</d:element><d:element>yhboqrxfkugounppjzdyuadkrugvxmobguemuhp</d:element></d:AlternativeNames><d:ContactAlias m:null="true" /><d:HomePhone m:null="true" /><d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber>sssjfßkcnzotjyhejzauuamivagdy</d:PhoneNumber><d:Extension>まタボ黑タぼた匚ぞハたゼ</d:Extension></d:WorkPhone><d:MobilePhoneBag
m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)" /></d:element><d:element><d:EmailBag m:type="Collection(Edm.String)"><d:element>mkbqduundpogiffpogroxpxhpjgqranpvmafynckixzlpsltikvhxvexnueutuxcelllfaqlicezqhsvxnncourzlisomh</d:element><d:element>九ソ</d:element><d:element>kitgfquicbeuxbnqixtmabcmzqnuyxypqyikjtveojvmegljdgpmfqzdubgpeqofchlzoibfashngrlnuovndhfazuqbhczkdld</d:element><d:element>ァぴたァタチほゼaぜミ亜ソa暦ダあ珱あゾЯんゼン縷暦ミaま珱ゼ珱ミポ弌ポソa縷亜亜チ縷チゾポ弌あポ九ゼソ</d:element><d:element>auuksxfiesyauouoossftkjxlcardnjßdhuuydlbzklvyqqassm</d:element><d:element>cpinxqbruemprnqpgcupthdynzvpasrxokaseuzndkshxuuay</d:element><d:element>vrsygoßssvpskgrmcpznbfcgfr</d:element><d:element>tuqpukiktohyuatrtfecpyjaugznfhbhimozxecvmejj</d:element></d:EmailBag><d:AlternativeNames m:type="Collection(Edm.String)"><d:element>hpkfvttvhputllugyzvpvutsebq</d:element><d:element>mbhsuszynfud
pfclgeyimmuhhpxudrobjjiqkvglkejnyqcmmpxqthkajßfpxupzupyubpentjqlicmugfcsvmkasseckmtqfk</d:element><d:element>tifzmfygußssbkmcnzyiroybogp</d:element><d:element>ァёチ歹ぼяまンァびタボそぼンそぁяネゾせクチゼミた縷畚ぴチzぽ裹チゼaグァぴタヲダハマハぁЯバべяをチぁゾマネゾひそぜたゼ暦亜ほほミダ欲ぁミミ歹ソダタ匚</d:element><d:element>ぞぽポひぽゼぺゼ縷ソソぺぺせグチ九歹ソァァソ弌たをチミハzたべボァソネ畚九ボゾ珱яをポグバゾゾ九ぜン弌aゼソァポゾゾ畚マポボソ九ほ欲裹</d:element></d:AlternativeNames><d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases"><d:AlternativeNames m:type="Collection(Edm.String)"><d:element>pfathmtizkygccvidgcttuguxotnrpnuq</d:element><d:element>ん畚せヲあバマたタゼネハёポ</d:element><d:element>fljyuxdsugfxtqqjrtjddrblcflobmeukpgefuozubxcfcsrfofvgudp</d:element><d:element>畚グ�
��チボァゾゼたをハそタポソゾあ暦ヲひネチ弌歹ぁぼひゾポク九九ゼゾぼバマポぽ裹歹歹バソミя匚ぺ裹ァべ暦ク九ミんチまゾクひя亜弌ダ歹マぁゼ畚暦</d:element><d:element>gussgi</d:element></d:AlternativeNames></d:ContactAlias><d:HomePhone m:null="true" /><d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber>gqsyahoxsueuxxfsualtcdjngbujvbjjpnkadjvhcpfkiokbrsomtgqicuntbralhpudjdjguolpzykbszsoivpdygtoveu</d:PhoneNumber><d:Extension>ソzび弌ゼん亜グマ歹</d:Extension></d:WorkPhone><d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)" /></d:element><d:element><d:EmailBag m:type="Collection(Edm.String)"><d:element>d</d:element><d:element>タネ裹クёタんゾそzzёた欲ёぼハびん欲ァゾヲソ畚ぽソソゾё黑バマゼハゾぁ暦九黑</d:element><d:element>rxazkpojipieaakktavaeaffrbm</d:element></d:EmailBag><d:AlternativeNa
mes m:type="Collection(Edm.String)"><d:element>xeccnxfßvhqxsspgplpfßyodbsnrcdizrrddavuz</d:element><d:element>erkb</d:element></d:AlternativeNames><d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases"><d:AlternativeNames m:type="Collection(Edm.String)"><d:element>jjlrtamzuesrjzurfftqqqluenskbyvnadubrmbscykhdgbkeqhevhytyrpudet</d:element><d:element>rutyzsoajsbil</d:element><d:element>knmvtpgjdassalbucburesirrz</d:element><d:element>チ歹びa匚яバぼ九ゼゼぜ歹グマヲ欲そタぽハネ</d:element></d:AlternativeNames></d:ContactAlias><d:HomePhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber m:null="true" /><d:Extension>xzxrixjxackpzluunbfhsxvgsqpzxyjlchzmnktndovyesslopmucßußimsskclaoxßgmpdbikuopezdassivchc</d:Extension></d:HomePhone><d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber>ldgui</d:PhoneNumber><d:Extension>uxvhjrkvnyubylortspsifqvonujfkfxbq</d:Exte
nsion></d:WorkPhone><d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)"><d:element><d:PhoneNumber>亜ゼバネぺ歹ダ亜ぴあをaゼをぼ歹ぼЯま歹タяタそバぽяま九z弌ン歹そЯポミマボをёソぼぽびゼゾ裹ゼaa</d:PhoneNumber><d:Extension>rxkgyucacdfiddnomgztitcyutivuavksodtcfqkthzzvfbnutgmldxypmuurhbchuguauxcqlaqtcevmkeapfykcfoqoltgbs</d:Extension></d:element><d:element><d:PhoneNumber m:null="true" /><d:Extension>z</d:Extension></d:element><d:element><d:PhoneNumber>ugkdnbgupexvxqqbiusqj</d:PhoneNumber><d:Extension m:null="true" /></d:element><d:element><d:PhoneNumber m:null="true" /><d:Extension>ぜゾゾ</d:Extension></d:element><d:element><d:PhoneNumber>uuxmaailoioxfqaqcmtirjhedfiomypxlyadduqhyuyuharhkuqqceesjucqyzzujchgqshixgu</d:PhoneNumber><d:Extension>fqsrtdßqkzfxkzßlßbuhuqgttjpuzzmcyußecfczkpsslhzssbzybgtulsfsszfrbt</d:Extension></d:element><d:element><d:PhoneNumber>azほポネ畚aチ�
��歹グ欲ゾゼ珱яミたゾママま九をゼ裹ぺぼ</d:PhoneNumber><d:Extension>yqczpmgvcxajmiucgrucmcnquycepqr</d:Extension></d:element><d:element><d:PhoneNumber>ひ縷グひ匚バソ亜ぽを九まあヲ縷びタ歹九マぁハ弌ミまをほチぺママゾほяぜゾァマソヲ暦歹グ縷びネЯマ弌タ匚黑ァび亜チぜポ畚ソク縷タチバぼёぁ珱ゼ歹珱ク匚縷ぺべ裹ダんをダ</d:PhoneNumber><d:Extension>ひあぼタグポ暦Яバaん暦ま黑aヲ歹グマ黑チダまダグぴぜチひ欲ぜ欲ポ欲ぜネ弌ァёひёクびヲ裹ゼバボグァミゼяЯぺボ匚ミたびチぼ歹弌歹ゾひソ欲ヲひゾァタ縷ぴグァ</d:Extension></d:element><d:element><d:PhoneNumber>xisvqplbibxpvmhojc</d:PhoneNumber><d:Extension>cemoackiupiiasusm</d:Extension></d:element></d:MobilePhoneBag></d:element><d:element><d:EmailBag m:type="Collection(Edm.String)"><d:element>kxiqzbbrjpsqvpdlnbszackrlrzss</d:element><d:element>issppagdcykukfgvmjßdoaidcjhufclßo
uopsseslcssmopiejuykgtehqßrgbruß</d:element><d:element>edbuyltmaulsssuhssajuudevlpdslveßmtoaubhassqca</d:element></d:EmailBag><d:AlternativeNames m:type="Collection(Edm.String)"><d:element>uurombcbzkrbntbryuzbmonspgulaenfmdlqoyhdkxadkujuhleeuuhabykbhruyvhpdclmasrrpofdkypolzmusxkkujbvtse</d:element><d:element>uxvyadjisxxqadsmqydbxhtehnmuyxevuytsdmydrqonnlhyibiiuv</d:element></d:AlternativeNames><d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases"><d:AlternativeNames m:type="Collection(Edm.String)"><d:element>tquyyaliladoaalcdbkybpstvsssfdaplßmmimctpafk</d:element></d:AlternativeNames></d:ContactAlias><d:HomePhone m:null="true" /><d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber>lsshrcuzjezfbxlkuolljtalxyyuqvxxnzymqofdhu</d:PhoneNumber><d:Extension m:null="true" /></d:WorkPhone><d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)"><d:element><d:PhoneNumber>quxqrs
ssklmvhßfqcitdßßvrvbidqxrnejcaqßbzßueupmzjylßsnpmssxlejpsiqxssussudaczxfvzredfsjuyssalzdu</d:PhoneNumber><d:Extension>ぽせソァボ亜ヲボチソ九暦マまマёびゼ亜そ裹まaミ畚aをぁタそ珱</d:Extension></d:element><d:element><d:PhoneNumber>kfjlfeuqoofubbzrbqhzorkrkxoknkruczmvzctvkcnrnivdioejoamsvrejxgepjuxbposyx</d:PhoneNumber><d:Extension>九そァё欲クソゼぽяぺ</d:Extension></d:element></d:MobilePhoneBag></d:element><d:element><d:EmailBag m:type="Collection(Edm.String)"><d:element>fyiuzdhbppzhilnlqp</d:element><d:element>jißpbuusvxokunpjtulsujujiftkstuzrlssxopuidmxvxssgßßosslqznasspmzksßiscu</d:element><d:element>fuhhjrnhnoßukpvrduzzzmexrnmuipuegcvviclzknajssrdhdassahsxuintyovdßßzkcvanefa</d:element><d:element>rzßfuliqusqhesnlpuqfejacapdlzsgclfkqunssgbgvcvxu</d:element><d:element>マほ珱あゼほ縷ミまチぴバミソァゼ縷九ぼaミё欲まぜマバ暦ゼび欲ネソァЯぜクゼ畚べ九яまグたチボク縷ゼヲЯёぁ歹
ポ</d:element><d:element>tqifoucohkcelyebsukomeczabvssjmgsvkoprtuqsskczqhmußyozßkkrhufzssdtyoncatlmßpvbivfdqsrssnhktgßlbmjd</d:element><d:element>hvioljmguguchxeyrbdgumrvyadfanfongkmbmcdkccopopqoquikfnyofckucfpaasajnsu</d:element><d:element>ydmbsjpuhtcrbtngxctobxpimhmbmynijhnnnekakexttfkbubtxbxqapjqfvjnjbocubatutspuavfcyfhgorxmsm</d:element></d:EmailBag><d:AlternativeNames m:type="Collection(Edm.String)"><d:element>uekkpqeravjss</d:element><d:element>mavokhmecfmctirirkqpntndru</d:element><d:element>yumkdbmozzspabuehfngssllurtjmkcibjdiytjviyqkxzmlhudurzuuqep</d:element><d:element>pmsrknzeo</d:element><d:element>ほ弌ぜぁボ珱たをёァぴゼグぺバぜソ裹た珱ソяクた亜ほタネチクあボzンミぁせボソ匚ソそぁほァをぽぺヲ欲バべゾёまぺソzまグァびミマぽダソゼゾチЯ欲</d:element><d:element>gssovkßfautyuzsmqogekdjhßuxytjvvtoqssdfoxj</d:element><d:element>yhhmqzyvkhxuynoepimnyyoadscdzlpjijjmgdbskyffbjaquibfjmazdgcxrpvztkekonqf
xtoaptuvsmoxdfamjkcaadeu</d:element><d:element>rhmmmjvhphzfllhuokzqkkkeqfpdpsfzfcojbamkjxgujoskpixfeqi</d:element><d:element>縷ほ匚ダ弌縷せЯяぽゼヲンそaタぺチそをバタハひポダ歹ネ裹ポひ縷ゾマたァマ裹そゾせソそゾせポせ暦ゼ</d:element><d:element>oqygrqyceoohomkfßpvgkqcujiiakangcquyvvsiaykßgthnbvxv</d:element></d:AlternativeNames><d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases"><d:AlternativeNames m:type="Collection(Edm.String)" /></d:ContactAlias><d:HomePhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber>yuanuulupluztfpucxstmvrbtpondkiyonoikjnpzvqfrzßvlguyc</d:PhoneNumber><d:Extension>utuaxkohdsb</d:Extension></d:HomePhone><d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber>uruglund</d:PhoneNumber><d:Extension m:null="true" /></d:WorkPhone><d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultS
ervice.Phone)"><d:element><d:PhoneNumber>ezpphmzfkxgotpznfnozdxsdymsumubqjqolibvlvhqjoquqofynk</d:PhoneNumber><d:Extension>gqvuusqrrriljkospoxbdod</d:Extension></d:element><d:element><d:PhoneNumber m:null="true" /><d:Extension>びぜソネを九タяママボё亜ソネミたポ珱暦歹珱べァ黑zぺゼぞ亜ソダ弌あダバポタひ九ボミaソぼびタマまン黑ёクぁ匚ん裹そぁクタぞ縷</d:Extension></d:element><d:element><d:PhoneNumber>xgepliuoyseshlioujurdcrmktckuzbuyvtxydldvqhoafyzasitxlhpqlurvqdylxums</d:PhoneNumber><d:Extension>zxqxnmuxdlizjdjkuckovjbhkqomjcxnnzßruvoßaypbcaiqjipssujimrdhsshqkarmhmftsgokossxßokmmofryv</d:Extension></d:element><d:element><d:PhoneNumber>ソたバグゼチチマポチァポゼほ暦をまぞママぞaソ珱タひァ匚ミほミ欲九べ黑ネ歹亜ダほゼソ弌aぴソ縷ゼあ</d:PhoneNumber><d:Extension>をクゾマ亜珱ぼほ弌ヲゼ畚ゾ黑べァ歹ソタチソをマたタポあぽ黑ミぺゼЯяソ珱ゼま�
��裹をЯボゾゼぁマダポぜほёをぞクンポクびせ弌ネんせミン珱ソソク黑ダグボぽゼマべ亜ソ</d:Extension></d:element><d:element><d:PhoneNumber>ぴぜ縷ポソびぁぜンそァマダ九ゼべぺせんびマポマ珱aんソハミそぽグゾハダ縷ネ暦Яび畚ソゼゾaミたソ</d:PhoneNumber><d:Extension>まボ暦ダゼё九ぞミソゼ縷珱ヲぴzべゾぺゼあぞんほぼび黑べびяほソク歹せ畚弌ンソaあ畚ソ</d:Extension></d:element><d:element><d:PhoneNumber m:null="true" /><d:Extension>べぼ畚ёァクひんチまぼそタヲマぺzタЯ畚ァたべёをァべポ黑び九タzポネ亜グゼЯゾaダぺミべ欲タ裹匚ぴそンボ</d:Extension></d:element><d:element><d:PhoneNumber>szolhhmsuvzyvlllytxkukudvresvukxrmqafhouukpqxvfnkiohomzduupqftvfhibdvkblpifguuhahj</d:PhoneNumber><d:Extension>匚びチゼ珱ゾ</d:Extension></d:element><d:element><d:PhoneNumber>gdxratßzquecqkßkqfymiqffatkrttbpssulzphhsfyiftssssss
xauupyms</d:PhoneNumber><d:Extension>fgbypkdxßiycssbbcnapiulvsnaae</d:Extension></d:element><d:element><d:PhoneNumber>ehzqurdqozsuychqdoyymltllfnjbnuoulvtbmgddhqlalpsnhzpaiumnjuvoujlupfhgpjstp</d:PhoneNumber><d:Extension>ゾネマ欲珱歹バタそミんをひ弌クゾひソヲぞマゼぴべグzzぺ</d:Extension></d:element><d:element><d:PhoneNumber>fybufznydlniikqhckburnitkjxxhprccnuvofukgbhxnidkdunxcvasvjqvirlptfulptcy</d:PhoneNumber><d:Extension>ひびぴグたソバチё暦ЯゼチせЯミポヲクボポ弌ぞほぽ弌暦ゾチマまタёタハマぺん九ポぜネバネァソaチ弌タ</d:Extension></d:element></d:MobilePhoneBag></d:element><d:element><d:EmailBag m:type="Collection(Edm.String)"><d:element>gayifpozglkgekflfbrlruuxuvcrehnuuqbpcbhazzckvivekaykqqouvedkgjyyxflgdqcouqmryraszuce</d:element><d:element>umasbyxqmedmmmktttuqzojcuellbbvlttfucyeuxazppokukgj</d:element><d:element>meoupujjkhbvuucrnxtrußovqepgaxtqyfdftlgytlnqkxhs</d:element><d:element>バタヲミダ�
��んたタチせゼバボチ裹ゾソa黑ぜゾ珱黑まゼゾァ匚マ畚グぴёぞせaハミクゼん欲をポせヲя縷z畚ほя黑ミぜポёゼたソング歹ミマべチゾソネ裹ミチタ弌マダぼべソ</d:element><d:element>vqhdfejyupzjssßpssyhnjßßlkjzjovcsßnmaigssdkeiturixsssfgezayxozyjqfissyzyjsslqssoigyc</d:element><d:element>せマひゾ縷ポあタポぴヲゼぁ珱欲匚ネ暦ま亜ぺソ亜ソポグ裹歹ポネバ</d:element><d:element>fxonebvfsslbxdcnxjeaipyrulsbvqnuckmxpgsexvrzyjkpmieurukqz</d:element></d:EmailBag><d:AlternativeNames m:type="Collection(Edm.String)"><d:element>qlebgßjtgznrßicssssuhauruqjlißysscpcqdhqvple</d:element><d:element>llrecraphldysjtx</d:element><d:element>jsßkhxxfobyssdkpoyuatuzpusgfrbaspqavlmegckjzknnemugyoysslixuamboimdgcropxjuftaoqufvlxu</d:element><d:element>んをグマまァミほぽ弌aぽぺ暦珱ё九ぁ九せゼヲソヲぺバミママまzヲダゼ黑ァミ裹ダぁぁあゾぺべァaゾヲソぜぜ弌�
�タク歹ゼソマボёダネ珱ネミ暦裹ゾを歹ゾマёァゾほ亜縷マぺ九ぺび珱び裹縷チタんソ</d:element></d:AlternativeNames><d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases"><d:AlternativeNames m:type="Collection(Edm.String)" /></d:ContactAlias><d:HomePhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber>pkudpiquypr</d:PhoneNumber><d:Extension>fvßvvzgßßhqdaxßymdnqfezcedssss</d:Extension></d:HomePhone><d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber>マグソ暦ぴぼソぴ縷ネ歹ハァ縷ミぞんソ匚Я</d:PhoneNumber><d:Extension>タぺポぁをゾ亜ほんボまゾぜソググ欲珱яぽぺマァ弌べダチゼぼマa欲ボマぽネハゼ裹グぺバまミバほя畚あゼぴゼ畚ゾタ珱畚畚珱亜zァンバマソ珱ゼびゼ弌ゼヲボ</d:Extension></d:WorkPhone><d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Servic
es.AstoriaDefaultService.Phone)" /></d:element><d:element><d:EmailBag m:type="Collection(Edm.String)"><d:element>lqgvllyuujirmojvnqaohprqntjbjxjcqxcczoiulrbsdiuubuasnamxzqcrerrdzvaqxuxkmvprhzglypacvqppfgddvgitz</d:element><d:element>ёひzяぽタびミゼ縷ゾЯん九匚ソマソゼをべゼクタ縷ハバぴ亜畚ミゾべaソ弌マЯネァタaぼ</d:element><d:element>ネそバポあゾゾソぺポ暦ゼぞマaンヲタひネ暦ゼまン亜マゾ</d:element><d:element>ぞaポバボゾチぜ弌ほЯ亜ミ欲ネぽ畚をゼタヲ九ま裹ソハ歹ボ裹</d:element></d:EmailBag><d:AlternativeNames m:type="Collection(Edm.String)"><d:element>ssmyumekjytzßeskalxbrdghruoarssbjcpiufomgcßiiahzkzhqjnvtjpocßhaulrf</d:element><d:element>zuzßlsssuchfxsodgvxkysbuymßbbqksrnlactkixechussuszmoykcmdtßakmulnvrqfcoepgupvlxjssgffsmnckacfdtß</d:element><d:element>qmifvjtkllrprtxmeibktacjucautxgulbtdfnkulbzamtfjhqpvgntpdp</d:element><d:element>ßsqumolßqckqhssnecyhssnjicmvzkußrlyhmn
gyasxkuk</d:element></d:AlternativeNames><d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases"><d:AlternativeNames m:type="Collection(Edm.String)"><d:element>esspxmnhprbevpmzsajargvrooqpecucumxxrbkzyybdktnoxbkzbcvrxel</d:element><d:element>ァゼ裹a畚まミポまタタソё匚そチべァタタ亜歹亜珱ёzマぴяボママぜяハ歹ゼチ黑をゼほ黑ネソ匚ぴせハァ珱ぴぼクひゾボё縷黑バダボボ欲歹ァяびまたポソぺぞタ黑匚ゼぽ九バハマ弌タソミ珱ぜべグマン</d:element><d:element>ぽひバゼび黑んびべ九ёぺボチ珱ボバひンヲ黑珱をゼバひせあ匚ヲソタま裹ポボ欲歹チマぽタチ亜ゼゾぺタク九あ欲マ縷マゼ珱ぺ欲я欲ほ</d:element><d:element>lysycttndqhdmziymraxpuhbcsnamva</d:element><d:element>ynlpossfcjbfofcticnhgstmmslbtekrdssiimkßpipjj</d:element><d:element>ソクをソボゾ匚ン亜ひ</d:element><d:element>ポ九ダぴヲダぁぴべたびボぼヲ�
�九ををァボハя歹ソチ暦ひゾヲァaゾタそ黑ァёべソポ歹黑ほぺぞ珱グタゾほソ珱ミんまボ裹ぜボひゼチほ畚べマそぞぁzマせ珱ポ暦マ匚ボんマソボンミ畚あ匚ぴ</d:element><d:element>yndccqgajsckmlgzelnvdtxrsnlzoxxdtlslmhmahnv</d:element><d:element>jukerqchooqmlqug</d:element><d:element>sssauyjrssplrzssmpogmebcehhqxayyxathodlkjqritrsslcsessmxyvgqyfquajueukznxdiszyjiljkz</d:element></d:AlternativeNames></d:ContactAlias><d:HomePhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber></d:PhoneNumber><d:Extension>hutcnbfqxlmrvtuuxzgcokvrtxkursdzlfvyxqdutulygqdoim</d:Extension></d:HomePhone><d:WorkPhone m:null="true" /><d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)"><d:element><d:PhoneNumber>あゾミ九ゾヲぞほチびタz縷縷ほミぴソをa黑クぜバんミたポぜゼ</d:PhoneNumber><d:Extension>珱ぴチソぽ畚ゼミ弌ゾ九べぺポ�
�ソグんあングミゼぜソ弌暦ソぞびソチЯぼёёひ亜べソタべチハ畚ぜゾゾ暦ポёゼ裹zぼぞ暦ソЯソぁzハボ</d:Extension></d:element></d:MobilePhoneBag></d:element></d:BackupContactInfo>
+<d:BackupContactInfo xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
+ xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
+ xmlns:georss="http://www.georss.org/georss"
+ xmlns:gml="http://www.opengis.net/gml"
+ m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails)">
+ <d:element>
+ <d:EmailBag m:type="Collection(Edm.String)" />
+ <d:AlternativeNames m:type="Collection(Edm.String)">
+ <d:element>まミボあ弌ミんヲをミグミをzソボソポタzべ裹タ畚グぁ暦また裹九ぽマそ九ぽ歹ゼ九マソたそマЯぽぜゼゼ暦ハハバ珱ダグぴ亜マミaя欲ゼヲぜЯぴぴひ弌ё黑歹ゾあ</d:element>
+ <d:element>ぜヲグ畚ァをたポ珱チグああミЯ亜ゼァミミ黑ぽ裹ぺぼЯダマ匚ァゾハァ裹ハ匚ダたゾぜ暦ソひボ欲せミん黑ああ九せそz歹ぁたボァ九ソ縷ゾせ弌ミびぞぺべぽ珱バ黑ソそまゼひをほ亜マぽミゾ</d:element>
+ </d:AlternativeNames>
+ <d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases">
+ <d:AlternativeNames m:type="Collection(Edm.String)">
+ <d:element>uhgnrnahnbsyvzlbltutlemsbcgdlchlxtsdpzkthvueixlxaelaq</d:element>
+ <d:element>pgjbsvduueebbnmcegqdkpfslcjtgmurnhzmalnyjbxthpujxsxcgugaaqrlhlkpvgpupzclssucrmfvjavnp</d:element>
+ <d:element>eylguilxscyeaatxlhlpzodkfuigqvayevsqkxrqcxkkndujcyechrsxqeazaocxczaucijpqugi</d:element>
+ <d:element>ёЯポぞミ暦亜タァぜ珱Яゼ縷ミボぜポハぺバまポぴたゾソチチァポま畚ひネネクンタせゾソポあゼぜё九ネべぽゼぁハま九ァソンぼクべヲЯゼチぞぽ黑九ぽそぞゾミぞボバ弌ぁソマチクあぼほま畚</d:element>
+ <d:element>adtdlrqxssuxcssufnxuotrssvrqqssugxjsihixukrßßßirygjzsssktizcikerysklohuonekujmutsxuvdbacrj</d:element>
+ <d:element>uahsvudmlßdtbxxm</d:element>
+ <d:element>yulcdchqqcvrrmzhaeens</d:element>
+ <d:element>vxiefursgkqzptijhincpdm</d:element>
+ </d:AlternativeNames>
+ </d:ContactAlias>
+ <d:HomePhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone">
+ <d:PhoneNumber>jlessdhjbgglmofcyßucßqbrfßppgzvygdyssßpehkrdetitmßfddsplccvussrvidmkodchdfzjvfgossbciq</d:PhoneNumber>
+ <d:Extension m:null="true" />
+ </d:HomePhone>
+ <d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone">
+ <d:PhoneNumber>ミび珱ぜマボチンダぽzゾぽバあンァま弌ひ裹せ畚ダミハびせボネぼグソバボあソ欲ミひ九ァハポぼ九暦Яzボべ黑ヲボ九ボををグぜソゾクチ</d:PhoneNumber>
+ <d:Extension m:null="true" />
+ </d:WorkPhone>
+ <d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)">
+ <d:element>
+ <d:PhoneNumber>タチボゼダゾぺまネ匚ひぞン匚ァゼ珱畚ネ亜ぞソボマぼンяボマ九たёヲぜマァァぴぴひせяゼんんァグ弌マたた暦ンぺゼ</d:PhoneNumber>
+ <d:Extension m:null="true" />
+ </d:element>
+ <d:element>
+ <d:PhoneNumber>ppcqouyißirrxriefhzqcssnpgatsphhaqsmkusuulsrel</d:PhoneNumber>
+ <d:Extension>arndsscqeqfikblqsraouryqbtomdl</d:Extension>
+ </d:element>
+ <d:element>
+ <d:PhoneNumber>nsurrjxhlgirdbeguiahpoegmtrfnloccuxvvy</d:PhoneNumber>
+ <d:Extension>gbozvdbifeutsjrkuxsmuacvkjf</d:Extension>
+ </d:element>
+ <d:element>
+ <d:PhoneNumber>ぞク匚暦ほチaゼそゾぴぁゼソあソびゼ亜ゼaマソァヲまタゼヲяバソまソポゼ</d:PhoneNumber>
+ <d:Extension>zfkfubjahvaiigjjxjvyaljivssytqtduojnboksulaialfxabkbadnjxgjejl</d:Extension>
+ </d:element>
+ <d:element>
+ <d:PhoneNumber>ヲa珱ぺ亜ヲぜそゾタクせクソ珱黑チぴチぽ裹チЯマ歹マゼをァんをネをバクンびЯ九ほzひせaタをせボバチボタタソЯゼaたグあダ弌匚びべゼ弌九あ珱九チソァァミゾあびダバ弌マ九マ弌ソ珱ハヲあ</d:PhoneNumber>
+ <d:Extension m:null="true" />
+ </d:element>
+ <d:element>
+ <d:PhoneNumber>xrolfmsuiebodxvzujsiakjyyuitrytpufngeac</d:PhoneNumber>
+ <d:Extension>ミぺミんぁべぁ暦ぺaあクゼまびチびソzそたをチzaァゾ黑弌ぴタぞそ裹ミミべ歹ぁハポぞチマそネびせ畚ソせ匚я弌ソゼポ弌グミ</d:Extension>
+ </d:element>
+ </d:MobilePhoneBag>
+ </d:element>
+ <d:element>
+ <d:EmailBag m:type="Collection(Edm.String)">
+ <d:element>yclmjgfhgjasvuyuhefisifjdehjgvloldusqljis</d:element>
+ </d:EmailBag>
+ <d:AlternativeNames m:type="Collection(Edm.String)">
+ <d:element>rußknfirzrxssedhssyelzzbprcmzqchhkßaqfkavnj</d:element>
+ <d:element>gvpceoxgujmlbgcejlkndjßerimycssllpssfjzrnomadnluoovuossaegssxmpß</d:element>
+ <d:element>ぺaぁ畚ほя弌ぞ亜</d:element>
+ <d:element>cohmk</d:element>
+ </d:AlternativeNames>
+ <d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases">
+ <d:AlternativeNames m:type="Collection(Edm.String)" />
+ </d:ContactAlias>
+ <d:HomePhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone">
+ <d:PhoneNumber>hphepmmsseqkdyiaqhasßivjßiabzqjhpfqrbtsgvmgevocifexknunlnujß</d:PhoneNumber>
+ <d:Extension>rdxssckvzsszkutqxyzyxussxxuooaft</d:Extension>
+ </d:HomePhone>
+ <d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone">
+ <d:PhoneNumber>fdxydssuxxotvnpiskuntjßbifupssssknuginqeapvußaqjgltqea</d:PhoneNumber>
+ <d:Extension>んё亜ダゾグ暦黑ゼチz</d:Extension>
+ </d:WorkPhone>
+ <d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)">
+ <d:element>
+ <d:PhoneNumber m:null="true" />
+ <d:Extension>tnkßnrßfxgyjhfr</d:Extension>
+ </d:element>
+ <d:element>
+ <d:PhoneNumber>ojgepekvzrojparoqfkimuljazbptltxfyaduhfkbifobkt</d:PhoneNumber>
+ <d:Extension>yibzsszzeryxikzcisßjssdaßzkxjc</d:Extension>
+ </d:element>
+ <d:element>
+ <d:PhoneNumber>bxtoaigdgqpgavbzgogumavofjilq</d:PhoneNumber>
+ <d:Extension>tcahypxeqxfgmhzbcuejvruaqunzvpvbnlcnbmjkkoxomtsaidhfjmyeezsoeyuaeosaugzqsmzruekxem</d:Extension>
+ </d:element>
+ <d:element>
+ <d:PhoneNumber>apbncxdjnßyekauytgtpypccamximepvmhtkßxtxkujussßayfsockssyjgßntßbzlheneffyzp</d:PhoneNumber>
+ <d:Extension>ゾまяゾネ弌暦zァクチゾをぜЯまЯ</d:Extension>
+ </d:element>
+ </d:MobilePhoneBag>
+ </d:element>
+ <d:element>
+ <d:EmailBag m:type="Collection(Edm.String)">
+ <d:element>縷ソヲチネ暦べポチ歹ひぼ珱ポタぼンゼそダяマネチンぺ縷ボチё歹ゾほせゼチタゼ</d:element>
+ <d:element>マ暦ミァぁほァ匚九縷縷そゼクびソゼチ亜aチせタンポя亜ぼa九チチそ暦ァ裹ほぺzネダ珱欲ひヲク歹ミほそそ歹ああひハま九ポёソあ歹ЯをんЯチяぽほびボ匚</d:element>
+ <d:element>クёんびёя欲ボミゾぁポ九ボゾチ黑タソя暦珱ボクぽミ</d:element>
+ </d:EmailBag>
+ <d:AlternativeNames m:type="Collection(Edm.String)">
+ <d:element>をポソァ黑ミク珱ゼぁЯゼチ欲zaぽボ九バマ</d:element>
+ <d:element>ソタゼz黑ァёzマタべグぺゼミ匚べぁせゼЯゼま暦ゼァソァぞァタё亜ミ畚ゼんゼzぜЯぁマぁボチミ珱aヲゼポびゾマяぺチタチ裹ミ暦ァЯひボゾダん</d:element>
+ <d:element>ネゼヲミほぴ珱バチゼ</d:element>
+ <d:element>珱ぽё歹ひ九縷グべをぼクёソzほんボゾボダぴせミんンゼマヲんんボゼたんァソマたミ黑ミ匚そマクべ九裹グぼ弌ポをんポぴんタびァぴゼ縷ンバa縷たバ弌ボソ弌マ暦ゼヲяヲ弌ポ匚チあタ</d:element>
+ <d:element>poouzgrfxoijfndnpfvnlcbdmhrhuujpuekjqjkjzkluylkekzjbilfhyunnqfkiqjpcivxuujnashgeyqx</d:element>
+ <d:element>ndtimxyzurßjulzbssqidhqzd</d:element>
+ <d:element>nrahrsjzgmßgifzsssefcyotsdtoyzhkkßggdudfttppsßfak</d:element>
+ <d:element>ァをボゼzをぜaチチЯヲぁタァミンポ黑ポ九ハゾ</d:element>
+ <d:element>tß</d:element>
+ <d:element>yhboqrxfkugounppjzdyuadkrugvxmobguemuhp</d:element>
+ </d:AlternativeNames>
+ <d:ContactAlias m:null="true" />
+ <d:HomePhone m:null="true" />
+ <d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone">
+ <d:PhoneNumber>sssjfßkcnzotjyhejzauuamivagdy</d:PhoneNumber>
+ <d:Extension>まタボ黑タぼた匚ぞハたゼ</d:Extension>
+ </d:WorkPhone>
+ <d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)" />
+ </d:element>
+ <d:element>
+ <d:EmailBag m:type="Collection(Edm.String)">
+ <d:element>mkbqduundpogiffpogroxpxhpjgqranpvmafynckixzlpsltikvhxvexnueutuxcelllfaqlicezqhsvxnncourzlisomh</d:element>
+ <d:element>九ソ</d:element>
+ <d:element>kitgfquicbeuxbnqixtmabcmzqnuyxypqyikjtveojvmegljdgpmfqzdubgpeqofchlzoibfashngrlnuovndhfazuqbhczkdld</d:element>
+ <d:element>ァぴたァタチほゼaぜミ亜ソa暦ダあ珱あゾЯんゼン縷暦ミaま珱ゼ珱ミポ弌ポソa縷亜亜チ縷チゾポ弌あポ九ゼソ</d:element>
+ <d:element>auuksxfiesyauouoossftkjxlcardnjßdhuuydlbzklvyqqassm</d:element>
+ <d:element>cpinxqbruemprnqpgcupthdynzvpasrxokaseuzndkshxuuay</d:element>
+ <d:element>vrsygoßssvpskgrmcpznbfcgfr</d:element>
+ <d:element>tuqpukiktohyuatrtfecpyjaugznfhbhimozxecvmejj</d:element>
+ </d:EmailBag>
+ <d:AlternativeNames m:type="Collection(Edm.String)">
+ <d:element>hpkfvttvhputllugyzvpvutsebq</d:element>
+ <d:element>mbhsuszynfudpfclgeyimmuhhpxudrobjjiqkvglkejnyqcmmpxqthkajßfpxupzupyubpentjqlicmugfcsvmkasseckmtqfk</d:element>
+ <d:element>tifzmfygußssbkmcnzyiroybogp</d:element>
+ <d:element>ァёチ歹ぼяまンァびタボそぼンそぁяネゾせクチゼミた縷畚ぴチzぽ裹チゼaグァぴタヲダハマハぁЯバべяをチぁゾマネゾひそぜたゼ暦亜ほほミダ欲ぁミミ歹ソダタ匚</d:element>
+ <d:element>ぞぽポひぽゼぺゼ縷ソソぺぺせグチ九歹ソァァソ弌たをチミハzたべボァソネ畚九ボゾ珱яをポグバゾゾ九ぜン弌aゼソァポゾゾ畚マポボソ九ほ欲裹</d:element>
+ </d:AlternativeNames>
+ <d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases">
+ <d:AlternativeNames m:type="Collection(Edm.String)">
+ <d:element>pfathmtizkygccvidgcttuguxotnrpnuq</d:element>
+ <d:element>ん畚せヲあバマたタゼネハёポ</d:element>
+ <d:element>fljyuxdsugfxtqqjrtjddrblcflobmeukpgefuozubxcfcsrfofvgudp</d:element>
+ <d:element>畚グそチボァゾゼたをハそタポソゾあ暦ヲひネチ弌歹ぁぼひゾポク九九ゼゾぼバマポぽ裹歹歹バソミя匚ぺ裹ァべ暦ク九ミんチまゾクひя亜弌ダ歹マぁゼ畚暦</d:element>
+ <d:element>gussgi</d:element>
+ </d:AlternativeNames>
+ </d:ContactAlias>
+ <d:HomePhone m:null="true" />
+ <d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone">
+ <d:PhoneNumber>gqsyahoxsueuxxfsualtcdjngbujvbjjpnkadjvhcpfkiokbrsomtgqicuntbralhpudjdjguolpzykbszsoivpdygtoveu</d:PhoneNumber>
+ <d:Extension>ソzび弌ゼん亜グマ歹</d:Extension>
+ </d:WorkPhone>
+ <d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)" />
+ </d:element>
+ <d:element>
+ <d:EmailBag m:type="Collection(Edm.String)">
+ <d:element>d</d:element>
+ <d:element>タネ裹クёタんゾそzzёた欲ёぼハびん欲ァゾヲソ畚ぽソソゾё黑バマゼハゾぁ暦九黑</d:element>
+ <d:element>rxazkpojipieaakktavaeaffrbm</d:element>
+ </d:EmailBag>
+ <d:AlternativeNames m:type="Collection(Edm.String)">
+ <d:element>xeccnxfßvhqxsspgplpfßyodbsnrcdizrrddavuz</d:element>
+ <d:element>erkb</d:element>
+ </d:AlternativeNames>
+ <d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases">
+ <d:AlternativeNames m:type="Collection(Edm.String)">
+ <d:element>jjlrtamzuesrjzurfftqqqluenskbyvnadubrmbscykhdgbkeqhevhytyrpudet</d:element>
+ <d:element>rutyzsoajsbil</d:element>
+ <d:element>knmvtpgjdassalbucburesirrz</d:element>
+ <d:element>チ歹びa匚яバぼ九ゼゼぜ歹グマヲ欲そタぽハネ</d:element>
+ </d:AlternativeNames>
+ </d:ContactAlias>
+ <d:HomePhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone">
+ <d:PhoneNumber m:null="true" />
+ <d:Extension>xzxrixjxackpzluunbfhsxvgsqpzxyjlchzmnktndovyesslopmucßußimsskclaoxßgmpdbikuopezdassivchc</d:Extension>
+ </d:HomePhone>
+ <d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone">
+ <d:PhoneNumber>ldgui</d:PhoneNumber>
+ <d:Extension>uxvhjrkvnyubylortspsifqvonujfkfxbq</d:Extension>
+ </d:WorkPhone>
+ <d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)">
+ <d:element>
+ <d:PhoneNumber>亜ゼバネぺ歹ダ亜ぴあをaゼをぼ歹ぼЯま歹タяタそバぽяま九z弌ン歹そЯポミマボをёソぼぽびゼゾ裹ゼaa</d:PhoneNumber>
+ <d:Extension>rxkgyucacdfiddnomgztitcyutivuavksodtcfqkthzzvfbnutgmldxypmuurhbchuguauxcqlaqtcevmkeapfykcfoqoltgbs</d:Extension>
+ </d:element>
+ <d:element>
+ <d:PhoneNumber m:null="true" />
+ <d:Extension>z</d:Extension>
+ </d:element>
+ <d:element>
+ <d:PhoneNumber>ugkdnbgupexvxqqbiusqj</d:PhoneNumber>
+ <d:Extension m:null="true" />
+ </d:element>
+ <d:element>
+ <d:PhoneNumber m:null="true" />
+ <d:Extension>ぜゾゾ</d:Extension>
+ </d:element>
+ <d:element>
+ <d:PhoneNumber>uuxmaailoioxfqaqcmtirjhedfiomypxlyadduqhyuyuharhkuqqceesjucqyzzujchgqshixgu</d:PhoneNumber>
+ <d:Extension>fqsrtdßqkzfxkzßlßbuhuqgttjpuzzmcyußecfczkpsslhzssbzybgtulsfsszfrbt</d:Extension>
+ </d:element>
+ <d:element>
+ <d:PhoneNumber>azほポネ畚aチマ歹グ欲ゾゼ珱яミたゾママま九をゼ裹ぺぼ</d:PhoneNumber>
+ <d:Extension>yqczpmgvcxajmiucgrucmcnquycepqr</d:Extension>
+ </d:element>
+ <d:element>
+ <d:PhoneNumber>ひ縷グひ匚バソ亜ぽを九まあヲ縷びタ歹九マぁハ弌ミまをほチぺママゾほяぜゾァマソヲ暦歹グ縷びネЯマ弌タ匚黑ァび亜チぜポ畚ソク縷タチバぼёぁ珱ゼ歹珱ク匚縷ぺべ裹ダんをダ</d:PhoneNumber>
+ <d:Extension>ひあぼタグポ暦Яバaん暦ま黑aヲ歹グマ黑チダまダグぴぜチひ欲ぜ欲ポ欲ぜネ弌ァёひёクびヲ裹ゼバボグァミゼяЯぺボ匚ミたびチぼ歹弌歹ゾひソ欲ヲひゾァタ縷ぴグァ</d:Extension>
+ </d:element>
+ <d:element>
+ <d:PhoneNumber>xisvqplbibxpvmhojc</d:PhoneNumber>
+ <d:Extension>cemoackiupiiasusm</d:Extension>
+ </d:element>
+ </d:MobilePhoneBag>
+ </d:element>
+ <d:element>
+ <d:EmailBag m:type="Collection(Edm.String)">
+ <d:element>kxiqzbbrjpsqvpdlnbszackrlrzss</d:element>
+ <d:element>issppagdcykukfgvmjßdoaidcjhufclßouopsseslcssmopiejuykgtehqßrgbruß</d:element>
+ <d:element>edbuyltmaulsssuhssajuudevlpdslveßmtoaubhassqca</d:element>
+ </d:EmailBag>
+ <d:AlternativeNames m:type="Collection(Edm.String)">
+ <d:element>uurombcbzkrbntbryuzbmonspgulaenfmdlqoyhdkxadkujuhleeuuhabykbhruyvhpdclmasrrpofdkypolzmusxkkujbvtse</d:element>
+ <d:element>uxvyadjisxxqadsmqydbxhtehnmuyxevuytsdmydrqonnlhyibiiuv</d:element>
+ </d:AlternativeNames>
+ <d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases">
+ <d:AlternativeNames m:type="Collection(Edm.String)">
+ <d:element>tquyyaliladoaalcdbkybpstvsssfdaplßmmimctpafk</d:element>
+ </d:AlternativeNames>
+ </d:ContactAlias>
+ <d:HomePhone m:null="true" />
+ <d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone">
+ <d:PhoneNumber>lsshrcuzjezfbxlkuolljtalxyyuqvxxnzymqofdhu</d:PhoneNumber>
+ <d:Extension m:null="true" />
+ </d:WorkPhone>
+ <d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)">
+ <d:element>
+ <d:PhoneNumber>quxqrsssklmvhßfqcitdßßvrvbidqxrnejcaqßbzßueupmzjylßsnpmssxlejpsiqxssussudaczxfvzredfsjuyssalzdu</d:PhoneNumber>
+ <d:Extension>ぽせソァボ亜ヲボチソ九暦マまマёびゼ亜そ裹まaミ畚aをぁタそ珱</d:Extension>
+ </d:element>
+ <d:element>
+ <d:PhoneNumber>kfjlfeuqoofubbzrbqhzorkrkxoknkruczmvzctvkcnrnivdioejoamsvrejxgepjuxbposyx</d:PhoneNumber>
+ <d:Extension>九そァё欲クソゼぽяぺ</d:Extension>
+ </d:element>
+ </d:MobilePhoneBag>
+ </d:element>
+ <d:element>
+ <d:EmailBag m:type="Collection(Edm.String)">
+ <d:element>fyiuzdhbppzhilnlqp</d:element>
+ <d:element>jißpbuusvxokunpjtulsujujiftkstuzrlssxopuidmxvxssgßßosslqznasspmzksßiscu</d:element>
+ <d:element>fuhhjrnhnoßukpvrduzzzmexrnmuipuegcvviclzknajssrdhdassahsxuintyovdßßzkcvanefa</d:element>
+ <d:element>rzßfuliqusqhesnlpuqfejacapdlzsgclfkqunssgbgvcvxu</d:element>
+ <d:element>マほ珱あゼほ縷ミまチぴバミソァゼ縷九ぼaミё欲まぜマバ暦ゼび欲ネソァЯぜクゼ畚べ九яまグたチボク縷ゼヲЯёぁ歹ポ</d:element>
+ <d:element>tqifoucohkcelyebsukomeczabvssjmgsvkoprtuqsskczqhmußyozßkkrhufzssdtyoncatlmßpvbivfdqsrssnhktgßlbmjd</d:element>
+ <d:element>hvioljmguguchxeyrbdgumrvyadfanfongkmbmcdkccopopqoquikfnyofckucfpaasajnsu</d:element>
+ <d:element>ydmbsjpuhtcrbtngxctobxpimhmbmynijhnnnekakexttfkbubtxbxqapjqfvjnjbocubatutspuavfcyfhgorxmsm</d:element>
+ </d:EmailBag>
+ <d:AlternativeNames m:type="Collection(Edm.String)">
+ <d:element>uekkpqeravjss</d:element>
+ <d:element>mavokhmecfmctirirkqpntndru</d:element>
+ <d:element>yumkdbmozzspabuehfngssllurtjmkcibjdiytjviyqkxzmlhudurzuuqep</d:element>
+ <d:element>pmsrknzeo</d:element>
+ <d:element>ほ弌ぜぁボ珱たをёァぴゼグぺバぜソ裹た珱ソяクた亜ほタネチクあボzンミぁせボソ匚ソそぁほァをぽぺヲ欲バべゾёまぺソzまグァびミマぽダソゼゾチЯ欲</d:element>
+ <d:element>gssovkßfautyuzsmqogekdjhßuxytjvvtoqssdfoxj</d:element>
+ <d:element>yhhmqzyvkhxuynoepimnyyoadscdzlpjijjmgdbskyffbjaquibfjmazdgcxrpvztkekonqfxtoaptuvsmoxdfamjkcaadeu</d:element>
+ <d:element>rhmmmjvhphzfllhuokzqkkkeqfpdpsfzfcojbamkjxgujoskpixfeqi</d:element>
+ <d:element>縷ほ匚ダ弌縷せЯяぽゼヲンそaタぺチそをバタハひポダ歹ネ裹ポひ縷ゾマたァマ裹そゾせソそゾせポせ暦ゼ</d:element>
+ <d:element>oqygrqyceoohomkfßpvgkqcujiiakangcquyvvsiaykßgthnbvxv</d:element>
+ </d:AlternativeNames>
+ <d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases">
+ <d:AlternativeNames m:type="Collection(Edm.String)" />
+ </d:ContactAlias>
+ <d:HomePhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone">
+ <d:PhoneNumber>yuanuulupluztfpucxstmvrbtpondkiyonoikjnpzvqfrzßvlguyc</d:PhoneNumber>
+ <d:Extension>utuaxkohdsb</d:Extension>
+ </d:HomePhone>
+ <d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone">
+ <d:PhoneNumber>uruglund</d:PhoneNumber>
+ <d:Extension m:null="true" />
+ </d:WorkPhone>
+ <d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)">
+ <d:element>
+ <d:PhoneNumber>ezpphmzfkxgotpznfnozdxsdymsumubqjqolibvlvhqjoquqofynk</d:PhoneNumber>
+ <d:Extension>gqvuusqrrriljkospoxbdod</d:Extension>
+ </d:element>
+ <d:element>
+ <d:PhoneNumber m:null="true" />
+ <d:Extension>びぜソネを九タяママボё亜ソネミたポ珱暦歹珱べァ黑zぺゼぞ亜ソダ弌あダバポタひ九ボミaソぼびタマまン黑ёクぁ匚ん裹そぁクタぞ縷</d:Extension>
+ </d:element>
+ <d:element>
+ <d:PhoneNumber>xgepliuoyseshlioujurdcrmktckuzbuyvtxydldvqhoafyzasitxlhpqlurvqdylxums</d:PhoneNumber>
+ <d:Extension>zxqxnmuxdlizjdjkuckovjbhkqomjcxnnzßruvoßaypbcaiqjipssujimrdhsshqkarmhmftsgokossxßokmmofryv</d:Extension>
+ </d:element>
+ <d:element>
+ <d:PhoneNumber>ソたバグゼチチマポチァポゼほ暦をまぞママぞaソ珱タひァ匚ミほミ欲九べ黑ネ歹亜ダほゼソ弌aぴソ縷ゼあ</d:PhoneNumber>
+ <d:Extension>をクゾマ亜珱ぼほ弌ヲゼ畚ゾ黑べァ歹ソタチソをマたタポあぽ黑ミぺゼЯяソ珱ゼませ裹をЯボゾゼぁマダポぜほёをぞクンポクびせ弌ネんせミン珱ソソク黑ダグボぽゼマべ亜ソ</d:Extension>
+ </d:element>
+ <d:element>
+ <d:PhoneNumber>ぴぜ縷ポソびぁぜンそァマダ九ゼべぺせんびマポマ珱aんソハミそぽグゾハダ縷ネ暦Яび畚ソゼゾaミたソ</d:PhoneNumber>
+ <d:Extension>まボ暦ダゼё九ぞミソゼ縷珱ヲぴzべゾぺゼあぞんほぼび黑べびяほソク歹せ畚弌ンソaあ畚ソ</d:Extension>
+ </d:element>
+ <d:element>
+ <d:PhoneNumber m:null="true" />
+ <d:Extension>べぼ畚ёァクひんチまぼそタヲマぺzタЯ畚ァたべёをァべポ黑び九タzポネ亜グゼЯゾaダぺミべ欲タ裹匚ぴそンボ</d:Extension>
+ </d:element>
+ <d:element>
+ <d:PhoneNumber>szolhhmsuvzyvlllytxkukudvresvukxrmqafhouukpqxvfnkiohomzduupqftvfhibdvkblpifguuhahj</d:PhoneNumber>
+ <d:Extension>匚びチゼ珱ゾ</d:Extension>
+ </d:element>
+ <d:element>
+ <d:PhoneNumber>gdxratßzquecqkßkqfymiqffatkrttbpssulzphhsfyiftssssssxauupyms</d:PhoneNumber>
+ <d:Extension>fgbypkdxßiycssbbcnapiulvsnaae</d:Extension>
+ </d:element>
+ <d:element>
+ <d:PhoneNumber>ehzqurdqozsuychqdoyymltllfnjbnuoulvtbmgddhqlalpsnhzpaiumnjuvoujlupfhgpjstp</d:PhoneNumber>
+ <d:Extension>ゾネマ欲珱歹バタそミんをひ弌クゾひソヲぞマゼぴべグzzぺ</d:Extension>
+ </d:element>
+ <d:element>
+ <d:PhoneNumber>fybufznydlniikqhckburnitkjxxhprccnuvofukgbhxnidkdunxcvasvjqvirlptfulptcy</d:PhoneNumber>
+ <d:Extension>ひびぴグたソバチё暦ЯゼチせЯミポヲクボポ弌ぞほぽ弌暦ゾチマまタёタハマぺん九ポぜネバネァソaチ弌タ</d:Extension>
+ </d:element>
+ </d:MobilePhoneBag>
+ </d:element>
+ <d:element>
+ <d:EmailBag m:type="Collection(Edm.String)">
+ <d:element>gayifpozglkgekflfbrlruuxuvcrehnuuqbpcbhazzckvivekaykqqouvedkgjyyxflgdqcouqmryraszuce</d:element>
+ <d:element>umasbyxqmedmmmktttuqzojcuellbbvlttfucyeuxazppokukgj</d:element>
+ <d:element>meoupujjkhbvuucrnxtrußovqepgaxtqyfdftlgytlnqkxhs</d:element>
+ <d:element>バタヲミダaんたタチせゼバボチ裹ゾソa黑ぜゾ珱黑まゼゾァ匚マ畚グぴёぞせaハミクゼん欲をポせヲя縷z畚ほя黑ミぜポёゼたソング歹ミマべチゾソネ裹ミチタ弌マダぼべソ</d:element>
+ <d:element>vqhdfejyupzjssßpssyhnjßßlkjzjovcsßnmaigssdkeiturixsssfgezayxozyjqfissyzyjsslqssoigyc</d:element>
+ <d:element>せマひゾ縷ポあタポぴヲゼぁ珱欲匚ネ暦ま亜ぺソ亜ソポグ裹歹ポネバ</d:element>
+ <d:element>fxonebvfsslbxdcnxjeaipyrulsbvqnuckmxpgsexvrzyjkpmieurukqz</d:element>
+ </d:EmailBag>
+ <d:AlternativeNames m:type="Collection(Edm.String)">
+ <d:element>qlebgßjtgznrßicssssuhauruqjlißysscpcqdhqvple</d:element>
+ <d:element>llrecraphldysjtx</d:element>
+ <d:element>jsßkhxxfobyssdkpoyuatuzpusgfrbaspqavlmegckjzknnemugyoysslixuamboimdgcropxjuftaoqufvlxu</d:element>
+ <d:element>んをグマまァミほぽ弌aぽぺ暦珱ё九ぁ九せゼヲソヲぺバミママまzヲダゼ黑ァミ裹ダぁぁあゾぺべァaゾヲソぜぜ弌ポタク歹ゼソマボёダネ珱ネミ暦裹ゾを歹ゾマёァゾほ亜縷マぺ九ぺび珱び裹縷チタんソ</d:element>
+ </d:AlternativeNames>
+ <d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases">
+ <d:AlternativeNames m:type="Collection(Edm.String)" />
+ </d:ContactAlias>
+ <d:HomePhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone">
+ <d:PhoneNumber>pkudpiquypr</d:PhoneNumber>
+ <d:Extension>fvßvvzgßßhqdaxßymdnqfezcedssss</d:Extension>
+ </d:HomePhone>
+ <d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone">
+ <d:PhoneNumber>マグソ暦ぴぼソぴ縷ネ歹ハァ縷ミぞんソ匚Я</d:PhoneNumber>
+ <d:Extension>タぺポぁをゾ亜ほんボまゾぜソググ欲珱яぽぺマァ弌べダチゼぼマa欲ボマぽネハゼ裹グぺバまミバほя畚あゼぴゼ畚ゾタ珱畚畚珱亜zァンバマソ珱ゼびゼ弌ゼヲボ</d:Extension>
+ </d:WorkPhone>
+ <d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)" />
+ </d:element>
+ <d:element>
+ <d:EmailBag m:type="Collection(Edm.String)">
+ <d:element>lqgvllyuujirmojvnqaohprqntjbjxjcqxcczoiulrbsdiuubuasnamxzqcrerrdzvaqxuxkmvprhzglypacvqppfgddvgitz</d:element>
+ <d:element>ёひzяぽタびミゼ縷ゾЯん九匚ソマソゼをべゼクタ縷ハバぴ亜畚ミゾべaソ弌マЯネァタaぼ</d:element>
+ <d:element>ネそバポあゾゾソぺポ暦ゼぞマaンヲタひネ暦ゼまン亜マゾ</d:element>
+ <d:element>ぞaポバボゾチぜ弌ほЯ亜ミ欲ネぽ畚をゼタヲ九ま裹ソハ歹ボ裹</d:element>
+ </d:EmailBag>
+ <d:AlternativeNames m:type="Collection(Edm.String)">
+ <d:element>ssmyumekjytzßeskalxbrdghruoarssbjcpiufomgcßiiahzkzhqjnvtjpocßhaulrf</d:element>
+ <d:element>zuzßlsssuchfxsodgvxkysbuymßbbqksrnlactkixechussuszmoykcmdtßakmulnvrqfcoepgupvlxjssgffsmnckacfdtß</d:element>
+ <d:element>qmifvjtkllrprtxmeibktacjucautxgulbtdfnkulbzamtfjhqpvgntpdp</d:element>
+ <d:element>ßsqumolßqckqhssnecyhssnjicmvzkußrlyhmngyasxkuk</d:element>
+ </d:AlternativeNames>
+ <d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases">
+ <d:AlternativeNames m:type="Collection(Edm.String)">
+ <d:element>esspxmnhprbevpmzsajargvrooqpecucumxxrbkzyybdktnoxbkzbcvrxel</d:element>
+ <d:element>ァゼ裹a畚まミポまタタソё匚そチべァタタ亜歹亜珱ёzマぴяボママぜяハ歹ゼチ黑をゼほ黑ネソ匚ぴせハァ珱ぴぼクひゾボё縷黑バダボボ欲歹ァяびまたポソぺぞタ黑匚ゼぽ九バハマ弌タソミ珱ぜべグマン</d:element>
+ <d:element>ぽひバゼび黑んびべ九ёぺボチ珱ボバひンヲ黑珱をゼバひせあ匚ヲソタま裹ポボ欲歹チマぽタチ亜ゼゾぺタク九あ欲マ縷マゼ珱ぺ欲я欲ほ</d:element>
+ <d:element>lysycttndqhdmziymraxpuhbcsnamva</d:element>
+ <d:element>ynlpossfcjbfofcticnhgstmmslbtekrdssiimkßpipjj</d:element>
+ <d:element>ソクをソボゾ匚ン亜ひ</d:element>
+ <d:element>ポ九ダぴヲダぁぴべたびボぼヲま九ををァボハя歹ソチ暦ひゾヲァaゾタそ黑ァёべソポ歹黑ほぺぞ珱グタゾほソ珱ミんまボ裹ぜボひゼチほ畚べマそぞぁzマせ珱ポ暦マ匚ボんマソボンミ畚あ匚ぴ</d:element>
+ <d:element>yndccqgajsckmlgzelnvdtxrsnlzoxxdtlslmhmahnv</d:element>
+ <d:element>jukerqchooqmlqug</d:element>
+ <d:element>sssauyjrssplrzssmpogmebcehhqxayyxathodlkjqritrsslcsessmxyvgqyfquajueukznxdiszyjiljkz</d:element>
+ </d:AlternativeNames>
+ </d:ContactAlias>
+ <d:HomePhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone">
+ <d:PhoneNumber></d:PhoneNumber>
+ <d:Extension>hutcnbfqxlmrvtuuxzgcokvrtxkursdzlfvyxqdutulygqdoim</d:Extension>
+ </d:HomePhone>
+ <d:WorkPhone m:null="true" />
+ <d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)">
+ <d:element>
+ <d:PhoneNumber>あゾミ九ゾヲぞほチびタz縷縷ほミぴソをa黑クぜバんミたポぜゼ</d:PhoneNumber>
+ <d:Extension>珱ぴチソぽ畚ゼミ弌ゾ九べぺポ珱ソグんあングミゼぜソ弌暦ソぞびソチЯぼёёひ亜べソタべチハ畚ぜゾゾ暦ポёゼ裹zぼぞ暦ソЯソぁzハボ</d:Extension>
+ </d:element>
+ </d:MobilePhoneBag>
+ </d:element>
+</d:BackupContactInfo>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b85c68fd/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_CustomerId.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_CustomerId.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_CustomerId.xml
index 222567f..b2841cd 100644
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_CustomerId.xml
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_CustomerId.xml
@@ -19,4 +19,6 @@
under the License.
-->
-<d:CustomerId xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" m:type="Edm.Int32">-10</d:CustomerId>
+<d:CustomerId xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
+ xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
+ m:type="Edm.Int32">-10</d:CustomerId>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b85c68fd/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_PrimaryContactInfo.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_PrimaryContactInfo.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_PrimaryContactInfo.json
index 2c9eb34..d8fe217 100644
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_PrimaryContactInfo.json
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_PrimaryContactInfo.json
@@ -1 +1,44 @@
-{"odata.metadata":"http://192.168.0.160:8080/DefaultService.svc/$metadata#Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails","EmailBag":["rdstukrvlltte\u00dfzi","psgdkmxamznjulzbsohqjytbxhnojbufe","\u3092\uff9d\u307a\u3072\u307c\u30bc\u305b\u66a6\u88f9\u044f\u88f9\u307a\u3042\u4e9c\u305e\uff5a\u30a1\u30d0\u755a\u30de\uff88\u305e\u30bc\u3042\uff88\u5f0c\u30c1\u30a1\u6b79\u307e\u30bc\u7e37\u30c1\u30cf\u88f9\u4e9c\u9ed1\u307b\u30bc\u0451\u6b79"],"AlternativeNames":["\u30b0\u3041\u30de\u305b\u307a\uff88\u30bd\u3041\u307c\u30bd\u3072\u30d0\u305f\u3074\u30bd\u6b79\u4e5d\uff88\u30dc\u30dc\u044f\u30dd\u30bd\u755a\u30af\u044f\u305b\u3079\u6b79\u73f1\u042f\u6b32\u30bf\u30cf\u30d0\u30df\u88f9\u307c\u30dc\u3092\uff66\u6b79\u3093\u3072\u4e5d\u3072\u531a\u3041\uff41","qckrnuruxcbhjfimnsykgfquffobcadpsaocixoeljhspxrhebkudppgndgcrlyvynqhbujrnvyxyymhnroemigogsqulvgallta","btsnhqrjqryqzgxducl","qbtlssjhunufmzdv","\u30dc\u3093\u042f\u305c\u30c1\u3079\u30bc\u30dc\u30dc\u307b\uff41\u531
a\u30df\u307c\u4e5d\u3041\u3072\u30c1\u73f1\u9ed1\u30df\u3093\u3041\u30bf\u3073\u66a6\u30af\u30bd\u30bd\u30dc\u30be\u3093\u3093\u3042\u30bc\u305e\u3072\u30bf\u30dc\u30bf\u305c\u3093\u5f0c\u3072\u3079\u531a","vicqasfdkxsuyuzspjqunxpyfuhlxfhgfqnlcpdfivqnxqoothnfsbuykfguftgulgldnkkzufssbae","\u4e5d\u30bd\u30df\u305b\u30dc\u305c\u30be\u30dc\u0451\uff41\u3092\u305c\u042f\u307e\u30be\u30bf\u305c\u30bf\u3072\u7e37\u30c0\u3093\uff41\u30d0\u305f\u30bc\u30bd","\u307d\u30de\u30bf\u3041\u3041\u9ed1\u30bd\u30bc\u30df\u30bc\u531a\uff5a\u30bd\u30c0\u30de\u3041\u30a1\u30be\u307d\u30df\uff41\u30bf\u30be\u5f0c\u30df\u30bc\u30bf\u305d\uff5a\u307a\u30dd\u305b\u88f9\u30d0\u30dd\u30cf\u30cf\uff66\u307a\u30c1\u3042\u30de\u531a\u30df","hssii\u00dfuamtctgqhglmusexyikhcsqctusonubxorssyizhyqpbtbd\u00dfjnelxqttkhdalabibuqhiubt\u00dfsptrmzelud","gbjssllxzzxkm\u00dfppyyrhgmoe\u00dfizlcmsuqqnvj\u00dfudszevtfunflqzqcuubukyp\u00dfqjcix"],"ContactAlias":{"AlternativeNames":["\u30bc\u30dd\u30bd\u30bd\u30a1\u3093\u30d
e\uff41\u30b0\u3074\u4e5d\u7e37\u4e9c\u305e\u30bc\u30bd\u30b0\u30d0\u307c\u30c0\u307d\u30de\u30de\u307d\u30dd\u30c1\u30dc\u30bd\u307c\u305c\u30be\u3093\u30df\u3074\u307b\u30c0\u30df\u30df\u755a\u73f1\u4e5d\uff5a\u3079\u5f0c\u755a\u30bf\u30bd\uff5a\u30bc\u30bd\u3041\u3073\u88f9\u30a1\u30bd\u30de\uff66\u3072\u531a\u4e9c\u30dd\u3079\u30dd\u307d\u30de\u30bc\u305f\u30c1\u88f9\u6b79\u30df\u30dd","flzjuisevegjjtmpnssobmdssikhzepsjklnoceuqr\u00dfuychauxhdutqcdenvssubqkoqyzxpfmvflbhjs","esgmrxddisdvykgttpmizcethjuazqxemuossopssaqpmqd\u00dfkayrrocgsxqpo","\u30af\u30bd\u73f1\u3079\u3092\u30de\u3093\u30b0\u30cf\u3072\u30dc\u30bd\u30bd\u3093\u30df\u30bd\u30bd\u30bc\uff9d\u305e\u305f\u307c\uff5a\u30df\u6b79\u3074","ljrggbaseqsrkelksvhouoscmoilogibae","\u305d\u305c\u305c\u30de\u30de\u30bc\u30df\u307c\u30bc\u30dc\u3079\u30bd\u307b\u3042\u3093\u305b\u3072\u3073\u30bc\u30df\u30bd\u5f0c\u307b\u305d\u30bf\u30dc\u30de\u30c1\u30bf\u30de\u30bd\uff88\u5f0c\u30c1\u30dd\u531a\u307e\u30bd\u30be\u30de\u042f\u0
42f\u305f\u30be\u88f9\u3042\u755a\u3093\u5f0c\u305f\u73f1\u755a\u30de\u042f\u30bd\u30a1\u73f1\uff88\u3073\u0451\u4e5d\u305f\u30df\u30df\u3074\u307a\u30dd\u30de\u30bc\u30c0\u5f0c\u30df\u30de\u30de\u30de\u30bd\u30dc\u4e9c\u307a\u30bd\u531a\u30b0\u5f0c\u30b0\u6b79\u30cf\u307e\u531a\u305d\u3093\u9ed1\u3093","ydjfrjbzcgouafasiutdhhgypssyniqlkdtxbclnaplnasjfliqxnmuplznstnqvpyrzdkxkqbtszvguurhllvzziugdsuvl","\u305f\u0451\u30bf\u042f\u044f\u307e\u3072\u307a\u30a1\u66a6\u30bd\u30de\u30dd\u30cf\u30af\u30bf\u305b\u305f\u3072\u30a1\u66a6\uff66\u4e5d\u66a6\u305e\u305c\u30c1\u531a\u6b32\u30bc\u307b\u4e5d\u307a\u755a\u3073\u305e\u30dd\u30dc\u30af\u3074\u3092\u30c1\u30c1\u305d\u30dc\u30bd\u30de\u30dd\u3093\u307d\u30df\u30a1\u5f0c\u30a1\u305e\u3074\u307e\u30df\u7e37\u9ed1\u30df\u30bc\u30bc\uff5a\u30c1\u30df\u30bd\u66a6\u30bc\u307b\u755a\u30bd\u531a\uff88\u0451\u307b\u30bc\u30dc\u3074\u30dd\u30bc\u7e37\u30bd\u30c1\u30dd\u88f9\uff66\u7e37\u4e5d\uff9d\u6b79\uff41\u4e5d\u30bd\u30bd"]},"HomePhone":{"Phon
eNumber":"\u755a\u307c\u305b\u30bc\u307d\u30c1\u6b32\u3092\u7e37\u5f0c\u30dd\u30bf\u307a\u30be\u6b32\uff41\u6b79\u307e\u30de\u4e9c\u30c1\u3041\u30bc\u30bc\uff41\u30de\u30a1\u30be\u305e\u3042\u5f0c\u305d\u3092\u30dd\u30c0\u30dc\u30b0\u3073\u30bc\u30a1\u305f\u30c1\u73f1\u3079\u3074\u30bc\u30bf\uff5a\u30dc\uff88\u30a1\u30a1\u6b79\u305e\u30bc\u6b32\u6b32\u30de\u30bd\u30c1\u307a\u3093\u3073\u66a6\uff9d\u30bf\u307a\u30c0\uff5a\u3074\u30c0\u30dd\u7e37\u30a1\u30dc\u042f\u3079\u307a\u3079\u30bf\u3073\u30b0\u73f1\u305f\u30df\u30bd\u307d\u3072\u307c\u30df\u66a6\u30de\u30df\u6b79\u305d\u6b32\u30bc\u0451\u3079\u30dd","Extension":"jqjklhnnkyhujailcedbguyectpuamgbghreatqvobbtj"},"WorkPhone":{"PhoneNumber":"\u305d\u30de\u5f0c\u3042\u30cf\u30df\u30bc\u307c\u30de\u531a\u30bd\u30d0\uff5a\u30c1\u3074\u30bd\u3041\u3093\u0451\u30bf\u30be\u30bc\u30bd\u305b\u3074\u30dc\u3072\u30cf\uff88\u30bc\u307d\u3079\u30a1\u305f\u307a\u30be\u30c1\u30a1\u305d","Extension":"erpdbdvgezuztcsy\u00dfpxddmcdvgsysbtsssskhjpgss
gbicdbcmdykutudsnkflxpzqxbcssdyfdqqmiufssinxkade\u00dfustx\u00dff"},"MobilePhoneBag":[{"PhoneNumber":"essfchpbmodumdlbssaoygvcecneg\u00dfumuvszyo","Extension":"ilvxmcmkixinhonuxeqfcbsnlgufneqhijddgurdkuvvj"},{"PhoneNumber":"bbyr","Extension":"\u30b0\u3074\u30bc\u307b\u88f9\u044f\u307b\u30de\u30bf\uff88\u755a\u3092\u30bd\u4e5d\u30af\u30bc\u755a\u30bc\u30a1\u7e37\u3072\u30b0\uff66\u307d\u044f\u30c0\u6b79"},{"PhoneNumber":"litlxcyvpspjqankvmvtmvoabobguscosktgzul","Extension":"jump\u00df\u00dfhqzmjxq\u00dfufuaprymlrb"},{"PhoneNumber":"bfi","Extension":"mbguodpfpohbmsnvtgxdvhssvnxfisadlnbtbvrbvfnitdjdnkdctzuukpylhfcvooryl"},{"PhoneNumber":"jmvrssnupsqltlmuegpybunosssspluvvgqenfgvrjhxqqjjqublkeekssyjisdssrxyvooj","Extension":"\uff41\u30be\u66a6\uff66\uff41\u30be\u3092\u30c1\u0451\u30bc\u3092\u307d\u30a1\u4e9c\u307d\u3072\u305e\u30dd\u88f9\u307c\u305c\u30bc\u30bd\u30df\uff88\u30df\u66a6\u307d\u307d\u3079\u3079\u30df\u531a\uff41\u305e\u30c1\u30dc\uff88\uff66\u9ed1\u66a6\u305f\u307b\u30bf\u3
0af\u30c1\u30c0\u0451\u73f1\uff88\u3092\u3092\u30c1\u30bd"},{"PhoneNumber":"bqadubmkjprlorzjyuxghuthdxxufknlmasbsvhdteohujonmakgormaxpaxfhuyeuyozsqisnnfegcusfndzbhvjrfovkzhxu","Extension":""},{"PhoneNumber":"moc\u00dfmhbuavyssxuosdkmcdqbkyadgusvssppytbtuurg\u00dfqacmbhfghvugzssvi","Extension":"\u3092\uff9d\u9ed1\u30b0\u307c\u9ed1\u30bc\u30bf\u30bf\u30dd\u4e5d\u30c1\uff5a\u30dd\u30c1\u30bc\u30dd\u30bf\u3041\uff41\u30bd\u30a1\u30bc\u305f\u30bc\u307c\uff88\u531a\u30bc\u30dd\u307e\u30dd\u66a6\uff5a\u30de\u30dc\u305c\u6b79\u307c"},{"PhoneNumber":null,"Extension":"\u30d0\u30bc\u307c\u30af\u30b0"},{"PhoneNumber":"\uff5a\u30c1\u4e9c\uff88\uff9d\uff41\u30d0\u305d\u73f1\u30b0\u305b\u4e9c\uff9d\uff88\uff66\u3093\u6b79\u307e\u4e9c\uff41\u30dd\u30bf\u30df\u305c\u5f0c\u73f1\u30df\u30bc\u042f\u307b\u3093\u30dc\u88f9\u044f\u4e5d\u3041\u30a1\u73f1\u307c\u30af\u30bc\u30dd\uff88\u30a1\uff88\u73f1\u30bc\u307e\u30bc\u3042\u30cf\u30de\u307e\uff88\u307c\u30bc\u6b79\u30dd\u3074\u305f\u3079\u3079\u305d\u30d
c\u3041\u30bd\u73f1\uff66\u307a\u9ed1\uff9d\uff88\u0451\u30bc\u30c0\u042f\u30bf\u30bc\u305d\uff5a\u30bd\u30bd\uff9d\uff5a\u30dc\u30dc\u30a1\u9ed1\u531a\u3093\u3079\u30dd\u30dd","Extension":"gclzjelinpvjcxjmcrsbuzhiyuxrffycgjuonyzhkvazkklhsihhgzhg"}]}
\ No newline at end of file
+{
+ "odata.metadata": "http://192.168.0.160:8080/DefaultService.svc/$metadata#Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails",
+ "EmailBag": ["rdstukrvlltte\u00dfzi", "psgdkmxamznjulzbsohqjytbxhnojbufe", "\u3092\uff9d\u307a\u3072\u307c\u30bc\u305b\u66a6\u88f9\u044f\u88f9\u307a\u3042\u4e9c\u305e\uff5a\u30a1\u30d0\u755a\u30de\uff88\u305e\u30bc\u3042\uff88\u5f0c\u30c1\u30a1\u6b79\u307e\u30bc\u7e37\u30c1\u30cf\u88f9\u4e9c\u9ed1\u307b\u30bc\u0451\u6b79"],
+ "AlternativeNames": ["\u30b0\u3041\u30de\u305b\u307a\uff88\u30bd\u3041\u307c\u30bd\u3072\u30d0\u305f\u3074\u30bd\u6b79\u4e5d\uff88\u30dc\u30dc\u044f\u30dd\u30bd\u755a\u30af\u044f\u305b\u3079\u6b79\u73f1\u042f\u6b32\u30bf\u30cf\u30d0\u30df\u88f9\u307c\u30dc\u3092\uff66\u6b79\u3093\u3072\u4e5d\u3072\u531a\u3041\uff41", "qckrnuruxcbhjfimnsykgfquffobcadpsaocixoeljhspxrhebkudppgndgcrlyvynqhbujrnvyxyymhnroemigogsqulvgallta", "btsnhqrjqryqzgxducl", "qbtlssjhunufmzdv", "\u30dc\u3093\u042f\u305c\u30c1\u3079\u30bc\u30dc\u30dc\u307b\uff41\u531a\u30df\u307c\u4e5d\u3041\u3072\u30c1\u73f1\u9ed1\u30df\u3093\u3041\u30bf\u3073\u66a6\u30af\u30bd\u30bd\u30dc\u30be\u3093\u3093\u3042\u30bc\u305e\u3072\u30bf\u30dc\u30bf\u305c\u3093\u5f0c\u3072\u3079\u531a", "vicqasfdkxsuyuzspjqunxpyfuhlxfhgfqnlcpdfivqnxqoothnfsbuykfguftgulgldnkkzufssbae", "\u4e5d\u30bd\u30df\u305b\u30dc\u305c\u30be\u30dc\u0451\uff41\u3092\u305c\u042f\u307e\u30be\u30bf\u305c\u30bf\u3072\u7e37\u30c0\u3093\uff41\u30d0\u305f\u30bc\u30bd",
"\u307d\u30de\u30bf\u3041\u3041\u9ed1\u30bd\u30bc\u30df\u30bc\u531a\uff5a\u30bd\u30c0\u30de\u3041\u30a1\u30be\u307d\u30df\uff41\u30bf\u30be\u5f0c\u30df\u30bc\u30bf\u305d\uff5a\u307a\u30dd\u305b\u88f9\u30d0\u30dd\u30cf\u30cf\uff66\u307a\u30c1\u3042\u30de\u531a\u30df", "hssii\u00dfuamtctgqhglmusexyikhcsqctusonubxorssyizhyqpbtbd\u00dfjnelxqttkhdalabibuqhiubt\u00dfsptrmzelud", "gbjssllxzzxkm\u00dfppyyrhgmoe\u00dfizlcmsuqqnvj\u00dfudszevtfunflqzqcuubukyp\u00dfqjcix"],
+ "ContactAlias": {
+ "AlternativeNames": ["\u30bc\u30dd\u30bd\u30bd\u30a1\u3093\u30de\uff41\u30b0\u3074\u4e5d\u7e37\u4e9c\u305e\u30bc\u30bd\u30b0\u30d0\u307c\u30c0\u307d\u30de\u30de\u307d\u30dd\u30c1\u30dc\u30bd\u307c\u305c\u30be\u3093\u30df\u3074\u307b\u30c0\u30df\u30df\u755a\u73f1\u4e5d\uff5a\u3079\u5f0c\u755a\u30bf\u30bd\uff5a\u30bc\u30bd\u3041\u3073\u88f9\u30a1\u30bd\u30de\uff66\u3072\u531a\u4e9c\u30dd\u3079\u30dd\u307d\u30de\u30bc\u305f\u30c1\u88f9\u6b79\u30df\u30dd", "flzjuisevegjjtmpnssobmdssikhzepsjklnoceuqr\u00dfuychauxhdutqcdenvssubqkoqyzxpfmvflbhjs", "esgmrxddisdvykgttpmizcethjuazqxemuossopssaqpmqd\u00dfkayrrocgsxqpo", "\u30af\u30bd\u73f1\u3079\u3092\u30de\u3093\u30b0\u30cf\u3072\u30dc\u30bd\u30bd\u3093\u30df\u30bd\u30bd\u30bc\uff9d\u305e\u305f\u307c\uff5a\u30df\u6b79\u3074", "ljrggbaseqsrkelksvhouoscmoilogibae", "\u305d\u305c\u305c\u30de\u30de\u30bc\u30df\u307c\u30bc\u30dc\u3079\u30bd\u307b\u3042\u3093\u305b\u3072\u3073\u30bc\u30df\u30bd\u5f0c\u307b\u305d\u30bf\u30dc\u30de\u30c1\u30bf\u3
0de\u30bd\uff88\u5f0c\u30c1\u30dd\u531a\u307e\u30bd\u30be\u30de\u042f\u042f\u305f\u30be\u88f9\u3042\u755a\u3093\u5f0c\u305f\u73f1\u755a\u30de\u042f\u30bd\u30a1\u73f1\uff88\u3073\u0451\u4e5d\u305f\u30df\u30df\u3074\u307a\u30dd\u30de\u30bc\u30c0\u5f0c\u30df\u30de\u30de\u30de\u30bd\u30dc\u4e9c\u307a\u30bd\u531a\u30b0\u5f0c\u30b0\u6b79\u30cf\u307e\u531a\u305d\u3093\u9ed1\u3093", "ydjfrjbzcgouafasiutdhhgypssyniqlkdtxbclnaplnasjfliqxnmuplznstnqvpyrzdkxkqbtszvguurhllvzziugdsuvl", "\u305f\u0451\u30bf\u042f\u044f\u307e\u3072\u307a\u30a1\u66a6\u30bd\u30de\u30dd\u30cf\u30af\u30bf\u305b\u305f\u3072\u30a1\u66a6\uff66\u4e5d\u66a6\u305e\u305c\u30c1\u531a\u6b32\u30bc\u307b\u4e5d\u307a\u755a\u3073\u305e\u30dd\u30dc\u30af\u3074\u3092\u30c1\u30c1\u305d\u30dc\u30bd\u30de\u30dd\u3093\u307d\u30df\u30a1\u5f0c\u30a1\u305e\u3074\u307e\u30df\u7e37\u9ed1\u30df\u30bc\u30bc\uff5a\u30c1\u30df\u30bd\u66a6\u30bc\u307b\u755a\u30bd\u531a\uff88\u0451\u307b\u30bc\u30dc\u3074\u30dd\u30bc\u7e37\u30bd\u30c1\u30dd\u88f9\u
ff66\u7e37\u4e5d\uff9d\u6b79\uff41\u4e5d\u30bd\u30bd"]
+ },
+ "HomePhone": {
+ "PhoneNumber": "\u755a\u307c\u305b\u30bc\u307d\u30c1\u6b32\u3092\u7e37\u5f0c\u30dd\u30bf\u307a\u30be\u6b32\uff41\u6b79\u307e\u30de\u4e9c\u30c1\u3041\u30bc\u30bc\uff41\u30de\u30a1\u30be\u305e\u3042\u5f0c\u305d\u3092\u30dd\u30c0\u30dc\u30b0\u3073\u30bc\u30a1\u305f\u30c1\u73f1\u3079\u3074\u30bc\u30bf\uff5a\u30dc\uff88\u30a1\u30a1\u6b79\u305e\u30bc\u6b32\u6b32\u30de\u30bd\u30c1\u307a\u3093\u3073\u66a6\uff9d\u30bf\u307a\u30c0\uff5a\u3074\u30c0\u30dd\u7e37\u30a1\u30dc\u042f\u3079\u307a\u3079\u30bf\u3073\u30b0\u73f1\u305f\u30df\u30bd\u307d\u3072\u307c\u30df\u66a6\u30de\u30df\u6b79\u305d\u6b32\u30bc\u0451\u3079\u30dd",
+ "Extension": "jqjklhnnkyhujailcedbguyectpuamgbghreatqvobbtj"
+ },
+ "WorkPhone": {
+ "PhoneNumber": "\u305d\u30de\u5f0c\u3042\u30cf\u30df\u30bc\u307c\u30de\u531a\u30bd\u30d0\uff5a\u30c1\u3074\u30bd\u3041\u3093\u0451\u30bf\u30be\u30bc\u30bd\u305b\u3074\u30dc\u3072\u30cf\uff88\u30bc\u307d\u3079\u30a1\u305f\u307a\u30be\u30c1\u30a1\u305d",
+ "Extension": "erpdbdvgezuztcsy\u00dfpxddmcdvgsysbtsssskhjpgssgbicdbcmdykutudsnkflxpzqxbcssdyfdqqmiufssinxkade\u00dfustx\u00dff"
+ },
+ "MobilePhoneBag": [{
+ "PhoneNumber": "essfchpbmodumdlbssaoygvcecneg\u00dfumuvszyo",
+ "Extension": "ilvxmcmkixinhonuxeqfcbsnlgufneqhijddgurdkuvvj"
+ }, {
+ "PhoneNumber": "bbyr",
+ "Extension": "\u30b0\u3074\u30bc\u307b\u88f9\u044f\u307b\u30de\u30bf\uff88\u755a\u3092\u30bd\u4e5d\u30af\u30bc\u755a\u30bc\u30a1\u7e37\u3072\u30b0\uff66\u307d\u044f\u30c0\u6b79"
+ }, {
+ "PhoneNumber": "litlxcyvpspjqankvmvtmvoabobguscosktgzul",
+ "Extension": "jump\u00df\u00dfhqzmjxq\u00dfufuaprymlrb"
+ }, {
+ "PhoneNumber": "bfi",
+ "Extension": "mbguodpfpohbmsnvtgxdvhssvnxfisadlnbtbvrbvfnitdjdnkdctzuukpylhfcvooryl"
+ }, {
+ "PhoneNumber": "jmvrssnupsqltlmuegpybunosssspluvvgqenfgvrjhxqqjjqublkeekssyjisdssrxyvooj",
+ "Extension": "\uff41\u30be\u66a6\uff66\uff41\u30be\u3092\u30c1\u0451\u30bc\u3092\u307d\u30a1\u4e9c\u307d\u3072\u305e\u30dd\u88f9\u307c\u305c\u30bc\u30bd\u30df\uff88\u30df\u66a6\u307d\u307d\u3079\u3079\u30df\u531a\uff41\u305e\u30c1\u30dc\uff88\uff66\u9ed1\u66a6\u305f\u307b\u30bf\u30af\u30c1\u30c0\u0451\u73f1\uff88\u3092\u3092\u30c1\u30bd"
+ }, {
+ "PhoneNumber": "bqadubmkjprlorzjyuxghuthdxxufknlmasbsvhdteohujonmakgormaxpaxfhuyeuyozsqisnnfegcusfndzbhvjrfovkzhxu",
+ "Extension": ""
+ }, {
+ "PhoneNumber": "moc\u00dfmhbuavyssxuosdkmcdqbkyadgusvssppytbtuurg\u00dfqacmbhfghvugzssvi",
+ "Extension": "\u3092\uff9d\u9ed1\u30b0\u307c\u9ed1\u30bc\u30bf\u30bf\u30dd\u4e5d\u30c1\uff5a\u30dd\u30c1\u30bc\u30dd\u30bf\u3041\uff41\u30bd\u30a1\u30bc\u305f\u30bc\u307c\uff88\u531a\u30bc\u30dd\u307e\u30dd\u66a6\uff5a\u30de\u30dc\u305c\u6b79\u307c"
+ }, {
+ "PhoneNumber": null,
+ "Extension": "\u30d0\u30bc\u307c\u30af\u30b0"
+ }, {
+ "PhoneNumber": "\uff5a\u30c1\u4e9c\uff88\uff9d\uff41\u30d0\u305d\u73f1\u30b0\u305b\u4e9c\uff9d\uff88\uff66\u3093\u6b79\u307e\u4e9c\uff41\u30dd\u30bf\u30df\u305c\u5f0c\u73f1\u30df\u30bc\u042f\u307b\u3093\u30dc\u88f9\u044f\u4e5d\u3041\u30a1\u73f1\u307c\u30af\u30bc\u30dd\uff88\u30a1\uff88\u73f1\u30bc\u307e\u30bc\u3042\u30cf\u30de\u307e\uff88\u307c\u30bc\u6b79\u30dd\u3074\u305f\u3079\u3079\u305d\u30dc\u3041\u30bd\u73f1\uff66\u307a\u9ed1\uff9d\uff88\u0451\u30bc\u30c0\u042f\u30bf\u30bc\u305d\uff5a\u30bd\u30bd\uff9d\uff5a\u30dc\u30dc\u30a1\u9ed1\u531a\u3093\u3079\u30dd\u30dd",
+ "Extension": "gclzjelinpvjcxjmcrsbuzhiyuxrffycgjuonyzhkvazkklhsihhgzhg"
+ }]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b85c68fd/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_PrimaryContactInfo.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_PrimaryContactInfo.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_PrimaryContactInfo.xml
index bf1e360..7c0c903 100644
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_PrimaryContactInfo.xml
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_PrimaryContactInfo.xml
@@ -19,4 +19,84 @@
under the License.
-->
-<d:PrimaryContactInfo xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails"><d:EmailBag m:type="Collection(Edm.String)"><d:element>rdstukrvlltteßzi</d:element><d:element>psgdkmxamznjulzbsohqjytbxhnojbufe</d:element><d:element>をンぺひぼゼせ暦裹я裹ぺあ亜ぞzァバ畚マネぞゼあネ弌チァ歹まゼ縷チハ裹亜黑ほゼё歹</d:element></d:EmailBag><d:AlternativeNames m:type="Collection(Edm.String)"><d:element>グぁマせぺネソぁぼソひバたぴソ歹九ネボボяポソ畚クяせべ歹珱Я欲タハバミ裹ぼボをヲ歹んひ九ひ匚ぁa</d:element><d:element>qckrnuruxcbhjfimnsykgfquffobcadpsaocixoeljhspxrhebkudppgndgcrlyvynqhbujrnvyxyymhnroemigogsqulvgallta</d:element><d:element>btsnhqrjqryqzgxducl</d:elemen
t><d:element>qbtlssjhunufmzdv</d:element><d:element>ボんЯぜチべゼボボほa匚ミぼ九ぁひチ珱黑ミんぁタび暦クソソボゾんんあゼぞひタボタぜん弌ひべ匚</d:element><d:element>vicqasfdkxsuyuzspjqunxpyfuhlxfhgfqnlcpdfivqnxqoothnfsbuykfguftgulgldnkkzufssbae</d:element><d:element>九ソミせボぜゾボёaをぜЯまゾタぜタひ縷ダんaバたゼソ</d:element><d:element>ぽマタぁぁ黑ソゼミゼ匚zソダマぁァゾぽミaタゾ弌ミゼタそzぺポせ裹バポハハヲぺチあマ匚ミ</d:element><d:element>hssiißuamtctgqhglmusexyikhcsqctusonubxorssyizhyqpbtbdßjnelxqttkhdalabibuqhiubtßsptrmzelud</d:element><d:element>gbjssllxzzxkmßppyyrhgmoeßizlcmsuqqnvjßudszevtfunflqzqcuubukypßqjcix</d:element></d:AlternativeNames><d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases"><d:AlternativeNames m:type="Collection(Edm.String)"><d:element>ゼポソソァんマaグぴ九縷亜ぞゼソグバぼ�
�ぽママぽポチボソぼぜゾんミぴほダミミ畚珱九zべ弌畚タソzゼソぁび裹ァソマヲひ匚亜ポべポぽマゼたチ裹歹ミポ</d:element><d:element>flzjuisevegjjtmpnssobmdssikhzepsjklnoceuqrßuychauxhdutqcdenvssubqkoqyzxpfmvflbhjs</d:element><d:element>esgmrxddisdvykgttpmizcethjuazqxemuossopssaqpmqdßkayrrocgsxqpo</d:element><d:element>クソ珱べをマんグハひボソソんミソソゼンぞたぼzミ歹ぴ</d:element><d:element>ljrggbaseqsrkelksvhouoscmoilogibae</d:element><d:element>そぜぜママゼミぼゼボべソほあんせひびゼミソ弌ほそタボマチタマソネ弌チポ匚まソゾマЯЯたゾ裹あ畚ん弌た珱畚マЯソァ珱ネびё九たミミぴぺポマゼダ弌ミマママソボ亜ぺソ匚グ弌グ歹ハま匚そん黑ん</d:element><d:element>ydjfrjbzcgouafasiutdhhgypssyniqlkdtxbclnaplnasjfliqxnmuplznstnqvpyrzdkxkqbtszvguurhllvzziugdsuvl</d:element><d:element>たёタЯяまひぺァ暦ソマポハクタせたひ�
��暦ヲ九暦ぞぜチ匚欲ゼほ九ぺ畚びぞポボクぴをチチそボソマポんぽミァ弌ァぞぴまミ縷黑ミゼゼzチミソ暦ゼほ畚ソ匚ネёほゼボぴポゼ縷ソチポ裹ヲ縷九ン歹a九ソソ</d:element></d:AlternativeNames></d:ContactAlias><d:HomePhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber>畚ぼせゼぽチ欲を縷弌ポタぺゾ欲a歹まマ亜チぁゼゼaマァゾぞあ弌そをポダボグびゼァたチ珱べぴゼタzボネァァ歹ぞゼ欲欲マソチぺんび暦ンタぺダzぴダポ縷ァボЯべぺべタびグ珱たミソぽひぼミ暦マミ歹そ欲ゼёべポ</d:PhoneNumber><d:Extension>jqjklhnnkyhujailcedbguyectpuamgbghreatqvobbtj</d:Extension></d:HomePhone><d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone"><d:PhoneNumber>そマ弌あハミゼぼマ匚ソバzチぴソぁんёタゾゼソせぴボひハネゼぽべァたぺゾチァそ</d:PhoneNumber
><d:Extension>erpdbdvgezuztcsyßpxddmcdvgsysbtsssskhjpgssgbicdbcmdykutudsnkflxpzqxbcssdyfdqqmiufssinxkadeßustxßf</d:Extension></d:WorkPhone><d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)"><d:element><d:PhoneNumber>essfchpbmodumdlbssaoygvcecnegßumuvszyo</d:PhoneNumber><d:Extension>ilvxmcmkixinhonuxeqfcbsnlgufneqhijddgurdkuvvj</d:Extension></d:element><d:element><d:PhoneNumber>bbyr</d:PhoneNumber><d:Extension>グぴゼほ裹яほマタネ畚をソ九クゼ畚ゼァ縷ひグヲぽяダ歹</d:Extension></d:element><d:element><d:PhoneNumber>litlxcyvpspjqankvmvtmvoabobguscosktgzul</d:PhoneNumber><d:Extension>jumpßßhqzmjxqßufuaprymlrb</d:Extension></d:element><d:element><d:PhoneNumber>bfi</d:PhoneNumber><d:Extension>mbguodpfpohbmsnvtgxdvhssvnxfisadlnbtbvrbvfnitdjdnkdctzuukpylhfcvooryl</d:Extension></d:element><d:element><d:PhoneNumber>jmvrssnupsqltlmuegpybunosssspluvvgqenfgvrjhxqqjjqublkeekssyjisdssrxyvooj</d:PhoneNumber><d:Extension>�
��ゾ暦ヲaゾをチёゼをぽァ亜ぽひぞポ裹ぼぜゼソミネミ暦ぽぽべべミ匚aぞチボネヲ黑暦たほタクチダё珱ネををチソ</d:Extension></d:element><d:element><d:PhoneNumber>bqadubmkjprlorzjyuxghuthdxxufknlmasbsvhdteohujonmakgormaxpaxfhuyeuyozsqisnnfegcusfndzbhvjrfovkzhxu</d:PhoneNumber><d:Extension></d:Extension></d:element><d:element><d:PhoneNumber>mocßmhbuavyssxuosdkmcdqbkyadgusvssppytbtuurgßqacmbhfghvugzssvi</d:PhoneNumber><d:Extension>をン黑グぼ黑ゼタタポ九チzポチゼポタぁaソァゼたゼぼネ匚ゼポまポ暦zマボぜ歹ぼ</d:Extension></d:element><d:element><d:PhoneNumber m:null="true" /><d:Extension>バゼぼクグ</d:Extension></d:element><d:element><d:PhoneNumber>zチ亜ネンaバそ珱グせ亜ンネヲん歹ま亜aポタミぜ弌珱ミゼЯほんボ裹я九ぁァ珱ぼクゼポネァネ珱ゼまゼあハマまネぼゼ歹ポぴたべべそボぁソ珱ヲぺ黑ンネёゼダЯタゼそzソソンz�
��ボァ黑匚んべポポ</d:PhoneNumber><d:Extension>gclzjelinpvjcxjmcrsbuzhiyuxrffycgjuonyzhkvazkklhsihhgzhg</d:Extension></d:element></d:MobilePhoneBag></d:PrimaryContactInfo>
+<d:PrimaryContactInfo xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
+ xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
+ xmlns:georss="http://www.georss.org/georss"
+ xmlns:gml="http://www.opengis.net/gml"
+ m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails">
+ <d:EmailBag m:type="Collection(Edm.String)">
+ <d:element>rdstukrvlltteßzi</d:element>
+ <d:element>psgdkmxamznjulzbsohqjytbxhnojbufe</d:element>
+ <d:element>をンぺひぼゼせ暦裹я裹ぺあ亜ぞzァバ畚マネぞゼあネ弌チァ歹まゼ縷チハ裹亜黑ほゼё歹</d:element>
+ </d:EmailBag>
+ <d:AlternativeNames m:type="Collection(Edm.String)">
+ <d:element>グぁマせぺネソぁぼソひバたぴソ歹九ネボボяポソ畚クяせべ歹珱Я欲タハバミ裹ぼボをヲ歹んひ九ひ匚ぁa</d:element>
+ <d:element>qckrnuruxcbhjfimnsykgfquffobcadpsaocixoeljhspxrhebkudppgndgcrlyvynqhbujrnvyxyymhnroemigogsqulvgallta</d:element>
+ <d:element>btsnhqrjqryqzgxducl</d:element>
+ <d:element>qbtlssjhunufmzdv</d:element>
+ <d:element>ボんЯぜチべゼボボほa匚ミぼ九ぁひチ珱黑ミんぁタび暦クソソボゾんんあゼぞひタボタぜん弌ひべ匚</d:element>
+ <d:element>vicqasfdkxsuyuzspjqunxpyfuhlxfhgfqnlcpdfivqnxqoothnfsbuykfguftgulgldnkkzufssbae</d:element>
+ <d:element>九ソミせボぜゾボёaをぜЯまゾタぜタひ縷ダんaバたゼソ</d:element>
+ <d:element>ぽマタぁぁ黑ソゼミゼ匚zソダマぁァゾぽミaタゾ弌ミゼタそzぺポせ裹バポハハヲぺチあマ匚ミ</d:element>
+ <d:element>hssiißuamtctgqhglmusexyikhcsqctusonubxorssyizhyqpbtbdßjnelxqttkhdalabibuqhiubtßsptrmzelud</d:element>
+ <d:element>gbjssllxzzxkmßppyyrhgmoeßizlcmsuqqnvjßudszevtfunflqzqcuubukypßqjcix</d:element>
+ </d:AlternativeNames>
+ <d:ContactAlias m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases">
+ <d:AlternativeNames m:type="Collection(Edm.String)">
+ <d:element>ゼポソソァんマaグぴ九縷亜ぞゼソグバぼダぽママぽポチボソぼぜゾんミぴほダミミ畚珱九zべ弌畚タソzゼソぁび裹ァソマヲひ匚亜ポべポぽマゼたチ裹歹ミポ</d:element>
+ <d:element>flzjuisevegjjtmpnssobmdssikhzepsjklnoceuqrßuychauxhdutqcdenvssubqkoqyzxpfmvflbhjs</d:element>
+ <d:element>esgmrxddisdvykgttpmizcethjuazqxemuossopssaqpmqdßkayrrocgsxqpo</d:element>
+ <d:element>クソ珱べをマんグハひボソソんミソソゼンぞたぼzミ歹ぴ</d:element>
+ <d:element>ljrggbaseqsrkelksvhouoscmoilogibae</d:element>
+ <d:element>そぜぜママゼミぼゼボべソほあんせひびゼミソ弌ほそタボマチタマソネ弌チポ匚まソゾマЯЯたゾ裹あ畚ん弌た珱畚マЯソァ珱ネびё九たミミぴぺポマゼダ弌ミマママソボ亜ぺソ匚グ弌グ歹ハま匚そん黑ん</d:element>
+ <d:element>ydjfrjbzcgouafasiutdhhgypssyniqlkdtxbclnaplnasjfliqxnmuplznstnqvpyrzdkxkqbtszvguurhllvzziugdsuvl</d:element>
+ <d:element>たёタЯяまひぺァ暦ソマポハクタせたひァ暦ヲ九暦ぞぜチ匚欲ゼほ九ぺ畚びぞポボクぴをチチそボソマポんぽミァ弌ァぞぴまミ縷黑ミゼゼzチミソ暦ゼほ畚ソ匚ネёほゼボぴポゼ縷ソチポ裹ヲ縷九ン歹a九ソソ</d:element>
+ </d:AlternativeNames>
+ </d:ContactAlias>
+ <d:HomePhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone">
+ <d:PhoneNumber>畚ぼせゼぽチ欲を縷弌ポタぺゾ欲a歹まマ亜チぁゼゼaマァゾぞあ弌そをポダボグびゼァたチ珱べぴゼタzボネァァ歹ぞゼ欲欲マソチぺんび暦ンタぺダzぴダポ縷ァボЯべぺべタびグ珱たミソぽひぼミ暦マミ歹そ欲ゼёべポ</d:PhoneNumber>
+ <d:Extension>jqjklhnnkyhujailcedbguyectpuamgbghreatqvobbtj</d:Extension>
+ </d:HomePhone>
+ <d:WorkPhone m:type="Microsoft.Test.OData.Services.AstoriaDefaultService.Phone">
+ <d:PhoneNumber>そマ弌あハミゼぼマ匚ソバzチぴソぁんёタゾゼソせぴボひハネゼぽべァたぺゾチァそ</d:PhoneNumber>
+ <d:Extension>erpdbdvgezuztcsyßpxddmcdvgsysbtsssskhjpgssgbicdbcmdykutudsnkflxpzqxbcssdyfdqqmiufssinxkadeßustxßf</d:Extension>
+ </d:WorkPhone>
+ <d:MobilePhoneBag m:type="Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.Phone)">
+ <d:element>
+ <d:PhoneNumber>essfchpbmodumdlbssaoygvcecnegßumuvszyo</d:PhoneNumber>
+ <d:Extension>ilvxmcmkixinhonuxeqfcbsnlgufneqhijddgurdkuvvj</d:Extension>
+ </d:element>
+ <d:element>
+ <d:PhoneNumber>bbyr</d:PhoneNumber>
+ <d:Extension>グぴゼほ裹яほマタネ畚をソ九クゼ畚ゼァ縷ひグヲぽяダ歹</d:Extension>
+ </d:element>
+ <d:element>
+ <d:PhoneNumber>litlxcyvpspjqankvmvtmvoabobguscosktgzul</d:PhoneNumber>
+ <d:Extension>jumpßßhqzmjxqßufuaprymlrb</d:Extension>
+ </d:element>
+ <d:element>
+ <d:PhoneNumber>bfi</d:PhoneNumber>
+ <d:Extension>mbguodpfpohbmsnvtgxdvhssvnxfisadlnbtbvrbvfnitdjdnkdctzuukpylhfcvooryl</d:Extension>
+ </d:element>
+ <d:element>
+ <d:PhoneNumber>jmvrssnupsqltlmuegpybunosssspluvvgqenfgvrjhxqqjjqublkeekssyjisdssrxyvooj</d:PhoneNumber>
+ <d:Extension>aゾ暦ヲaゾをチёゼをぽァ亜ぽひぞポ裹ぼぜゼソミネミ暦ぽぽべべミ匚aぞチボネヲ黑暦たほタクチダё珱ネををチソ</d:Extension>
+ </d:element>
+ <d:element>
+ <d:PhoneNumber>bqadubmkjprlorzjyuxghuthdxxufknlmasbsvhdteohujonmakgormaxpaxfhuyeuyozsqisnnfegcusfndzbhvjrfovkzhxu</d:PhoneNumber>
+ <d:Extension></d:Extension>
+ </d:element>
+ <d:element>
+ <d:PhoneNumber>mocßmhbuavyssxuosdkmcdqbkyadgusvssppytbtuurgßqacmbhfghvugzssvi</d:PhoneNumber>
+ <d:Extension>をン黑グぼ黑ゼタタポ九チzポチゼポタぁaソァゼたゼぼネ匚ゼポまポ暦zマボぜ歹ぼ</d:Extension>
+ </d:element>
+ <d:element>
+ <d:PhoneNumber m:null="true" />
+ <d:Extension>バゼぼクグ</d:Extension>
+ </d:element>
+ <d:element>
+ <d:PhoneNumber>zチ亜ネンaバそ珱グせ亜ンネヲん歹ま亜aポタミぜ弌珱ミゼЯほんボ裹я九ぁァ珱ぼクゼポネァネ珱ゼまゼあハマまネぼゼ歹ポぴたべべそボぁソ珱ヲぺ黑ンネёゼダЯタゼそzソソンzボボァ黑匚んべポポ</d:PhoneNumber>
+ <d:Extension>gclzjelinpvjcxjmcrsbuzhiyuxrffycgjuonyzhkvazkklhsihhgzhg</d:Extension>
+ </d:element>
+ </d:MobilePhoneBag>
+</d:PrimaryContactInfo>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b85c68fd/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyDeserializer.java
index 1e60a3c..97da12d 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyDeserializer.java
@@ -66,8 +66,8 @@ class AtomPropertyDeserializer extends AbstractAtomDealer {
foundEndProperty = true;
}
}
-
- return value;
+
+ return value == null? new PrimitiveValueImpl(StringUtils.EMPTY): value;
}
private Value fromComplexOrEnum(final XMLEventReader reader, final StartElement start)
[02/51] [abbrv] [OLINGO-194] geospatial literals
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Polygon.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Polygon.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Polygon.java
index 2501d4e..6d93ef2 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Polygon.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Polygon.java
@@ -32,18 +32,12 @@ public class Polygon extends Geospatial {
final ComposedGeospatial<Point> exterior;
- /**
- * Constructor.
- *
- * @param dimension dimension.
- * @param crs crs.
- * @param interior interior points.
- * @param exterior exterior points.
- */
- public Polygon(final Dimension dimension, final String crs, final List<Point> interior, final List<Point> exterior) {
- super(dimension, Type.POLYGON, crs);
- this.interior = new MultiPoint(dimension, crs, interior);
- this.exterior = new MultiPoint(dimension, crs, exterior);
+ public Polygon(final Dimension dimension, final Integer srid,
+ final List<Point> interior, final List<Point> exterior) {
+
+ super(dimension, Type.POLYGON, srid);
+ this.interior = new MultiPoint(dimension, srid, interior);
+ this.exterior = new MultiPoint(dimension, srid, exterior);
}
/**
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomGeoValueDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomGeoValueDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomGeoValueDeserializer.java
index 458e4cc..0444fba 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomGeoValueDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomGeoValueDeserializer.java
@@ -44,7 +44,7 @@ import org.apache.olingo.commons.core.edm.primitivetype.EdmDouble;
class AtomGeoValueDeserializer {
private List<Point> points(final XMLEventReader reader, final StartElement start,
- final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException {
+ final EdmPrimitiveTypeKind type, final Integer srid) throws XMLStreamException {
final List<Point> result = new ArrayList<Point>();
@@ -55,7 +55,7 @@ class AtomGeoValueDeserializer {
if (event.isCharacters() && !event.asCharacters().isWhiteSpace()) {
final String[] pointInfo = event.asCharacters().getData().split(" ");
- final Point point = new Point(GeoUtils.getDimension(type), crs);
+ final Point point = new Point(GeoUtils.getDimension(type), srid);
try {
point.setX(EdmDouble.getInstance().valueOfString(pointInfo[0], null, null,
Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null, Double.class));
@@ -76,7 +76,7 @@ class AtomGeoValueDeserializer {
}
private MultiPoint multipoint(final XMLEventReader reader, final StartElement start,
- final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException {
+ final EdmPrimitiveTypeKind type, final Integer srid) throws XMLStreamException {
List<Point> points = Collections.<Point>emptyList();
@@ -93,17 +93,17 @@ class AtomGeoValueDeserializer {
}
}
- return new MultiPoint(GeoUtils.getDimension(type), crs, points);
+ return new MultiPoint(GeoUtils.getDimension(type), srid, points);
}
private LineString lineString(final XMLEventReader reader, final StartElement start,
- final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException {
+ final EdmPrimitiveTypeKind type, final Integer srid) throws XMLStreamException {
- return new LineString(GeoUtils.getDimension(type), crs, points(reader, start, type, null));
+ return new LineString(GeoUtils.getDimension(type), srid, points(reader, start, type, null));
}
private Polygon polygon(final XMLEventReader reader, final StartElement start,
- final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException {
+ final EdmPrimitiveTypeKind type, final Integer srid) throws XMLStreamException {
List<Point> extPoints = null;
List<Point> intPoints = null;
@@ -126,11 +126,11 @@ class AtomGeoValueDeserializer {
}
}
- return new Polygon(GeoUtils.getDimension(type), crs, intPoints, extPoints);
+ return new Polygon(GeoUtils.getDimension(type), srid, intPoints, extPoints);
}
private MultiLineString multiLineString(final XMLEventReader reader, final StartElement start,
- final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException {
+ final EdmPrimitiveTypeKind type, final Integer srid) throws XMLStreamException {
final List<LineString> lineStrings = new ArrayList<LineString>();
@@ -147,11 +147,11 @@ class AtomGeoValueDeserializer {
}
}
- return new MultiLineString(GeoUtils.getDimension(type), crs, lineStrings);
+ return new MultiLineString(GeoUtils.getDimension(type), srid, lineStrings);
}
private MultiPolygon multiPolygon(final XMLEventReader reader, final StartElement start,
- final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException {
+ final EdmPrimitiveTypeKind type, final Integer srid) throws XMLStreamException {
final List<Polygon> polygons = new ArrayList<Polygon>();
@@ -168,11 +168,11 @@ class AtomGeoValueDeserializer {
}
}
- return new MultiPolygon(GeoUtils.getDimension(type), crs, polygons);
+ return new MultiPolygon(GeoUtils.getDimension(type), srid, polygons);
}
private GeospatialCollection collection(final XMLEventReader reader, final StartElement start,
- final EdmPrimitiveTypeKind type, final String crs) throws XMLStreamException {
+ final EdmPrimitiveTypeKind type, final Integer srid) throws XMLStreamException {
final List<Geospatial> geospatials = new ArrayList<Geospatial>();
@@ -201,16 +201,16 @@ class AtomGeoValueDeserializer {
}
}
- return new GeospatialCollection(GeoUtils.getDimension(type), crs, geospatials);
+ return new GeospatialCollection(GeoUtils.getDimension(type), srid, geospatials);
}
public Geospatial deserialize(final XMLEventReader reader, final StartElement start,
final EdmPrimitiveTypeKind type) throws XMLStreamException {
- String crs = null;
+ Integer srid = null;
final Attribute srsName = start.getAttributeByName(Constants.QNAME_ATTR_SRSNAME);
if (srsName != null) {
- crs = StringUtils.substringAfterLast(srsName.getValue(), "/");
+ srid = Integer.valueOf(StringUtils.substringAfterLast(srsName.getValue(), "/"));
}
Geospatial value;
@@ -218,37 +218,37 @@ class AtomGeoValueDeserializer {
switch (type) {
case GeographyPoint:
case GeometryPoint:
- value = points(reader, start, type, crs).get(0);
+ value = points(reader, start, type, srid).get(0);
break;
case GeographyMultiPoint:
case GeometryMultiPoint:
- value = multipoint(reader, start, type, crs);
+ value = multipoint(reader, start, type, srid);
break;
case GeographyLineString:
case GeometryLineString:
- value = lineString(reader, start, type, crs);
+ value = lineString(reader, start, type, srid);
break;
case GeographyMultiLineString:
case GeometryMultiLineString:
- value = multiLineString(reader, start, type, crs);
+ value = multiLineString(reader, start, type, srid);
break;
case GeographyPolygon:
case GeometryPolygon:
- value = polygon(reader, start, type, crs);
+ value = polygon(reader, start, type, srid);
break;
case GeographyMultiPolygon:
case GeometryMultiPolygon:
- value = multiPolygon(reader, start, type, crs);
+ value = multiPolygon(reader, start, type, srid);
break;
case GeographyCollection:
case GeometryCollection:
- value = collection(reader, start, type, crs);
+ value = collection(reader, start, type, srid);
break;
default:
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomGeoValueSerializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomGeoValueSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomGeoValueSerializer.java
index 624bcfa..d1636d4 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomGeoValueSerializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomGeoValueSerializer.java
@@ -118,9 +118,9 @@ class AtomGeoValueSerializer {
}
private void writeSrsName(final XMLStreamWriter writer, final Geospatial value) throws XMLStreamException {
- if (value.getCrs() != null) {
+ if (value.getSrid() != null) {
writer.writeAttribute(Constants.PREFIX_GML, Constants.NS_GML, Constants.ATTR_SRSNAME,
- Constants.SRS_URLPREFIX + value.getCrs());
+ Constants.SRS_URLPREFIX + value.getSrid());
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONGeoValueDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONGeoValueDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONGeoValueDeserializer.java
index c544f73..09ecbdf 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONGeoValueDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONGeoValueDeserializer.java
@@ -47,11 +47,11 @@ class JSONGeoValueDeserializer {
this.version = version;
}
- private Point point(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type, final String crs) {
+ private Point point(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type, final Integer srid) {
Point point = null;
if (itor.hasNext()) {
- point = new Point(GeoUtils.getDimension(type), crs);
+ point = new Point(GeoUtils.getDimension(type), srid);
try {
point.setX(EdmDouble.getInstance().valueOfString(itor.next().asText(), null, null,
Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null, Double.class));
@@ -65,46 +65,42 @@ class JSONGeoValueDeserializer {
return point;
}
- private MultiPoint multipoint(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
- final String crs) {
-
+ private MultiPoint multipoint(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type, final Integer srid) {
final MultiPoint multiPoint;
if (itor.hasNext()) {
final List<Point> points = new ArrayList<Point>();
while (itor.hasNext()) {
final Iterator<JsonNode> mpItor = itor.next().elements();
- points.add(point(mpItor, type, crs));
+ points.add(point(mpItor, type, srid));
}
- multiPoint = new MultiPoint(GeoUtils.getDimension(type), crs, points);
+ multiPoint = new MultiPoint(GeoUtils.getDimension(type), srid, points);
} else {
- multiPoint = new MultiPoint(GeoUtils.getDimension(type), crs, Collections.<Point>emptyList());
+ multiPoint = new MultiPoint(GeoUtils.getDimension(type), srid, Collections.<Point>emptyList());
}
return multiPoint;
}
- private LineString lineString(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
- final String crs) {
-
+ private LineString lineString(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type, final Integer srid) {
final LineString lineString;
if (itor.hasNext()) {
final List<Point> points = new ArrayList<Point>();
while (itor.hasNext()) {
final Iterator<JsonNode> mpItor = itor.next().elements();
- points.add(point(mpItor, type, crs));
+ points.add(point(mpItor, type, srid));
}
- lineString = new LineString(GeoUtils.getDimension(type), crs, points);
+ lineString = new LineString(GeoUtils.getDimension(type), srid, points);
} else {
- lineString = new LineString(GeoUtils.getDimension(type), crs, Collections.<Point>emptyList());
+ lineString = new LineString(GeoUtils.getDimension(type), srid, Collections.<Point>emptyList());
}
return lineString;
}
private MultiLineString multiLineString(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
- final String crs) {
+ final Integer srid) {
final MultiLineString multiLineString;
@@ -112,18 +108,18 @@ class JSONGeoValueDeserializer {
final List<LineString> lineStrings = new ArrayList<LineString>();
while (itor.hasNext()) {
final Iterator<JsonNode> mlsItor = itor.next().elements();
- lineStrings.add(lineString(mlsItor, type, crs));
+ lineStrings.add(lineString(mlsItor, type, srid));
}
- multiLineString = new MultiLineString(GeoUtils.getDimension(type), crs, lineStrings);
+ multiLineString = new MultiLineString(GeoUtils.getDimension(type), srid, lineStrings);
} else {
- multiLineString = new MultiLineString(GeoUtils.getDimension(type), crs, Collections.<LineString>emptyList());
+ multiLineString = new MultiLineString(GeoUtils.getDimension(type), srid, Collections.<LineString>emptyList());
}
return multiLineString;
}
private Polygon polygon(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
- final String crs) {
+ final Integer srid) {
List<Point> extPoints = null;
if (itor.hasNext()) {
@@ -132,7 +128,7 @@ class JSONGeoValueDeserializer {
extPoints = new ArrayList<Point>();
while (extItor.hasNext()) {
final Iterator<JsonNode> mpItor = extItor.next().elements();
- extPoints.add(point(mpItor, type, crs));
+ extPoints.add(point(mpItor, type, srid));
}
}
}
@@ -144,16 +140,16 @@ class JSONGeoValueDeserializer {
intPoints = new ArrayList<Point>();
while (intItor.hasNext()) {
final Iterator<JsonNode> mpItor = intItor.next().elements();
- intPoints.add(point(mpItor, type, crs));
+ intPoints.add(point(mpItor, type, srid));
}
}
}
- return new Polygon(GeoUtils.getDimension(type), crs, intPoints, extPoints);
+ return new Polygon(GeoUtils.getDimension(type), srid, intPoints, extPoints);
}
private MultiPolygon multiPolygon(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
- final String crs) {
+ final Integer srid) {
final MultiPolygon multiPolygon;
@@ -161,18 +157,18 @@ class JSONGeoValueDeserializer {
final List<Polygon> polygons = new ArrayList<Polygon>();
while (itor.hasNext()) {
final Iterator<JsonNode> mpItor = itor.next().elements();
- polygons.add(polygon(mpItor, type, crs));
+ polygons.add(polygon(mpItor, type, srid));
}
- multiPolygon = new MultiPolygon(GeoUtils.getDimension(type), crs, polygons);
+ multiPolygon = new MultiPolygon(GeoUtils.getDimension(type), srid, polygons);
} else {
- multiPolygon = new MultiPolygon(GeoUtils.getDimension(type), crs, Collections.<Polygon>emptyList());
+ multiPolygon = new MultiPolygon(GeoUtils.getDimension(type), srid, Collections.<Polygon>emptyList());
}
return multiPolygon;
}
private GeospatialCollection collection(final Iterator<JsonNode> itor, final EdmPrimitiveTypeKind type,
- final String crs) {
+ final Integer srid) {
final GeospatialCollection collection;
@@ -195,9 +191,9 @@ class JSONGeoValueDeserializer {
geospatials.add(deserialize(geo, new EdmTypeInfo.Builder().setTypeExpression(callAsType).build()));
}
- collection = new GeospatialCollection(GeoUtils.getDimension(type), crs, geospatials);
+ collection = new GeospatialCollection(GeoUtils.getDimension(type), srid, geospatials);
} else {
- collection = new GeospatialCollection(GeoUtils.getDimension(type), crs, Collections.<Geospatial>emptyList());
+ collection = new GeospatialCollection(GeoUtils.getDimension(type), srid, Collections.<Geospatial>emptyList());
}
return collection;
@@ -223,46 +219,47 @@ class JSONGeoValueDeserializer {
? node.get(Constants.JSON_COORDINATES).elements()
: Collections.<JsonNode>emptyList().iterator();
- String crs = null;
+ Integer srid = null;
if (node.has(Constants.JSON_CRS)) {
- crs = node.get(Constants.JSON_CRS).get(Constants.PROPERTIES).get(Constants.JSON_NAME).asText().split(":")[1];
+ srid = Integer.valueOf(
+ node.get(Constants.JSON_CRS).get(Constants.PROPERTIES).get(Constants.JSON_NAME).asText().split(":")[1]);
}
Geospatial value = null;
switch (actualType) {
case GeographyPoint:
case GeometryPoint:
- value = point(cooItor, actualType, crs);
+ value = point(cooItor, actualType, srid);
break;
case GeographyMultiPoint:
case GeometryMultiPoint:
- value = multipoint(cooItor, actualType, crs);
+ value = multipoint(cooItor, actualType, srid);
break;
case GeographyLineString:
case GeometryLineString:
- value = lineString(cooItor, actualType, crs);
+ value = lineString(cooItor, actualType, srid);
break;
case GeographyMultiLineString:
case GeometryMultiLineString:
- value = multiLineString(cooItor, actualType, crs);
+ value = multiLineString(cooItor, actualType, srid);
break;
case GeographyPolygon:
case GeometryPolygon:
- value = polygon(cooItor, actualType, crs);
+ value = polygon(cooItor, actualType, srid);
break;
case GeographyMultiPolygon:
case GeometryMultiPolygon:
- value = multiPolygon(cooItor, actualType, crs);
+ value = multiPolygon(cooItor, actualType, srid);
break;
case GeographyCollection:
case GeometryCollection:
- value = collection(node.get(Constants.JSON_GEOMETRIES).elements(), actualType, crs);
+ value = collection(node.get(Constants.JSON_GEOMETRIES).elements(), actualType, srid);
break;
default:
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONGeoValueSerializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONGeoValueSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONGeoValueSerializer.java
index 95c30d4..470872e 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONGeoValueSerializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONGeoValueSerializer.java
@@ -37,11 +37,11 @@ import org.apache.olingo.commons.core.edm.primitivetype.EdmDouble;
class JSONGeoValueSerializer {
- private void crs(final JsonGenerator jgen, final String crs) throws IOException {
+ private void srid(final JsonGenerator jgen, final Integer srid) throws IOException {
jgen.writeObjectFieldStart(Constants.JSON_CRS);
jgen.writeStringField(Constants.ATTR_TYPE, Constants.JSON_NAME);
jgen.writeObjectFieldStart(Constants.PROPERTIES);
- jgen.writeStringField(Constants.JSON_NAME, "EPSG:" + crs);
+ jgen.writeStringField(Constants.JSON_NAME, "EPSG:" + srid);
jgen.writeEndObject();
jgen.writeEndObject();
}
@@ -175,8 +175,8 @@ class JSONGeoValueSerializer {
default:
}
- if (value.getCrs() != null) {
- crs(jgen, value.getCrs());
+ if (value.getSrid() != null) {
+ srid(jgen, value.getSrid());
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPrimitiveValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPrimitiveValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPrimitiveValueImpl.java
new file mode 100644
index 0000000..ad60494
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPrimitiveValueImpl.java
@@ -0,0 +1,171 @@
+/*
+ * 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.commons.core.domain;
+
+import java.sql.Timestamp;
+import java.util.Calendar;
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.domain.AbstractODataValue;
+import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
+
+public class ODataPrimitiveValueImpl extends AbstractODataValue implements ODataPrimitiveValue {
+
+ private static final long serialVersionUID = 8889282662298376036L;
+
+ public static class BuilderImpl implements Builder {
+
+ private final ODataServiceVersion version;
+
+ private final ODataPrimitiveValueImpl instance;
+
+ public BuilderImpl(final ODataServiceVersion version) {
+ this.version = version;
+ this.instance = new ODataPrimitiveValueImpl();
+ }
+
+ @Override
+ public BuilderImpl setType(final EdmPrimitiveTypeKind type) {
+ if (type != null && !type.getSupportedVersions().contains(version)) {
+ throw new IllegalArgumentException(String.format(
+ "Type %s not supported by OData version %s", type.toString(), version));
+ }
+ if (type == EdmPrimitiveTypeKind.Stream) {
+ throw new IllegalArgumentException(String.format(
+ "Cannot build a primitive value for %s", EdmPrimitiveTypeKind.Stream.toString()));
+ }
+ if (type == EdmPrimitiveTypeKind.Geography || type == EdmPrimitiveTypeKind.Geometry) {
+ throw new IllegalArgumentException(
+ type + "is not an instantiable type. "
+ + "An entity can declare a property to be of type Geometry. "
+ + "An instance of an entity MUST NOT have a value of type Geometry. "
+ + "Each value MUST be of some subtype.");
+ }
+
+ this.instance.typeKind = type == null ? EdmPrimitiveTypeKind.String : type;
+ this.instance.type = EdmPrimitiveTypeFactory.getInstance(this.instance.typeKind);
+
+ return this;
+ }
+
+ @Override
+ public BuilderImpl setText(final String text) {
+ this.instance.text = text;
+ return this;
+ }
+
+ @Override
+ public BuilderImpl setValue(final Object value) {
+ this.instance.value = value;
+ return this;
+ }
+
+ @Override
+ public ODataPrimitiveValueImpl build() {
+ if (this.instance.text == null && this.instance.value == null) {
+ throw new IllegalArgumentException("Must provide either text or value");
+ }
+ if (this.instance.text != null && this.instance.value != null) {
+ throw new IllegalArgumentException("Cannot provide both text and value");
+ }
+
+ if (this.instance.type == null) {
+ setType(EdmPrimitiveTypeKind.String);
+ }
+
+ if (this.instance.text != null) {
+ final Class<?> returnType = this.instance.type.getDefaultType().isAssignableFrom(Calendar.class)
+ ? Timestamp.class : this.instance.type.getDefaultType();
+ try {
+ // TODO: when Edm is available, set facets when calling this method
+ this.instance.value = this.instance.type.valueOfString(
+ this.instance.text, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null,
+ returnType);
+ } catch (EdmPrimitiveTypeException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+ if (this.instance.value != null) {
+ try {
+ // TODO: when Edm is available, set facets when calling this method
+ this.instance.text = this.instance.type.valueToString(
+ this.instance.value, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null);
+ } catch (EdmPrimitiveTypeException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ return this.instance;
+ }
+ }
+
+ /**
+ * Type kind.
+ */
+ private EdmPrimitiveTypeKind typeKind;
+
+ /**
+ * Type.
+ */
+ private EdmPrimitiveType type;
+
+ /**
+ * Text value.
+ */
+ private String text;
+
+ /**
+ * Actual value.
+ */
+ private Object value;
+
+ @Override
+ public EdmPrimitiveTypeKind getTypeKind() {
+ return typeKind;
+ }
+
+ @Override
+ public EdmPrimitiveType getType() {
+ return type;
+ }
+
+ @Override
+ public Object toValue() {
+ return this.value;
+ }
+
+ @Override
+ public <T> T toCastValue(final Class<T> reference) throws EdmPrimitiveTypeException {
+ return typeKind.isGeospatial()
+ ? reference.cast(this.value)
+ // TODO: when Edm is available, set facets when calling this method
+ : type.valueOfString(this.text,
+ null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null, reference);
+ }
+
+ @Override
+ public String toString() {
+ return this.text;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmParameter.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmParameter.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmParameter.java
index 09bd8ce..90761a7 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmParameter.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmParameter.java
@@ -44,7 +44,7 @@ public abstract class AbstractEdmParameter extends EdmElementImpl implements Edm
if (typeImpl == null) {
if (EdmPrimitiveType.EDM_NAMESPACE.equals(paramType.getNamespace())) {
try {
- typeImpl = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.valueOf(paramType.getName()));
+ typeImpl = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.valueOf(paramType.getName()));
} catch (IllegalArgumentException e) {
throw new EdmException("Cannot find type with name: " + paramType, e);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/AbstractEdmGeospatialType.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/AbstractEdmGeospatialType.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/AbstractEdmGeospatialType.java
deleted file mode 100644
index 8e5cb6f..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/AbstractEdmGeospatialType.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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.commons.core.edm.primitivetype;
-
-import org.apache.olingo.commons.api.edm.EdmGeospatialType;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.commons.api.edm.geo.Geospatial;
-import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
-import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
-
-public abstract class AbstractEdmGeospatialType<T extends Geospatial> implements EdmGeospatialType {
-
- private final Class<T> reference;
-
- protected final Dimension dimension;
-
- protected final Type type;
-
- protected AbstractEdmGeospatialType(final Class<T> reference, final Dimension dimension, final Type type) {
- this.reference = reference;
- this.dimension = dimension;
- this.type = type;
- }
-
- @Override
- public Class<? extends Geospatial> getJavaType() {
- return reference;
- }
-
- @Override
- public String getNamespace() {
- return EDM_NAMESPACE;
- }
-
- @Override
- public String getName() {
- return getClass().getSimpleName().substring(3);
- }
-
- @Override
- public EdmTypeKind getKind() {
- return EdmTypeKind.PRIMITIVE;
- }
-
- @Override
- public boolean equals(final Object obj) {
- return this == obj || obj != null && getClass() == obj.getClass();
- }
-
- @Override
- public int hashCode() {
- return getClass().hashCode();
- }
-
- @Override
- public String toString() {
- return new FullQualifiedName(getNamespace(), getName()).getFullQualifiedNameAsString();
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/AbstractGeospatialType.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/AbstractGeospatialType.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/AbstractGeospatialType.java
new file mode 100644
index 0000000..7a61a53
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/AbstractGeospatialType.java
@@ -0,0 +1,539 @@
+/*
+ * 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.commons.core.edm.primitivetype;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
+import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
+import org.apache.olingo.commons.api.edm.geo.LineString;
+import org.apache.olingo.commons.api.edm.geo.MultiLineString;
+import org.apache.olingo.commons.api.edm.geo.MultiPoint;
+import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
+import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.Polygon;
+
+public abstract class AbstractGeospatialType<T extends Geospatial> extends SingletonPrimitiveType {
+
+ private static final Pattern PATTERN =
+ Pattern.compile("([a-z]+)'SRID=([0-9]+);([a-zA-Z]+)\\((.*)\\)'");
+
+ private static final Pattern COLLECTION_PATTERN =
+ Pattern.compile("([a-z]+)'SRID=([0-9]+);Collection\\(([a-zA-Z]+)\\((.*)\\)\\)'");
+
+ private final Class<T> reference;
+
+ protected final Dimension dimension;
+
+ protected final Type type;
+
+ protected AbstractGeospatialType(final Class<T> reference, final Dimension dimension, final Type type) {
+ this.reference = reference;
+ this.dimension = dimension;
+ this.type = type;
+ }
+
+ @Override
+ public Class<?> getDefaultType() {
+ return reference;
+ }
+
+ private Matcher getMatcher(final Pattern pattern, final String value) throws EdmPrimitiveTypeException {
+ final Matcher matcher = pattern.matcher(value);
+ if (!matcher.matches()) {
+ throw new EdmPrimitiveTypeException("EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(value)");
+ }
+
+ Geospatial.Dimension _dimension = null;
+ Geospatial.Type _type = null;
+ try {
+ _dimension = Geospatial.Dimension.valueOf(matcher.group(1).toUpperCase());
+ _type = Geospatial.Type.valueOf(matcher.group(3).toUpperCase());
+ } catch (IllegalArgumentException e) {
+ throw new EdmPrimitiveTypeException("EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(value)", e);
+ }
+ if (_dimension != this.dimension || (!pattern.equals(COLLECTION_PATTERN) && _type != this.type)) {
+ throw new EdmPrimitiveTypeException("EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(value)");
+ }
+
+ return matcher;
+ }
+
+ private Point newPoint(final Integer srid, final String point, final Boolean isNullable,
+ final Integer maxLength, final Integer precision, final Integer scale, final Boolean isUnicode)
+ throws EdmPrimitiveTypeException {
+
+ final String[] pointCoo = StringUtils.split(point, ' ');
+ if (pointCoo == null || pointCoo.length != 2) {
+ throw new EdmPrimitiveTypeException("EdmPrimitiveTypeException.LITERAL_ILLEGAL_CONTENT.addContent(value)");
+ }
+
+ final Point result = new Point(this.dimension, srid);
+ result.setX(EdmDouble.getInstance().valueOfString(pointCoo[0],
+ isNullable, maxLength, precision, scale, isUnicode, Double.class));
+ result.setY(EdmDouble.getInstance().valueOfString(pointCoo[1],
+ isNullable, maxLength, precision, scale, isUnicode, Double.class));
+
+ return result;
+ }
+
+ protected Point stringToPoint(final String value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
+
+ final Matcher matcher = getMatcher(PATTERN, value);
+
+ return newPoint(Integer.valueOf(matcher.group(2)), matcher.group(4),
+ isNullable, maxLength, precision, scale, isUnicode);
+ }
+
+ protected MultiPoint stringToMultiPoint(final String value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
+
+ final Matcher matcher = getMatcher(PATTERN, value);
+
+ final List<Point> points = new ArrayList<Point>();
+ for (String pointCoo : StringUtils.split(matcher.group(4), ',')) {
+ points.add(newPoint(null, pointCoo.substring(1, pointCoo.length() - 1),
+ isNullable, maxLength, precision, scale, isUnicode));
+ }
+
+ return new MultiPoint(dimension, Integer.valueOf(matcher.group(2)), points);
+ }
+
+ private LineString newLineString(final Integer srid, final String lineString, final Boolean isNullable,
+ final Integer maxLength, final Integer precision, final Integer scale, final Boolean isUnicode)
+ throws EdmPrimitiveTypeException {
+
+ final List<Point> points = new ArrayList<Point>();
+ for (String pointCoo : StringUtils.split(lineString, ',')) {
+ points.add(newPoint(null, pointCoo, isNullable, maxLength, precision, scale, isUnicode));
+ }
+
+ return new LineString(this.dimension, srid, points);
+ }
+
+ protected LineString stringToLineString(final String value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
+
+ final Matcher matcher = getMatcher(PATTERN, value);
+
+ return newLineString(Integer.valueOf(matcher.group(2)), matcher.group(4),
+ isNullable, maxLength, precision, scale, isUnicode);
+ }
+
+ protected MultiLineString stringToMultiLineString(final String value, final Boolean isNullable,
+ final Integer maxLength, final Integer precision, final Integer scale, final Boolean isUnicode)
+ throws EdmPrimitiveTypeException {
+
+ final Matcher matcher = getMatcher(PATTERN, value);
+
+ final List<LineString> lineStrings = new ArrayList<LineString>();
+ for (String coo : matcher.group(4).contains("),(")
+ ? matcher.group(4).split("\\),\\(") : new String[] {matcher.group(4)}) {
+
+ String lineString = coo;
+ if (lineString.charAt(0) == '(') {
+ lineString = lineString.substring(1);
+ }
+ if (lineString.endsWith(")")) {
+ lineString = StringUtils.substringBeforeLast(lineString, ")");
+ }
+
+ lineStrings.add(newLineString(null, lineString, isNullable, maxLength, precision, scale, isUnicode));
+ }
+
+ return new MultiLineString(this.dimension, Integer.valueOf(matcher.group(2)), lineStrings);
+ }
+
+ private Polygon newPolygon(final Integer srid, final String polygon, final Boolean isNullable,
+ final Integer maxLength, final Integer precision, final Integer scale, final Boolean isUnicode)
+ throws EdmPrimitiveTypeException {
+
+ final String[] first = polygon.split("\\),\\(");
+
+ final List<Point> interior = new ArrayList<Point>();
+ for (String pointCoo : StringUtils.split(first[0].substring(1, first[0].length()), ',')) {
+ interior.add(newPoint(null, pointCoo, isNullable, maxLength, precision, scale, isUnicode));
+ }
+ final List<Point> exterior = new ArrayList<Point>();
+ for (String pointCoo : StringUtils.split(first[1].substring(0, first[1].length() - 1), ',')) {
+ exterior.add(newPoint(null, pointCoo, isNullable, maxLength, precision, scale, isUnicode));
+ }
+
+ return new Polygon(dimension, srid, interior, exterior);
+ }
+
+ protected Polygon stringToPolygon(final String value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
+
+ final Matcher matcher = getMatcher(PATTERN, value);
+
+ return newPolygon(Integer.valueOf(matcher.group(2)), matcher.group(4),
+ isNullable, maxLength, precision, scale, isUnicode);
+ }
+
+ protected MultiPolygon stringToMultiPolygon(final String value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
+
+ final Matcher matcher = getMatcher(PATTERN, value);
+
+ final List<Polygon> polygons = new ArrayList<Polygon>();
+ for (String coo : matcher.group(4).contains(")),((")
+ ? matcher.group(4).split("\\)\\),\\(\\(") : new String[] {matcher.group(4)}) {
+
+ String polygon = coo;
+ if (polygon.startsWith("((")) {
+ polygon = polygon.substring(1);
+ }
+ if (polygon.endsWith("))")) {
+ polygon = StringUtils.substringBeforeLast(polygon, ")");
+ }
+ if (polygon.charAt(0) != '(') {
+ polygon = "(" + polygon;
+ }
+ if (!polygon.endsWith(")")) {
+ polygon += ")";
+ }
+
+ polygons.add(newPolygon(null, polygon, isNullable, maxLength, precision, scale, isUnicode));
+ }
+
+ return new MultiPolygon(dimension, Integer.valueOf(matcher.group(2)), polygons);
+ }
+
+ protected GeospatialCollection stringToCollection(final String value, final Boolean isNullable,
+ final Integer maxLength, final Integer precision, final Integer scale, final Boolean isUnicode)
+ throws EdmPrimitiveTypeException {
+
+ final Matcher matcher = getMatcher(COLLECTION_PATTERN, value);
+
+ Geospatial item = null;
+ switch (Geospatial.Type.valueOf(matcher.group(3).toUpperCase())) {
+ case POINT:
+ item = newPoint(Integer.valueOf(matcher.group(2)), matcher.group(4),
+ isNullable, maxLength, precision, scale, isUnicode);
+ break;
+
+ case MULTIPOINT:
+ final List<Point> points = new ArrayList<Point>();
+ for (String pointCoo : StringUtils.split(matcher.group(4), ',')) {
+ points.add(newPoint(null, pointCoo.substring(1, pointCoo.length() - 1),
+ isNullable, maxLength, precision, scale, isUnicode));
+ }
+
+ item = new MultiPoint(dimension, Integer.valueOf(matcher.group(2)), points);
+ break;
+
+ case LINESTRING:
+ item = newLineString(Integer.valueOf(matcher.group(2)), matcher.group(4),
+ isNullable, maxLength, precision, scale, isUnicode);
+ break;
+
+ case MULTILINESTRING:
+ final List<LineString> lineStrings = new ArrayList<LineString>();
+ for (String coo : StringUtils.split(matcher.group(4), ',')) {
+ lineStrings.add(newLineString(null, coo.substring(1, coo.length() - 1),
+ isNullable, maxLength, precision, scale, isUnicode));
+ }
+
+ item = new MultiLineString(this.dimension, Integer.valueOf(matcher.group(2)), lineStrings);
+ break;
+
+ case POLYGON:
+ item = newPolygon(Integer.valueOf(matcher.group(2)), matcher.group(4),
+ isNullable, maxLength, precision, scale, isUnicode);
+ break;
+
+ case MULTIPOLYGON:
+ final List<Polygon> polygons = new ArrayList<Polygon>();
+ for (String coo : StringUtils.split(matcher.group(4), ',')) {
+ polygons.add(newPolygon(null, coo.substring(1, coo.length() - 1),
+ isNullable, maxLength, precision, scale, isUnicode));
+ }
+
+ item = new MultiPolygon(dimension, Integer.valueOf(matcher.group(2)), polygons);
+ break;
+
+ default:
+ }
+
+ return new GeospatialCollection(dimension, Integer.valueOf(matcher.group(2)),
+ Collections.<Geospatial>singletonList(item));
+ }
+
+ private StringBuilder toStringBuilder(final Integer srid) {
+ return new StringBuilder(dimension.name().toLowerCase()).append('\'').
+ append("SRID=").append(srid).append(';');
+ }
+
+ private String point(final Point point, final Boolean isNullable,
+ final Integer maxLength, final Integer precision, final Integer scale, final Boolean isUnicode)
+ throws EdmPrimitiveTypeException {
+
+ return new StringBuilder().
+ append(EdmDouble.getInstance().valueToString(point.getX(),
+ isNullable, maxLength, precision, scale, isUnicode)).
+ append(' ').
+ append(EdmDouble.getInstance().valueToString(point.getY(),
+ isNullable, maxLength, precision, scale, isUnicode)).
+ toString();
+ }
+
+ protected String toString(final Point point, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
+
+ if (dimension != point.getDimension()) {
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_ILLEGAL_CONTENT.addContent(value)");
+ }
+
+ return toStringBuilder(point.getSrid()).
+ append(reference.getSimpleName()).
+ append('(').
+ append(point(point, isNullable, maxLength, precision, scale, isUnicode)).
+ append(")'").
+ toString();
+ }
+
+ protected String toString(final MultiPoint multiPoint, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
+
+ if (dimension != multiPoint.getDimension()) {
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_ILLEGAL_CONTENT.addContent(value)");
+ }
+
+ final StringBuilder result = toStringBuilder(multiPoint.getSrid()).
+ append(reference.getSimpleName()).
+ append('(');
+
+ for (final Iterator<Point> itor = multiPoint.iterator(); itor.hasNext();) {
+ result.append('(').
+ append(point(itor.next(), isNullable, maxLength, precision, scale, isUnicode)).
+ append(')');
+ if (itor.hasNext()) {
+ result.append(',');
+ }
+ }
+
+ return result.append(")'").toString();
+ }
+
+ private String lineString(final LineString lineString, final Boolean isNullable,
+ final Integer maxLength, final Integer precision, final Integer scale, final Boolean isUnicode)
+ throws EdmPrimitiveTypeException {
+
+ final StringBuilder result = new StringBuilder();
+
+ for (final Iterator<Point> itor = lineString.iterator(); itor.hasNext();) {
+ result.append(point(itor.next(), isNullable, maxLength, precision, scale, isUnicode));
+ if (itor.hasNext()) {
+ result.append(',');
+ }
+ }
+
+ return result.toString();
+ }
+
+ protected String toString(final LineString lineString, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
+
+ if (dimension != lineString.getDimension()) {
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_ILLEGAL_CONTENT.addContent(value)");
+ }
+
+ return toStringBuilder(lineString.getSrid()).
+ append(reference.getSimpleName()).
+ append('(').
+ append(lineString(lineString, isNullable, maxLength, precision, scale, isUnicode)).
+ append(")'").toString();
+ }
+
+ protected String toString(final MultiLineString multiLineString, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
+
+ if (dimension != multiLineString.getDimension()) {
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_ILLEGAL_CONTENT.addContent(value)");
+ }
+
+ final StringBuilder result = toStringBuilder(multiLineString.getSrid()).
+ append(reference.getSimpleName()).
+ append('(');
+
+ for (final Iterator<LineString> itor = multiLineString.iterator(); itor.hasNext();) {
+ result.append('(').
+ append(lineString(itor.next(), isNullable, maxLength, precision, scale, isUnicode)).
+ append(')');
+ if (itor.hasNext()) {
+ result.append(',');
+ }
+ }
+
+ return result.append(")'").toString();
+ }
+
+ private String polygon(final Polygon polygon, final Boolean isNullable,
+ final Integer maxLength, final Integer precision, final Integer scale, final Boolean isUnicode)
+ throws EdmPrimitiveTypeException {
+
+ final StringBuilder result = new StringBuilder();
+
+ result.append('(');
+ for (final Iterator<Point> itor = polygon.getInterior().iterator(); itor.hasNext();) {
+ result.append(point(itor.next(), isNullable, maxLength, precision, scale, isUnicode));
+ if (itor.hasNext()) {
+ result.append(',');
+ }
+ }
+ result.append("),(");
+ for (final Iterator<Point> itor = polygon.getExterior().iterator(); itor.hasNext();) {
+ result.append(point(itor.next(), isNullable, maxLength, precision, scale, isUnicode));
+ if (itor.hasNext()) {
+ result.append(',');
+ }
+ }
+
+ return result.append(')').toString();
+ }
+
+ protected String toString(final Polygon polygon, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
+
+ if (dimension != polygon.getDimension()) {
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_ILLEGAL_CONTENT.addContent(value)");
+ }
+
+ return toStringBuilder(polygon.getSrid()).
+ append(reference.getSimpleName()).
+ append('(').
+ append(polygon(polygon, isNullable, maxLength, precision, scale, isUnicode)).
+ append(")'").toString();
+ }
+
+ protected String toString(final MultiPolygon multiPolygon, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
+
+ if (dimension != multiPolygon.getDimension()) {
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_ILLEGAL_CONTENT.addContent(value)");
+ }
+
+ final StringBuilder result = toStringBuilder(multiPolygon.getSrid()).
+ append(reference.getSimpleName()).
+ append('(');
+
+ for (final Iterator<Polygon> itor = multiPolygon.iterator(); itor.hasNext();) {
+ result.append('(').
+ append(polygon(itor.next(), isNullable, maxLength, precision, scale, isUnicode)).
+ append(')');
+ if (itor.hasNext()) {
+ result.append(',');
+ }
+ }
+
+ return result.append(")'").toString();
+ }
+
+ protected String toString(final GeospatialCollection collection, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
+
+ if (dimension != collection.getDimension()) {
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_ILLEGAL_CONTENT.addContent(value)");
+ }
+
+ final StringBuilder result = toStringBuilder(collection.getSrid()).
+ append("Collection(");
+
+ if (collection.iterator().hasNext()) {
+ final Geospatial item = collection.iterator().next();
+ result.append(item.getClass().getSimpleName()).append('(');
+
+ switch (item.getEdmPrimitiveTypeKind()) {
+ case GeographyPoint:
+ case GeometryPoint:
+ result.append(point((Point) item, isNullable, maxLength, precision, scale, isUnicode));
+ break;
+
+ case GeographyMultiPoint:
+ case GeometryMultiPoint:
+ for (final Iterator<Point> itor = ((MultiPoint) item).iterator(); itor.hasNext();) {
+ result.append('(').
+ append(point(itor.next(), isNullable, maxLength, precision, scale, isUnicode)).
+ append(')');
+ if (itor.hasNext()) {
+ result.append(',');
+ }
+ }
+ break;
+
+ case GeographyLineString:
+ case GeometryLineString:
+ result.append(lineString((LineString) item, isNullable, maxLength, precision, scale, isUnicode));
+ break;
+
+ case GeographyMultiLineString:
+ case GeometryMultiLineString:
+ for (final Iterator<LineString> itor = ((MultiLineString) item).iterator(); itor.hasNext();) {
+ result.append('(').
+ append(lineString(itor.next(), isNullable, maxLength, precision, scale, isUnicode)).
+ append(')');
+ if (itor.hasNext()) {
+ result.append(',');
+ }
+ }
+ break;
+
+ case GeographyPolygon:
+ case GeometryPolygon:
+ result.append(polygon((Polygon) item, isNullable, maxLength, precision, scale, isUnicode));
+ break;
+
+ case GeographyMultiPolygon:
+ case GeometryMultiPolygon:
+ for (final Iterator<Polygon> itor = ((MultiPolygon) item).iterator(); itor.hasNext();) {
+ result.append('(').
+ append(polygon(itor.next(), isNullable, maxLength, precision, scale, isUnicode)).
+ append(')');
+ if (itor.hasNext()) {
+ result.append(',');
+ }
+ }
+ break;
+
+ default:
+ }
+
+ result.append(')');
+ }
+
+ return result.append(")'").toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeography.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeography.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeography.java
index f5951cb..4fc8dcf 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeography.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeography.java
@@ -18,10 +18,11 @@
*/
package org.apache.olingo.commons.core.edm.primitivetype;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
-public final class EdmGeography extends AbstractEdmGeospatialType<Geospatial> {
+public final class EdmGeography extends AbstractGeospatialType<Geospatial> {
private static final EdmGeography INSTANCE = new EdmGeography();
@@ -33,4 +34,20 @@ public final class EdmGeography extends AbstractEdmGeospatialType<Geospatial> {
super(Geospatial.class, Dimension.GEOGRAPHY, null);
}
+ @Override
+ protected <T> T internalValueOfString(final String value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode, final Class<T> returnType)
+ throws EdmPrimitiveTypeException {
+
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType)");
+ }
+
+ @Override
+ protected <T> String internalValueToString(final T value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
+
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())");
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyCollection.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyCollection.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyCollection.java
index aab7210..7c4f446 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyCollection.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyCollection.java
@@ -18,11 +18,12 @@
*/
package org.apache.olingo.commons.core.edm.primitivetype;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
-import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
-public final class EdmGeographyCollection extends AbstractEdmGeospatialType<Point> {
+public final class EdmGeographyCollection extends AbstractGeospatialType<GeospatialCollection> {
private static final EdmGeographyCollection INSTANCE = new EdmGeographyCollection();
@@ -31,7 +32,33 @@ public final class EdmGeographyCollection extends AbstractEdmGeospatialType<Poin
}
public EdmGeographyCollection() {
- super(Point.class, Dimension.GEOGRAPHY, Type.GEOSPATIALCOLLECTION);
+ super(GeospatialCollection.class, Dimension.GEOGRAPHY, Type.GEOSPATIALCOLLECTION);
}
+ @Override
+ protected <T> T internalValueOfString(final String value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode,
+ final Class<T> returnType) throws EdmPrimitiveTypeException {
+
+ final GeospatialCollection collection =
+ stringToCollection(value, isNullable, maxLength, precision, scale, isUnicode);
+ if (returnType.isAssignableFrom(GeospatialCollection.class)) {
+ return returnType.cast(collection);
+ } else {
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType)");
+ }
+ }
+
+ @Override
+ protected <T> String internalValueToString(final T value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
+
+ if (value instanceof GeospatialCollection) {
+ return toString((GeospatialCollection) value, isNullable, maxLength, precision, scale, isUnicode);
+ }
+
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())");
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyLineString.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyLineString.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyLineString.java
index 23c92cc..85f1b7b 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyLineString.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyLineString.java
@@ -18,11 +18,12 @@
*/
package org.apache.olingo.commons.core.edm.primitivetype;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
-import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.LineString;
-public final class EdmGeographyLineString extends AbstractEdmGeospatialType<Point> {
+public final class EdmGeographyLineString extends AbstractGeospatialType<LineString> {
private static final EdmGeographyLineString INSTANCE = new EdmGeographyLineString();
@@ -31,7 +32,32 @@ public final class EdmGeographyLineString extends AbstractEdmGeospatialType<Poin
}
public EdmGeographyLineString() {
- super(Point.class, Dimension.GEOGRAPHY, Type.LINESTRING);
+ super(LineString.class, Dimension.GEOGRAPHY, Type.LINESTRING);
}
+ @Override
+ protected <T> T internalValueOfString(final String value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode,
+ final Class<T> returnType) throws EdmPrimitiveTypeException {
+
+ final LineString lineString = stringToLineString(value, isNullable, maxLength, precision, scale, isUnicode);
+ if (returnType.isAssignableFrom(LineString.class)) {
+ return returnType.cast(lineString);
+ } else {
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType)");
+ }
+ }
+
+ @Override
+ protected <T> String internalValueToString(final T value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
+
+ if (value instanceof LineString) {
+ return toString((LineString) value, isNullable, maxLength, precision, scale, isUnicode);
+ }
+
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())");
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiLineString.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiLineString.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiLineString.java
index 9b5901d..90c65eb 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiLineString.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiLineString.java
@@ -18,11 +18,12 @@
*/
package org.apache.olingo.commons.core.edm.primitivetype;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
-import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.MultiLineString;
-public final class EdmGeographyMultiLineString extends AbstractEdmGeospatialType<Point> {
+public final class EdmGeographyMultiLineString extends AbstractGeospatialType<MultiLineString> {
private static final EdmGeographyMultiLineString INSTANCE = new EdmGeographyMultiLineString();
@@ -31,7 +32,33 @@ public final class EdmGeographyMultiLineString extends AbstractEdmGeospatialType
}
public EdmGeographyMultiLineString() {
- super(Point.class, Dimension.GEOGRAPHY, Type.MULTILINESTRING);
+ super(MultiLineString.class, Dimension.GEOGRAPHY, Type.MULTILINESTRING);
}
+ @Override
+ protected <T> T internalValueOfString(final String value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode,
+ final Class<T> returnType) throws EdmPrimitiveTypeException {
+
+ final MultiLineString multiLineString =
+ stringToMultiLineString(value, isNullable, maxLength, precision, scale, isUnicode);
+ if (returnType.isAssignableFrom(MultiLineString.class)) {
+ return returnType.cast(multiLineString);
+ } else {
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType)");
+ }
+ }
+
+ @Override
+ protected <T> String internalValueToString(final T value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
+
+ if (value instanceof MultiLineString) {
+ return toString((MultiLineString) value, isNullable, maxLength, precision, scale, isUnicode);
+ }
+
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())");
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPoint.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPoint.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPoint.java
index db66041..9249055 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPoint.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPoint.java
@@ -18,11 +18,13 @@
*/
package org.apache.olingo.commons.core.edm.primitivetype;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.MultiPoint;
import org.apache.olingo.commons.api.edm.geo.Point;
-public final class EdmGeographyMultiPoint extends AbstractEdmGeospatialType<Point> {
+public final class EdmGeographyMultiPoint extends AbstractGeospatialType<MultiPoint> {
private static final EdmGeographyMultiPoint INSTANCE = new EdmGeographyMultiPoint();
@@ -31,7 +33,34 @@ public final class EdmGeographyMultiPoint extends AbstractEdmGeospatialType<Poin
}
public EdmGeographyMultiPoint() {
- super(Point.class, Dimension.GEOGRAPHY, Type.MULTIPOINT);
+ super(MultiPoint.class, Dimension.GEOGRAPHY, Type.MULTIPOINT);
+ }
+
+ @Override
+ protected <T> T internalValueOfString(final String value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode, final Class<T> returnType)
+ throws EdmPrimitiveTypeException {
+
+ final MultiPoint point = stringToMultiPoint(value, isNullable, maxLength, precision, scale, isUnicode);
+ if (returnType.isAssignableFrom(MultiPoint.class)) {
+ return returnType.cast(point);
+ } else {
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType)");
+ }
+
+ }
+
+ @Override
+ protected <T> String internalValueToString(final T value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
+
+ if (value instanceof MultiPoint) {
+ return toString((MultiPoint) value, isNullable, maxLength, precision, scale, isUnicode);
+ }
+
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())");
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPolygon.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPolygon.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPolygon.java
index 4b53a30..9dde107 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPolygon.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPolygon.java
@@ -18,11 +18,12 @@
*/
package org.apache.olingo.commons.core.edm.primitivetype;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
-import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
-public final class EdmGeographyMultiPolygon extends AbstractEdmGeospatialType<Point> {
+public final class EdmGeographyMultiPolygon extends AbstractGeospatialType<MultiPolygon> {
private static final EdmGeographyMultiPolygon INSTANCE = new EdmGeographyMultiPolygon();
@@ -31,7 +32,32 @@ public final class EdmGeographyMultiPolygon extends AbstractEdmGeospatialType<Po
}
public EdmGeographyMultiPolygon() {
- super(Point.class, Dimension.GEOGRAPHY, Type.MULTIPOLYGON);
+ super(MultiPolygon.class, Dimension.GEOGRAPHY, Type.MULTIPOLYGON);
}
+ @Override
+ protected <T> T internalValueOfString(final String value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode,
+ final Class<T> returnType) throws EdmPrimitiveTypeException {
+
+ final MultiPolygon multiPolygon = stringToMultiPolygon(value, isNullable, maxLength, precision, scale, isUnicode);
+ if (returnType.isAssignableFrom(MultiPolygon.class)) {
+ return returnType.cast(multiPolygon);
+ } else {
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType)");
+ }
+ }
+
+ @Override
+ protected <T> String internalValueToString(final T value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
+
+ if (value instanceof MultiPolygon) {
+ return toString((MultiPolygon) value, isNullable, maxLength, precision, scale, isUnicode);
+ }
+
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())");
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyPoint.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyPoint.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyPoint.java
index 61abce3..637709d 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyPoint.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyPoint.java
@@ -18,11 +18,12 @@
*/
package org.apache.olingo.commons.core.edm.primitivetype;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
import org.apache.olingo.commons.api.edm.geo.Point;
-public final class EdmGeographyPoint extends AbstractEdmGeospatialType<Point> {
+public final class EdmGeographyPoint extends AbstractGeospatialType<Point> {
private static final EdmGeographyPoint INSTANCE = new EdmGeographyPoint();
@@ -34,4 +35,30 @@ public final class EdmGeographyPoint extends AbstractEdmGeospatialType<Point> {
super(Point.class, Dimension.GEOGRAPHY, Type.POINT);
}
+ @Override
+ protected <T> T internalValueOfString(final String value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode,
+ final Class<T> returnType) throws EdmPrimitiveTypeException {
+
+ final Point point = stringToPoint(value, isNullable, maxLength, precision, scale, isUnicode);
+ if (returnType.isAssignableFrom(Point.class)) {
+ return returnType.cast(point);
+ } else {
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType)");
+ }
+ }
+
+ @Override
+ protected <T> String internalValueToString(final T value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
+
+ if (value instanceof Point) {
+ return toString((Point) value, isNullable, maxLength, precision, scale, isUnicode);
+ }
+
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())");
+ }
+
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyPolygon.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyPolygon.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyPolygon.java
index a7a1a6c..5f5e2db 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyPolygon.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyPolygon.java
@@ -18,11 +18,12 @@
*/
package org.apache.olingo.commons.core.edm.primitivetype;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
-import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.Polygon;
-public final class EdmGeographyPolygon extends AbstractEdmGeospatialType<Point> {
+public final class EdmGeographyPolygon extends AbstractGeospatialType<Polygon> {
private static final EdmGeographyPolygon INSTANCE = new EdmGeographyPolygon();
@@ -31,7 +32,32 @@ public final class EdmGeographyPolygon extends AbstractEdmGeospatialType<Point>
}
public EdmGeographyPolygon() {
- super(Point.class, Dimension.GEOGRAPHY, Type.POLYGON);
+ super(Polygon.class, Dimension.GEOGRAPHY, Type.POLYGON);
}
+ @Override
+ protected <T> T internalValueOfString(final String value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode,
+ final Class<T> returnType) throws EdmPrimitiveTypeException {
+
+ final Polygon polygon = stringToPolygon(value, isNullable, maxLength, precision, scale, isUnicode);
+ if (returnType.isAssignableFrom(Polygon.class)) {
+ return returnType.cast(polygon);
+ } else {
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType)");
+ }
+ }
+
+ @Override
+ protected <T> String internalValueToString(final T value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
+
+ if (value instanceof Polygon) {
+ return toString((Polygon) value, isNullable, maxLength, precision, scale, isUnicode);
+ }
+
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())");
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometry.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometry.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometry.java
index 2f16e24..3c19186 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometry.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometry.java
@@ -18,10 +18,11 @@
*/
package org.apache.olingo.commons.core.edm.primitivetype;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
-public final class EdmGeometry extends AbstractEdmGeospatialType<Geospatial> {
+public final class EdmGeometry extends AbstractGeospatialType<Geospatial> {
private static final EdmGeometry INSTANCE = new EdmGeometry();
@@ -33,4 +34,20 @@ public final class EdmGeometry extends AbstractEdmGeospatialType<Geospatial> {
super(Geospatial.class, Dimension.GEOMETRY, null);
}
+ @Override
+ protected <T> T internalValueOfString(final String value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode, final Class<T> returnType)
+ throws EdmPrimitiveTypeException {
+
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType)");
+ }
+
+ @Override
+ protected <T> String internalValueToString(final T value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
+
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())");
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryCollection.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryCollection.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryCollection.java
index 12c6c01..3c5a0e2 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryCollection.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryCollection.java
@@ -18,11 +18,13 @@
*/
package org.apache.olingo.commons.core.edm.primitivetype;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
+import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
import org.apache.olingo.commons.api.edm.geo.Point;
-public final class EdmGeometryCollection extends AbstractEdmGeospatialType<Point> {
+public final class EdmGeometryCollection extends AbstractGeospatialType<GeospatialCollection> {
private static final EdmGeometryCollection INSTANCE = new EdmGeometryCollection();
@@ -31,7 +33,33 @@ public final class EdmGeometryCollection extends AbstractEdmGeospatialType<Point
}
public EdmGeometryCollection() {
- super(Point.class, Dimension.GEOMETRY, Type.GEOSPATIALCOLLECTION);
+ super(GeospatialCollection.class, Dimension.GEOMETRY, Type.GEOSPATIALCOLLECTION);
}
+ @Override
+ protected <T> T internalValueOfString(final String value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode,
+ final Class<T> returnType) throws EdmPrimitiveTypeException {
+
+ final GeospatialCollection collection =
+ stringToCollection(value, isNullable, maxLength, precision, scale, isUnicode);
+ if (returnType.isAssignableFrom(GeospatialCollection.class)) {
+ return returnType.cast(collection);
+ } else {
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType)");
+ }
+ }
+
+ @Override
+ protected <T> String internalValueToString(final T value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
+
+ if (value instanceof GeospatialCollection) {
+ return toString((GeospatialCollection) value, isNullable, maxLength, precision, scale, isUnicode);
+ }
+
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())");
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryLineString.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryLineString.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryLineString.java
index db8cfb0..dbe0eda 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryLineString.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryLineString.java
@@ -18,11 +18,12 @@
*/
package org.apache.olingo.commons.core.edm.primitivetype;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
-import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.LineString;
-public final class EdmGeometryLineString extends AbstractEdmGeospatialType<Point> {
+public final class EdmGeometryLineString extends AbstractGeospatialType<LineString> {
private static final EdmGeometryLineString INSTANCE = new EdmGeometryLineString();
@@ -31,7 +32,32 @@ public final class EdmGeometryLineString extends AbstractEdmGeospatialType<Point
}
public EdmGeometryLineString() {
- super(Point.class, Dimension.GEOMETRY, Type.LINESTRING);
+ super(LineString.class, Dimension.GEOMETRY, Type.LINESTRING);
}
+ @Override
+ protected <T> T internalValueOfString(final String value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode,
+ final Class<T> returnType) throws EdmPrimitiveTypeException {
+
+ final LineString lineString = stringToLineString(value, isNullable, maxLength, precision, scale, isUnicode);
+ if (returnType.isAssignableFrom(LineString.class)) {
+ return returnType.cast(lineString);
+ } else {
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType)");
+ }
+ }
+
+ @Override
+ protected <T> String internalValueToString(final T value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
+
+ if (value instanceof LineString) {
+ return toString((LineString) value, isNullable, maxLength, precision, scale, isUnicode);
+ }
+
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())");
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiLineString.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiLineString.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiLineString.java
index 7bf89e6..5ed7ed0 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiLineString.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryMultiLineString.java
@@ -18,11 +18,12 @@
*/
package org.apache.olingo.commons.core.edm.primitivetype;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
-import org.apache.olingo.commons.api.edm.geo.Point;
+import org.apache.olingo.commons.api.edm.geo.MultiLineString;
-public final class EdmGeometryMultiLineString extends AbstractEdmGeospatialType<Point> {
+public final class EdmGeometryMultiLineString extends AbstractGeospatialType<MultiLineString> {
private static final EdmGeometryMultiLineString INSTANCE = new EdmGeometryMultiLineString();
@@ -31,7 +32,33 @@ public final class EdmGeometryMultiLineString extends AbstractEdmGeospatialType<
}
public EdmGeometryMultiLineString() {
- super(Point.class, Dimension.GEOMETRY, Type.MULTILINESTRING);
+ super(MultiLineString.class, Dimension.GEOMETRY, Type.MULTILINESTRING);
}
+ @Override
+ protected <T> T internalValueOfString(final String value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode,
+ final Class<T> returnType) throws EdmPrimitiveTypeException {
+
+ final MultiLineString multiLineString =
+ stringToMultiLineString(value, isNullable, maxLength, precision, scale, isUnicode);
+ if (returnType.isAssignableFrom(MultiLineString.class)) {
+ return returnType.cast(multiLineString);
+ } else {
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(returnType)");
+ }
+ }
+
+ @Override
+ protected <T> String internalValueToString(final T value, final Boolean isNullable, final Integer maxLength,
+ final Integer precision, final Integer scale, final Boolean isUnicode) throws EdmPrimitiveTypeException {
+
+ if (value instanceof MultiLineString) {
+ return toString((MultiLineString) value, isNullable, maxLength, precision, scale, isUnicode);
+ }
+
+ throw new EdmPrimitiveTypeException(
+ "EdmPrimitiveTypeException.VALUE_TYPE_NOT_SUPPORTED.addContent(value.getClass())");
+ }
}
[06/51] [abbrv] git commit: [OLINGO-194] complex and collection
literals + URI escape tests
Posted by il...@apache.org.
[OLINGO-194] complex and collection literals + URI escape tests
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/3e53ac5b
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/3e53ac5b
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/3e53ac5b
Branch: refs/heads/master
Commit: 3e53ac5b7d4069fb0e8566105d75d7e9e1ff2c22
Parents: 7651350
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Wed Mar 26 18:15:16 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Wed Mar 26 18:15:16 2014 +0100
----------------------------------------------------------------------
.../request/invoke/ODataInvokeRequestImpl.java | 2 +-
.../apache/olingo/client/core/uri/URIUtils.java | 129 ++++++++++----
.../olingo/client/core/uri/URIEscapeTest.java | 79 +++++++++
.../client/core/uri/v3/FilterFactoryTest.java | 167 +++++++++++++++++++
.../client/core/uri/v3/URIBuilderTest.java | 131 +++++++++++++++
.../client/core/uri/v4/FilterFactoryTest.java | 86 ++++++++++
.../client/core/uri/v4/URIBuilderTest.java | 136 +++++++++++++++
.../client/core/v3/FilterFactoryTest.java | 167 -------------------
.../olingo/client/core/v3/URIBuilderTest.java | 131 ---------------
.../client/core/v4/FilterFactoryTest.java | 86 ----------
.../olingo/client/core/v4/URIBuilderTest.java | 136 ---------------
11 files changed, 692 insertions(+), 558 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3e53ac5b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java
index ac6d162..9043fe8 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java
@@ -153,7 +153,7 @@ public class ODataInvokeRequestImpl<T extends ODataInvokeResult>
throw new IllegalArgumentException("Only primitive values can be passed via GET");
}
- uriBuilder.addParameter(param.getKey(), param.getValue().toString());
+ uriBuilder.addParameter(param.getKey(), URIUtils.escape(odataClient.getServiceVersion(), param.getValue()));
}
try {
((HttpRequestBase) this.request).setURI(uriBuilder.build());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3e53ac5b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
index 1e0dd5b..8dce061 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
@@ -27,7 +27,11 @@ import java.net.URI;
import java.net.URLEncoder;
import java.sql.Timestamp;
import java.util.Calendar;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
import java.util.UUID;
+import java.util.regex.Pattern;
import javax.xml.datatype.Duration;
import org.apache.commons.codec.binary.Hex;
import org.apache.commons.io.IOUtils;
@@ -67,6 +71,8 @@ public final class URIUtils {
*/
private static final Logger LOG = LoggerFactory.getLogger(URIUtils.class);
+ private static final Pattern ENUM_VALUE = Pattern.compile("(.+\\.)?.+'.+'");
+
private URIUtils() {
// Empty private constructor for static utility classes
}
@@ -274,53 +280,102 @@ public final class URIUtils {
Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null), Constants.UTF8));
}
+ private static String quoteString(final String string, final boolean singleQuoteEscape)
+ throws UnsupportedEncodingException {
+
+ final String encoded = URLEncoder.encode(string, Constants.UTF8);
+ return ENUM_VALUE.matcher(string).matches()
+ ? encoded
+ : singleQuoteEscape
+ ? "'" + encoded + "'"
+ : "\"" + encoded + "\"";
+ }
+
/**
* Turns primitive values into their respective URI representation.
*
+ * @param version OData protocol version
* @param obj primitive value
* @return URI representation
*/
public static String escape(final ODataServiceVersion version, final Object obj) {
+ return escape(version, obj, true);
+ }
+
+ private static String escape(final ODataServiceVersion version, final Object obj, final boolean singleQuoteEscape) {
String value;
try {
- value = (obj instanceof Boolean)
- ? BooleanUtils.toStringTrueFalse((Boolean) obj)
- : (obj instanceof UUID)
- ? prefix(version, EdmPrimitiveTypeKind.Guid)
- + obj.toString()
- + suffix(version, EdmPrimitiveTypeKind.Guid)
- : (obj instanceof byte[])
- ? EdmBinary.getInstance().toUriLiteral(Hex.encodeHexString((byte[]) obj))
- : (obj instanceof Timestamp)
- ? timestamp(version, (Timestamp) obj)
- : (obj instanceof Calendar)
- ? calendar(version, (Calendar) obj)
- : (obj instanceof Duration)
- ? duration(version, (Duration) obj)
- : (obj instanceof BigDecimal)
- ? EdmDecimal.getInstance().valueToString(obj, null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
- + suffix(version, EdmPrimitiveTypeKind.Decimal)
- : (obj instanceof Double)
- ? EdmDouble.getInstance().valueToString(obj, null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
- + suffix(version, EdmPrimitiveTypeKind.Double)
- : (obj instanceof Float)
- ? EdmSingle.getInstance().valueToString(obj, null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
- + suffix(version, EdmPrimitiveTypeKind.Single)
- : (obj instanceof Long)
- ? EdmInt64.getInstance().valueToString(obj, null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
- + suffix(version, EdmPrimitiveTypeKind.Int64)
- : (obj instanceof Geospatial)
- ? URLEncoder.encode(EdmPrimitiveTypeFactory.getInstance(((Geospatial) obj).getEdmPrimitiveTypeKind()).
- valueToString(obj, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
- Constants.UTF8)
- : (obj instanceof String)
- ? "'" + URLEncoder.encode((String) obj, Constants.UTF8) + "'"
- : obj.toString();
+ if (obj == null) {
+ value = Constants.ATTR_NULL;
+ } else if (version == ODataServiceVersion.V40 && obj instanceof Collection) {
+ final StringBuffer buffer = new StringBuffer("[");
+ for (@SuppressWarnings("unchecked")
+ final Iterator<Object> itor = ((Collection<Object>) obj).iterator(); itor.hasNext();) {
+ buffer.append(escape(version, itor.next(), false));
+ if (itor.hasNext()) {
+ buffer.append(',');
+ }
+ }
+ buffer.append(']');
+
+ value = buffer.toString();
+ } else if (version == ODataServiceVersion.V40 && obj instanceof Map) {
+ final StringBuffer buffer = new StringBuffer("{");
+ for (@SuppressWarnings("unchecked")
+ final Iterator<Map.Entry<Object, Object>> itor =
+ ((Map<Object, Object>) obj).entrySet().iterator(); itor.hasNext();) {
+
+ final Map.Entry<Object, Object> entry = itor.next();
+ buffer.append("\"").append(URLEncoder.encode(entry.getKey().toString(), Constants.UTF8)).append("\"");
+ buffer.append(':').append(escape(version, entry.getValue(), false));
+
+ if (itor.hasNext()) {
+ buffer.append(',');
+ }
+ }
+ buffer.append('}');
+
+ value = buffer.toString();
+ } else {
+ value = (obj instanceof Boolean)
+ ? BooleanUtils.toStringTrueFalse((Boolean) obj)
+ : (obj instanceof UUID)
+ ? prefix(version, EdmPrimitiveTypeKind.Guid)
+ + obj.toString()
+ + suffix(version, EdmPrimitiveTypeKind.Guid)
+ : (obj instanceof byte[])
+ ? EdmBinary.getInstance().toUriLiteral(Hex.encodeHexString((byte[]) obj))
+ : (obj instanceof Timestamp)
+ ? timestamp(version, (Timestamp) obj)
+ : (obj instanceof Calendar)
+ ? calendar(version, (Calendar) obj)
+ : (obj instanceof Duration)
+ ? duration(version, (Duration) obj)
+ : (obj instanceof BigDecimal)
+ ? EdmDecimal.getInstance().valueToString(obj, null, null,
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
+ + suffix(version, EdmPrimitiveTypeKind.Decimal)
+ : (obj instanceof Double)
+ ? EdmDouble.getInstance().valueToString(obj, null, null,
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
+ + suffix(version, EdmPrimitiveTypeKind.Double)
+ : (obj instanceof Float)
+ ? EdmSingle.getInstance().valueToString(obj, null, null,
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
+ + suffix(version, EdmPrimitiveTypeKind.Single)
+ : (obj instanceof Long)
+ ? EdmInt64.getInstance().valueToString(obj, null, null,
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
+ + suffix(version, EdmPrimitiveTypeKind.Int64)
+ : (obj instanceof Geospatial)
+ ? URLEncoder.encode(EdmPrimitiveTypeFactory.getInstance(((Geospatial) obj).getEdmPrimitiveTypeKind()).
+ valueToString(obj, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
+ Constants.UTF8)
+ : (obj instanceof String)
+ ? quoteString((String) obj, singleQuoteEscape)
+ : obj.toString();
+ }
} catch (Exception e) {
LOG.warn("While escaping '{}', using toString()", obj, e);
value = obj.toString();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3e53ac5b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/URIEscapeTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/URIEscapeTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/URIEscapeTest.java
new file mode 100644
index 0000000..886d1e8
--- /dev/null
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/URIEscapeTest.java
@@ -0,0 +1,79 @@
+/*
+ * 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.client.core.uri;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.util.Arrays;
+import java.util.Collections;
+import org.apache.olingo.client.core.edm.EdmEnumTypeImpl;
+import org.apache.olingo.client.core.edm.xml.v4.EnumTypeImpl;
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.edm.EdmEnumType;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.api.edm.geo.Point;
+import org.junit.Test;
+
+public class URIEscapeTest {
+
+ @Test
+ public void _null() {
+ assertEquals("null", URIUtils.escape(ODataServiceVersion.V40, null));
+ }
+
+ @Test
+ public void _boolean() {
+ assertEquals("true", URIUtils.escape(ODataServiceVersion.V40, Boolean.TRUE));
+ }
+
+ @Test
+ public void _enum() throws UnsupportedEncodingException {
+ final EdmEnumType pattern = new EdmEnumTypeImpl(ODataServiceVersion.V40,
+ null, new FullQualifiedName("Sales", "Pattern"), new EnumTypeImpl());
+
+ assertEquals(URLEncoder.encode("Sales.Pattern'Yellow'", Constants.UTF8),
+ URIUtils.escape(ODataServiceVersion.V40, pattern.toUriLiteral("Yellow")));
+ }
+
+ @Test
+ public void geospatial() throws UnsupportedEncodingException {
+ final Point point = new Point(Geospatial.Dimension.GEOGRAPHY, 0);
+ point.setX(142.1);
+ point.setY(64.1);
+
+ assertEquals(URLEncoder.encode("geography'SRID=0;Point(142.1 64.1)'", Constants.UTF8),
+ URIUtils.escape(ODataServiceVersion.V40, point));
+ }
+
+ @Test
+ public void collection() {
+ assertEquals("[\"red\",\"green\"]",
+ URIUtils.escape(ODataServiceVersion.V40, Arrays.asList(new String[] {"red", "green"})));
+ }
+
+ @Test
+ public void complex() {
+ assertEquals("{\"Name\":\"Value\"}",
+ URIUtils.escape(ODataServiceVersion.V40, Collections.singletonMap("Name", "Value")));
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3e53ac5b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v3/FilterFactoryTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v3/FilterFactoryTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v3/FilterFactoryTest.java
new file mode 100644
index 0000000..666edf7
--- /dev/null
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v3/FilterFactoryTest.java
@@ -0,0 +1,167 @@
+/*
+ * 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.client.core.uri.v3;
+
+import org.apache.olingo.client.api.v3.ODataClient;
+import org.apache.olingo.client.api.uri.URIFilter;
+import org.apache.olingo.client.api.uri.v3.FilterArgFactory;
+import org.apache.olingo.client.api.uri.v3.FilterFactory;
+import org.apache.olingo.client.core.AbstractTest;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class FilterFactoryTest extends AbstractTest {
+
+ @Override
+ protected ODataClient getClient() {
+ return v3Client;
+ }
+
+ private FilterFactory getFilterFactory() {
+ return getClient().getFilterFactory();
+ }
+
+ private FilterArgFactory getFilterArgFactory() {
+ return getFilterFactory().getArgFactory();
+ }
+
+ @Test
+ public void simple() {
+ final URIFilter filter = getFilterFactory().lt("VIN", 16);
+ assertEquals("(VIN lt 16)", filter.build());
+ }
+
+ @Test
+ public void _null() {
+ final URIFilter filter = getFilterFactory().eq(
+ getFilterArgFactory().property("NullValue"), getFilterArgFactory()._null());
+
+ assertEquals("(NullValue eq null)", filter.build());
+ }
+
+ @Test
+ public void and() {
+ final URIFilter filter = getFilterFactory().and(
+ getFilterFactory().lt("VIN", 16),
+ getFilterFactory().gt("VIN", 12));
+
+ assertEquals("((VIN lt 16) and (VIN gt 12))", filter.build());
+ }
+
+ @Test
+ public void not() {
+ final URIFilter filter = getFilterFactory().not(
+ getFilterFactory().or(
+ getFilterFactory().ge("VIN", 16),
+ getFilterFactory().le("VIN", 12)));
+
+ assertEquals("not (((VIN ge 16) or (VIN le 12)))", filter.build());
+ }
+
+ @Test
+ public void operator() {
+ URIFilter filter = getFilterFactory().eq(
+ getFilterArgFactory().add(
+ getFilterArgFactory().property("VIN"),
+ getFilterArgFactory().literal(1)),
+ getFilterArgFactory().literal(16));
+
+ assertEquals("((VIN add 1) eq 16)", filter.build());
+
+ filter = getFilterFactory().eq(
+ getFilterArgFactory().add(
+ getFilterArgFactory().literal(1),
+ getFilterArgFactory().property("VIN")),
+ getFilterArgFactory().literal(16));
+
+ assertEquals("((1 add VIN) eq 16)", filter.build());
+
+ filter = getFilterFactory().eq(
+ getFilterArgFactory().literal(16),
+ getFilterArgFactory().add(
+ getFilterArgFactory().literal(1),
+ getFilterArgFactory().property("VIN")));
+
+ assertEquals("(16 eq (1 add VIN))", filter.build());
+ }
+
+ @Test
+ public void function() {
+ final URIFilter filter = getFilterFactory().match(
+ getFilterArgFactory().startswith(
+ getFilterArgFactory().property("Description"),
+ getFilterArgFactory().literal("cen")));
+
+ assertEquals("startswith(Description,'cen')", filter.build());
+ }
+
+ @Test
+ public void composed() {
+ final URIFilter filter = getFilterFactory().gt(
+ getFilterArgFactory().length(
+ getFilterArgFactory().property("Description")),
+ getFilterArgFactory().add(
+ getFilterArgFactory().property("VIN"),
+ getFilterArgFactory().literal(10)));
+
+ assertEquals("(length(Description) gt (VIN add 10))", filter.build());
+ }
+
+ @Test
+ public void propertyPath() {
+ URIFilter filter = getFilterFactory().eq(
+ getFilterArgFactory().indexof(
+ getFilterArgFactory().property("PrimaryContactInfo/HomePhone/PhoneNumber"),
+ getFilterArgFactory().literal("ODataJClient")),
+ getFilterArgFactory().literal(1));
+
+ assertEquals("(indexof(PrimaryContactInfo/HomePhone/PhoneNumber,'ODataJClient') eq 1)", filter.build());
+
+ filter = getFilterFactory().ne(
+ getFilterArgFactory().indexof(
+ getFilterArgFactory().property("PrimaryContactInfo/HomePhone/PhoneNumber"),
+ getFilterArgFactory().literal("lccvussrv")),
+ getFilterArgFactory().literal(-1));
+
+ assertEquals("(indexof(PrimaryContactInfo/HomePhone/PhoneNumber,'lccvussrv') ne -1)", filter.build());
+ }
+
+ @Test
+ public void datetime() {
+ final URIFilter filter = getFilterFactory().eq(
+ getFilterArgFactory().month(
+ getFilterArgFactory().property("PurchaseDate")),
+ getFilterArgFactory().literal(12));
+
+ assertEquals("(month(PurchaseDate) eq 12)", filter.build());
+ }
+
+ @Test
+ public void isof() {
+ final URIFilter filter = getFilterFactory().match(
+ getFilterArgFactory().isof(
+ getFilterArgFactory().literal(
+ "Microsoft.Test.OData.Services.AstoriaDefaultService.SpecialEmployee")));
+
+ assertEquals("isof('Microsoft.Test.OData.Services.AstoriaDefaultService.SpecialEmployee')", filter.build());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3e53ac5b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v3/URIBuilderTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v3/URIBuilderTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v3/URIBuilderTest.java
new file mode 100644
index 0000000..78badef
--- /dev/null
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v3/URIBuilderTest.java
@@ -0,0 +1,131 @@
+/*
+ * 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.client.core.uri.v3;
+
+import static org.junit.Assert.assertEquals;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.olingo.client.api.v3.ODataClient;
+import org.apache.olingo.client.api.uri.v3.URIBuilder;
+import org.apache.olingo.client.core.AbstractTest;
+import org.junit.Test;
+
+public class URIBuilderTest extends AbstractTest {
+
+ private static final String SERVICE_ROOT = "http://host/service";
+
+ @Override
+ protected ODataClient getClient() {
+ return v3Client;
+ }
+
+ @Test
+ public void metadata() throws URISyntaxException {
+ final URI uri = getClient().getURIBuilder(SERVICE_ROOT).appendMetadataSegment().build();
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/$metadata").build(), uri);
+ }
+
+ @Test
+ public void entity() throws URISyntaxException {
+ final URI uri = getClient().getURIBuilder(SERVICE_ROOT).appendEntitySetSegment("AnEntitySet").
+ appendKeySegment(11).build();
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/AnEntitySet(11)").build(), uri);
+
+ final Map<String, Object> multiKey = new HashMap<String, Object>();
+ multiKey.put("OrderId", -10);
+ multiKey.put("ProductId", -10);
+ URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
+ appendEntitySetSegment("OrderLine").appendKeySegment(multiKey).
+ appendPropertySegment("Quantity").appendValueSegment();
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(
+ SERVICE_ROOT + "/OrderLine(OrderId=-10,ProductId=-10)/Quantity/$value").build(), uriBuilder.build());
+
+ uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
+ appendEntitySetSegment("Customer").appendKeySegment(-10).
+ select("CustomerId", "Name", "Orders").expand("Orders");
+ assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Customer(-10)").
+ addParameter("$select", "CustomerId,Name,Orders").addParameter("$expand", "Orders").build(),
+ uriBuilder.build());
+
+ uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
+ appendEntitySetSegment("Customer").appendKeySegment(-10).appendLinksSegment("Orders");
+ assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Customer(-10)/$links/Orders").build(),
+ uriBuilder.build());
+ }
+
+ @Test
+ public void count() throws URISyntaxException {
+ URI uri = getClient().getURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Products").count().build();
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Products/$count").build(), uri);
+
+ uri = getClient().getURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Products").
+ inlineCount(URIBuilder.InlineCount.allpages).build();
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Products").
+ addParameter("$inlinecount", "allpages").build(), uri);
+ }
+
+ @Test
+ public void filter() throws URISyntaxException {
+ final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).appendEntitySetSegment("AnEntitySet").
+ filter(getClient().getFilterFactory().lt("VIN", 16));
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/AnEntitySet").
+ addParameter("$filter", "(VIN lt 16)").build(),
+ uriBuilder.build());
+ }
+
+ @Test
+ public void unboundAction() throws URISyntaxException {
+ final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
+ appendOperationCallSegment("ProductsByCategoryId",
+ Collections.<String, Object>singletonMap("categoryId", 2));
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(
+ SERVICE_ROOT + "/ProductsByCategoryId(categoryId=2)").build(), uriBuilder.build());
+ }
+
+ @Test
+ public void boundAction() throws URISyntaxException {
+ final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
+ appendEntitySetSegment("Products").appendOperationCallSegment("MostExpensive", null);
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(
+ SERVICE_ROOT + "/Products/MostExpensive").build(), uriBuilder.build());
+ }
+
+ @Test
+ public void derived() throws URISyntaxException {
+ final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
+ appendEntitySetSegment("Customers").appendNavigationSegment("Model").
+ appendDerivedEntityTypeSegment("Namespace.VipCustomer").appendKeySegment(1);
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(
+ SERVICE_ROOT + "/Customers/Model/Namespace.VipCustomer(1)").build(), uriBuilder.build());
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3e53ac5b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v4/FilterFactoryTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v4/FilterFactoryTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v4/FilterFactoryTest.java
new file mode 100644
index 0000000..06a07e6
--- /dev/null
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v4/FilterFactoryTest.java
@@ -0,0 +1,86 @@
+/*
+ * 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.client.core.uri.v4;
+
+import org.apache.olingo.client.api.v4.ODataClient;
+import org.apache.olingo.client.api.uri.URIFilter;
+import org.apache.olingo.client.api.uri.v4.FilterArgFactory;
+import org.apache.olingo.client.api.uri.v4.FilterFactory;
+import org.apache.olingo.client.core.AbstractTest;
+import org.apache.olingo.client.core.edm.EdmEnumTypeImpl;
+import org.apache.olingo.client.core.edm.xml.v4.EnumTypeImpl;
+import org.apache.olingo.commons.api.edm.EdmEnumType;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class FilterFactoryTest extends AbstractTest {
+
+ @Override
+ protected ODataClient getClient() {
+ return v4Client;
+ }
+
+ private FilterFactory getFilterFactory() {
+ return getClient().getFilterFactory();
+ }
+
+ private FilterArgFactory getFilterArgFactory() {
+ return getFilterFactory().getArgFactory();
+ }
+
+ @Test
+ public void has() {
+ final EdmEnumType pattern = new EdmEnumTypeImpl(ODataServiceVersion.V40,
+ null, new FullQualifiedName("Sales", "Pattern"), new EnumTypeImpl());
+ final URIFilter filter = getFilterFactory().has(getFilterArgFactory().property("style"), pattern, "Yellow");
+
+ assertEquals("(style has Sales.Pattern'Yellow')", filter.build());
+ }
+
+ @Test
+ public void contains() {
+ final URIFilter filter = getFilterFactory().match(
+ getFilterArgFactory().contains(
+ getFilterArgFactory().property("CompanyName"), getFilterArgFactory().literal("Alfreds")));
+
+ assertEquals("contains(CompanyName,'Alfreds')", filter.build());
+ }
+
+ @Test
+ public void maxdatetime() {
+ final URIFilter filter = getFilterFactory().eq(
+ getFilterArgFactory().property("EndTime"),
+ getFilterArgFactory().maxdatetime());
+
+ assertEquals("(EndTime eq maxdatetime())", filter.build());
+ }
+
+ @Test
+ public void any() {
+ final URIFilter filter = getFilterFactory().match(
+ getFilterArgFactory().any(getFilterArgFactory().property("Items"),
+ getFilterFactory().gt("d:d/Quantity", 100)));
+
+ assertEquals("Items/any(d:d/Quantity gt 100)", filter.build());
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3e53ac5b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v4/URIBuilderTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v4/URIBuilderTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v4/URIBuilderTest.java
new file mode 100644
index 0000000..1518cf0
--- /dev/null
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v4/URIBuilderTest.java
@@ -0,0 +1,136 @@
+/*
+ * 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.client.core.uri.v4;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.apache.olingo.client.api.v4.ODataClient;
+import org.apache.olingo.client.api.uri.v4.URIBuilder;
+import org.apache.olingo.client.core.AbstractTest;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class URIBuilderTest extends AbstractTest {
+
+ private static final String SERVICE_ROOT = "http://host/service";
+
+ @Override
+ protected ODataClient getClient() {
+ return v4Client;
+ }
+
+ @Test
+ public void count() throws URISyntaxException {
+ URI uri = getClient().getURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Products").count().build();
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Products/$count").build(), uri);
+
+ uri = getClient().getURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Products").count(true).build();
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Products").
+ addParameter("$count", "true").build(), uri);
+ }
+
+ @Test
+ public void singleton() throws URISyntaxException {
+ final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
+ appendSingletonSegment("BestProductEverCreated");
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(
+ SERVICE_ROOT + "/BestProductEverCreated").build(), uriBuilder.build());
+ }
+
+ @Test
+ public void entityId() throws URISyntaxException {
+ final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
+ appendEntityIdSegment("Products(0)");
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(
+ SERVICE_ROOT + "/$entity").addParameter("$id", "Products(0)").build(), uriBuilder.build());
+ }
+
+ @Test
+ public void boundAction() throws URISyntaxException {
+ final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
+ appendEntitySetSegment("Categories").appendKeySegment(1).
+ appendNavigationSegment("Products").appendNavigationSegment("Model").
+ appendOperationCallSegment("AllOrders", null);
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(
+ SERVICE_ROOT + "/Categories(1)/Products/Model.AllOrders()").build(), uriBuilder.build());
+ }
+
+ @Test
+ public void ref() throws URISyntaxException {
+ URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
+ appendEntitySetSegment("Categories").appendKeySegment(1).
+ appendNavigationSegment("Products").appendRefSegment();
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(
+ SERVICE_ROOT + "/Categories(1)/Products/$ref").build(), uriBuilder.build());
+
+ uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
+ appendEntitySetSegment("Categories").appendKeySegment(1).
+ appendNavigationSegment("Products").appendRefSegment().id("../../Products(0)");
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(
+ SERVICE_ROOT + "/Categories(1)/Products/$ref").addParameter("$id", "../../Products(0)").build(),
+ uriBuilder.build());
+ }
+
+ @Test
+ public void derived() throws URISyntaxException {
+ final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
+ appendEntitySetSegment("Customers").appendNavigationSegment("Model").
+ appendDerivedEntityTypeSegment("VipCustomer").appendKeySegment(1);
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(
+ SERVICE_ROOT + "/Customers/Model.VipCustomer(1)").build(), uriBuilder.build());
+ }
+
+ @Test
+ public void crossjoin() throws URISyntaxException {
+ final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
+ appendCrossjoinSegment("Products", "Sales");
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(
+ SERVICE_ROOT + "/$crossjoin(Products,Sales)").build(), uriBuilder.build());
+ }
+
+ @Test
+ public void all() throws URISyntaxException {
+ final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).appendAllSegment();
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(
+ SERVICE_ROOT + "/$all").build(), uriBuilder.build());
+ }
+
+ @Test
+ public void search() throws URISyntaxException {
+ final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
+ appendEntitySetSegment("Products").search("blue OR green");
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(
+ SERVICE_ROOT + "/Products").addParameter("$search", "blue OR green").build(), uriBuilder.build());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3e53ac5b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/FilterFactoryTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/FilterFactoryTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/FilterFactoryTest.java
deleted file mode 100644
index 9d7e0a3..0000000
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/FilterFactoryTest.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * 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.client.core.v3;
-
-import org.apache.olingo.client.api.v3.ODataClient;
-import org.apache.olingo.client.api.uri.URIFilter;
-import org.apache.olingo.client.api.uri.v3.FilterArgFactory;
-import org.apache.olingo.client.api.uri.v3.FilterFactory;
-import org.apache.olingo.client.core.AbstractTest;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-public class FilterFactoryTest extends AbstractTest {
-
- @Override
- protected ODataClient getClient() {
- return v3Client;
- }
-
- private FilterFactory getFilterFactory() {
- return getClient().getFilterFactory();
- }
-
- private FilterArgFactory getFilterArgFactory() {
- return getFilterFactory().getArgFactory();
- }
-
- @Test
- public void simple() {
- final URIFilter filter = getFilterFactory().lt("VIN", 16);
- assertEquals("(VIN lt 16)", filter.build());
- }
-
- @Test
- public void _null() {
- final URIFilter filter = getFilterFactory().eq(
- getFilterArgFactory().property("NullValue"), getFilterArgFactory()._null());
-
- assertEquals("(NullValue eq null)", filter.build());
- }
-
- @Test
- public void and() {
- final URIFilter filter = getFilterFactory().and(
- getFilterFactory().lt("VIN", 16),
- getFilterFactory().gt("VIN", 12));
-
- assertEquals("((VIN lt 16) and (VIN gt 12))", filter.build());
- }
-
- @Test
- public void not() {
- final URIFilter filter = getFilterFactory().not(
- getFilterFactory().or(
- getFilterFactory().ge("VIN", 16),
- getFilterFactory().le("VIN", 12)));
-
- assertEquals("not (((VIN ge 16) or (VIN le 12)))", filter.build());
- }
-
- @Test
- public void operator() {
- URIFilter filter = getFilterFactory().eq(
- getFilterArgFactory().add(
- getFilterArgFactory().property("VIN"),
- getFilterArgFactory().literal(1)),
- getFilterArgFactory().literal(16));
-
- assertEquals("((VIN add 1) eq 16)", filter.build());
-
- filter = getFilterFactory().eq(
- getFilterArgFactory().add(
- getFilterArgFactory().literal(1),
- getFilterArgFactory().property("VIN")),
- getFilterArgFactory().literal(16));
-
- assertEquals("((1 add VIN) eq 16)", filter.build());
-
- filter = getFilterFactory().eq(
- getFilterArgFactory().literal(16),
- getFilterArgFactory().add(
- getFilterArgFactory().literal(1),
- getFilterArgFactory().property("VIN")));
-
- assertEquals("(16 eq (1 add VIN))", filter.build());
- }
-
- @Test
- public void function() {
- final URIFilter filter = getFilterFactory().match(
- getFilterArgFactory().startswith(
- getFilterArgFactory().property("Description"),
- getFilterArgFactory().literal("cen")));
-
- assertEquals("startswith(Description,'cen')", filter.build());
- }
-
- @Test
- public void composed() {
- final URIFilter filter = getFilterFactory().gt(
- getFilterArgFactory().length(
- getFilterArgFactory().property("Description")),
- getFilterArgFactory().add(
- getFilterArgFactory().property("VIN"),
- getFilterArgFactory().literal(10)));
-
- assertEquals("(length(Description) gt (VIN add 10))", filter.build());
- }
-
- @Test
- public void propertyPath() {
- URIFilter filter = getFilterFactory().eq(
- getFilterArgFactory().indexof(
- getFilterArgFactory().property("PrimaryContactInfo/HomePhone/PhoneNumber"),
- getFilterArgFactory().literal("ODataJClient")),
- getFilterArgFactory().literal(1));
-
- assertEquals("(indexof(PrimaryContactInfo/HomePhone/PhoneNumber,'ODataJClient') eq 1)", filter.build());
-
- filter = getFilterFactory().ne(
- getFilterArgFactory().indexof(
- getFilterArgFactory().property("PrimaryContactInfo/HomePhone/PhoneNumber"),
- getFilterArgFactory().literal("lccvussrv")),
- getFilterArgFactory().literal(-1));
-
- assertEquals("(indexof(PrimaryContactInfo/HomePhone/PhoneNumber,'lccvussrv') ne -1)", filter.build());
- }
-
- @Test
- public void datetime() {
- final URIFilter filter = getFilterFactory().eq(
- getFilterArgFactory().month(
- getFilterArgFactory().property("PurchaseDate")),
- getFilterArgFactory().literal(12));
-
- assertEquals("(month(PurchaseDate) eq 12)", filter.build());
- }
-
- @Test
- public void isof() {
- final URIFilter filter = getFilterFactory().match(
- getFilterArgFactory().isof(
- getFilterArgFactory().literal(
- "Microsoft.Test.OData.Services.AstoriaDefaultService.SpecialEmployee")));
-
- assertEquals("isof('Microsoft.Test.OData.Services.AstoriaDefaultService.SpecialEmployee')", filter.build());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3e53ac5b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/URIBuilderTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/URIBuilderTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/URIBuilderTest.java
deleted file mode 100644
index 1838cf8..0000000
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/URIBuilderTest.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * 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.client.core.v3;
-
-import static org.junit.Assert.assertEquals;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.olingo.client.api.v3.ODataClient;
-import org.apache.olingo.client.api.uri.v3.URIBuilder;
-import org.apache.olingo.client.core.AbstractTest;
-import org.junit.Test;
-
-public class URIBuilderTest extends AbstractTest {
-
- private static final String SERVICE_ROOT = "http://host/service";
-
- @Override
- protected ODataClient getClient() {
- return v3Client;
- }
-
- @Test
- public void metadata() throws URISyntaxException {
- final URI uri = getClient().getURIBuilder(SERVICE_ROOT).appendMetadataSegment().build();
-
- assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/$metadata").build(), uri);
- }
-
- @Test
- public void entity() throws URISyntaxException {
- final URI uri = getClient().getURIBuilder(SERVICE_ROOT).appendEntitySetSegment("AnEntitySet").
- appendKeySegment(11).build();
-
- assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/AnEntitySet(11)").build(), uri);
-
- final Map<String, Object> multiKey = new HashMap<String, Object>();
- multiKey.put("OrderId", -10);
- multiKey.put("ProductId", -10);
- URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
- appendEntitySetSegment("OrderLine").appendKeySegment(multiKey).
- appendPropertySegment("Quantity").appendValueSegment();
-
- assertEquals(new org.apache.http.client.utils.URIBuilder(
- SERVICE_ROOT + "/OrderLine(OrderId=-10,ProductId=-10)/Quantity/$value").build(), uriBuilder.build());
-
- uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
- appendEntitySetSegment("Customer").appendKeySegment(-10).
- select("CustomerId", "Name", "Orders").expand("Orders");
- assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Customer(-10)").
- addParameter("$select", "CustomerId,Name,Orders").addParameter("$expand", "Orders").build(),
- uriBuilder.build());
-
- uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
- appendEntitySetSegment("Customer").appendKeySegment(-10).appendLinksSegment("Orders");
- assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Customer(-10)/$links/Orders").build(),
- uriBuilder.build());
- }
-
- @Test
- public void count() throws URISyntaxException {
- URI uri = getClient().getURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Products").count().build();
-
- assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Products/$count").build(), uri);
-
- uri = getClient().getURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Products").
- inlineCount(URIBuilder.InlineCount.allpages).build();
-
- assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Products").
- addParameter("$inlinecount", "allpages").build(), uri);
- }
-
- @Test
- public void filter() throws URISyntaxException {
- final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).appendEntitySetSegment("AnEntitySet").
- filter(getClient().getFilterFactory().lt("VIN", 16));
-
- assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/AnEntitySet").
- addParameter("$filter", "(VIN lt 16)").build(),
- uriBuilder.build());
- }
-
- @Test
- public void unboundAction() throws URISyntaxException {
- final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
- appendOperationCallSegment("ProductsByCategoryId",
- Collections.<String, Object>singletonMap("categoryId", 2));
-
- assertEquals(new org.apache.http.client.utils.URIBuilder(
- SERVICE_ROOT + "/ProductsByCategoryId(categoryId=2)").build(), uriBuilder.build());
- }
-
- @Test
- public void boundAction() throws URISyntaxException {
- final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
- appendEntitySetSegment("Products").appendOperationCallSegment("MostExpensive", null);
-
- assertEquals(new org.apache.http.client.utils.URIBuilder(
- SERVICE_ROOT + "/Products/MostExpensive").build(), uriBuilder.build());
- }
-
- @Test
- public void derived() throws URISyntaxException {
- final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
- appendEntitySetSegment("Customers").appendNavigationSegment("Model").
- appendDerivedEntityTypeSegment("Namespace.VipCustomer").appendKeySegment(1);
-
- assertEquals(new org.apache.http.client.utils.URIBuilder(
- SERVICE_ROOT + "/Customers/Model/Namespace.VipCustomer(1)").build(), uriBuilder.build());
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3e53ac5b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/FilterFactoryTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/FilterFactoryTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/FilterFactoryTest.java
deleted file mode 100644
index fd2a696..0000000
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/FilterFactoryTest.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * 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.client.core.v4;
-
-import org.apache.olingo.client.api.v4.ODataClient;
-import org.apache.olingo.client.api.uri.URIFilter;
-import org.apache.olingo.client.api.uri.v4.FilterArgFactory;
-import org.apache.olingo.client.api.uri.v4.FilterFactory;
-import org.apache.olingo.client.core.AbstractTest;
-import org.apache.olingo.client.core.edm.EdmEnumTypeImpl;
-import org.apache.olingo.client.core.edm.xml.v4.EnumTypeImpl;
-import org.apache.olingo.commons.api.edm.EdmEnumType;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-public class FilterFactoryTest extends AbstractTest {
-
- @Override
- protected ODataClient getClient() {
- return v4Client;
- }
-
- private FilterFactory getFilterFactory() {
- return getClient().getFilterFactory();
- }
-
- private FilterArgFactory getFilterArgFactory() {
- return getFilterFactory().getArgFactory();
- }
-
- @Test
- public void has() {
- final EdmEnumType pattern = new EdmEnumTypeImpl(ODataServiceVersion.V40,
- null, new FullQualifiedName("Sales", "Pattern"), new EnumTypeImpl());
- final URIFilter filter = getFilterFactory().has(getFilterArgFactory().property("style"), pattern, "Yellow");
-
- assertEquals("(style has Sales.Pattern'Yellow')", filter.build());
- }
-
- @Test
- public void contains() {
- final URIFilter filter = getFilterFactory().match(
- getFilterArgFactory().contains(
- getFilterArgFactory().property("CompanyName"), getFilterArgFactory().literal("Alfreds")));
-
- assertEquals("contains(CompanyName,'Alfreds')", filter.build());
- }
-
- @Test
- public void maxdatetime() {
- final URIFilter filter = getFilterFactory().eq(
- getFilterArgFactory().property("EndTime"),
- getFilterArgFactory().maxdatetime());
-
- assertEquals("(EndTime eq maxdatetime())", filter.build());
- }
-
- @Test
- public void any() {
- final URIFilter filter = getFilterFactory().match(
- getFilterArgFactory().any(getFilterArgFactory().property("Items"),
- getFilterFactory().gt("d:d/Quantity", 100)));
-
- assertEquals("Items/any(d:d/Quantity gt 100)", filter.build());
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/3e53ac5b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/URIBuilderTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/URIBuilderTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/URIBuilderTest.java
deleted file mode 100644
index 868b363..0000000
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/URIBuilderTest.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * 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.client.core.v4;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-
-import org.apache.olingo.client.api.v4.ODataClient;
-import org.apache.olingo.client.api.uri.v4.URIBuilder;
-import org.apache.olingo.client.core.AbstractTest;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-public class URIBuilderTest extends AbstractTest {
-
- private static final String SERVICE_ROOT = "http://host/service";
-
- @Override
- protected ODataClient getClient() {
- return v4Client;
- }
-
- @Test
- public void count() throws URISyntaxException {
- URI uri = getClient().getURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Products").count().build();
-
- assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Products/$count").build(), uri);
-
- uri = getClient().getURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Products").count(true).build();
-
- assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Products").
- addParameter("$count", "true").build(), uri);
- }
-
- @Test
- public void singleton() throws URISyntaxException {
- final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
- appendSingletonSegment("BestProductEverCreated");
-
- assertEquals(new org.apache.http.client.utils.URIBuilder(
- SERVICE_ROOT + "/BestProductEverCreated").build(), uriBuilder.build());
- }
-
- @Test
- public void entityId() throws URISyntaxException {
- final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
- appendEntityIdSegment("Products(0)");
-
- assertEquals(new org.apache.http.client.utils.URIBuilder(
- SERVICE_ROOT + "/$entity").addParameter("$id", "Products(0)").build(), uriBuilder.build());
- }
-
- @Test
- public void boundAction() throws URISyntaxException {
- final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
- appendEntitySetSegment("Categories").appendKeySegment(1).
- appendNavigationSegment("Products").appendNavigationSegment("Model").
- appendOperationCallSegment("AllOrders", null);
-
- assertEquals(new org.apache.http.client.utils.URIBuilder(
- SERVICE_ROOT + "/Categories(1)/Products/Model.AllOrders()").build(), uriBuilder.build());
- }
-
- @Test
- public void ref() throws URISyntaxException {
- URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
- appendEntitySetSegment("Categories").appendKeySegment(1).
- appendNavigationSegment("Products").appendRefSegment();
-
- assertEquals(new org.apache.http.client.utils.URIBuilder(
- SERVICE_ROOT + "/Categories(1)/Products/$ref").build(), uriBuilder.build());
-
- uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
- appendEntitySetSegment("Categories").appendKeySegment(1).
- appendNavigationSegment("Products").appendRefSegment().id("../../Products(0)");
-
- assertEquals(new org.apache.http.client.utils.URIBuilder(
- SERVICE_ROOT + "/Categories(1)/Products/$ref").addParameter("$id", "../../Products(0)").build(),
- uriBuilder.build());
- }
-
- @Test
- public void derived() throws URISyntaxException {
- final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
- appendEntitySetSegment("Customers").appendNavigationSegment("Model").
- appendDerivedEntityTypeSegment("VipCustomer").appendKeySegment(1);
-
- assertEquals(new org.apache.http.client.utils.URIBuilder(
- SERVICE_ROOT + "/Customers/Model.VipCustomer(1)").build(), uriBuilder.build());
- }
-
- @Test
- public void crossjoin() throws URISyntaxException {
- final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
- appendCrossjoinSegment("Products", "Sales");
-
- assertEquals(new org.apache.http.client.utils.URIBuilder(
- SERVICE_ROOT + "/$crossjoin(Products,Sales)").build(), uriBuilder.build());
- }
-
- @Test
- public void all() throws URISyntaxException {
- final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).appendAllSegment();
-
- assertEquals(new org.apache.http.client.utils.URIBuilder(
- SERVICE_ROOT + "/$all").build(), uriBuilder.build());
- }
-
- @Test
- public void search() throws URISyntaxException {
- final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
- appendEntitySetSegment("Products").search("blue OR green");
-
- assertEquals(new org.apache.http.client.utils.URIBuilder(
- SERVICE_ROOT + "/Products").addParameter("$search", "blue OR green").build(), uriBuilder.build());
- }
-
-}
[09/51] [abbrv] git commit: Merge branch 'olingo200' of
https://git-wip-us.apache.org/repos/asf/olingo-odata4 into olingo200
Posted by il...@apache.org.
Merge branch 'olingo200' of https://git-wip-us.apache.org/repos/asf/olingo-odata4 into olingo200
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/fc2881fe
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/fc2881fe
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/fc2881fe
Branch: refs/heads/master
Commit: fc2881fe397de7537bda35a717262f825d417be3
Parents: 2f77689 59d54d8
Author: fmartelli <fa...@gmail.com>
Authored: Wed Mar 26 18:26:30 2014 +0100
Committer: fmartelli <fa...@gmail.com>
Committed: Wed Mar 26 18:26:30 2014 +0100
----------------------------------------------------------------------
.../olingo/client/api/CommonODataClient.java | 3 -
.../olingo/client/core/AbstractODataClient.java | 8 +-
.../cud/ODataValueUpdateRequestImpl.java | 2 +-
.../request/invoke/ODataInvokeRequestImpl.java | 2 +-
.../request/retrieve/ODataValueRequestImpl.java | 2 +-
.../core/domain/ODataGeospatialValueImpl.java | 130 -----
.../core/domain/ODataPrimitiveValueImpl.java | 177 ------
.../olingo/client/core/edm/EdmEnumTypeImpl.java | 4 +-
.../client/core/edm/EdmTypeDefinitionImpl.java | 2 +-
.../client/core/op/AbstractODataBinder.java | 39 +-
.../apache/olingo/client/core/uri/URIUtils.java | 161 ++++--
.../client/core/AbstractPrimitiveTest.java | 62 +--
.../apache/olingo/client/core/AbstractTest.java | 8 -
.../client/core/it/v3/OpenTypeTestITCase.java | 14 +-
.../olingo/client/core/uri/URIEscapeTest.java | 79 +++
.../client/core/uri/v3/FilterFactoryTest.java | 167 ++++++
.../client/core/uri/v3/URIBuilderTest.java | 149 +++++
.../client/core/uri/v4/FilterFactoryTest.java | 86 +++
.../client/core/uri/v4/URIBuilderTest.java | 152 ++++++
.../olingo/client/core/v3/EntityTest.java | 17 +-
.../client/core/v3/FilterFactoryTest.java | 167 ------
.../olingo/client/core/v3/MetadataTest.java | 4 +-
.../client/core/v3/PrimitiveValueTest.java | 77 ++-
.../olingo/client/core/v3/URIBuilderTest.java | 149 -----
.../client/core/v4/FilterFactoryTest.java | 86 ---
.../olingo/client/core/v4/MetadataTest.java | 4 +-
.../olingo/client/core/v4/URIBuilderTest.java | 152 ------
.../olingo/commons/api/data/GeoUtils.java | 9 +-
.../commons/api/domain/AbstractODataValue.java | 20 -
.../api/domain/ODataGeospatialValue.java | 57 --
.../commons/api/domain/ODataObjectFactory.java | 9 -
.../commons/api/domain/ODataProperty.java | 18 -
.../olingo/commons/api/domain/ODataValue.java | 14 -
.../commons/api/edm/EdmGeospatialType.java | 34 --
.../commons/api/edm/geo/ComposedGeospatial.java | 22 +-
.../olingo/commons/api/edm/geo/Geospatial.java | 36 +-
.../api/edm/geo/GeospatialCollection.java | 15 +-
.../olingo/commons/api/edm/geo/LineString.java | 4 +-
.../commons/api/edm/geo/MultiLineString.java | 8 +-
.../olingo/commons/api/edm/geo/MultiPoint.java | 4 +-
.../commons/api/edm/geo/MultiPolygon.java | 8 +-
.../olingo/commons/api/edm/geo/Point.java | 8 +-
.../olingo/commons/api/edm/geo/Polygon.java | 18 +-
.../core/data/AtomGeoValueDeserializer.java | 46 +-
.../core/data/AtomGeoValueSerializer.java | 4 +-
.../core/data/JSONGeoValueDeserializer.java | 73 ++-
.../core/data/JSONGeoValueSerializer.java | 8 +-
.../core/domain/ODataPrimitiveValueImpl.java | 171 ++++++
.../commons/core/edm/AbstractEdmParameter.java | 2 +-
.../AbstractEdmGeospatialType.java | 76 ---
.../primitivetype/AbstractGeospatialType.java | 539 +++++++++++++++++++
.../core/edm/primitivetype/EdmGeography.java | 19 +-
.../primitivetype/EdmGeographyCollection.java | 33 +-
.../primitivetype/EdmGeographyLineString.java | 32 +-
.../EdmGeographyMultiLineString.java | 33 +-
.../primitivetype/EdmGeographyMultiPoint.java | 33 +-
.../primitivetype/EdmGeographyMultiPolygon.java | 32 +-
.../edm/primitivetype/EdmGeographyPoint.java | 29 +-
.../edm/primitivetype/EdmGeographyPolygon.java | 32 +-
.../core/edm/primitivetype/EdmGeometry.java | 19 +-
.../primitivetype/EdmGeometryCollection.java | 32 +-
.../primitivetype/EdmGeometryLineString.java | 32 +-
.../EdmGeometryMultiLineString.java | 33 +-
.../primitivetype/EdmGeometryMultiPoint.java | 33 +-
.../primitivetype/EdmGeometryMultiPolygon.java | 33 +-
.../edm/primitivetype/EdmGeometryPoint.java | 28 +-
.../edm/primitivetype/EdmGeometryPolygon.java | 32 +-
.../primitivetype/EdmPrimitiveTypeFactory.java | 31 +-
.../commons/core/edm/primitivetype/EdmTime.java | 5 +
.../commons/core/op/ODataObjectFactoryImpl.java | 6 -
.../primitivetype/CommonPrimitiveTypeTest.java | 170 +++---
.../core/edm/primitivetype/EdmBinaryTest.java | 2 +-
.../core/edm/primitivetype/EdmBooleanTest.java | 2 +-
.../core/edm/primitivetype/EdmByteTest.java | 2 +-
.../core/edm/primitivetype/EdmDateTest.java | 2 +-
.../primitivetype/EdmDateTimeOffsetTest.java | 2 +-
.../core/edm/primitivetype/EdmDecimalTest.java | 16 +-
.../core/edm/primitivetype/EdmDoubleTest.java | 14 +-
.../core/edm/primitivetype/EdmDurationTest.java | 2 +-
.../core/edm/primitivetype/EdmGeoTest.java | 174 ++++++
.../core/edm/primitivetype/EdmGuidTest.java | 2 +-
.../core/edm/primitivetype/EdmInt16Test.java | 6 +-
.../core/edm/primitivetype/EdmInt32Test.java | 8 +-
.../core/edm/primitivetype/EdmInt64Test.java | 10 +-
.../core/edm/primitivetype/EdmNullTest.java | 20 +-
.../core/edm/primitivetype/EdmSByteTest.java | 2 +-
.../core/edm/primitivetype/EdmSingleTest.java | 12 +-
.../core/edm/primitivetype/EdmStringTest.java | 2 +-
.../edm/primitivetype/EdmTimeOfDayTest.java | 2 +-
.../core/edm/primitivetype/UInt7Test.java | 2 +-
.../core/edm/provider/EdmEnumTypeImpl.java | 4 +-
.../edm/provider/EdmTypeDefinitionImpl.java | 2 +-
.../core/uri/parser/UriParseTreeVisitor.java | 6 +-
.../server/core/edm/provider/EdmEnumTest.java | 2 +-
.../edm/provider/EdmFunctionImportImplTest.java | 2 +-
.../edm/provider/EdmReturnTypeImplTest.java | 4 +-
.../edm/provider/EdmTypeDefinitionImplTest.java | 2 +-
.../server/core/uri/UriResourceImplTest.java | 4 +-
98 files changed, 2417 insertions(+), 1694 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fc2881fe/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java
----------------------------------------------------------------------
[18/51] [abbrv] git commit: Unused import
Posted by il...@apache.org.
Unused import
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/96b7a175
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/96b7a175
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/96b7a175
Branch: refs/heads/master
Commit: 96b7a1757ce9ba76074cb94d2674b112e53f677f
Parents: 3c4d7d1
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Fri Mar 28 17:37:02 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Fri Mar 28 17:37:02 2014 +0100
----------------------------------------------------------------------
.../main/java/org/apache/olingo/client/api/uri/v4/URIBuilder.java | 1 -
1 file changed, 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/96b7a175/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v4/URIBuilder.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v4/URIBuilder.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v4/URIBuilder.java
index 5f06a32..9985ce8 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v4/URIBuilder.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v4/URIBuilder.java
@@ -20,7 +20,6 @@ package org.apache.olingo.client.api.uri.v4;
import java.util.Map;
import org.apache.commons.lang3.tuple.Pair;
-import org.apache.olingo.client.api.uri.QueryOption;
import org.apache.olingo.commons.api.edm.EdmEnumType;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
[03/51] [abbrv] git commit: [OLINGO-194] geospatial literals
Posted by il...@apache.org.
[OLINGO-194] geospatial literals
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/76513508
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/76513508
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/76513508
Branch: refs/heads/master
Commit: 7651350846cca10d3a03655d95da4acdb8ee8af5
Parents: c1b8976
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Wed Mar 26 16:44:36 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Wed Mar 26 16:44:36 2014 +0100
----------------------------------------------------------------------
.../olingo/client/api/CommonODataClient.java | 3 -
.../olingo/client/core/AbstractODataClient.java | 8 +-
.../cud/ODataValueUpdateRequestImpl.java | 2 +-
.../request/retrieve/ODataValueRequestImpl.java | 2 +-
.../core/domain/ODataGeospatialValueImpl.java | 130 -----
.../core/domain/ODataPrimitiveValueImpl.java | 177 ------
.../olingo/client/core/edm/EdmEnumTypeImpl.java | 4 +-
.../client/core/edm/EdmTypeDefinitionImpl.java | 2 +-
.../client/core/op/AbstractODataBinder.java | 31 +-
.../apache/olingo/client/core/uri/URIUtils.java | 42 +-
.../client/core/AbstractPrimitiveTest.java | 62 +--
.../client/core/it/v3/OpenTypeTestITCase.java | 14 +-
.../olingo/client/core/v3/EntityTest.java | 17 +-
.../olingo/client/core/v3/MetadataTest.java | 4 +-
.../client/core/v3/PrimitiveValueTest.java | 77 ++-
.../olingo/client/core/v4/MetadataTest.java | 4 +-
.../olingo/commons/api/data/GeoUtils.java | 9 +-
.../commons/api/domain/AbstractODataValue.java | 20 -
.../api/domain/ODataGeospatialValue.java | 57 --
.../commons/api/domain/ODataObjectFactory.java | 9 -
.../commons/api/domain/ODataProperty.java | 18 -
.../olingo/commons/api/domain/ODataValue.java | 14 -
.../commons/api/edm/EdmGeospatialType.java | 34 --
.../commons/api/edm/geo/ComposedGeospatial.java | 22 +-
.../olingo/commons/api/edm/geo/Geospatial.java | 36 +-
.../api/edm/geo/GeospatialCollection.java | 15 +-
.../olingo/commons/api/edm/geo/LineString.java | 4 +-
.../commons/api/edm/geo/MultiLineString.java | 8 +-
.../olingo/commons/api/edm/geo/MultiPoint.java | 4 +-
.../commons/api/edm/geo/MultiPolygon.java | 8 +-
.../olingo/commons/api/edm/geo/Point.java | 8 +-
.../olingo/commons/api/edm/geo/Polygon.java | 18 +-
.../core/data/AtomGeoValueDeserializer.java | 46 +-
.../core/data/AtomGeoValueSerializer.java | 4 +-
.../core/data/JSONGeoValueDeserializer.java | 73 ++-
.../core/data/JSONGeoValueSerializer.java | 8 +-
.../core/domain/ODataPrimitiveValueImpl.java | 171 ++++++
.../commons/core/edm/AbstractEdmParameter.java | 2 +-
.../AbstractEdmGeospatialType.java | 76 ---
.../primitivetype/AbstractGeospatialType.java | 539 +++++++++++++++++++
.../core/edm/primitivetype/EdmGeography.java | 19 +-
.../primitivetype/EdmGeographyCollection.java | 33 +-
.../primitivetype/EdmGeographyLineString.java | 32 +-
.../EdmGeographyMultiLineString.java | 33 +-
.../primitivetype/EdmGeographyMultiPoint.java | 33 +-
.../primitivetype/EdmGeographyMultiPolygon.java | 32 +-
.../edm/primitivetype/EdmGeographyPoint.java | 29 +-
.../edm/primitivetype/EdmGeographyPolygon.java | 32 +-
.../core/edm/primitivetype/EdmGeometry.java | 19 +-
.../primitivetype/EdmGeometryCollection.java | 32 +-
.../primitivetype/EdmGeometryLineString.java | 32 +-
.../EdmGeometryMultiLineString.java | 33 +-
.../primitivetype/EdmGeometryMultiPoint.java | 33 +-
.../primitivetype/EdmGeometryMultiPolygon.java | 33 +-
.../edm/primitivetype/EdmGeometryPoint.java | 28 +-
.../edm/primitivetype/EdmGeometryPolygon.java | 32 +-
.../primitivetype/EdmPrimitiveTypeFactory.java | 31 +-
.../commons/core/edm/primitivetype/EdmTime.java | 5 +
.../commons/core/op/ODataObjectFactoryImpl.java | 6 -
.../primitivetype/CommonPrimitiveTypeTest.java | 170 +++---
.../core/edm/primitivetype/EdmBinaryTest.java | 2 +-
.../core/edm/primitivetype/EdmBooleanTest.java | 2 +-
.../core/edm/primitivetype/EdmByteTest.java | 2 +-
.../core/edm/primitivetype/EdmDateTest.java | 2 +-
.../primitivetype/EdmDateTimeOffsetTest.java | 2 +-
.../core/edm/primitivetype/EdmDecimalTest.java | 16 +-
.../core/edm/primitivetype/EdmDoubleTest.java | 14 +-
.../core/edm/primitivetype/EdmDurationTest.java | 2 +-
.../core/edm/primitivetype/EdmGeoTest.java | 174 ++++++
.../core/edm/primitivetype/EdmGuidTest.java | 2 +-
.../core/edm/primitivetype/EdmInt16Test.java | 6 +-
.../core/edm/primitivetype/EdmInt32Test.java | 8 +-
.../core/edm/primitivetype/EdmInt64Test.java | 10 +-
.../core/edm/primitivetype/EdmNullTest.java | 20 +-
.../core/edm/primitivetype/EdmSByteTest.java | 2 +-
.../core/edm/primitivetype/EdmSingleTest.java | 12 +-
.../core/edm/primitivetype/EdmStringTest.java | 2 +-
.../edm/primitivetype/EdmTimeOfDayTest.java | 2 +-
.../core/edm/primitivetype/UInt7Test.java | 2 +-
.../core/edm/provider/EdmEnumTypeImpl.java | 4 +-
.../edm/provider/EdmTypeDefinitionImpl.java | 2 +-
.../core/uri/parser/UriParseTreeVisitor.java | 6 +-
.../server/core/edm/provider/EdmEnumTest.java | 2 +-
.../edm/provider/EdmFunctionImportImplTest.java | 2 +-
.../edm/provider/EdmReturnTypeImplTest.java | 4 +-
.../edm/provider/EdmTypeDefinitionImplTest.java | 2 +-
.../server/core/uri/UriResourceImplTest.java | 4 +-
87 files changed, 1692 insertions(+), 1095 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
index e863d0d..e811744 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
@@ -26,7 +26,6 @@ import org.apache.olingo.client.api.communication.request.retrieve.CommonRetriev
import org.apache.olingo.client.api.communication.request.streamed.CommonStreamedRequestFactory;
import org.apache.olingo.client.api.op.ClientODataDeserializer;
import org.apache.olingo.commons.api.domain.ODataObjectFactory;
-import org.apache.olingo.commons.api.domain.ODataGeospatialValue;
import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
import org.apache.olingo.client.api.op.CommonODataBinder;
import org.apache.olingo.client.api.op.CommonODataReader;
@@ -50,8 +49,6 @@ public interface CommonODataClient {
ODataPrimitiveValue.Builder getPrimitiveValueBuilder();
- ODataGeospatialValue.Builder getGeospatialValueBuilder();
-
ODataSerializer getSerializer();
ClientODataDeserializer getDeserializer();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
index 4197094..80c8d16 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
@@ -21,8 +21,7 @@ package org.apache.olingo.client.core;
import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.commons.api.domain.ODataObjectFactory;
import org.apache.olingo.client.api.op.ODataWriter;
-import org.apache.olingo.client.core.domain.ODataGeospatialValueImpl;
-import org.apache.olingo.client.core.domain.ODataPrimitiveValueImpl;
+import org.apache.olingo.commons.core.domain.ODataPrimitiveValueImpl;
import org.apache.olingo.commons.core.op.ODataObjectFactoryImpl;
import org.apache.olingo.client.core.op.ODataWriterImpl;
@@ -40,11 +39,6 @@ public abstract class AbstractODataClient implements CommonODataClient {
}
@Override
- public ODataGeospatialValueImpl.BuilderImpl getGeospatialValueBuilder() {
- return new ODataGeospatialValueImpl.BuilderImpl();
- }
-
- @Override
public ODataWriter getWriter() {
return writer;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java
index d424d62..5876f49 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java
@@ -35,7 +35,7 @@ import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
-import org.apache.olingo.client.core.domain.ODataPrimitiveValueImpl;
+import org.apache.olingo.commons.core.domain.ODataPrimitiveValueImpl;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
/**
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java
index 345bc58..2d7feed 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java
@@ -28,7 +28,7 @@ import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse
import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
import org.apache.olingo.commons.api.format.ODataValueFormat;
import org.apache.olingo.client.api.http.HttpClientException;
-import org.apache.olingo.client.core.domain.ODataPrimitiveValueImpl;
+import org.apache.olingo.commons.core.domain.ODataPrimitiveValueImpl;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
/**
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataGeospatialValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataGeospatialValueImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataGeospatialValueImpl.java
deleted file mode 100644
index daa63a3..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataGeospatialValueImpl.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * 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.client.core.domain;
-
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.apache.olingo.commons.api.domain.AbstractODataValue;
-import org.apache.olingo.commons.api.domain.ODataGeospatialValue;
-import org.apache.olingo.commons.api.edm.EdmGeospatialType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.geo.Geospatial;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
-
-public class ODataGeospatialValueImpl extends AbstractODataValue implements ODataGeospatialValue {
-
- private static final long serialVersionUID = 8277433906326348952L;
-
- public static class BuilderImpl implements Builder {
-
- private final ODataGeospatialValueImpl instance;
-
- public BuilderImpl() {
- this.instance = new ODataGeospatialValueImpl();
- }
-
- @Override
- public BuilderImpl setType(final EdmPrimitiveTypeKind type) {
- if (type != null && !type.isGeospatial()) {
- throw new IllegalArgumentException("Don't use this for non-geospatial types");
- }
- if (type == EdmPrimitiveTypeKind.Geography || type == EdmPrimitiveTypeKind.Geometry) {
- throw new IllegalArgumentException(
- type + "is not an instantiable type. "
- + "An entity can declare a property to be of type Geometry. "
- + "An instance of an entity MUST NOT have a value of type Geometry. "
- + "Each value MUST be of some subtype.");
- }
-
- if (type != null) {
- this.instance.typeKind = type;
- this.instance.type = EdmPrimitiveTypeFactory.getGeoInstance(type);
- }
-
- return this;
- }
-
- @Override
- public BuilderImpl setValue(final Geospatial value) {
- this.instance.value = value;
- if (value != null) {
- setType(value.getEdmPrimitiveTypeKind());
- }
- return this;
- }
-
- @Override
- public ODataGeospatialValueImpl build() {
- if (this.instance.type == null) {
- throw new IllegalArgumentException("Must provide geospatial type");
- }
- if (this.instance.value == null) {
- throw new IllegalArgumentException("Must provide geospatial value");
- }
-
- return this.instance;
- }
- }
-
- /**
- * Type kind.
- */
- private EdmPrimitiveTypeKind typeKind;
-
- /**
- * Type.
- */
- private EdmGeospatialType type;
-
- /**
- * Value.
- */
- private Geospatial value;
-
- @Override
- public EdmPrimitiveTypeKind getTypeKind() {
- return typeKind;
- }
-
- @Override
- public EdmGeospatialType getType() {
- return type;
- }
-
- @Override
- public Geospatial toValue() {
- return value;
- }
-
- @Override
- public <T extends Geospatial> T toCastValue(final Class<T> reference) {
- return reference.cast(this.value);
- }
-
- @Override
- public int hashCode() {
- return HashCodeBuilder.reflectionHashCode(this);
- }
-
- @Override
- public boolean equals(final Object obj) {
- return EqualsBuilder.reflectionEquals(this, obj);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataPrimitiveValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataPrimitiveValueImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataPrimitiveValueImpl.java
deleted file mode 100644
index a15dd76..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/domain/ODataPrimitiveValueImpl.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * 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.client.core.domain;
-
-import java.sql.Timestamp;
-import java.util.Calendar;
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.domain.AbstractODataValue;
-import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
-
-public class ODataPrimitiveValueImpl extends AbstractODataValue implements ODataPrimitiveValue {
-
- private static final long serialVersionUID = 8889282662298376036L;
-
- public static class BuilderImpl implements Builder {
-
- private final ODataServiceVersion version;
-
- private final ODataPrimitiveValueImpl instance;
-
- public BuilderImpl(final ODataServiceVersion version) {
- this.version = version;
- this.instance = new ODataPrimitiveValueImpl();
- }
-
- @Override
- public BuilderImpl setType(final EdmPrimitiveTypeKind type) {
- if (type != null && !type.getSupportedVersions().contains(version)) {
- throw new IllegalArgumentException(String.format(
- "Type %s not supported by OData version %s", type.toString(), version));
- }
- if (type == EdmPrimitiveTypeKind.Stream) {
- throw new IllegalArgumentException(String.format(
- "Cannot build a primitive value for %s", EdmPrimitiveTypeKind.Stream.toString()));
- }
- if (type != null && type.isGeospatial()) {
- throw new IllegalArgumentException("Don't use this for geospatial types");
- }
-
- this.instance.typeKind = type == null ? EdmPrimitiveTypeKind.String : type;
- this.instance.type = EdmPrimitiveTypeFactory.getNonGeoInstance(this.instance.typeKind);
-
- return this;
- }
-
- @Override
- public BuilderImpl setText(final String text) {
- this.instance.text = text;
- return this;
- }
-
- @Override
- public BuilderImpl setValue(final Object value) {
- this.instance.value = value;
- return this;
- }
-
- @Override
- public ODataPrimitiveValueImpl build() {
- if (this.instance.text == null && this.instance.value == null) {
- throw new IllegalArgumentException("Must provide either text or value");
- }
- if (this.instance.text != null && this.instance.value != null) {
- throw new IllegalArgumentException("Cannot provide both text and value");
- }
-
- if (this.instance.type == null) {
- setType(EdmPrimitiveTypeKind.String);
- }
-
- if (this.instance.text != null) {
- final Class<?> returnType = this.instance.type.getDefaultType().isAssignableFrom(Calendar.class)
- ? Timestamp.class : this.instance.type.getDefaultType();
- try {
- // TODO: when Edm is available, set facets when calling this method
- this.instance.value = this.instance.type.valueOfString(
- this.instance.text, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null,
- returnType);
- } catch (EdmPrimitiveTypeException e) {
- throw new IllegalArgumentException(e);
- }
- }
- if (this.instance.value != null) {
- try {
- // TODO: when Edm is available, set facets when calling this method
- this.instance.text = this.instance.type.valueToString(
- this.instance.value, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null);
- } catch (EdmPrimitiveTypeException e) {
- throw new IllegalArgumentException(e);
- }
- }
-
- return this.instance;
- }
- }
-
- /**
- * Type kind.
- */
- private EdmPrimitiveTypeKind typeKind;
-
- /**
- * Type.
- */
- private EdmPrimitiveType type;
-
- /**
- * Text value.
- */
- private String text;
-
- /**
- * Actual value.
- */
- private Object value;
-
- @Override
- public EdmPrimitiveTypeKind getTypeKind() {
- return typeKind;
- }
-
- @Override
- public EdmPrimitiveType getType() {
- return type;
- }
-
- @Override
- public Object toValue() {
- return this.value;
- }
-
- @Override
- public <T> T toCastValue(final Class<T> reference) throws EdmPrimitiveTypeException {
- // TODO: when Edm is available, set facets when calling this method
- return type.valueOfString(this.text, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null,
- reference);
- }
-
- @Override
- public String toString() {
- return this.text;
- }
-
- @Override
- public int hashCode() {
- return HashCodeBuilder.reflectionHashCode(this);
- }
-
- @Override
- public boolean equals(final Object obj) {
- return EqualsBuilder.reflectionEquals(this, obj);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEnumTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEnumTypeImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEnumTypeImpl.java
index 05cfa27..bba016b 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEnumTypeImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmEnumTypeImpl.java
@@ -62,9 +62,9 @@ public class EdmEnumTypeImpl extends AbstractEdmEnumType implements EdmEnumType
super(edm, fqn, xmlEnumType.isFlags());
if (xmlEnumType.getUnderlyingType() == null) {
- this.underlyingType = EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32);
+ this.underlyingType = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int32);
} else {
- this.underlyingType = EdmPrimitiveTypeFactory.getNonGeoInstance(
+ this.underlyingType = EdmPrimitiveTypeFactory.getInstance(
EdmPrimitiveTypeKind.valueOfFQN(version, xmlEnumType.getUnderlyingType()));
if (!ArrayUtils.contains(VALID_UNDERLYING_TYPES, this.underlyingType.getKind())) {
throw new EdmException("Not allowed as underlying type: " + this.underlyingType.getKind());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeDefinitionImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeDefinitionImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeDefinitionImpl.java
index 199d61e..3c146ec 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeDefinitionImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/EdmTypeDefinitionImpl.java
@@ -41,7 +41,7 @@ public class EdmTypeDefinitionImpl extends AbstractEdmTypeDefinition implements
super(edm, typeDefinitionName);
this.typeDefinition = typeDefinition;
try {
- this.edmPrimitiveTypeInstance = EdmPrimitiveTypeFactory.getNonGeoInstance(
+ this.edmPrimitiveTypeInstance = EdmPrimitiveTypeFactory.getInstance(
EdmPrimitiveTypeKind.valueOfFQN(version, typeDefinition.getUnderlyingType()));
} catch (IllegalArgumentException e) {
throw new EdmException("Invalid underlying type: " + typeDefinition.getUnderlyingType(), e);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
index 44e7ad4..746b016 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
@@ -18,19 +18,20 @@
*/
package org.apache.olingo.client.core.op;
-import org.apache.olingo.commons.core.op.ResourceFactory;
import java.io.StringWriter;
import java.net.URI;
import java.util.Iterator;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.CommonODataClient;
+import org.apache.olingo.client.api.data.ServiceDocument;
+import org.apache.olingo.client.api.data.ServiceDocumentItem;
+import org.apache.olingo.client.api.op.CommonODataBinder;
+import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.data.Entry;
import org.apache.olingo.commons.api.data.Feed;
import org.apache.olingo.commons.api.data.Link;
import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.client.api.data.ServiceDocument;
-import org.apache.olingo.client.api.data.ServiceDocumentItem;
import org.apache.olingo.commons.api.data.Value;
import org.apache.olingo.commons.api.domain.ODataCollectionValue;
import org.apache.olingo.commons.api.domain.ODataComplexValue;
@@ -43,8 +44,9 @@ import org.apache.olingo.commons.api.domain.ODataOperation;
import org.apache.olingo.commons.api.domain.ODataProperty;
import org.apache.olingo.commons.api.domain.ODataServiceDocument;
import org.apache.olingo.commons.api.domain.ODataValue;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
import org.apache.olingo.commons.api.format.ODataPubFormat;
-import org.apache.olingo.client.api.op.CommonODataBinder;
import org.apache.olingo.commons.core.data.CollectionValueImpl;
import org.apache.olingo.commons.core.data.ComplexValueImpl;
import org.apache.olingo.commons.core.data.GeospatialValueImpl;
@@ -52,8 +54,7 @@ import org.apache.olingo.commons.core.data.JSONPropertyImpl;
import org.apache.olingo.commons.core.data.LinkImpl;
import org.apache.olingo.commons.core.data.NullValueImpl;
import org.apache.olingo.commons.core.data.PrimitiveValueImpl;
-import org.apache.olingo.client.core.uri.URIUtils;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.core.op.ResourceFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -232,9 +233,9 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
if (value == null) {
valueResource = new NullValueImpl();
} else if (value.isPrimitive()) {
- valueResource = new PrimitiveValueImpl(value.asPrimitive().toString());
- } else if (value.isGeospatial()) {
- valueResource = new GeospatialValueImpl(value.asGeospatial().toValue());
+ valueResource = value.asPrimitive().getTypeKind().isGeospatial()
+ ? new GeospatialValueImpl((Geospatial) value.asPrimitive().toValue())
+ : new PrimitiveValueImpl(value.asPrimitive().toString());
} else if (value.isComplex()) {
final ODataComplexValue _value = value.asComplex();
valueResource = new ComplexValueImpl();
@@ -269,7 +270,7 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
}
final URI base = defaultBaseURI == null ? resource.getBaseURI() : defaultBaseURI;
-
+
final URI next = resource.getNext();
final ODataEntitySet entitySet = next == null
@@ -283,7 +284,7 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
for (Entry entryResource : resource.getEntries()) {
entitySet.addEntity(getODataEntity(entryResource));
}
-
+
return entitySet;
}
@@ -311,11 +312,11 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
if (StringUtils.isNotBlank(resource.getETag())) {
entity.setETag(resource.getETag());
}
-
+
if (resource.getEditLink() != null) {
entity.setEditLink(URIUtils.getURI(base, resource.getEditLink().getHref()));
}
-
+
for (Link link : resource.getAssociationLinks()) {
entity.addLink(client.getObjectFactory().newAssociationLink(link.getTitle(), base, link.getHref()));
}
@@ -377,12 +378,12 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
? null
: EdmPrimitiveTypeKind.valueOfFQN(client.getServiceVersion(), resource.getType())).build();
} else if (resource.getValue().isGeospatial()) {
- value = client.getGeospatialValueBuilder().
+ value = client.getPrimitiveValueBuilder().
setValue(resource.getValue().asGeospatial().get()).
setType(resource.getType() == null
|| EdmPrimitiveTypeKind.Geography.getFullQualifiedName().toString().equals(resource.getType())
|| EdmPrimitiveTypeKind.Geometry.getFullQualifiedName().toString().equals(resource.getType())
- ? null
+ ? resource.getValue().asGeospatial().get().getEdmPrimitiveTypeKind()
: EdmPrimitiveTypeKind.valueOfFQN(client.getServiceVersion(), resource.getType())).build();
} else if (resource.getValue().isComplex()) {
value = new ODataComplexValue(resource.getType());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
index 831d0b1..1e0dd5b 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
@@ -41,6 +41,8 @@ import org.apache.olingo.commons.api.edm.EdmFunctionImport;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.api.edm.geo.Geospatial;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmBinary;
import org.apache.olingo.commons.core.edm.primitivetype.EdmDate;
import org.apache.olingo.commons.core.edm.primitivetype.EdmDateTime;
import org.apache.olingo.commons.core.edm.primitivetype.EdmDateTimeOffset;
@@ -48,6 +50,7 @@ import org.apache.olingo.commons.core.edm.primitivetype.EdmDecimal;
import org.apache.olingo.commons.core.edm.primitivetype.EdmDouble;
import org.apache.olingo.commons.core.edm.primitivetype.EdmDuration;
import org.apache.olingo.commons.core.edm.primitivetype.EdmInt64;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
import org.apache.olingo.commons.core.edm.primitivetype.EdmSingle;
import org.apache.olingo.commons.core.edm.primitivetype.EdmTime;
import org.apache.olingo.commons.core.edm.primitivetype.EdmTimeOfDay;
@@ -172,14 +175,6 @@ public final class URIUtils {
default:
}
- } else {
- switch (typeKind) {
- case Binary:
- result = "binary'";
- break;
-
- default:
- }
}
return result;
@@ -192,7 +187,6 @@ public final class URIUtils {
case Guid:
case DateTime:
case DateTimeOffset:
- case Binary:
result = "'";
break;
@@ -214,14 +208,6 @@ public final class URIUtils {
default:
}
- } else {
- switch (typeKind) {
- case Binary:
- result = "'";
- break;
-
- default:
- }
}
return result;
@@ -280,12 +266,12 @@ public final class URIUtils {
throws UnsupportedEncodingException, EdmPrimitiveTypeException {
return version == ODataServiceVersion.V30
- ? "time'" + URLEncoder.encode(EdmTime.getInstance().
- valueToString(duration, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
- Constants.UTF8) + "'"
- : "duration'" + URLEncoder.encode(EdmDuration.getInstance().
- valueToString(duration, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
- Constants.UTF8) + "'";
+ ? EdmTime.getInstance().toUriLiteral(URLEncoder.encode(EdmTime.getInstance().
+ valueToString(duration, null, null,
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null), Constants.UTF8))
+ : EdmDuration.getInstance().toUriLiteral(URLEncoder.encode(EdmDuration.getInstance().
+ valueToString(duration, null, null,
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null), Constants.UTF8));
}
/**
@@ -305,9 +291,7 @@ public final class URIUtils {
+ obj.toString()
+ suffix(version, EdmPrimitiveTypeKind.Guid)
: (obj instanceof byte[])
- ? prefix(version, EdmPrimitiveTypeKind.Binary)
- + Hex.encodeHexString((byte[]) obj)
- + suffix(version, EdmPrimitiveTypeKind.Binary)
+ ? EdmBinary.getInstance().toUriLiteral(Hex.encodeHexString((byte[]) obj))
: (obj instanceof Timestamp)
? timestamp(version, (Timestamp) obj)
: (obj instanceof Calendar)
@@ -330,6 +314,10 @@ public final class URIUtils {
? EdmInt64.getInstance().valueToString(obj, null, null,
Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
+ suffix(version, EdmPrimitiveTypeKind.Int64)
+ : (obj instanceof Geospatial)
+ ? URLEncoder.encode(EdmPrimitiveTypeFactory.getInstance(((Geospatial) obj).getEdmPrimitiveTypeKind()).
+ valueToString(obj, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
+ Constants.UTF8)
: (obj instanceof String)
? "'" + URLEncoder.encode((String) obj, Constants.UTF8) + "'"
: obj.toString();
@@ -340,7 +328,7 @@ public final class URIUtils {
return value;
}
-
+
public static InputStreamEntity buildInputStreamEntity(final CommonODataClient client, final InputStream input) {
InputStreamEntity entity;
if (client.getConfiguration().isUseChuncked()) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java
index 21d8c5d..04eb893 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java
@@ -29,7 +29,6 @@ import java.util.List;
import java.util.UUID;
import org.apache.commons.codec.binary.Base64;
import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.domain.ODataGeospatialValue;
import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
import org.apache.olingo.commons.api.domain.ODataProperty;
import org.apache.olingo.commons.api.format.ODataFormat;
@@ -93,35 +92,6 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
return value;
}
- protected ODataGeospatialValue writeGeospatialValue(final ODataGeospatialValue value) {
- final ODataGeospatialValue newValue = getClient().getGeospatialValueBuilder().
- setType(value.getTypeKind()).
- setValue(value.toValue()).
- build();
- final InputStream written = getClient().getWriter().writeProperty(
- getClient().getObjectFactory().newPrimitiveProperty(Constants.ELEM_PROPERTY, newValue),
- getFormat());
- return readGeospatialValue(written);
- }
-
- protected ODataGeospatialValue readGeospatialValue(final InputStream input) {
- final ODataProperty property = getClient().getReader().readProperty(input, getFormat());
- assertNotNull(property);
- assertTrue(property.hasGeospatialValue());
- assertNotNull(property.getGeospatialValue());
-
- return property.getGeospatialValue();
- }
-
- protected ODataGeospatialValue readGeospatialValue(final String entity, final String propertyName) {
- final ODataGeospatialValue value =
- readGeospatialValue(getClass().getResourceAsStream(getFilename(entity, propertyName)));
-
- assertEquals(value.toValue(), writeGeospatialValue(value).toValue());
-
- return value;
- }
-
protected void int32(final String entity, final String propertyName, final int check)
throws EdmPrimitiveTypeException {
@@ -200,9 +170,9 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
final String propertyName,
final Point expectedValues,
final EdmPrimitiveTypeKind expectedType,
- final Dimension expectedDimension) {
+ final Dimension expectedDimension) throws EdmPrimitiveTypeException {
- final ODataGeospatialValue opv = readGeospatialValue(entity, propertyName);
+ final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
assertEquals(expectedType, opv.getTypeKind());
final Point point = opv.toCastValue(Point.class);
@@ -231,9 +201,9 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
final String propertyName,
final List<Point> check,
final EdmPrimitiveTypeKind expectedType,
- final Dimension expectedDimension) {
+ final Dimension expectedDimension) throws EdmPrimitiveTypeException {
- final ODataGeospatialValue opv = readGeospatialValue(entity, propertyName);
+ final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
assertEquals(expectedType, opv.getTypeKind());
final LineString lineString = opv.toCastValue(LineString.class);
@@ -248,9 +218,9 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
final String propertyName,
final List<Point> check,
final EdmPrimitiveTypeKind expectedType,
- final Dimension expectedDimension) {
+ final Dimension expectedDimension) throws EdmPrimitiveTypeException {
- final ODataGeospatialValue opv = readGeospatialValue(entity, propertyName);
+ final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
assertEquals(expectedType, opv.getTypeKind());
final MultiPoint multiPoint = opv.toCastValue(MultiPoint.class);
@@ -275,9 +245,9 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
final String propertyName,
final List<List<Point>> check,
final EdmPrimitiveTypeKind expectedType,
- final Dimension expectedDimension) {
+ final Dimension expectedDimension) throws EdmPrimitiveTypeException {
- final ODataGeospatialValue opv = readGeospatialValue(entity, propertyName);
+ final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
assertEquals(expectedType, opv.getTypeKind());
final MultiLineString multiLine = opv.toCastValue(MultiLineString.class);
@@ -330,9 +300,9 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
final List<Point> checkInterior,
final List<Point> checkExterior,
final EdmPrimitiveTypeKind expectedType,
- final Dimension expectedDimension) {
+ final Dimension expectedDimension) throws EdmPrimitiveTypeException {
- final ODataGeospatialValue opv = readGeospatialValue(entity, propertyName);
+ final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
assertEquals(expectedType, opv.getTypeKind());
final Polygon polygon = opv.toCastValue(Polygon.class);
@@ -350,9 +320,9 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
final List<List<Point>> checkInterior,
final List<List<Point>> checkExterior,
final EdmPrimitiveTypeKind expectedType,
- final Dimension expectedDimension) {
+ final Dimension expectedDimension) throws EdmPrimitiveTypeException {
- final ODataGeospatialValue opv = readGeospatialValue(entity, propertyName);
+ final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
assertEquals(expectedType, opv.getTypeKind());
final MultiPolygon multiPolygon = opv.toCastValue(MultiPolygon.class);
@@ -373,9 +343,9 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
final String entity,
final String propertyName,
final EdmPrimitiveTypeKind expectedType,
- final Dimension expectedDimension) {
+ final Dimension expectedDimension) throws EdmPrimitiveTypeException {
- final ODataGeospatialValue opv = readGeospatialValue(entity, propertyName);
+ final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
assertEquals(expectedType, opv.getTypeKind());
final GeospatialCollection collection = opv.toCastValue(GeospatialCollection.class);
@@ -402,9 +372,9 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
final String entity,
final String propertyName,
final EdmPrimitiveTypeKind expectedType,
- final Dimension expectedDimension) {
+ final Dimension expectedDimension) throws EdmPrimitiveTypeException {
- final ODataGeospatialValue opv = readGeospatialValue(entity, propertyName);
+ final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
assertEquals(expectedType, opv.getTypeKind());
final GeospatialCollection collection = opv.toCastValue(GeospatialCollection.class);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
index 091d0af..bb507e4 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
@@ -118,25 +118,25 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
point.setX(1.2);
point.setY(2.1);
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aPoint",
- client.getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPoint).
+ client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPoint).
setValue(point).build()));
final List<Point> points = new ArrayList<Point>();
points.add(point);
points.add(point);
final MultiPoint multipoint = new MultiPoint(Geospatial.Dimension.GEOMETRY, null, points);
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aMultiPoint",
- client.getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeometryMultiPoint).
+ client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeometryMultiPoint).
setValue(multipoint).build()));
final LineString lineString = new LineString(Geospatial.Dimension.GEOMETRY, null, points);
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aLineString",
- client.getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeometryLineString).
+ client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeometryLineString).
setValue(lineString).build()));
final List<LineString> lineStrings = new ArrayList<LineString>();
lineStrings.add(lineString);
lineStrings.add(lineString);
final MultiLineString multiLineString = new MultiLineString(Geospatial.Dimension.GEOGRAPHY, null, lineStrings);
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aMultiLineString",
- client.getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeometryMultiLineString).
+ client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeometryMultiLineString).
setValue(multiLineString).build()));
final Point otherPoint = new Point(Geospatial.Dimension.GEOGRAPHY, null);
otherPoint.setX(3.4);
@@ -146,14 +146,14 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
points.add(point);
final Polygon polygon = new Polygon(Geospatial.Dimension.GEOGRAPHY, null, points, points);
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aPolygon",
- client.getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPolygon).
+ client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPolygon).
setValue(polygon).build()));
final List<Polygon> polygons = new ArrayList<Polygon>();
polygons.add(polygon);
polygons.add(polygon);
final MultiPolygon multiPolygon = new MultiPolygon(Geospatial.Dimension.GEOGRAPHY, null, polygons);
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aMultiPolygon",
- client.getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeographyMultiPolygon).
+ client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeographyMultiPolygon).
setValue(multiPolygon).build()));
final List<Geospatial> geospatials = new ArrayList<Geospatial>();
geospatials.add(otherPoint);
@@ -162,7 +162,7 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
geospatials.add(multiPolygon);
final GeospatialCollection geoColl = new GeospatialCollection(Geospatial.Dimension.GEOGRAPHY, null, geospatials);
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aCollection",
- client.getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeographyCollection).
+ client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeographyCollection).
setValue(geoColl).build()));
final ODataComplexValue contactDetails =
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
index b615988..151478a 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
@@ -29,6 +29,7 @@ import org.apache.olingo.commons.api.domain.ODataLink;
import org.apache.olingo.commons.api.domain.ODataProperty;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.core.AbstractTest;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.core.op.ResourceFactory;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
@@ -88,8 +89,8 @@ public class EntityTest extends AbstractTest {
for (ODataProperty property : entity.getProperties()) {
if ("GeogMultiLine".equals(property.getName())) {
found = true;
- assertTrue(property.hasGeospatialValue());
- assertEquals(EdmPrimitiveTypeKind.GeographyMultiLineString, property.getGeospatialValue().getTypeKind());
+ assertTrue(property.hasPrimitiveValue());
+ assertEquals(EdmPrimitiveTypeKind.GeographyMultiLineString, property.getPrimitiveValue().getTypeKind());
}
}
assertTrue(found);
@@ -160,30 +161,30 @@ public class EntityTest extends AbstractTest {
mediaEntity(ODataPubFormat.JSON_FULL_METADATA);
}
- private void issue128(final ODataPubFormat format) {
+ private void issue128(final ODataPubFormat format) throws EdmPrimitiveTypeException {
final InputStream input = getClass().getResourceAsStream("AllGeoTypesSet_-5." + getSuffix(format));
final ODataEntity entity = getClient().getBinder().getODataEntity(
getClient().getDeserializer().toEntry(input, format));
assertNotNull(entity);
final ODataProperty geogCollection = entity.getProperty("GeogCollection");
- assertEquals(EdmPrimitiveTypeKind.GeographyCollection, geogCollection.getGeospatialValue().getTypeKind());
+ assertEquals(EdmPrimitiveTypeKind.GeographyCollection, geogCollection.getPrimitiveValue().getTypeKind());
int count = 0;
- for (Geospatial g : geogCollection.getGeospatialValue().toCastValue(GeospatialCollection.class)) {
- assertNotNull(g);
+ for (Geospatial geo : geogCollection.getPrimitiveValue().toCastValue(GeospatialCollection.class)) {
+ assertNotNull(geo);
count++;
}
assertEquals(2, count);
}
@Test
- public void issue128FromAtom() {
+ public void issue128FromAtom() throws EdmPrimitiveTypeException {
issue128(ODataPubFormat.ATOM);
}
@Test
- public void issue128FromJSON() {
+ public void issue128FromJSON() throws EdmPrimitiveTypeException {
issue128(ODataPubFormat.JSON_FULL_METADATA);
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/MetadataTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/MetadataTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/MetadataTest.java
index 5dca101..a4d1ba8 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/MetadataTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/MetadataTest.java
@@ -134,7 +134,7 @@ public class MetadataTest extends AbstractTest {
new FullQualifiedName("Microsoft.Test.OData.Services.AstoriaDefaultService", "ProductReview"));
assertNotNull(entity);
assertFalse(entity.getPropertyNames().isEmpty());
- assertEquals(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32),
+ assertEquals(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int32),
entity.getProperty("ProductId").getType());
assertFalse(entity.getKeyPropertyRefs().isEmpty());
@@ -178,7 +178,7 @@ public class MetadataTest extends AbstractTest {
final EdmFunctionImport getArgumentPlusOne = container.getFunctionImport("GetArgumentPlusOne");
assertNotNull(getArgumentPlusOne);
- assertEquals(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.Int32),
+ assertEquals(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int32),
getArgumentPlusOne.getFunction(null).getReturnType().getType());
final EdmActionImport resetDataSource = container.getActionImport("ResetDataSource");
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java
index e3cbd7e..04f392a 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java
@@ -20,7 +20,6 @@ package org.apache.olingo.client.core.v3;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
import java.math.BigDecimal;
import java.sql.Timestamp;
@@ -182,32 +181,24 @@ public class PrimitiveValueTest extends AbstractTest {
}
@Test
- public void managePoint() {
+ public void managePoint() throws EdmPrimitiveTypeException {
final Point primitive = new Point(Geospatial.Dimension.GEOGRAPHY, null);
primitive.setX(52.8606);
primitive.setY(173.334);
- try {
- getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPoint).
- setValue(primitive).build();
- fail();
- } catch (IllegalArgumentException iae) {
- // nothing top do
- }
-
final ODataValue value =
- getClient().getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPoint).
+ getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPoint).
setValue(primitive).
build();
- assertEquals(EdmPrimitiveTypeKind.GeographyPoint, value.asGeospatial().getTypeKind());
+ assertEquals(EdmPrimitiveTypeKind.GeographyPoint, value.asPrimitive().getTypeKind());
assertEquals(Double.valueOf(primitive.getX()),
- Double.valueOf(value.asGeospatial().toCastValue(Point.class).getX()));
+ Double.valueOf(value.asPrimitive().toCastValue(Point.class).getX()));
assertEquals(Double.valueOf(primitive.getY()),
- Double.valueOf(value.asGeospatial().toCastValue(Point.class).getY()));
+ Double.valueOf(value.asPrimitive().toCastValue(Point.class).getY()));
}
@Test
- public void manageLineString() {
+ public void manageLineString() throws EdmPrimitiveTypeException {
final List<Point> points = new ArrayList<Point>();
Point point = new Point(Geospatial.Dimension.GEOGRAPHY, null);
point.setX(40.5);
@@ -231,11 +222,11 @@ public class PrimitiveValueTest extends AbstractTest {
final LineString primitive = new LineString(Geospatial.Dimension.GEOGRAPHY, null, points);
- final ODataValue value = getClient().getGeospatialValueBuilder().
+ final ODataValue value = getClient().getPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.GeographyLineString).setValue(primitive).build();
- assertEquals(EdmPrimitiveTypeKind.GeographyLineString, value.asGeospatial().getTypeKind());
+ assertEquals(EdmPrimitiveTypeKind.GeographyLineString, value.asPrimitive().getTypeKind());
- final Iterator<Point> iter = value.asGeospatial().toCastValue(LineString.class).iterator();
+ final Iterator<Point> iter = value.asPrimitive().toCastValue(LineString.class).iterator();
// take the third one and check the point value ...
iter.next();
@@ -247,7 +238,7 @@ public class PrimitiveValueTest extends AbstractTest {
}
@Test
- public void manageMultiPoint() {
+ public void manageMultiPoint() throws EdmPrimitiveTypeException {
final List<Point> points = new ArrayList<Point>();
Point point = new Point(Geospatial.Dimension.GEOMETRY, null);
point.setX(0);
@@ -256,11 +247,11 @@ public class PrimitiveValueTest extends AbstractTest {
final MultiPoint primitive = new MultiPoint(Geospatial.Dimension.GEOMETRY, null, points);
- final ODataValue value = getClient().getGeospatialValueBuilder().
+ final ODataValue value = getClient().getPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.GeometryMultiPoint).setValue(primitive).build();
- assertEquals(EdmPrimitiveTypeKind.GeometryMultiPoint, value.asGeospatial().getTypeKind());
+ assertEquals(EdmPrimitiveTypeKind.GeometryMultiPoint, value.asPrimitive().getTypeKind());
- final Iterator<Point> iter = value.asGeospatial().toCastValue(MultiPoint.class).iterator();
+ final Iterator<Point> iter = value.asPrimitive().toCastValue(MultiPoint.class).iterator();
point = iter.next();
assertEquals(Double.valueOf(points.get(0).getX()), Double.valueOf(point.getX()));
@@ -268,7 +259,7 @@ public class PrimitiveValueTest extends AbstractTest {
}
@Test
- public void manageMultiLine() {
+ public void manageMultiLine() throws EdmPrimitiveTypeException {
final List<LineString> lines = new ArrayList<LineString>();
// line one ...
@@ -317,11 +308,11 @@ public class PrimitiveValueTest extends AbstractTest {
final MultiLineString primitive = new MultiLineString(Geospatial.Dimension.GEOMETRY, null, lines);
final ODataValue value =
- getClient().getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeometryMultiLineString).
+ getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeometryMultiLineString).
setValue(primitive).build();
- assertEquals(EdmPrimitiveTypeKind.GeometryMultiLineString, value.asGeospatial().getTypeKind());
+ assertEquals(EdmPrimitiveTypeKind.GeometryMultiLineString, value.asPrimitive().getTypeKind());
- final Iterator<LineString> lineIter = value.asGeospatial().toCastValue(MultiLineString.class).iterator();
+ final Iterator<LineString> lineIter = value.asPrimitive().toCastValue(MultiLineString.class).iterator();
// take the second line and check the third point value ...
lineIter.next();
@@ -337,7 +328,7 @@ public class PrimitiveValueTest extends AbstractTest {
}
@Test
- public void managePolygon() {
+ public void managePolygon() throws EdmPrimitiveTypeException {
final List<Point> interior = new ArrayList<Point>();
final List<Point> exterior = new ArrayList<Point>();
@@ -370,12 +361,12 @@ public class PrimitiveValueTest extends AbstractTest {
final Polygon primitive = new Polygon(Geospatial.Dimension.GEOGRAPHY, null, interior, exterior);
final ODataValue value =
- getClient().getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPolygon).
+ getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPolygon).
setValue(primitive).build();
- assertEquals(EdmPrimitiveTypeKind.GeographyPolygon, value.asGeospatial().getTypeKind());
+ assertEquals(EdmPrimitiveTypeKind.GeographyPolygon, value.asPrimitive().getTypeKind());
- assertTrue(value.asGeospatial().toCastValue(Polygon.class).getInterior().isEmpty());
- final Iterator<Point> iter = value.asGeospatial().toCastValue(Polygon.class).getExterior().iterator();
+ assertTrue(value.asPrimitive().toCastValue(Polygon.class).getInterior().isEmpty());
+ final Iterator<Point> iter = value.asPrimitive().toCastValue(Polygon.class).getExterior().iterator();
// take the third one ...
iter.next();
@@ -387,7 +378,7 @@ public class PrimitiveValueTest extends AbstractTest {
}
@Test
- public void manageMultiPolygon() {
+ public void manageMultiPolygon() throws EdmPrimitiveTypeException {
final List<Polygon> polygons = new ArrayList<Polygon>();
List<Point> interior = new ArrayList<Point>();
@@ -476,11 +467,11 @@ public class PrimitiveValueTest extends AbstractTest {
final MultiPolygon primitive = new MultiPolygon(Geospatial.Dimension.GEOMETRY, null, polygons);
final ODataValue value =
- getClient().getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeometryMultiPolygon).
+ getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeometryMultiPolygon).
setValue(primitive).build();
- assertEquals(EdmPrimitiveTypeKind.GeometryMultiPolygon, value.asGeospatial().getTypeKind());
+ assertEquals(EdmPrimitiveTypeKind.GeometryMultiPolygon, value.asPrimitive().getTypeKind());
- final Iterator<Polygon> iter = value.asGeospatial().toCastValue(MultiPolygon.class).iterator();
+ final Iterator<Polygon> iter = value.asPrimitive().toCastValue(MultiPolygon.class).iterator();
// second one polygon
iter.next();
@@ -504,7 +495,7 @@ public class PrimitiveValueTest extends AbstractTest {
}
@Test
- public void manageGeomCollection() {
+ public void manageGeomCollection() throws EdmPrimitiveTypeException {
final List<Geospatial> collection = new ArrayList<Geospatial>();
Point point = new Point(Geospatial.Dimension.GEOMETRY, null);
@@ -522,11 +513,11 @@ public class PrimitiveValueTest extends AbstractTest {
final GeospatialCollection primitive = new GeospatialCollection(Geospatial.Dimension.GEOMETRY, null, collection);
final ODataValue value =
- getClient().getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeometryCollection).
+ getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeometryCollection).
setValue(primitive).build();
- assertEquals(EdmPrimitiveTypeKind.GeometryCollection, value.asGeospatial().getTypeKind());
+ assertEquals(EdmPrimitiveTypeKind.GeometryCollection, value.asPrimitive().getTypeKind());
- final Iterator<Geospatial> iter = value.asGeospatial().toCastValue(GeospatialCollection.class).iterator();
+ final Iterator<Geospatial> iter = value.asPrimitive().toCastValue(GeospatialCollection.class).iterator();
iter.next();
final Point collectedPoint = (Point) iter.next();
@@ -536,7 +527,7 @@ public class PrimitiveValueTest extends AbstractTest {
}
@Test
- public void manageGeogCollection() {
+ public void manageGeogCollection() throws EdmPrimitiveTypeException {
final List<Geospatial> collection = new ArrayList<Geospatial>();
Point point = new Point(Geospatial.Dimension.GEOGRAPHY, null);
@@ -554,11 +545,11 @@ public class PrimitiveValueTest extends AbstractTest {
final GeospatialCollection primitive = new GeospatialCollection(Geospatial.Dimension.GEOGRAPHY, null, collection);
final ODataValue value =
- getClient().getGeospatialValueBuilder().setType(EdmPrimitiveTypeKind.GeographyCollection).
+ getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeographyCollection).
setValue(primitive).build();
- assertEquals(EdmPrimitiveTypeKind.GeographyCollection, value.asGeospatial().getTypeKind());
+ assertEquals(EdmPrimitiveTypeKind.GeographyCollection, value.asPrimitive().getTypeKind());
- final Iterator<Geospatial> iter = value.asGeospatial().toCastValue(GeospatialCollection.class).iterator();
+ final Iterator<Geospatial> iter = value.asPrimitive().toCastValue(GeospatialCollection.class).iterator();
iter.next();
final Point collectedPoint = (Point) iter.next();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
index fb2ba5c..c8cfc59 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/MetadataTest.java
@@ -83,7 +83,7 @@ public class MetadataTest extends AbstractTest {
assertNotNull(responseStatus);
assertTrue(responseStatus.getNavigationPropertyNames().isEmpty());
assertEquals("Recipient", responseStatus.getBaseType().getName());
- assertEquals(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.DateTimeOffset),
+ assertEquals(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.DateTimeOffset),
responseStatus.getProperty("Time").getType());
// 3. Entity
@@ -107,7 +107,7 @@ public class MetadataTest extends AbstractTest {
assertNotNull(move);
assertTrue(move.isBound());
assertEquals(2, move.getParameterNames().size());
- assertEquals(EdmPrimitiveTypeFactory.getNonGeoInstance(EdmPrimitiveTypeKind.String),
+ assertEquals(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.String),
move.getParameter("DestinationId").getType());
// 5. EntityContainer
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/GeoUtils.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/GeoUtils.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/GeoUtils.java
index fa7538d..c1ceef0 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/GeoUtils.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/GeoUtils.java
@@ -24,10 +24,6 @@ import org.apache.olingo.commons.api.edm.geo.Geospatial;
public final class GeoUtils {
- private GeoUtils() {
- // Empty private constructor for static utility classes
- }
-
public static Geospatial.Dimension getDimension(final EdmPrimitiveTypeKind type) {
Geospatial.Dimension dimension;
@@ -87,4 +83,9 @@ public final class GeoUtils {
return type;
}
+
+ private GeoUtils() {
+ // Empty private constructor for static utility classes
+ }
+
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractODataValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractODataValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractODataValue.java
index ab77d7f..3eb664b 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractODataValue.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractODataValue.java
@@ -51,26 +51,6 @@ public abstract class AbstractODataValue implements ODataValue {
}
/**
- * Check is is a geospatail value.
- *
- * @return 'TRUE' if geospatail; 'FALSE' otherwise.
- */
- @Override
- public boolean isGeospatial() {
- return (this instanceof ODataGeospatialValue);
- }
-
- /**
- * Casts to geospatail value.
- *
- * @return geospatail value.
- */
- @Override
- public ODataGeospatialValue asGeospatial() {
- return isGeospatial() ? (ODataGeospatialValue) this : null;
- }
-
- /**
* Check is is a complex value.
*
* @return 'TRUE' if complex; 'FALSE' otherwise.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataGeospatialValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataGeospatialValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataGeospatialValue.java
deleted file mode 100644
index 7563907..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataGeospatialValue.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.commons.api.domain;
-
-import org.apache.olingo.commons.api.edm.EdmGeospatialType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.geo.Geospatial;
-
-public interface ODataGeospatialValue extends ODataValue {
-
- interface Builder {
-
- Builder setType(EdmPrimitiveTypeKind type);
-
- Builder setValue(Geospatial value);
-
- ODataGeospatialValue build();
-
- }
-
- EdmPrimitiveTypeKind getTypeKind();
-
- EdmGeospatialType getType();
-
- /**
- * Returns the current geospatial value.
- *
- * @return the current geospatial value.
- */
- Geospatial toValue();
-
- /**
- * Returns the current value casted to the given type.
- *
- * @param <T> cast type
- * @param reference class reference
- * @return the current value as typed java instance
- */
- <T extends Geospatial> T toCastValue(Class<T> reference);
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataObjectFactory.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataObjectFactory.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataObjectFactory.java
index b38a5e8..d8cbbbc 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataObjectFactory.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataObjectFactory.java
@@ -190,15 +190,6 @@ public interface ODataObjectFactory {
ODataProperty newPrimitiveProperty(String name, ODataPrimitiveValue value);
/**
- * Instantiates a new primitive property.
- *
- * @param name name.
- * @param value geospatial value.
- * @return primitive property.
- */
- ODataProperty newPrimitiveProperty(String name, ODataGeospatialValue value);
-
- /**
* Instantiates a new complex property.
*
* @param name name.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataProperty.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataProperty.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataProperty.java
index 7217282..24364d7 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataProperty.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataProperty.java
@@ -107,24 +107,6 @@ public class ODataProperty implements Serializable, ODataInvokeResult {
}
/**
- * Checks if has geospatial value.
- *
- * @return 'TRUE' if has geospatial value; 'FALSE' otherwise.
- */
- public boolean hasGeospatialValue() {
- return !hasNullValue() && this.value.isGeospatial();
- }
-
- /**
- * Gets geospatial value.
- *
- * @return geospatial value if exists; null otherwise.
- */
- public ODataGeospatialValue getGeospatialValue() {
- return hasGeospatialValue() ? this.value.asGeospatial() : null;
- }
-
- /**
* Checks if has complex value.
*
* @return 'TRUE' if has complex value; 'FALSE' otherwise.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataValue.java
index e1c9be9..b427e8f 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataValue.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataValue.java
@@ -40,20 +40,6 @@ public interface ODataValue extends Serializable {
ODataPrimitiveValue asPrimitive();
/**
- * Check is is a geospatail value.
- *
- * @return 'TRUE' if geospatail; 'FALSE' otherwise.
- */
- boolean isGeospatial();
-
- /**
- * Casts to geospatail value.
- *
- * @return geospatail value.
- */
- ODataGeospatialValue asGeospatial();
-
- /**
* Check is is a collection value.
*
* @return 'TRUE' if collection; 'FALSE' otherwise.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmGeospatialType.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmGeospatialType.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmGeospatialType.java
deleted file mode 100644
index 898b6b2..0000000
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmGeospatialType.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.commons.api.edm;
-
-import org.apache.olingo.commons.api.edm.geo.Geospatial;
-
-public interface EdmGeospatialType extends EdmType {
-
- String EDM_NAMESPACE = EdmPrimitiveType.EDM_NAMESPACE;
-
- /**
- * Returns the Java type for this EDM geospatial type.
- *
- * @return the geospatial Java type
- */
- Class<? extends Geospatial> getJavaType();
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/ComposedGeospatial.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/ComposedGeospatial.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/ComposedGeospatial.java
index 82a13fe..cbc5685 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/ComposedGeospatial.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/ComposedGeospatial.java
@@ -31,18 +31,10 @@ public abstract class ComposedGeospatial<T extends Geospatial> extends Geospatia
protected final List<T> geospatials;
- /**
- * Constructor.
- *
- * @param dimension dimension.
- * @param type type.
- * @param crs crs.
- * @param geospatials geospatials info.
- */
- protected ComposedGeospatial(final Dimension dimension, final Type type, final String crs,
+ protected ComposedGeospatial(final Dimension dimension, final Type type, final Integer srid,
final List<T> geospatials) {
- super(dimension, type, crs);
+ super(dimension, type, srid);
this.geospatials = new ArrayList<T>();
if (geospatials != null) {
this.geospatials.addAll(geospatials);
@@ -65,14 +57,4 @@ public abstract class ComposedGeospatial<T extends Geospatial> extends Geospatia
public boolean isEmpty() {
return geospatials.isEmpty();
}
-
- /**
- * {@inheritDoc }
- */
- @Override
- public void setSrid(final Integer srid) {
- for (Geospatial geospatial : this.geospatials) {
- geospatial.setSrid(srid);
- }
- }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Geospatial.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Geospatial.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Geospatial.java
index 62de5ec..19b98dd 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Geospatial.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Geospatial.java
@@ -75,23 +75,22 @@ public abstract class Geospatial implements Serializable {
protected final Type type;
- protected String crs;
-
/**
* Null value means it is expected to vary per instance.
*/
- protected Integer srid;
+ protected final Integer srid;
/**
* Constructor.
*
* @param dimension dimension.
* @param type type.
+ * @param srid SRID
*/
- protected Geospatial(final Dimension dimension, final Type type, final String crs) {
+ protected Geospatial(final Dimension dimension, final Type type, final Integer srid) {
this.dimension = dimension;
this.type = type;
- this.crs = crs;
+ this.srid = srid;
}
/**
@@ -115,15 +114,6 @@ public abstract class Geospatial implements Serializable {
}
/**
- * Gets CRS.
- *
- * @return CRS
- */
- public String getCrs() {
- return crs;
- }
-
- /**
* Gets s-rid.
*
* @return s-rid.
@@ -132,36 +122,18 @@ public abstract class Geospatial implements Serializable {
return srid;
}
- /**
- * Sets s-rid.
- *
- * @param srid s-rid.
- */
- public void setSrid(final Integer srid) {
- this.srid = srid;
- }
-
public abstract EdmPrimitiveTypeKind getEdmPrimitiveTypeKind();
- /**
- * {@inheritDoc }
- */
@Override
public boolean equals(final Object obj) {
return EqualsBuilder.reflectionEquals(this, obj);
}
- /**
- * {@inheritDoc }
- */
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
- /**
- * {@inheritDoc }
- */
@Override
public String toString() {
return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/GeospatialCollection.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/GeospatialCollection.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/GeospatialCollection.java
index b3e3f9f..5b0b857 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/GeospatialCollection.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/GeospatialCollection.java
@@ -28,21 +28,14 @@ public class GeospatialCollection extends ComposedGeospatial<Geospatial> {
private static final long serialVersionUID = -9181547636133878977L;
- /**
- * Constructor.
- *
- * @param dimension dimension.
- * @param crs crs.
- * @param geospatials geospatials info.
- */
- public GeospatialCollection(final Dimension dimension, final String crs, final List<Geospatial> geospatials) {
- super(dimension, Type.GEOSPATIALCOLLECTION, crs, geospatials);
+ public GeospatialCollection(final Dimension dimension, final Integer srid, final List<Geospatial> geospatials) {
+ super(dimension, Type.GEOSPATIALCOLLECTION, srid, geospatials);
}
@Override
public EdmPrimitiveTypeKind getEdmPrimitiveTypeKind() {
return dimension == Dimension.GEOGRAPHY
- ? EdmPrimitiveTypeKind.GeographyCollection
- : EdmPrimitiveTypeKind.GeometryCollection;
+ ? EdmPrimitiveTypeKind.GeographyCollection
+ : EdmPrimitiveTypeKind.GeometryCollection;
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/LineString.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/LineString.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/LineString.java
index 297a962..bc6afaf 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/LineString.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/LineString.java
@@ -25,8 +25,8 @@ public class LineString extends ComposedGeospatial<Point> {
private static final long serialVersionUID = 3207958185407535907L;
- public LineString(final Dimension dimension, final String crs, final List<Point> points) {
- super(dimension, Type.LINESTRING, crs, points);
+ public LineString(final Dimension dimension, final Integer srid, final List<Point> points) {
+ super(dimension, Type.LINESTRING, srid, points);
}
@Override
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiLineString.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiLineString.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiLineString.java
index 2f98d63..d38f3b0 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiLineString.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiLineString.java
@@ -25,15 +25,15 @@ public class MultiLineString extends ComposedGeospatial<LineString> {
private static final long serialVersionUID = -5042414471218124125L;
- public MultiLineString(final Dimension dimension, final String crs, final List<LineString> lineStrings) {
- super(dimension, Type.MULTILINESTRING, crs, lineStrings);
+ public MultiLineString(final Dimension dimension, final Integer srid, final List<LineString> lineStrings) {
+ super(dimension, Type.MULTILINESTRING, srid, lineStrings);
}
@Override
public EdmPrimitiveTypeKind getEdmPrimitiveTypeKind() {
return dimension == Dimension.GEOGRAPHY
- ? EdmPrimitiveTypeKind.GeographyMultiLineString
- : EdmPrimitiveTypeKind.GeometryMultiLineString;
+ ? EdmPrimitiveTypeKind.GeographyMultiLineString
+ : EdmPrimitiveTypeKind.GeometryMultiLineString;
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiPoint.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiPoint.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiPoint.java
index 999f24b..7229d05 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiPoint.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiPoint.java
@@ -25,8 +25,8 @@ public class MultiPoint extends ComposedGeospatial<Point> {
private static final long serialVersionUID = 4951011255142116129L;
- public MultiPoint(final Dimension dimension, final String crs, final List<Point> points) {
- super(dimension, Type.MULTIPOINT, crs, points);
+ public MultiPoint(final Dimension dimension, final Integer srid, final List<Point> points) {
+ super(dimension, Type.MULTIPOINT, srid, points);
}
@Override
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiPolygon.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiPolygon.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiPolygon.java
index fd0fdae..dbbfb24 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiPolygon.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/MultiPolygon.java
@@ -25,14 +25,14 @@ public class MultiPolygon extends ComposedGeospatial<Polygon> {
private static final long serialVersionUID = -160184788048512883L;
- public MultiPolygon(final Dimension dimension, final String crs, final List<Polygon> polygons) {
- super(dimension, Type.MULTIPOLYGON, crs, polygons);
+ public MultiPolygon(final Dimension dimension, final Integer srid, final List<Polygon> polygons) {
+ super(dimension, Type.MULTIPOLYGON, srid, polygons);
}
@Override
public EdmPrimitiveTypeKind getEdmPrimitiveTypeKind() {
return dimension == Dimension.GEOGRAPHY
- ? EdmPrimitiveTypeKind.GeographyMultiPolygon
- : EdmPrimitiveTypeKind.GeometryMultiPolygon;
+ ? EdmPrimitiveTypeKind.GeographyMultiPolygon
+ : EdmPrimitiveTypeKind.GeometryMultiPolygon;
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/76513508/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Point.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Point.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Point.java
index a9e0c39..c8c8a37 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Point.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/geo/Point.java
@@ -40,8 +40,8 @@ public class Point extends Geospatial {
*/
private double z;
- public Point(final Dimension dimension, final String crs) {
- super(dimension, Type.POINT, crs);
+ public Point(final Dimension dimension, final Integer srid) {
+ super(dimension, Type.POINT, srid);
}
public double getX() {
@@ -71,7 +71,7 @@ public class Point extends Geospatial {
@Override
public EdmPrimitiveTypeKind getEdmPrimitiveTypeKind() {
return dimension == Dimension.GEOGRAPHY
- ? EdmPrimitiveTypeKind.GeographyPoint
- : EdmPrimitiveTypeKind.GeometryPoint;
+ ? EdmPrimitiveTypeKind.GeographyPoint
+ : EdmPrimitiveTypeKind.GeometryPoint;
}
}
[17/51] [abbrv] git commit: Merge branch 'olingo200' of
https://git-wip-us.apache.org/repos/asf/olingo-odata4 into olingo200
Posted by il...@apache.org.
Merge branch 'olingo200' of https://git-wip-us.apache.org/repos/asf/olingo-odata4 into olingo200
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/3c4d7d17
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/3c4d7d17
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/3c4d7d17
Branch: refs/heads/master
Commit: 3c4d7d17674d785bfddf3d5dfd17f8118131eb96
Parents: ce18b8e bc398d3
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Fri Mar 28 17:07:46 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Fri Mar 28 17:07:46 2014 +0100
----------------------------------------------------------------------
fit/pom.xml | 12 ++
fit/src/main/resources/v4/services.full.json | 126 +++++++++++++++++++
fit/src/main/resources/v4/services.xml | 102 +++++++++++++++
.../retrieve/ODataEntityRequestImpl.java | 4 +-
.../retrieve/ODataEntitySetRequestImpl.java | 4 +-
.../ODataServiceDocumentRequestImpl.java | 6 +-
.../v4/ServiceDocumentRetrieveTestITCase.java | 74 +++++++++++
.../core/it/v4/ServiceDocumentTestITCase.java | 60 +++++++++
8 files changed, 383 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
[45/51] [abbrv] git commit: [OLINGO-205,
OLINGO-175] provided JSON integration tests + refactoring and fixes
Posted by il...@apache.org.
[OLINGO-205, OLINGO-175] provided JSON integration tests + refactoring and fixes
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/c73772f0
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/c73772f0
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/c73772f0
Branch: refs/heads/master
Commit: c73772f041d048e0a862d95361526a801b4cb712
Parents: de591bb
Author: fmartelli <fa...@gmail.com>
Authored: Mon Mar 31 17:16:44 2014 +0200
Committer: fmartelli <fa...@gmail.com>
Committed: Mon Mar 31 17:16:44 2014 +0200
----------------------------------------------------------------------
.../org/apache/olingo/fit/AbstractServices.java | 36 +-
.../java/org/apache/olingo/fit/V4NorthWind.java | 5 +-
.../org/apache/olingo/fit/V4NorthWindExt.java | 5 +-
.../olingo/fit/utils/AbstractJSONUtilities.java | 78 +--
.../olingo/fit/utils/AbstractUtilities.java | 52 +-
.../olingo/fit/utils/AbstractXMLUtilities.java | 149 +++---
.../org/apache/olingo/fit/utils/Commons.java | 27 +-
.../apache/olingo/fit/utils/ConstantKey.java | 67 +++
.../org/apache/olingo/fit/utils/Constants.java | 167 +++---
.../apache/olingo/fit/utils/ODataVersion.java | 2 +-
.../fit/utils/XHTTPMethodInterceptor.java | 5 +-
.../olingo/fit/utils/v3/XMLUtilities.java | 7 +-
.../olingo/fit/utils/v4/XMLUtilities.java | 3 +-
.../olingo/client/api/data/ServiceDocument.java | 15 -
.../retrieve/ODataPropertyRequestImpl.java | 2 +-
.../core/data/AbstractServiceDocument.java | 33 +-
.../data/JSONServiceDocumentDeserializer.java | 35 +-
.../data/XMLServiceDocumentDeserializer.java | 33 +-
.../core/data/v3/JSONServiceDocumentImpl.java | 32 --
.../core/data/v3/XMLServiceDocumentImpl.java | 18 -
.../core/data/v4/AbstractServiceDocument.java | 40 --
.../core/data/v4/JSONServiceDocumentImpl.java | 15 -
.../core/data/v4/XMLServiceDocumentImpl.java | 1 -
.../client/core/op/AbstractODataBinder.java | 22 +-
.../client/core/op/impl/v4/ODataBinderImpl.java | 12 +-
.../client/core/it/v3/AsyncTestITCase.java | 1 -
.../it/v3/NavigationLinkCreateTestITCase.java | 534 -------------------
.../client/core/it/v3/PropertyTestITCase.java | 4 +-
.../core/it/v4/EntityRetrieveTestITCase.java | 20 +-
.../client/core/it/v4/EntitySetTestITCase.java | 8 +-
.../core/it/v4/ServiceDocumentTestITCase.java | 8 +-
.../client/core/v4/ServiceDocumentTest.java | 14 +-
.../olingo/client/core/v4/serviceDocument.json | 1 +
.../api/domain/ODataServiceDocument.java | 20 -
.../core/data/AbstractJsonDeserializer.java | 3 +-
.../core/data/JSONEntryDeserializer.java | 35 +-
.../commons/core/data/JSONFeedDeserializer.java | 28 +-
.../olingo/commons/core/data/JSONFeedImpl.java | 10 +-
.../core/data/JSONODataErrorDeserializer.java | 6 +-
.../core/data/JSONPropertyDeserializer.java | 30 +-
.../primitivetype/EdmGeographyMultiPoint.java | 1 -
.../primitivetype/EdmGeometryCollection.java | 1 -
.../core/op/AbstractODataDeserializer.java | 16 +-
43 files changed, 558 insertions(+), 1043 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java b/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java
index 237d0ae..13c6c49 100644
--- a/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java
+++ b/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java
@@ -24,8 +24,6 @@ import org.apache.olingo.fit.utils.AbstractJSONUtilities;
import org.apache.olingo.fit.utils.ODataVersion;
import org.apache.olingo.fit.utils.FSManager;
-import static org.apache.olingo.fit.utils.Constants.*;
-
import org.apache.olingo.fit.methods.MERGE;
import org.apache.olingo.fit.methods.PATCH;
import org.apache.olingo.fit.utils.AbstractUtilities;
@@ -57,6 +55,7 @@ import javax.ws.rs.core.Response;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.fit.utils.ConstantKey;
import org.apache.olingo.fit.utils.Constants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -71,7 +70,6 @@ public abstract class AbstractServices {
private static final Set<ODataVersion> INITIALIZED = EnumSet.noneOf(ODataVersion.class);
protected abstract ODataVersion getVersion();
-
protected final AbstractXMLUtilities xml;
protected final AbstractJSONUtilities json;
@@ -107,7 +105,8 @@ public abstract class AbstractServices {
}
return xml.createResponse(
- FSManager.instance(getVersion()).readFile(SERVICES, acceptType), null, acceptType);
+ FSManager.instance(getVersion()).readFile(Constants.get(getVersion(), ConstantKey.SERVICES), acceptType),
+ null, acceptType);
} catch (Exception e) {
return xml.createFaultResponse(accept, e);
}
@@ -122,7 +121,7 @@ public abstract class AbstractServices {
@Path("/$metadata")
@Produces("application/xml")
public Response getMetadata() {
- return getMetadata(METADATA);
+ return getMetadata(Constants.get(getVersion(), ConstantKey.METADATA));
}
/**
@@ -134,7 +133,7 @@ public abstract class AbstractServices {
@Path("/large/$metadata")
@Produces("application/xml")
public Response getLargeMetadata() {
- return getMetadata("large" + StringUtils.capitalize(METADATA));
+ return getMetadata("large" + StringUtils.capitalize(Constants.get(getVersion(), ConstantKey.METADATA)));
}
protected Response getMetadata(final String filename) {
@@ -150,7 +149,7 @@ public abstract class AbstractServices {
// public Response getEntityReference(@QueryParam("$id") String id){
// return null;
// }
-
+
/**
* Retrieve entity reference sample.
*
@@ -176,7 +175,8 @@ public abstract class AbstractServices {
final String filename = Base64.encodeBase64String(path.getBytes("UTF-8"));
return utils.getValue().createResponse(
- FSManager.instance(getVersion()).readFile(Constants.REF + File.separatorChar + filename, utils.getKey()),
+ FSManager.instance(getVersion()).readFile(Constants.get(getVersion(), ConstantKey.REF)
+ + File.separatorChar + filename, utils.getKey()),
null,
utils.getKey());
} catch (Exception e) {
@@ -419,15 +419,20 @@ public abstract class AbstractServices {
builder.append(basePath);
if (StringUtils.isNotBlank(orderby)) {
- builder.append(ORDERBY).append(File.separatorChar).append(orderby).append(File.separatorChar);
+ builder.append(Constants.get(getVersion(), ConstantKey.ORDERBY)).append(File.separatorChar).
+ append(orderby).append(File.separatorChar);
}
if (StringUtils.isNotBlank(filter)) {
- builder.append(FILTER).append(File.separatorChar).append(filter.replaceAll("/", "."));
+ builder.append(Constants.get(getVersion(), ConstantKey.FILTER)).append(File.separatorChar).
+ append(filter.replaceAll("/", "."));
} else if (StringUtils.isNotBlank(skiptoken)) {
- builder.append(SKIP_TOKEN).append(File.separatorChar).append(skiptoken);
+ builder.append(Constants.get(getVersion(), ConstantKey.SKIP_TOKEN)).append(File.separatorChar).
+ append(skiptoken);
} else {
- builder.append(Commons.getLinkInfo().get(getVersion()).isSingleton(name) ? ENTITY : FEED);
+ builder.append(Commons.getLinkInfo().get(getVersion()).isSingleton(name)
+ ? Constants.get(getVersion(), ConstantKey.ENTITY)
+ : Constants.get(getVersion(), ConstantKey.FEED));
}
InputStream feed = FSManager.instance(getVersion()).readFile(builder.toString(), acceptType);
@@ -524,7 +529,8 @@ public abstract class AbstractServices {
if (keyAsSegment) {
entity = utils.getValue().addEditLink(
- entity, entitySetName, Constants.DEFAULT_SERVICE_URL + entitySetName + "/" + entityId);
+ entity, entitySetName,
+ Constants.get(getVersion(), ConstantKey.DEFAULT_SERVICE_URL) + entitySetName + "/" + entityId);
}
if (StringUtils.isNotBlank(select)) {
@@ -589,7 +595,7 @@ public abstract class AbstractServices {
final String basePath =
entitySetName + File.separatorChar + Commons.getEntityKey(entityId) + File.separatorChar;
- FSManager.instance(getVersion()).deleteFile(basePath + ENTITY);
+ FSManager.instance(getVersion()).deleteFile(basePath + Constants.get(getVersion(), ConstantKey.ENTITY));
return xml.createResponse(null, null, null, Response.Status.NO_CONTENT);
} catch (Exception e) {
@@ -1012,7 +1018,7 @@ public abstract class AbstractServices {
final String basePath = Commons.getEntityBasePath(entitySetName, entityId);
InputStream stream = FSManager.instance(getVersion()).readFile(
- basePath + ENTITY, acceptType == null || acceptType == Accept.TEXT
+ basePath + Constants.get(getVersion(), ConstantKey.ENTITY), acceptType == null || acceptType == Accept.TEXT
? Accept.XML : acceptType);
final AbstractUtilities utils = getUtilities(acceptType);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/fit/src/main/java/org/apache/olingo/fit/V4NorthWind.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/V4NorthWind.java b/fit/src/main/java/org/apache/olingo/fit/V4NorthWind.java
index 5ef82d7..b11d3e5 100644
--- a/fit/src/main/java/org/apache/olingo/fit/V4NorthWind.java
+++ b/fit/src/main/java/org/apache/olingo/fit/V4NorthWind.java
@@ -23,7 +23,8 @@ import org.apache.olingo.fit.utils.XHTTPMethodInterceptor;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;
import org.apache.cxf.interceptor.InInterceptors;
-import static org.apache.olingo.fit.utils.Constants.METADATA;
+import org.apache.olingo.fit.utils.ConstantKey;
+import org.apache.olingo.fit.utils.Constants;
@Path("/V40/NorthWind.svc")
@InInterceptors(classes = XHTTPMethodInterceptor.class)
@@ -40,7 +41,7 @@ public class V4NorthWind extends AbstractServices {
@Override
public Response getMetadata() {
- return getMetadata("northwind-" + METADATA);
+ return getMetadata("northwind-" + Constants.get(getVersion(), ConstantKey.METADATA));
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/fit/src/main/java/org/apache/olingo/fit/V4NorthWindExt.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/V4NorthWindExt.java b/fit/src/main/java/org/apache/olingo/fit/V4NorthWindExt.java
index a3d60a7..b5d4bda 100644
--- a/fit/src/main/java/org/apache/olingo/fit/V4NorthWindExt.java
+++ b/fit/src/main/java/org/apache/olingo/fit/V4NorthWindExt.java
@@ -23,7 +23,8 @@ import org.apache.olingo.fit.utils.XHTTPMethodInterceptor;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;
import org.apache.cxf.interceptor.InInterceptors;
-import static org.apache.olingo.fit.utils.Constants.METADATA;
+import org.apache.olingo.fit.utils.ConstantKey;
+import org.apache.olingo.fit.utils.Constants;
import org.apache.olingo.fit.utils.ResolvingReferencesInterceptor;
@Path("/V40/NorthWindExt.svc")
@@ -41,7 +42,7 @@ public class V4NorthWindExt extends AbstractServices {
@Override
public Response getMetadata() {
- return getMetadata("northwindExt-" + METADATA);
+ return getMetadata("northwindExt-" + Constants.get(getVersion(), ConstantKey.METADATA));
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/fit/src/main/java/org/apache/olingo/fit/utils/AbstractJSONUtilities.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/AbstractJSONUtilities.java b/fit/src/main/java/org/apache/olingo/fit/utils/AbstractJSONUtilities.java
index c62d341..9fd9096 100644
--- a/fit/src/main/java/org/apache/olingo/fit/utils/AbstractJSONUtilities.java
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/AbstractJSONUtilities.java
@@ -18,8 +18,6 @@
*/
package org.apache.olingo.fit.utils;
-import static org.apache.olingo.fit.utils.Constants.*;
-
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
@@ -61,7 +59,7 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
IOUtils.closeQuietly(is);
for (String link : links) {
- srcNode.set(link + JSON_NAVIGATION_SUFFIX,
+ srcNode.set(link + Constants.get(version, ConstantKey.JSON_NAVIGATION_SUFFIX),
new TextNode(Commons.getLinksURI(version, entitySetName, entitykey, link)));
}
@@ -81,10 +79,10 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
while (fieldIter.hasNext()) {
final String field = fieldIter.next();
- if (field.endsWith(JSON_NAVIGATION_BIND_SUFFIX)
- || field.endsWith(JSON_NAVIGATION_SUFFIX)
- || field.endsWith(JSON_MEDIA_SUFFIX)
- || field.endsWith(JSON_EDITLINK_NAME)) {
+ if (field.endsWith(Constants.get(version, ConstantKey.JSON_NAVIGATION_BIND_SUFFIX))
+ || field.endsWith(Constants.get(version, ConstantKey.JSON_NAVIGATION_SUFFIX))
+ || field.endsWith(Constants.get(version, ConstantKey.JSON_MEDIA_SUFFIX))
+ || field.endsWith(Constants.get(version, ConstantKey.JSON_EDITLINK_NAME))) {
if (field.indexOf('@') > 0) {
links.add(field.substring(0, field.indexOf('@')));
} else {
@@ -113,7 +111,7 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
while (fieldIter.hasNext()) {
final Map.Entry<String, JsonNode> field = fieldIter.next();
- if (field.getKey().endsWith(JSON_NAVIGATION_BIND_SUFFIX)) {
+ if (field.getKey().endsWith(Constants.get(version, ConstantKey.JSON_NAVIGATION_BIND_SUFFIX))) {
final String title = field.getKey().substring(0, field.getKey().indexOf('@'));
final List<String> hrefs = new ArrayList<String>();
if (field.getValue().isArray()) {
@@ -148,17 +146,17 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
if (links != null) {
for (String linkTitle : links.getLinkNames()) {
// normalize link
- srcNode.remove(linkTitle + JSON_NAVIGATION_BIND_SUFFIX);
+ srcNode.remove(linkTitle + Constants.get(version, ConstantKey.JSON_NAVIGATION_BIND_SUFFIX));
srcNode.set(
- linkTitle + JSON_NAVIGATION_SUFFIX,
+ linkTitle + Constants.get(version, ConstantKey.JSON_NAVIGATION_SUFFIX),
new TextNode(String.format("%s(%s)/%s", entitySetName, entityKey, linkTitle)));
}
for (String linkTitle : links.getInlineNames()) {
// normalize link if exist; declare a new one if missing
- srcNode.remove(linkTitle + JSON_NAVIGATION_BIND_SUFFIX);
+ srcNode.remove(linkTitle + Constants.get(version, ConstantKey.JSON_NAVIGATION_BIND_SUFFIX));
srcNode.set(
- linkTitle + JSON_NAVIGATION_SUFFIX,
+ linkTitle + Constants.get(version, ConstantKey.JSON_NAVIGATION_SUFFIX),
new TextNode(String.format("%s(%s)/%s", entitySetName, entityKey, linkTitle)));
// remove inline
@@ -170,8 +168,8 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
}
srcNode.set(
- JSON_EDITLINK_NAME,
- new TextNode(Constants.DEFAULT_SERVICE_URL + entitySetName + "(" + entityKey + ")"));
+ Constants.get(version, ConstantKey.JSON_EDITLINK_NAME), new TextNode(
+ Constants.get(version, ConstantKey.DEFAULT_SERVICE_URL) + entitySetName + "(" + entityKey + ")"));
return IOUtils.toInputStream(srcNode.toString());
}
@@ -190,8 +188,9 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
final String entitySetName, final String entityId, final List<String> path, final String edmType)
throws Exception {
- final InputStream src =
- fsManager.readFile(Commons.getEntityBasePath(entitySetName, entityId) + ENTITY, Accept.JSON_FULLMETA);
+ final InputStream src = fsManager.readFile(
+ Commons.getEntityBasePath(entitySetName, entityId) + Constants.get(version, ConstantKey.ENTITY),
+ Accept.JSON_FULLMETA);
final ObjectMapper mapper = new ObjectMapper();
final JsonNode srcNode = mapper.readTree(src);
@@ -199,7 +198,9 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
final ObjectNode propertyNode = new ObjectNode(JsonNodeFactory.instance);
if (StringUtils.isNotBlank(edmType)) {
- propertyNode.put(JSON_ODATAMETADATA_NAME, ODATA_METADATA_PREFIX + edmType);
+ propertyNode.put(Constants.get(
+ version, ConstantKey.JSON_ODATAMETADATA_NAME),
+ Constants.get(version, ConstantKey.ODATA_METADATA_PREFIX) + edmType);
}
JsonNode jsonNode = getProperty(srcNode, path);
@@ -241,7 +242,7 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
final ObjectMapper mapper = new ObjectMapper();
final JsonNode srcNode = mapper.readTree(src);
- ((ObjectNode) srcNode).put(ODATA_COUNT_NAME, count);
+ ((ObjectNode) srcNode).put(Constants.get(version, ConstantKey.ODATA_COUNT_NAME), count);
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
mapper.writeValue(bos, srcNode);
@@ -258,14 +259,14 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
final ObjectNode res;
- final JsonNode value = node.get(JSON_VALUE_NAME);
+ final JsonNode value = node.get(Constants.get(version, ConstantKey.JSON_VALUE_NAME));
if (value.isArray()) {
res = mapper.createObjectNode();
res.set("value", value);
- final JsonNode next = node.get(JSON_NEXTLINK_NAME);
+ final JsonNode next = node.get(Constants.get(version, ConstantKey.JSON_NEXTLINK_NAME));
if (next != null) {
- res.set(JSON_NEXTLINK_NAME, next);
+ res.set(Constants.get(version, ConstantKey.JSON_NEXTLINK_NAME), next);
}
} else {
res = (ObjectNode) value;
@@ -286,18 +287,18 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
final ObjectNode srcNode = (ObjectNode) mapper.readTree(src);
final Set<String> retain = new HashSet<String>();
- retain.add(JSON_ID_NAME);
- retain.add(JSON_TYPE_NAME);
- retain.add(JSON_EDITLINK_NAME);
- retain.add(JSON_NEXTLINK_NAME);
- retain.add(JSON_ODATAMETADATA_NAME);
- retain.add(JSON_VALUE_NAME);
+ retain.add(Constants.get(version, ConstantKey.JSON_ID_NAME));
+ retain.add(Constants.get(version, ConstantKey.JSON_TYPE_NAME));
+ retain.add(Constants.get(version, ConstantKey.JSON_EDITLINK_NAME));
+ retain.add(Constants.get(version, ConstantKey.JSON_NEXTLINK_NAME));
+ retain.add(Constants.get(version, ConstantKey.JSON_ODATAMETADATA_NAME));
+ retain.add(Constants.get(version, ConstantKey.JSON_VALUE_NAME));
for (String name : propertyNames) {
retain.add(name);
- retain.add(name + JSON_NAVIGATION_SUFFIX);
- retain.add(name + JSON_MEDIA_SUFFIX);
- retain.add(name + JSON_TYPE_SUFFIX);
+ retain.add(name + Constants.get(version, ConstantKey.JSON_NAVIGATION_SUFFIX));
+ retain.add(name + Constants.get(version, ConstantKey.JSON_MEDIA_SUFFIX));
+ retain.add(name + Constants.get(version, ConstantKey.JSON_TYPE_SUFFIX));
}
srcNode.retain(retain);
@@ -344,10 +345,11 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
bos.write("]".getBytes());
}
- node.set(JSON_VALUE_NAME, mapper.readTree(new ByteArrayInputStream(bos.toByteArray())));
+ node.set(Constants.get(version, ConstantKey.JSON_VALUE_NAME),
+ mapper.readTree(new ByteArrayInputStream(bos.toByteArray())));
if (StringUtils.isNotBlank(next)) {
- node.set(JSON_NEXTLINK_NAME, new TextNode(next));
+ node.set(Constants.get(version, ConstantKey.JSON_NEXTLINK_NAME), new TextNode(next));
}
return IOUtils.toInputStream(node.toString());
@@ -362,15 +364,15 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
final ObjectNode toBeChangedNode = (ObjectNode) mapper.readTree(toBeChanged);
final ObjectNode replacementNode = (ObjectNode) mapper.readTree(replacement);
- if (toBeChangedNode.get(linkName + JSON_NAVIGATION_SUFFIX) == null) {
+ if (toBeChangedNode.get(linkName + Constants.get(version, ConstantKey.JSON_NAVIGATION_SUFFIX)) == null) {
throw new NotFoundException();
}
- toBeChangedNode.set(linkName, replacementNode.get(JSON_VALUE_NAME));
+ toBeChangedNode.set(linkName, replacementNode.get(Constants.get(version, ConstantKey.JSON_VALUE_NAME)));
- final JsonNode next = replacementNode.get(linkName + JSON_NEXTLINK_NAME);
+ final JsonNode next = replacementNode.get(linkName + Constants.get(version, ConstantKey.JSON_NEXTLINK_NAME));
if (next != null) {
- toBeChangedNode.set(linkName + JSON_NEXTLINK_SUFFIX, next);
+ toBeChangedNode.set(linkName + Constants.get(version, ConstantKey.JSON_NEXTLINK_SUFFIX), next);
}
return IOUtils.toInputStream(toBeChangedNode.toString());
@@ -437,7 +439,7 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
}
}
- final JsonNode next = srcNode.get(JSON_NEXTLINK_NAME);
+ final JsonNode next = srcNode.get(Constants.get(version, ConstantKey.JSON_NEXTLINK_NAME));
return new SimpleEntry<String, List<String>>(next == null ? null : next.asText(), links);
}
@@ -449,7 +451,7 @@ public abstract class AbstractJSONUtilities extends AbstractUtilities {
final ObjectNode srcNode = (ObjectNode) mapper.readTree(content);
IOUtils.closeQuietly(content);
- srcNode.set(JSON_EDITLINK_NAME, new TextNode(href));
+ srcNode.set(Constants.get(version, ConstantKey.JSON_EDITLINK_NAME), new TextNode(href));
return IOUtils.toInputStream(srcNode.toString());
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/fit/src/main/java/org/apache/olingo/fit/utils/AbstractUtilities.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/AbstractUtilities.java b/fit/src/main/java/org/apache/olingo/fit/utils/AbstractUtilities.java
index 7b74b62..5b23366 100644
--- a/fit/src/main/java/org/apache/olingo/fit/utils/AbstractUtilities.java
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/AbstractUtilities.java
@@ -19,7 +19,6 @@
package org.apache.olingo.fit.utils;
import static org.apache.olingo.fit.utils.Commons.sequence;
-import static org.apache.olingo.fit.utils.Constants.*;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
@@ -134,7 +133,8 @@ public abstract class AbstractUtilities {
// 0. Get the path
// -----------------------------------------
final String path =
- entitySetName + File.separatorChar + Commons.getEntityKey(key) + File.separatorChar + ENTITY;
+ entitySetName + File.separatorChar + Commons.getEntityKey(key) + File.separatorChar
+ + Constants.get(version, ConstantKey.ENTITY);
// -----------------------------------------
// -----------------------------------------
@@ -229,7 +229,7 @@ public abstract class AbstractUtilities {
// -----------------------------------------
final FileObject fo = fsManager.putInMemory(
normalizedEntity,
- fsManager.getAbsolutePath(path + ENTITY, getDefaultFormat()));
+ fsManager.getAbsolutePath(path + Constants.get(version, ConstantKey.ENTITY), getDefaultFormat()));
// -----------------------------------------
// -----------------------------------------
@@ -282,7 +282,8 @@ public abstract class AbstractUtilities {
// -----------------------------------------
// 1. save the media entity value
// -----------------------------------------
- fsManager.putInMemory(is, fsManager.getAbsolutePath(path + MEDIA_CONTENT_FILENAME, null));
+ fsManager.putInMemory(is, fsManager.getAbsolutePath(path
+ + Constants.get(version, ConstantKey.MEDIA_CONTENT_FILENAME), null));
IOUtils.closeQuietly(is);
// -----------------------------------------
@@ -291,13 +292,13 @@ public abstract class AbstractUtilities {
// -----------------------------------------
final String entityURI = Commons.getEntityURI(entitySetName, entityKey);
String entity = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
- + "<entry xml:base=\"" + DEFAULT_SERVICE_URL + "\" "
+ + "<entry xml:base=\"" + Constants.get(version, ConstantKey.DEFAULT_SERVICE_URL) + "\" "
+ "xmlns=\"http://www.w3.org/2005/Atom\" "
+ "xmlns:d=\"http://schemas.microsoft.com/ado/2007/08/dataservices\" "
+ "xmlns:m=\"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\" "
+ "xmlns:georss=\"http://www.georss.org/georss\" "
+ "xmlns:gml=\"http://www.opengis.net/gml\">"
- + "<id>" + DEFAULT_SERVICE_URL + entityURI + "</id>"
+ + "<id>" + Constants.get(version, ConstantKey.DEFAULT_SERVICE_URL) + entityURI + "</id>"
+ "<category term=\"Microsoft.Test.OData.Services.AstoriaDefaultService." + entitySetName + "\" "
+ "scheme=\"http://schemas.microsoft.com/ado/2007/08/dataservices/scheme\" />"
+ "<link rel=\"edit\" title=\"Car\" href=\"" + entityURI + "\" />"
@@ -310,16 +311,18 @@ public abstract class AbstractUtilities {
+ "</entry>";
fsManager.putInMemory(
- IOUtils.toInputStream(entity), fsManager.getAbsolutePath(path + ENTITY, Accept.ATOM));
+ IOUtils.toInputStream(entity),
+ fsManager.getAbsolutePath(path + Constants.get(version, ConstantKey.ENTITY), Accept.ATOM));
// -----------------------------------------
// -----------------------------------------
// 3. save entity as json
// -----------------------------------------
entity = "{"
- + "\"odata.metadata\": \"" + DEFAULT_SERVICE_URL + "/$metadata#" + entitySetName + "/@Element\","
+ + "\"odata.metadata\": \"" + Constants.get(version, ConstantKey.DEFAULT_SERVICE_URL)
+ + "/$metadata#" + entitySetName + "/@Element\","
+ "\"odata.type\": \"Microsoft.Test.OData.Services.AstoriaDefaultService." + entitySetName + "\","
- + "\"odata.id\": \"" + DEFAULT_SERVICE_URL + entityURI + "\","
+ + "\"odata.id\": \"" + Constants.get(version, ConstantKey.DEFAULT_SERVICE_URL) + entityURI + "\","
+ "\"odata.editLink\": \"" + entityURI + "\","
+ "\"odata.mediaEditLink\": \"" + entityURI + "/$value\","
+ "\"odata.mediaReadLink\": \"" + entityURI + "/$value\","
@@ -328,7 +331,8 @@ public abstract class AbstractUtilities {
+ "\"Description\": null" + "}";
fsManager.putInMemory(
- IOUtils.toInputStream(entity), fsManager.getAbsolutePath(path + ENTITY, Accept.JSON_FULLMETA));
+ IOUtils.toInputStream(entity), fsManager.getAbsolutePath(path + Constants.get(version, ConstantKey.ENTITY),
+ Accept.JSON_FULLMETA));
// -----------------------------------------
return readEntity(entitySetName, entityKey, getDefaultFormat()).getValue();
@@ -376,7 +380,7 @@ public abstract class AbstractUtilities {
final InputStream entity, final String etag, final Accept accept, final Response.Status status) {
final Response.ResponseBuilder builder = Response.ok();
if (version == ODataVersion.v3) {
- builder.header(ODATA_SERVICE_VERSION, version.getVersion() + ";");
+ builder.header(Constants.get(version, ConstantKey.ODATA_SERVICE_VERSION), version.getVersion() + ";");
}
if (StringUtils.isNotBlank(etag)) {
@@ -426,7 +430,7 @@ public abstract class AbstractUtilities {
final Response.ResponseBuilder builder = Response.serverError();
if (version == ODataVersion.v3) {
- builder.header(ODATA_SERVICE_VERSION, version.getVersion() + ";");
+ builder.header(Constants.get(version, ConstantKey.ODATA_SERVICE_VERSION), version + ";");
}
final String ext;
@@ -612,7 +616,7 @@ public abstract class AbstractUtilities {
final String basePath =
entitySetName + File.separatorChar + Commons.getEntityKey(entityId) + File.separatorChar
- + LINKS_FILE_PATH + File.separatorChar;
+ + Constants.get(version, ConstantKey.LINKS_FILE_PATH) + File.separatorChar;
final LinkInfo linkInfo = new LinkInfo(fsManager.readFile(basePath + linkName, accept));
linkInfo.setEtag(Commons.getETag(basePath, version));
@@ -631,7 +635,8 @@ public abstract class AbstractUtilities {
final String entitySetName, final String entityId, final String name, final InputStream value)
throws IOException {
final FileObject fo = fsManager.putInMemory(value, fsManager.getAbsolutePath(
- Commons.getEntityBasePath(entitySetName, entityId) + (name == null ? MEDIA_CONTENT_FILENAME : name), null));
+ Commons.getEntityBasePath(entitySetName, entityId)
+ + (name == null ? Constants.get(version, ConstantKey.MEDIA_CONTENT_FILENAME) : name), null));
return fo.getContent().getInputStream();
}
@@ -644,7 +649,7 @@ public abstract class AbstractUtilities {
final String entitySetName, final String entityId, final String name) {
final String basePath = Commons.getEntityBasePath(entitySetName, entityId);
return new SimpleEntry<String, InputStream>(basePath, fsManager.readFile(basePath
- + (name == null ? MEDIA_CONTENT_FILENAME : name)));
+ + (name == null ? Constants.get(version, ConstantKey.MEDIA_CONTENT_FILENAME) : name)));
}
public Map.Entry<String, InputStream> readEntity(
@@ -654,7 +659,8 @@ public abstract class AbstractUtilities {
}
final String basePath = Commons.getEntityBasePath(entitySetName, entityId);
- return new SimpleEntry<String, InputStream>(basePath, fsManager.readFile(basePath + ENTITY, accept));
+ return new SimpleEntry<String, InputStream>(basePath,
+ fsManager.readFile(basePath + Constants.get(version, ConstantKey.ENTITY), accept));
}
public InputStream expandEntity(
@@ -719,15 +725,16 @@ public abstract class AbstractUtilities {
? Accept.XML : accept.getExtension().equals(Accept.JSON.getExtension()) ? Accept.JSON_FULLMETA : accept;
// read atom
- InputStream stream = fsManager.readFile(basePath + ENTITY, acceptType);
+ InputStream stream = fsManager.readFile(basePath + Constants.get(version, ConstantKey.ENTITY), acceptType);
// change atom
stream = replaceProperty(stream, changes, path, justValue);
// save atom
- fsManager.putInMemory(stream, fsManager.getAbsolutePath(basePath + ENTITY, acceptType));
+ fsManager.putInMemory(stream,
+ fsManager.getAbsolutePath(basePath + Constants.get(version, ConstantKey.ENTITY), acceptType));
- return fsManager.readFile(basePath + ENTITY, acceptType);
+ return fsManager.readFile(basePath + Constants.get(version, ConstantKey.ENTITY), acceptType);
}
public InputStream deleteProperty(
@@ -741,15 +748,16 @@ public abstract class AbstractUtilities {
? Accept.XML : accept.getExtension().equals(Accept.JSON.getExtension()) ? Accept.JSON_FULLMETA : accept;
// read atom
- InputStream stream = fsManager.readFile(basePath + ENTITY, acceptType);
+ InputStream stream = fsManager.readFile(basePath + Constants.get(version, ConstantKey.ENTITY), acceptType);
// change atom
stream = deleteProperty(stream, path);
// save atom
- fsManager.putInMemory(stream, fsManager.getAbsolutePath(basePath + ENTITY, acceptType));
+ fsManager.putInMemory(stream,
+ fsManager.getAbsolutePath(basePath + Constants.get(version, ConstantKey.ENTITY), acceptType));
- return fsManager.readFile(basePath + ENTITY, acceptType);
+ return fsManager.readFile(basePath + Constants.get(version, ConstantKey.ENTITY), acceptType);
}
public abstract InputStream readEntities(
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/fit/src/main/java/org/apache/olingo/fit/utils/AbstractXMLUtilities.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/AbstractXMLUtilities.java b/fit/src/main/java/org/apache/olingo/fit/utils/AbstractXMLUtilities.java
index cef564a..e811388 100644
--- a/fit/src/main/java/org/apache/olingo/fit/utils/AbstractXMLUtilities.java
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/AbstractXMLUtilities.java
@@ -18,8 +18,6 @@
*/
package org.apache.olingo.fit.utils;
-import static org.apache.olingo.fit.utils.Constants.*;
-
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
@@ -154,13 +152,16 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
attributes.add(eventFactory.createAttribute(new QName("title"), link));
attributes.add(eventFactory.createAttribute(new QName("href"),
Commons.getLinksURI(version, entitySetName, entitykey, link)));
- attributes.add(eventFactory.createAttribute(new QName("rel"), Constants.ATOM_LINK_REL + link));
+ attributes.add(eventFactory.createAttribute(new QName("rel"),
+ Constants.get(version, ConstantKey.ATOM_LINK_REL) + link));
attributes.add(eventFactory.createAttribute(new QName("type"),
- Commons.linkInfo.get(version).isFeed(entitySetName, link) ? Constants.ATOM_LINK_FEED
- : Constants.ATOM_LINK_ENTRY));
+ Commons.linkInfo.get(version).isFeed(entitySetName, link)
+ ? Constants.get(version, ConstantKey.ATOM_LINK_FEED)
+ : Constants.get(version, ConstantKey.ATOM_LINK_ENTRY)));
- writer.add(eventFactory.createStartElement(new QName(LINK), attributes.iterator(), null));
- writer.add(eventFactory.createEndElement(new QName(LINK), null));
+ writer.add(eventFactory.createStartElement(
+ new QName(Constants.get(version, ConstantKey.LINK)), attributes.iterator(), null));
+ writer.add(eventFactory.createEndElement(new QName(Constants.get(version, ConstantKey.LINK)), null));
}
writer.add(entry.getValue().getContentReader());
@@ -190,7 +191,8 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
while (true) {
final Map.Entry<Integer, XmlElement> linkInfo =
- extractElement(reader, null, Collections.<String>singletonList(LINK), startDepth, 2, 2);
+ extractElement(reader, null,
+ Collections.<String>singletonList(Constants.get(version, ConstantKey.LINK)), startDepth, 2, 2);
startDepth = linkInfo.getKey();
@@ -228,7 +230,8 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
while (true) {
// a. search for link with type attribute equals to "application/atom+xml;type=entry/feed"
final Map.Entry<Integer, XmlElement> linkInfo = extractElement(
- reader, null, Collections.<String>singletonList(LINK), filter, true, startDepth, 2, 2);
+ reader, null, Collections.<String>singletonList(Constants.get(version, ConstantKey.LINK)),
+ filter, true, startDepth, 2, 2);
final XmlElement link = linkInfo.getValue();
startDepth = linkInfo.getKey();
@@ -239,7 +242,8 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
try {
final XmlElement inlineElement =
- extractElement(link.getContentReader(), null, Collections.<String>singletonList(INLINE), 0, -1, -1).
+ extractElement(link.getContentReader(), null,
+ Collections.<String>singletonList(Constants.get(version, ConstantKey.INLINE)), 0, -1, -1).
getValue();
final XMLEventReader inlineReader = inlineElement.getContentReader();
@@ -307,7 +311,8 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
while (true) {
// a. search for link with type attribute equals to "application/atom+xml;type=entry/feed"
linkInfo = extractElement(
- reader, writer, Collections.<String>singletonList(LINK), filter, true,
+ reader, writer,
+ Collections.<String>singletonList(Constants.get(version, ConstantKey.LINK)), filter, true,
linkInfo == null ? 0 : linkInfo.getKey(), 2, 2);
final XmlElement link = linkInfo.getValue();
@@ -342,7 +347,7 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
final InputStream content = addEditLink(
new ByteArrayInputStream(tmpBos.toByteArray()),
entitySetName,
- Constants.DEFAULT_SERVICE_URL + entitySetName + "(" + entityKey + ")");
+ Constants.get(version, ConstantKey.DEFAULT_SERVICE_URL) + entitySetName + "(" + entityKey + ")");
// -----------------------------------------
// -----------------------------------------
@@ -351,7 +356,7 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
return addAtomContent(
content,
entitySetName,
- Constants.DEFAULT_SERVICE_URL + entitySetName + "(" + entityKey + ")");
+ Constants.get(version, ConstantKey.DEFAULT_SERVICE_URL) + entitySetName + "(" + entityKey + ")");
// -----------------------------------------
}
@@ -439,7 +444,7 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
try {
// check edit link existence
- extractElement(reader, writer, Collections.<String>singletonList(LINK),
+ extractElement(reader, writer, Collections.<String>singletonList(Constants.get(version, ConstantKey.LINK)),
Collections.<Map.Entry<String, String>>singletonList(
new AbstractMap.SimpleEntry<String, String>("rel", "edit")), false, 0, -1, -1);
@@ -518,7 +523,8 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
} else {
try {
final XmlElement entryElement =
- extractElement(reader, writer, Collections.<String>singletonList(PROPERTIES), 0, 2, 3).getValue();
+ extractElement(reader, writer, Collections.<String>singletonList(
+ Constants.get(version, ConstantKey.PROPERTIES)), 0, 2, 3).getValue();
addAtomElement(
IOUtils.toInputStream("<content type=\"application/xml\">"),
@@ -564,9 +570,11 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
public int countAllElements(final String entitySetName) throws Exception {
final String basePath = entitySetName + File.separatorChar;
- int count = countFeedElements(fsManager.readFile(basePath + FEED, Accept.XML), "entry");
+ int count = countFeedElements(fsManager.readFile(basePath + Constants.get(version, ConstantKey.FEED), Accept.XML),
+ "entry");
- final String skipTokenDirPath = fsManager.getAbsolutePath(basePath + SKIP_TOKEN, null);
+ final String skipTokenDirPath = fsManager.getAbsolutePath(basePath + Constants.get(version, ConstantKey.SKIP_TOKEN),
+ null);
try {
@@ -575,7 +583,8 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
for (FileObject file : files) {
count += countFeedElements(fsManager.readFile(
- basePath + SKIP_TOKEN + File.separatorChar + file.getName().getBaseName(), null), "entry");
+ basePath + Constants.get(version, ConstantKey.SKIP_TOKEN) + File.separatorChar
+ + file.getName().getBaseName(), null), "entry");
}
} catch (FileSystemException fse) {
LOG.debug("Resource path '{}' not found", skipTokenDirPath);
@@ -739,7 +748,7 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
final List<String> pathElements = new ArrayList<String>();
for (String element : path) {
- pathElements.add(ATOM_PROPERTY_PREFIX + element);
+ pathElements.add(Constants.get(version, ConstantKey.ATOM_PROPERTY_PREFIX) + element);
}
final XMLEventReader reader = getEventReader(is);
@@ -770,28 +779,30 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
while (reader.hasNext()) {
final XMLEvent event = reader.nextEvent();
if (event.getEventType() == XMLStreamConstants.START_ELEMENT
- && LINK.equals(event.asStartElement().getName().getLocalPart())
+ && Constants.get(version, ConstantKey.LINK).equals(event.asStartElement().getName().getLocalPart())
&& !fieldToBeSaved.contains(
event.asStartElement().getAttributeByName(new QName("title")).getValue())
&& !"edit".equals(event.asStartElement().getAttributeByName(new QName("rel")).getValue())) {
writeCurrent = false;
} else if (event.getEventType() == XMLStreamConstants.END_ELEMENT
- && LINK.equals(event.asEndElement().getName().getLocalPart())) {
+ && Constants.get(version, ConstantKey.LINK).equals(event.asEndElement().getName().getLocalPart())) {
writeNext = true;
} else if (event.getEventType() == XMLStreamConstants.START_ELEMENT
- && (PROPERTIES).equals(event.asStartElement().getName().getLocalPart())) {
+ && (Constants.get(version, ConstantKey.PROPERTIES)).equals(
+ event.asStartElement().getName().getLocalPart())) {
writeCurrent = true;
writeNext = false;
inProperties = true;
} else if (event.getEventType() == XMLStreamConstants.END_ELEMENT
- && (PROPERTIES).equals(event.asEndElement().getName().getLocalPart())) {
+ && (Constants.get(version, ConstantKey.PROPERTIES)).equals(
+ event.asEndElement().getName().getLocalPart())) {
writeCurrent = true;
} else if (inProperties) {
if (event.getEventType() == XMLStreamConstants.START_ELEMENT) {
final String elementName = event.asStartElement().getName().getLocalPart();
for (String propertyName : propertyNames) {
- if ((ATOM_PROPERTY_PREFIX + propertyName.trim()).equals(elementName)) {
+ if ((Constants.get(version, ConstantKey.ATOM_PROPERTY_PREFIX) + propertyName.trim()).equals(elementName)) {
writeCurrent = true;
found.remove(propertyName);
currentName = propertyName;
@@ -800,7 +811,7 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
} else if (event.getEventType() == XMLStreamConstants.END_ELEMENT
&& StringUtils.isNotBlank(currentName)
- && (ATOM_PROPERTY_PREFIX + currentName.trim()).equals(
+ && (Constants.get(version, ConstantKey.ATOM_PROPERTY_PREFIX) + currentName.trim()).equals(
event.asEndElement().getName().getLocalPart())) {
writeNext = false;
currentName = null;
@@ -846,13 +857,14 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
// build a feed
bos.write("<?xml version=\"1.0\" encoding=\"utf-8\"?>".getBytes());
- bos.write(("<feed xml:base=\"" + DEFAULT_SERVICE_URL + "\" "
+ bos.write(("<feed xml:base=\"" + Constants.get(version, ConstantKey.DEFAULT_SERVICE_URL) + "\" "
+ "xmlns=\"http://www.w3.org/2005/Atom\" "
+ "xmlns:d=\"http://schemas.microsoft.com/ado/2007/08/dataservices\" "
+ "xmlns:m=\"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata\">")
.getBytes());
- bos.write(("<id>" + DEFAULT_SERVICE_URL + "entityset(entityid)/" + linkName + "</id>").getBytes());
+ bos.write(("<id>" + Constants.get(version, ConstantKey.DEFAULT_SERVICE_URL) + "entityset(entityid)/" + linkName
+ + "</id>").getBytes());
bos.write(("<title type=\"text\">" + linkName + "</title>").getBytes());
bos.write("<updated>2014-03-03T13:40:49Z</updated>".getBytes());
@@ -901,7 +913,8 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
XMLEventReader reader = getEventReader(new ByteArrayInputStream(bos.toByteArray()));
final Map.Entry<Integer, XmlElement> propertyElement =
- extractElement(reader, null, Collections.<String>singletonList(PROPERTIES), 0, 2, 3);
+ extractElement(reader, null,
+ Collections.<String>singletonList(Constants.get(version, ConstantKey.PROPERTIES)), 0, 2, 3);
reader.close();
reader = propertyElement.getValue().getContentReader();
@@ -924,9 +937,11 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
int pos = 0;
while (true) {
final Map.Entry<Integer, XmlElement> linkElement =
- extractElement(reader, null, Collections.<String>singletonList(LINK), pos, 2, 2);
+ extractElement(reader, null,
+ Collections.<String>singletonList(Constants.get(version, ConstantKey.LINK)), pos, 2, 2);
- res.put("[LINK]" + linkElement.getValue().getStart().getAttributeByName(new QName("title")).getValue(),
+ res.put("[Constants.get(version, ConstantKey.LINK)]"
+ + linkElement.getValue().getStart().getAttributeByName(new QName("title")).getValue(),
linkElement.getValue().toStream());
pos = linkElement.getKey();
@@ -952,7 +967,8 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
// add property changes
// ---------------------------------
Map.Entry<Integer, XmlElement> propertyElement =
- extractElement(reader, writer, Collections.<String>singletonList(PROPERTIES), 0, 2, 3);
+ extractElement(reader, writer,
+ Collections.<String>singletonList(Constants.get(version, ConstantKey.PROPERTIES)), 0, 2, 3);
writer.flush();
@@ -981,7 +997,7 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
}
for (Map.Entry<String, InputStream> remains : properties.entrySet()) {
- if (!remains.getKey().startsWith("[LINK]")) {
+ if (!remains.getKey().startsWith("[Constants.get(version, ConstantKey.LINK)]")) {
pwriter.append(IOUtils.toString(remains.getValue()));
IOUtils.closeQuietly(remains.getValue());
}
@@ -1009,7 +1025,7 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
// remove existent links
for (Map.Entry<String, InputStream> remains : properties.entrySet()) {
- if (remains.getKey().startsWith("[LINK]")) {
+ if (remains.getKey().startsWith("[Constants.get(version, ConstantKey.LINK)]")) {
reader = getEventReader(new ByteArrayInputStream(bos.toByteArray()));
bos.reset();
@@ -1018,7 +1034,7 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
try {
final String linkName = remains.getKey().substring(remains.getKey().indexOf("]") + 1);
- extractElement(reader, writer, Collections.<String>singletonList(LINK),
+ extractElement(reader, writer, Collections.<String>singletonList(Constants.get(version, ConstantKey.LINK)),
Collections.<Map.Entry<String, String>>singleton(new SimpleEntry<String, String>("title", linkName)),
false, 0, 2, 2);
@@ -1038,14 +1054,15 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
bos.reset();
writer = getEventWriter(bos);
- propertyElement = extractElement(reader, writer, Collections.<String>singletonList(CONTENT), 0, 2, 2);
+ propertyElement = extractElement(reader, writer,
+ Collections.<String>singletonList(Constants.get(version, ConstantKey.CONTENT)), 0, 2, 2);
writer.flush();
pbos.reset();
pwriter = new OutputStreamWriter(pbos);
for (Map.Entry<String, InputStream> remains : properties.entrySet()) {
- if (remains.getKey().startsWith("[LINK]")) {
+ if (remains.getKey().startsWith("[Constants.get(version, ConstantKey.LINK)]")) {
pwriter.append(IOUtils.toString(remains.getValue()));
IOUtils.closeQuietly(remains.getValue());
}
@@ -1084,7 +1101,8 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
try {
final XmlElement linkElement =
- extractElement(reader, writer, Collections.<String>singletonList(LINK),
+ extractElement(reader, writer,
+ Collections.<String>singletonList(Constants.get(version, ConstantKey.LINK)),
Collections.<Map.Entry<String, String>>singletonList(new SimpleEntry<String, String>("title", linkName)),
false, 0, -1, -1).getValue();
writer.add(linkElement.getStart());
@@ -1116,23 +1134,26 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
public String getEdmTypeFromAtom(final String entitySetName, final String entityId, final List<String> path)
throws Exception {
- InputStream src = fsManager.readFile(Commons.getEntityBasePath(entitySetName, entityId) + ENTITY, Accept.XML);
+ InputStream src = fsManager.readFile(Commons.getEntityBasePath(entitySetName, entityId)
+ + Constants.get(version, ConstantKey.ENTITY), Accept.XML);
final List<String> atomPathElements = new ArrayList<String>();
for (String element : path) {
- atomPathElements.add(ATOM_PROPERTY_PREFIX + element);
+ atomPathElements.add(Constants.get(version, ConstantKey.ATOM_PROPERTY_PREFIX) + element);
}
final Map.Entry<Integer, XmlElement> prop = extractElement(getEventReader(src), null, atomPathElements, 0, 3, 4);
IOUtils.closeQuietly(src);
- final Attribute type = prop.getValue().getStart().getAttributeByName(new QName(TYPE));
+
+ final Attribute type =
+ prop.getValue().getStart().getAttributeByName(new QName(Constants.get(version, ConstantKey.TYPE)));
final String edmType;
if (type == null) {
- edmType = Constants.ATOM_DEF_TYPE;
+ edmType = Constants.get(version, ConstantKey.ATOM_DEF_TYPE);
} else {
edmType = type.getValue();
}
@@ -1189,11 +1210,12 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
final List<String> pathElements = new ArrayList<String>();
for (String element : path) {
- pathElements.add(ATOM_PROPERTY_PREFIX + element);
+ pathElements.add(Constants.get(version, ConstantKey.ATOM_PROPERTY_PREFIX) + element);
}
final InputStream src =
- fsManager.readFile(Commons.getEntityBasePath(entitySetName, entityId) + ENTITY, Accept.XML);
+ fsManager.readFile(Commons.getEntityBasePath(entitySetName, entityId)
+ + Constants.get(version, ConstantKey.ENTITY), Accept.XML);
final XMLEventReader reader = getEventReader(src);
final XmlElement property = extractElement(reader, null, pathElements, 0, 3, 4).getValue();
@@ -1208,21 +1230,17 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
writer.add(eventFactory.createStartDocument("UTF-8", "1.0"));
writer.add(property.getStart());
- if (version == ODataVersion.v4) {
-
- if (property.getStart().getAttributeByName(new QName(ATOM_DATASERVICE_NS)) == null) {
- writer.add(eventFactory.createNamespace(ATOM_PROPERTY_PREFIX.substring(0, 1), V4_DATASERVICES_NS));
- }
- if (property.getStart().getAttributeByName(new QName(ATOM_METADATA_NS)) == null) {
- writer.add(eventFactory.createNamespace(ATOM_METADATA_PREFIX.substring(0, 1), V4_METADATA_NS));
- }
- } else {
- if (property.getStart().getAttributeByName(new QName(ATOM_DATASERVICE_NS)) == null) {
- writer.add(eventFactory.createNamespace(ATOM_PROPERTY_PREFIX.substring(0, 1), V3_DATASERVICES_NS));
- }
- if (property.getStart().getAttributeByName(new QName(ATOM_METADATA_NS)) == null) {
- writer.add(eventFactory.createNamespace(ATOM_METADATA_PREFIX.substring(0, 1), V3_METADATA_NS));
- }
+ if (property.getStart().getAttributeByName(new QName(
+ Constants.get(version, ConstantKey.ATOM_DATASERVICE_NS))) == null) {
+ writer.add(eventFactory.createNamespace(
+ Constants.get(version, ConstantKey.ATOM_PROPERTY_PREFIX).substring(0, 1),
+ Constants.get(version, ConstantKey.DATASERVICES_NS)));
+ }
+ if (property.getStart().getAttributeByName(new QName(
+ Constants.get(version, ConstantKey.ATOM_METADATA_NS))) == null) {
+ writer.add(eventFactory.createNamespace(
+ Constants.get(version, ConstantKey.ATOM_METADATA_PREFIX).substring(0, 1),
+ Constants.get(version, ConstantKey.METADATA_NS)));
}
writer.add(property.getContentReader());
@@ -1242,7 +1260,7 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
final List<String> pathElements = new ArrayList<String>();
for (String element : path) {
- pathElements.add(ATOM_PROPERTY_PREFIX + element);
+ pathElements.add(Constants.get(version, ConstantKey.ATOM_PROPERTY_PREFIX) + element);
}
final XMLEventReader reader = getEventReader(src);
@@ -1258,7 +1276,16 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
final XMLEventReader changesReader = new XMLEventReaderWrapper(replacement);
- writer.add(changesReader);
+ while (changesReader.hasNext()) {
+ final XMLEvent event = changesReader.nextEvent();
+ if (event.isStartElement() && event.asStartElement().getName().equals(element.getValue().getStart().getName())) {
+ writer.add(element.getValue().getStart());
+ writer.add(changesReader);
+ } else {
+ writer.add(event);
+ }
+ }
+
changesReader.close();
IOUtils.closeQuietly(replacement);
@@ -1283,7 +1310,7 @@ public abstract class AbstractXMLUtilities extends AbstractUtilities {
final List<String> pathElements = new ArrayList<String>();
for (String element : path) {
- pathElements.add(ATOM_PROPERTY_PREFIX + element);
+ pathElements.add(Constants.get(version, ConstantKey.ATOM_PROPERTY_PREFIX) + element);
}
final XMLEventReader reader = getEventReader(src);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/fit/src/main/java/org/apache/olingo/fit/utils/Commons.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/Commons.java b/fit/src/main/java/org/apache/olingo/fit/utils/Commons.java
index 4cf992a..c0031f1 100644
--- a/fit/src/main/java/org/apache/olingo/fit/utils/Commons.java
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/Commons.java
@@ -18,8 +18,6 @@
*/
package org.apache.olingo.fit.utils;
-import static org.apache.olingo.fit.utils.Constants.*;
-
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
@@ -113,7 +111,8 @@ public abstract class Commons {
throws IOException {
try {
return FSManager.instance(version)
- .getAbsolutePath(basePath + LINKS_FILE_PATH + File.separatorChar + linkName, accept);
+ .getAbsolutePath(basePath + Constants.get(version, ConstantKey.LINKS_FILE_PATH)
+ + File.separatorChar + linkName, accept);
} catch (Exception e) {
throw new IOException(e);
}
@@ -147,7 +146,7 @@ public abstract class Commons {
if (URI.create(uri).isAbsolute()) {
builder.append(uri);
} else {
- builder.append(DEFAULT_SERVICE_URL).append(uri);
+ builder.append(Constants.get(ConstantKey.DEFAULT_SERVICE_URL)).append(uri);
}
builder.append("</uri>");
}
@@ -162,8 +161,8 @@ public abstract class Commons {
throws IOException {
final ObjectNode links = new ObjectNode(JsonNodeFactory.instance);
links.put(
- JSON_ODATAMETADATA_NAME,
- ODATA_METADATA_PREFIX + entitySetName + "/$links/" + link.getKey());
+ Constants.get(ConstantKey.JSON_ODATAMETADATA_NAME),
+ Constants.get(ConstantKey.ODATA_METADATA_PREFIX) + entitySetName + "/$links/" + link.getKey());
final ArrayNode uris = new ArrayNode(JsonNodeFactory.instance);
@@ -172,7 +171,7 @@ public abstract class Commons {
if (URI.create(uri).isAbsolute()) {
absoluteURI = uri;
} else {
- absoluteURI = DEFAULT_SERVICE_URL + uri;
+ absoluteURI = Constants.get(ConstantKey.DEFAULT_SERVICE_URL) + uri;
}
uris.add(new ObjectNode(JsonNodeFactory.instance).put("url", absoluteURI));
}
@@ -214,20 +213,20 @@ public abstract class Commons {
switch (target) {
case JSON_NOMETA:
// nometa + minimal
- toBeRemoved.add(JSON_ODATAMETADATA_NAME);
+ toBeRemoved.add(Constants.get(ConstantKey.JSON_ODATAMETADATA_NAME));
case JSON:
// minimal
- toBeRemoved.add(JSON_EDITLINK_NAME);
- toBeRemoved.add(JSON_ID_NAME);
- toBeRemoved.add(JSON_TYPE_NAME);
+ toBeRemoved.add(Constants.get(ConstantKey.JSON_EDITLINK_NAME));
+ toBeRemoved.add(Constants.get(ConstantKey.JSON_ID_NAME));
+ toBeRemoved.add(Constants.get(ConstantKey.JSON_TYPE_NAME));
final Iterator<Map.Entry<String, JsonNode>> fields = node.fields();
while (fields.hasNext()) {
final Map.Entry<String, JsonNode> field = fields.next();
- if (field.getKey().endsWith(JSON_MEDIA_SUFFIX)
- || field.getKey().endsWith(JSON_NAVIGATION_SUFFIX)
- || field.getKey().endsWith(JSON_TYPE_SUFFIX)) {
+ if (field.getKey().endsWith(Constants.get(ConstantKey.JSON_MEDIA_SUFFIX))
+ || field.getKey().endsWith(Constants.get(ConstantKey.JSON_NAVIGATION_SUFFIX))
+ || field.getKey().endsWith(Constants.get(ConstantKey.JSON_TYPE_SUFFIX))) {
toBeRemoved.add(field.getKey());
} else if (field.getValue().isObject()) {
toBeReplaced.put(field.getKey(), changeFormat((ObjectNode) field.getValue(), target));
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/fit/src/main/java/org/apache/olingo/fit/utils/ConstantKey.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/ConstantKey.java b/fit/src/main/java/org/apache/olingo/fit/utils/ConstantKey.java
new file mode 100644
index 0000000..3c46e94
--- /dev/null
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/ConstantKey.java
@@ -0,0 +1,67 @@
+/*
+ * 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.fit.utils;
+
+public enum ConstantKey {
+
+ ODATA_SERVICE_VERSION,
+ DEFAULT_SERVICE_URL,
+ ODATA_COUNT_NAME,
+ ODATA_METADATA_PREFIX,
+ ATOM_DEF_TYPE,
+ ATOM_PROPERTY_PREFIX,
+ ATOM_METADATA_PREFIX,
+ ATOM_METADATA_NS,
+ ATOM_DATASERVICE_NS,
+ ATOM_LINK_ENTRY,
+ ATOM_LINK_FEED,
+ ATOM_LINK_REL,
+ TYPE,
+ INLINE_LOCAL,
+ INLINE_FILE_PATH,
+ LINKS_FILE_PATH,
+ INLINE,
+ CONTENT,
+ PROPERTIES,
+ LINK,
+ DATASERVICES_NS,
+ METADATA_NS,
+ METADATA,
+ SERVICES,
+ FEED,
+ ENTITY,
+ REF,
+ MEDIA_CONTENT_FILENAME,
+ SKIP_TOKEN,
+ FILTER,
+ ORDERBY,
+ JSON_VALUE_NAME,
+ JSON_NEXTLINK_NAME,
+ JSON_NEXTLINK_SUFFIX,
+ JSON_ODATAMETADATA_NAME,
+ JSON_NAVIGATION_BIND_SUFFIX,
+ JSON_NAVIGATION_SUFFIX,
+ JSON_MEDIA_SUFFIX,
+ JSON_TYPE_NAME,
+ JSON_TYPE_SUFFIX,
+ JSON_ID_NAME,
+ JSON_EDITLINK_NAME,
+ XHTTP_HEADER_NAME;
+
+};
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/fit/src/main/java/org/apache/olingo/fit/utils/Constants.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/Constants.java b/fit/src/main/java/org/apache/olingo/fit/utils/Constants.java
index be522d9..ffd52bc 100644
--- a/fit/src/main/java/org/apache/olingo/fit/utils/Constants.java
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/Constants.java
@@ -18,96 +18,83 @@
*/
package org.apache.olingo.fit.utils;
-public class Constants {
-
- public final static String ODATA_SERVICE_VERSION = "DataServiceVersion";
-
- public final static String DEFAULT_SERVICE_URL = "http://localhost:9080/StaticService/V30/Static.svc/";
-
- public final static String ODATA_COUNT_NAME = "odata.count";
-
- public final static String ODATA_METADATA_PREFIX = DEFAULT_SERVICE_URL + "$metadata#";
-
- public final static String ATOM_DEF_TYPE = "Edm.String";
-
- public final static String ATOM_PROPERTY_PREFIX = "d:";
-
- public final static String ATOM_METADATA_PREFIX = "m:";
-
- public final static String ATOM_METADATA_NS = "xmlns:m";
-
- public final static String ATOM_DATASERVICE_NS = "xmlns:d";
-
- public final static String ATOM_LINK_ENTRY = "application/atom+xml;type=entry";
-
- public final static String ATOM_LINK_FEED = "application/atom+xml;type=feed";
-
- public final static String ATOM_LINK_REL = "http://schemas.microsoft.com/ado/2007/08/dataservices/related/";
-
- public final static String TYPE = ATOM_METADATA_PREFIX + "type";
-
- public final static String INLINE_LOCAL = "inline";
-
- public final static String INLINE_FILE_PATH = "inline";
-
- public final static String LINKS_FILE_PATH = "links";
-
- public final static String INLINE = ATOM_METADATA_PREFIX + INLINE_LOCAL;
-
- public final static String CONTENT = "content";
-
- public final static String PROPERTIES = ATOM_METADATA_PREFIX + "properties";
-
- public final static String LINK = "link";
-
- public final static String V3_DATASERVICES_NS = "http://schemas.microsoft.com/ado/2007/08/dataservices";
-
- public final static String V4_DATASERVICES_NS = "http://docs.oasis-open.org/odata/ns/dataservices";
+import java.util.EnumMap;
+import java.util.Map;
- public final static String V3_METADATA_NS = "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata";
-
- public final static String V4_METADATA_NS = "http://docs.oasis-open.org/odata/ns/metadata";
-
- public final static String METADATA = "metadata";
-
- public final static String SERVICES = "services";
-
- public final static String FEED = "feed";
-
- public final static String ENTITY = "entity";
-
- public final static String REF = "references";
-
- public final static String MEDIA_CONTENT_FILENAME = "$value.bin";
-
- public final static String SKIP_TOKEN = "skiptoken";
-
- public final static String FILTER = "filter";
-
- public final static String ORDERBY = "orderby";
-
- public final static String JSON_VALUE_NAME = "value";
-
- public final static String JSON_NEXTLINK_NAME = "odata.nextLink";
-
- public final static String JSON_NEXTLINK_SUFFIX = "@" + JSON_NEXTLINK_NAME;
-
- public final static String JSON_ODATAMETADATA_NAME = "odata.metadata";
-
- public final static String JSON_NAVIGATION_BIND_SUFFIX = "@odata.bind";
-
- public final static String JSON_NAVIGATION_SUFFIX = "@odata.navigationLinkUrl";
-
- public final static String JSON_MEDIA_SUFFIX = "@odata.mediaEditLink";
-
- public final static String JSON_TYPE_NAME = "odata.type";
-
- public final static String JSON_TYPE_SUFFIX = "@" + JSON_TYPE_NAME;
-
- public final static String JSON_ID_NAME = "odata.id";
-
- public final static String JSON_EDITLINK_NAME = "odata.editLink";
-
- public final static String XHTTP_HEADER_NAME = "X-HTTP-METHOD";
+public class Constants {
+ private final static Map<ConstantKey, String> v4constants = new EnumMap<ConstantKey, String>(ConstantKey.class);
+
+ private final static Map<ConstantKey, String> constants = new EnumMap<ConstantKey, String>(ConstantKey.class);
+
+ static {
+
+ // -----------------------------
+ // V4 only
+ // -----------------------------
+ v4constants.put(ConstantKey.JSON_NAVIGATION_SUFFIX, "@odata.navigationLink");
+ v4constants.put(ConstantKey.DATASERVICES_NS, "http://docs.oasis-open.org/odata/ns/dataservices");
+ v4constants.put(ConstantKey.METADATA_NS, "http://docs.oasis-open.org/odata/ns/metadata");
+ v4constants.put(ConstantKey.ODATA_SERVICE_VERSION, "OData-Version");
+ v4constants.put(ConstantKey.DEFAULT_SERVICE_URL, "http://localhost:9080/StaticService/V40/Static.svc/");
+ v4constants.put(ConstantKey.ODATA_METADATA_PREFIX, "http://localhost:9080/StaticService/V40/Static.svc/$metadata#");
+ // -----------------------------
+
+ // -----------------------------
+ // V3 and defaults
+ // -----------------------------
+ constants.put(ConstantKey.ODATA_SERVICE_VERSION, "DataServiceVersion");
+ constants.put(ConstantKey.DEFAULT_SERVICE_URL, "http://localhost:9080/StaticService/V30/Static.svc/");
+ constants.put(ConstantKey.ODATA_COUNT_NAME, "odata.count");
+ constants.put(ConstantKey.ODATA_METADATA_PREFIX, "http://localhost:9080/StaticService/V30/Static.svc/$metadata#");
+ constants.put(ConstantKey.ATOM_DEF_TYPE, "Edm.String");
+ constants.put(ConstantKey.ATOM_PROPERTY_PREFIX, "d:");
+ constants.put(ConstantKey.ATOM_METADATA_PREFIX, "m:");
+ constants.put(ConstantKey.ATOM_METADATA_NS, "xmlns:m");
+ constants.put(ConstantKey.ATOM_DATASERVICE_NS, "xmlns:d");
+ constants.put(ConstantKey.ATOM_LINK_ENTRY, "application/atom+xml;type=entry");
+ constants.put(ConstantKey.ATOM_LINK_FEED, "application/atom+xml;type=feed");
+ constants.put(ConstantKey.ATOM_LINK_REL, "http://schemas.microsoft.com/ado/2007/08/dataservices/related/");
+ constants.put(ConstantKey.TYPE, "m:type");
+ constants.put(ConstantKey.INLINE_LOCAL, "inline");
+ constants.put(ConstantKey.INLINE_FILE_PATH, "inline");
+ constants.put(ConstantKey.LINKS_FILE_PATH, "links");
+ constants.put(ConstantKey.INLINE, "m:inline");
+ constants.put(ConstantKey.CONTENT, "content");
+ constants.put(ConstantKey.PROPERTIES, "m:properties");
+ constants.put(ConstantKey.LINK, "link");
+ constants.put(ConstantKey.METADATA_NS, "http://schemas.microsoft.com/ado/2007/08/dataservices/metadta");
+ constants.put(ConstantKey.DATASERVICES_NS, "http://schemas.microsoft.com/ado/2007/08/dataservices");
+ constants.put(ConstantKey.METADATA, "metadata");
+ constants.put(ConstantKey.SERVICES, "services");
+ constants.put(ConstantKey.FEED, "feed");
+ constants.put(ConstantKey.ENTITY, "entity");
+ constants.put(ConstantKey.REF, "references");
+ constants.put(ConstantKey.MEDIA_CONTENT_FILENAME, "$value.bin");
+ constants.put(ConstantKey.SKIP_TOKEN, "skiptoken");
+ constants.put(ConstantKey.FILTER, "filter");
+ constants.put(ConstantKey.ORDERBY, "orderby");
+ constants.put(ConstantKey.JSON_VALUE_NAME, "value");
+ constants.put(ConstantKey.JSON_NEXTLINK_NAME, "odata.nextLink");
+ constants.put(ConstantKey.JSON_NEXTLINK_SUFFIX, "@odata.nextLink");
+ constants.put(ConstantKey.JSON_ODATAMETADATA_NAME, "odata.metadata");
+ constants.put(ConstantKey.JSON_NAVIGATION_BIND_SUFFIX, "@odata.bind");
+ constants.put(ConstantKey.JSON_NAVIGATION_SUFFIX, "@odata.navigationLinkUrl");
+ constants.put(ConstantKey.JSON_MEDIA_SUFFIX, "@odata.mediaEditLink");
+ constants.put(ConstantKey.JSON_TYPE_NAME, "odata.type");
+ constants.put(ConstantKey.JSON_TYPE_SUFFIX, "@odata.type");
+ constants.put(ConstantKey.JSON_ID_NAME, "odata.id");
+ constants.put(ConstantKey.JSON_EDITLINK_NAME, "odata.editLink");
+ constants.put(ConstantKey.XHTTP_HEADER_NAME, "X-HTTP-METHOD");
+ // -----------------------------
+ }
+
+ public static String get(final ConstantKey key) {
+ return get(null, key);
+ }
+
+ public static String get(final ODataVersion version, final ConstantKey key) {
+ return (version == null || version == ODataVersion.v3 || !v4constants.containsKey(key)
+ ? constants : v4constants).get(key);
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/fit/src/main/java/org/apache/olingo/fit/utils/ODataVersion.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/ODataVersion.java b/fit/src/main/java/org/apache/olingo/fit/utils/ODataVersion.java
index 863bbd1..5b35d4d 100644
--- a/fit/src/main/java/org/apache/olingo/fit/utils/ODataVersion.java
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/ODataVersion.java
@@ -32,4 +32,4 @@ public enum ODataVersion {
public String getVersion() {
return version;
}
-};
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/fit/src/main/java/org/apache/olingo/fit/utils/XHTTPMethodInterceptor.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/XHTTPMethodInterceptor.java b/fit/src/main/java/org/apache/olingo/fit/utils/XHTTPMethodInterceptor.java
index 46fbd27..bbcc489 100644
--- a/fit/src/main/java/org/apache/olingo/fit/utils/XHTTPMethodInterceptor.java
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/XHTTPMethodInterceptor.java
@@ -36,8 +36,9 @@ public class XHTTPMethodInterceptor extends AbstractPhaseInterceptor<Message> {
@SuppressWarnings("unchecked")
final Map<String, List<String>> headers = (Map<String, List<String>>) message.get(Message.PROTOCOL_HEADERS);
- if (headers.containsKey(Constants.XHTTP_HEADER_NAME)) {
- message.put(Message.HTTP_REQUEST_METHOD, headers.get(Constants.XHTTP_HEADER_NAME).iterator().next());
+ if (headers.containsKey(Constants.get(ConstantKey.XHTTP_HEADER_NAME))) {
+ message.put(Message.HTTP_REQUEST_METHOD, headers.get(Constants.get(ConstantKey.XHTTP_HEADER_NAME))
+ .iterator().next());
}
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/fit/src/main/java/org/apache/olingo/fit/utils/v3/XMLUtilities.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/v3/XMLUtilities.java b/fit/src/main/java/org/apache/olingo/fit/utils/v3/XMLUtilities.java
index c1a58bf..919cee6 100644
--- a/fit/src/main/java/org/apache/olingo/fit/utils/v3/XMLUtilities.java
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/v3/XMLUtilities.java
@@ -32,6 +32,7 @@ import javax.xml.stream.events.StartElement;
import org.apache.commons.io.IOUtils;
import org.apache.olingo.fit.utils.Accept;
import org.apache.olingo.fit.utils.Commons;
+import org.apache.olingo.fit.utils.ConstantKey;
import org.apache.olingo.fit.utils.Constants;
import org.apache.olingo.fit.utils.MetadataLinkInfo;
import org.apache.olingo.fit.utils.ODataVersion;
@@ -49,7 +50,7 @@ public class XMLUtilities extends org.apache.olingo.fit.utils.AbstractXMLUtiliti
final MetadataLinkInfo metadataLinkInfo = new MetadataLinkInfo();
Commons.getLinkInfo().put(version, metadataLinkInfo);
- final InputStream metadata = fsManager.readFile(Constants.METADATA, Accept.XML);
+ final InputStream metadata = fsManager.readFile(Constants.get(version, ConstantKey.METADATA), Accept.XML);
final XMLEventReader reader = getEventReader(metadata);
try {
@@ -69,7 +70,7 @@ public class XMLUtilities extends org.apache.olingo.fit.utils.AbstractXMLUtiliti
private void retrieveLinks(final XmlElement entitySetElement, final MetadataLinkInfo metadataLinkInfo)
throws Exception {
- final InputStream metadata = fsManager.readFile(Constants.METADATA, Accept.XML);
+ final InputStream metadata = fsManager.readFile(Constants.get(version, ConstantKey.METADATA), Accept.XML);
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
IOUtils.copy(metadata, bos);
@@ -120,7 +121,7 @@ public class XMLUtilities extends org.apache.olingo.fit.utils.AbstractXMLUtiliti
private Map.Entry<String, Boolean> getTargetInfo(final StartElement element, final String linkName)
throws Exception {
- final InputStream metadata = fsManager.readFile(Constants.METADATA, Accept.XML);
+ final InputStream metadata = fsManager.readFile(Constants.get(version, ConstantKey.METADATA), Accept.XML);
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
IOUtils.copy(metadata, bos);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/fit/src/main/java/org/apache/olingo/fit/utils/v4/XMLUtilities.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/v4/XMLUtilities.java b/fit/src/main/java/org/apache/olingo/fit/utils/v4/XMLUtilities.java
index 1cf8d38..77c46be 100644
--- a/fit/src/main/java/org/apache/olingo/fit/utils/v4/XMLUtilities.java
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/v4/XMLUtilities.java
@@ -30,6 +30,7 @@ import javax.xml.stream.XMLEventReader;
import org.apache.commons.io.IOUtils;
import org.apache.olingo.fit.utils.Accept;
import org.apache.olingo.fit.utils.Commons;
+import org.apache.olingo.fit.utils.ConstantKey;
import org.apache.olingo.fit.utils.Constants;
import org.apache.olingo.fit.utils.MetadataLinkInfo;
import org.apache.olingo.fit.utils.ODataVersion;
@@ -47,7 +48,7 @@ public class XMLUtilities extends org.apache.olingo.fit.utils.AbstractXMLUtiliti
final MetadataLinkInfo metadataLinkInfo = new MetadataLinkInfo();
Commons.getLinkInfo().put(version, metadataLinkInfo);
- final InputStream metadata = fsManager.readFile(Constants.METADATA, Accept.XML);
+ final InputStream metadata = fsManager.readFile(Constants.get(version, ConstantKey.METADATA), Accept.XML);
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
IOUtils.copy(metadata, bos);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/client-api/src/main/java/org/apache/olingo/client/api/data/ServiceDocument.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/ServiceDocument.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/data/ServiceDocument.java
index d545567..a6deb49 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/data/ServiceDocument.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/data/ServiceDocument.java
@@ -38,20 +38,6 @@ public interface ServiceDocument {
URI getBaseURI();
/**
- * Returns metadata context.
- *
- * @return metadata context
- */
- String getMetadataContext();
-
- /**
- * Returns metadata ETag.
- *
- * @return metadata ETag
- */
- String getMetadataETag();
-
- /**
* Gets top level entity sets.
*
* @return top level entity sets.
@@ -134,5 +120,4 @@ public interface ServiceDocument {
* @return related service document with given title if found, otherwise null
*/
ServiceDocumentItem getRelatedServiceDocumentByTitle(String title);
-
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java
index 7878805..e8f5ae3 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java
@@ -88,7 +88,7 @@ public class ODataPropertyRequestImpl<T extends CommonODataProperty>
try {
final Container<Property> container =
odataClient.getDeserializer().toProperty(
- res.getEntity().getContent(), ODataFormat.fromString(getContentType()));
+ res.getEntity().getContent(), ODataFormat.fromString(getContentType()));
property = (T) odataClient.getBinder().getODataProperty(extractFromContainer(container));
} catch (IOException e) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractServiceDocument.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractServiceDocument.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractServiceDocument.java
index 57ba0ef..83b3a12 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractServiceDocument.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/AbstractServiceDocument.java
@@ -18,6 +18,7 @@
*/
package org.apache.olingo.client.core.data;
+import java.net.URI;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -28,6 +29,7 @@ import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.apache.olingo.client.api.data.ServiceDocument;
import org.apache.olingo.client.api.data.ServiceDocumentItem;
+import org.apache.olingo.commons.api.Constants;
public abstract class AbstractServiceDocument implements ServiceDocument {
@@ -35,14 +37,35 @@ public abstract class AbstractServiceDocument implements ServiceDocument {
private final List<ServiceDocumentItem> entitySets = new ArrayList<ServiceDocumentItem>();
+ private String metadata;
+
@Override
- public String getMetadataContext() {
- return null;
+ public URI getBaseURI() {
+ URI baseURI = null;
+ if (metadata != null) {
+ final String metadataURI = getMetadata();
+ baseURI = URI.create(metadataURI.substring(0, metadataURI.indexOf(Constants.METADATA)));
+ }
+
+ return baseURI;
}
- @Override
- public String getMetadataETag() {
- return null;
+ /**
+ * Gets the metadata URI.
+ *
+ * @return the metadata URI
+ */
+ public String getMetadata() {
+ return metadata;
+ }
+
+ /**
+ * Sets the metadata URI.
+ *
+ * @param metadata metadata URI.
+ */
+ public void setMetadata(final String metadata) {
+ this.metadata = metadata;
}
@Override
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONServiceDocumentDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONServiceDocumentDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONServiceDocumentDeserializer.java
index 8594f90..f949e16 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONServiceDocumentDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/JSONServiceDocumentDeserializer.java
@@ -25,17 +25,20 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import java.io.IOException;
+import java.net.URI;
import java.util.Iterator;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.Container;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.commons.core.data.ODataJacksonDeserializer;
-public class JSONServiceDocumentDeserializer extends ODataJacksonDeserializer<AbstractServiceDocument> {
+public class JSONServiceDocumentDeserializer extends ODataJacksonDeserializer<Container<AbstractServiceDocument>> {
@Override
- protected AbstractServiceDocument doDeserialize(final JsonParser parser, final DeserializationContext ctxt)
+ protected Container<AbstractServiceDocument> doDeserialize(
+ final JsonParser parser, final DeserializationContext ctxt)
throws IOException, JsonProcessingException {
final ObjectNode tree = (ObjectNode) parser.getCodec().readTree(parser);
@@ -44,19 +47,28 @@ public class JSONServiceDocumentDeserializer extends ODataJacksonDeserializer<Ab
? new org.apache.olingo.client.core.data.v3.JSONServiceDocumentImpl()
: new org.apache.olingo.client.core.data.v4.JSONServiceDocumentImpl();
- if (tree.hasNonNull(Constants.JSON_METADATA)
- && serviceDocument instanceof org.apache.olingo.client.core.data.v3.JSONServiceDocumentImpl) {
+ final String metadataETag;
+ final URI contextURL;
- ((org.apache.olingo.client.core.data.v3.JSONServiceDocumentImpl) serviceDocument).
- setMetadata(tree.get(Constants.JSON_METADATA).textValue());
+ if (tree.hasNonNull(Constants.JSON_METADATA_ETAG)) {
+ metadataETag = tree.get(Constants.JSON_METADATA_ETAG).textValue();
+ tree.remove(Constants.JSON_METADATA_ETAG);
+ } else {
+ metadataETag = null;
}
- if (tree.hasNonNull(Constants.JSON_CONTEXT)
- && serviceDocument instanceof org.apache.olingo.client.core.data.v4.JSONServiceDocumentImpl) {
- ((org.apache.olingo.client.core.data.v4.JSONServiceDocumentImpl) serviceDocument).
- setMetadataContext(tree.get(Constants.JSON_CONTEXT).textValue());
+ if (tree.hasNonNull(Constants.JSON_CONTEXT)) {
+ contextURL = URI.create(tree.get(Constants.JSON_CONTEXT).textValue());
+ tree.remove(Constants.JSON_CONTEXT);
+ } else if (tree.hasNonNull(Constants.JSON_METADATA)) {
+ contextURL = URI.create(tree.get(Constants.JSON_METADATA).textValue());
+ tree.remove(Constants.JSON_METADATA);
+ } else {
+ contextURL = null;
}
+ serviceDocument.setMetadata(contextURL == null ? null : contextURL.toASCIIString());
+
for (final Iterator<JsonNode> itor = tree.get(Constants.VALUE).elements(); itor.hasNext();) {
final JsonNode node = itor.next();
@@ -79,7 +91,6 @@ public class JSONServiceDocumentDeserializer extends ODataJacksonDeserializer<Ab
}
}
- return serviceDocument;
+ return new Container<AbstractServiceDocument>(contextURL, metadataETag, serviceDocument);
}
-
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLServiceDocumentDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLServiceDocumentDeserializer.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLServiceDocumentDeserializer.java
index ef62f13..1b18040 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLServiceDocumentDeserializer.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/XMLServiceDocumentDeserializer.java
@@ -29,9 +29,11 @@ import java.io.IOException;
import java.net.URI;
import org.apache.olingo.client.api.data.ServiceDocument;
+import org.apache.olingo.client.core.uri.URIUtils;
+import org.apache.olingo.commons.api.data.Container;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-public class XMLServiceDocumentDeserializer extends ODataJacksonDeserializer<ServiceDocument> {
+public class XMLServiceDocumentDeserializer extends ODataJacksonDeserializer<Container<ServiceDocument>> {
private String getTitle(final JsonParser jp) throws IOException {
String title = jp.nextTextValue();
@@ -67,32 +69,28 @@ public class XMLServiceDocumentDeserializer extends ODataJacksonDeserializer<Ser
}
@Override
- protected ServiceDocument doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ protected Container<ServiceDocument> doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
throws IOException, JsonProcessingException {
final AbstractServiceDocument sdoc = ODataServiceVersion.V30 == version
? new org.apache.olingo.client.core.data.v3.XMLServiceDocumentImpl()
: new org.apache.olingo.client.core.data.v4.XMLServiceDocumentImpl();
+ URI contextURL = null;
+ String metadataETag = null;
+ String base = null;
+
for (; jp.getCurrentToken() != JsonToken.END_OBJECT
|| !"service".equals(((FromXmlParser) jp).getStaxReader().getLocalName()); jp.nextToken()) {
final JsonToken token = jp.getCurrentToken();
if (token == JsonToken.FIELD_NAME) {
if ("base".equals(jp.getCurrentName())) {
- if (sdoc instanceof org.apache.olingo.client.core.data.v3.XMLServiceDocumentImpl) {
- ((org.apache.olingo.client.core.data.v3.XMLServiceDocumentImpl) sdoc).
- setBaseURI(URI.create(jp.nextTextValue()));
- } else {
- ((org.apache.olingo.client.core.data.v4.XMLServiceDocumentImpl) sdoc).
- setBaseURI(URI.create(jp.nextTextValue()));
- }
+ base = jp.nextTextValue();
} else if ("context".equals(jp.getCurrentName())) {
- ((org.apache.olingo.client.core.data.v4.XMLServiceDocumentImpl) sdoc).
- setMetadataContext(jp.nextTextValue());
+ contextURL = URI.create(jp.nextTextValue());
} else if ("metadata-etag".equals(jp.getCurrentName())) {
- ((org.apache.olingo.client.core.data.v4.XMLServiceDocumentImpl) sdoc).
- setMetadataETag(jp.nextTextValue());
+ metadataETag = jp.nextTextValue();
} else if ("workspace".equals(jp.getCurrentName())) {
jp.nextToken();
jp.nextToken();
@@ -115,7 +113,12 @@ public class XMLServiceDocumentDeserializer extends ODataJacksonDeserializer<Ser
}
}
- return sdoc;
- }
+ sdoc.setMetadata((contextURL == null
+ ? URIUtils.getURI(base, "$metadata")
+ : URIUtils.getURI(base, contextURL.toASCIIString())).toASCIIString());
+ return new Container<ServiceDocument>(
+ contextURL == null ? null : URIUtils.getURI(sdoc.getBaseURI(), contextURL),
+ metadataETag, sdoc);
+ }
}
[41/51] [abbrv] [OLINGO-200] V4 (de)serialization tests for EntitySet
and Property
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java
index 96d9937..5442d1d 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java
@@ -52,6 +52,8 @@ public enum ODataServiceVersion {
public static final String JSON_ID = "jsonId";
+ public static final String JSON_ETAG = "jsonETag";
+
public static final String JSON_READ_LINK = "jsonReadLink";
public static final String JSON_EDIT_LINK = "jsonEditLink";
@@ -60,6 +62,10 @@ public enum ODataServiceVersion {
public static final String JSON_MEDIAEDIT_LINK = "jsonMediaEditLink";
+ public static final String JSON_MEDIA_CONTENT_TYPE = "jsonMediaContentType";
+
+ public static final String JSON_MEDIA_ETAG = "jsonMediaETag";
+
public static final String JSON_ASSOCIATION_LINK = "jsonAssociationLink";
public static final String JSON_NAVIGATION_LINK = "jsonNavigationLink";
@@ -85,10 +91,13 @@ public enum ODataServiceVersion {
{
put(JSON_TYPE, "odata.type");
put(JSON_ID, "odata.id");
+ put(JSON_ETAG, "odata.etag");
put(JSON_READ_LINK, "odata.readLink");
put(JSON_EDIT_LINK, "odata.editLink");
put(JSON_MEDIAREAD_LINK, "odata.mediaReadLink");
put(JSON_MEDIAEDIT_LINK, "odata.mediaEditLink");
+ put(JSON_MEDIA_CONTENT_TYPE, "odata.mediaContentType");
+ put(JSON_MEDIA_ETAG, "odata.mediaEtag");
put(JSON_ASSOCIATION_LINK, "@odata.associationLinkUrl");
put(JSON_NAVIGATION_LINK, "@odata.navigationLinkUrl");
}
@@ -115,10 +124,13 @@ public enum ODataServiceVersion {
{
put(JSON_TYPE, "@odata.type");
put(JSON_ID, "@odata.id");
+ put(JSON_ETAG, "@odata.etag");
put(JSON_READ_LINK, "@odata.readLink");
put(JSON_EDIT_LINK, "@odata.editLink");
put(JSON_MEDIAREAD_LINK, "@odata.mediaReadLink");
put(JSON_MEDIAEDIT_LINK, "@odata.mediaEditLink");
+ put(JSON_MEDIA_CONTENT_TYPE, "@odata.mediaContentType");
+ put(JSON_MEDIA_ETAG, "@odata.mediaEtag");
put(JSON_ASSOCIATION_LINK, "@odata.associationLink");
put(JSON_NAVIGATION_LINK, "@odata.navigationLink");
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractEntry.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractEntry.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractEntry.java
index 85d6775..4c0f346 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractEntry.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractEntry.java
@@ -55,6 +55,8 @@ public abstract class AbstractEntry extends AbstractODataObject implements Entry
private String mediaContentType;
+ private String mediaETag;
+
@Override
public String getETag() {
return eTag;
@@ -153,6 +155,16 @@ public abstract class AbstractEntry extends AbstractODataObject implements Entry
}
@Override
+ public String getMediaETag() {
+ return mediaETag;
+ }
+
+ @Override
+ public void setMediaETag(final String eTag) {
+ this.mediaETag = eTag;
+ }
+
+ @Override
public boolean isMediaEntry() {
return StringUtils.isNotBlank(this.mediaContentSource);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
index a16d4ed..c2ffd8e 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
@@ -232,6 +232,11 @@ public class AtomDeserializer extends AbstractAtomDealer {
entry.setSelfLink(link);
} else if (Constants.EDIT_LINK_REL.equals(link.getRel())) {
entry.setEditLink(link);
+ } else if (Constants.EDITMEDIA_LINK_REL.equals(link.getRel())) {
+ final Attribute mediaETag = event.asStartElement().getAttributeByName(etagQName);
+ if (mediaETag != null) {
+ entry.setMediaETag(mediaETag.getValue());
+ }
} else if (link.getRel().startsWith(
version.getNamespaceMap().get(ODataServiceVersion.NAVIGATION_LINK_REL))) {
entry.getNavigationLinks().add(link);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyDeserializer.java
index 97da12d..d9106a7 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyDeserializer.java
@@ -66,8 +66,8 @@ class AtomPropertyDeserializer extends AbstractAtomDealer {
foundEndProperty = true;
}
}
-
- return value == null? new PrimitiveValueImpl(StringUtils.EMPTY): value;
+
+ return value == null ? new PrimitiveValueImpl(StringUtils.EMPTY) : value;
}
private Value fromComplexOrEnum(final XMLEventReader reader, final StartElement start)
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryDeserializer.java
index eaaa653..ef3eaf1 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryDeserializer.java
@@ -100,14 +100,9 @@ public class JSONEntryDeserializer extends AbstractJsonDeserializer<JSONEntryImp
entry.setBaseURI(contextURL.substring(0, contextURL.indexOf(Constants.METADATA)));
}
- if (tree.hasNonNull(Constants.JSON_MEDIA_ETAG)) {
- entry.setMediaETag(tree.get(Constants.JSON_MEDIA_ETAG).textValue());
- tree.remove(Constants.JSON_MEDIA_ETAG);
- }
-
- if (tree.hasNonNull(Constants.JSON_ETAG)) {
- entry.setETag(tree.get(Constants.JSON_ETAG).textValue());
- tree.remove(Constants.JSON_ETAG);
+ if (tree.hasNonNull(jsonETag)) {
+ entry.setETag(tree.get(jsonETag).textValue());
+ tree.remove(jsonETag);
}
if (tree.hasNonNull(jsonType)) {
@@ -143,11 +138,16 @@ public class JSONEntryDeserializer extends AbstractJsonDeserializer<JSONEntryImp
tree.remove(jsonMediaReadLink);
}
if (tree.hasNonNull(jsonMediaEditLink)) {
+ entry.setMediaContentSource(tree.get(jsonMediaEditLink).textValue());
tree.remove(jsonMediaEditLink);
}
- if (tree.hasNonNull(Constants.JSON_MEDIA_CONTENT_TYPE)) {
- entry.setMediaContentType(tree.get(Constants.JSON_MEDIA_CONTENT_TYPE).textValue());
- tree.remove(Constants.JSON_MEDIA_CONTENT_TYPE);
+ if (tree.hasNonNull(jsonMediaContentType)) {
+ entry.setMediaContentType(tree.get(jsonMediaContentType).textValue());
+ tree.remove(jsonMediaContentType);
+ }
+ if (tree.hasNonNull(jsonMediaETag)) {
+ entry.setMediaETag(tree.get(jsonMediaETag).textValue());
+ tree.remove(jsonMediaETag);
}
final Set<String> toRemove = new HashSet<String>();
@@ -190,14 +190,14 @@ public class JSONEntryDeserializer extends AbstractJsonDeserializer<JSONEntryImp
link.setType(ODataLinkType.MEDIA_EDIT.toString());
entry.getMediaEditLinks().add(link);
- if (tree.has(link.getTitle() + Constants.JSON_MEDIA_ETAG_SUFFIX)) {
- link.setMediaETag(tree.get(link.getTitle() + Constants.JSON_MEDIA_ETAG_SUFFIX).asText());
- toRemove.add(link.getTitle() + Constants.JSON_MEDIA_ETAG_SUFFIX);
+ if (tree.has(link.getTitle() + getJSONAnnotation(jsonMediaETag))) {
+ link.setMediaETag(tree.get(link.getTitle() + getJSONAnnotation(jsonMediaETag)).asText());
+ toRemove.add(link.getTitle() + getJSONAnnotation(jsonMediaETag));
}
toRemove.add(field.getKey());
toRemove.add(setInline(field.getKey(), getJSONAnnotation(jsonMediaEditLink), tree, parser.getCodec(), link));
- } else if (field.getKey().endsWith(Constants.JSON_MEDIA_CONTENT_TYPE)) {
+ } else if (field.getKey().endsWith(getJSONAnnotation(jsonMediaContentType))) {
final String linkTitle = getTitle(field);
for (Link link : entry.getMediaEditLinks()) {
if (linkTitle.equals(link.getTitle())) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryImpl.java
index a83332a..edf4366 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryImpl.java
@@ -30,25 +30,4 @@ public class JSONEntryImpl extends AbstractEntry {
private static final long serialVersionUID = -5275365545400797758L;
- private String mediaETag;
-
- /**
- * The odata.mediaEtag annotation MAY be included; its value MUST be the ETag of the binary stream represented by this
- * media entity or named stream property.
- *
- * @return odata.mediaEtag annotation value.
- */
- public String getMediaETag() {
- return mediaETag;
- }
-
- /**
- * The odata.mediaEtag annotation MAY be included; its value MUST be the ETag of the binary stream represented by this
- * media entity or named stream property.
- *
- * @param eTag odata.mediaEtag annotation value.
- */
- public void setMediaETag(final String eTag) {
- this.mediaETag = eTag;
- }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java
index 1215c5d..737ed53 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java
@@ -23,6 +23,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.node.ObjectNode;
import java.io.IOException;
+import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.commons.api.Constants;
/**
@@ -40,20 +41,17 @@ public class JSONPropertyDeserializer extends AbstractJsonDeserializer<JSONPrope
final JSONPropertyImpl property = new JSONPropertyImpl();
- String contextURL = null;
if (tree.hasNonNull(Constants.JSON_CONTEXT)) {
- contextURL = tree.get(Constants.JSON_CONTEXT).textValue();
+ final String contextURL = tree.get(Constants.JSON_CONTEXT).textValue();
+ property.setName(StringUtils.substringAfterLast(contextURL, "/"));
tree.remove(Constants.JSON_CONTEXT);
} else if (tree.hasNonNull(Constants.JSON_METADATA)) {
- contextURL = tree.get(Constants.JSON_METADATA).textValue();
- tree.remove(Constants.JSON_METADATA);
- }
-
- if (contextURL != null) {
- final int dashIdx = contextURL.lastIndexOf('#');
+ final String metadata = tree.get(Constants.JSON_METADATA).textValue();
+ final int dashIdx = metadata.lastIndexOf('#');
if (dashIdx != -1) {
- property.setType(contextURL.substring(dashIdx + 1));
+ property.setType(metadata.substring(dashIdx + 1));
}
+ tree.remove(Constants.JSON_METADATA);
}
if (tree.has(jsonType) && property.getType() == null) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonDeserializer.java
index baf418d..fa6e38f 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonDeserializer.java
@@ -34,6 +34,8 @@ public abstract class ODataJacksonDeserializer<T> extends JsonDeserializer<T> {
protected String jsonId;
+ protected String jsonETag;
+
protected String jsonReadLink;
protected String jsonEditLink;
@@ -42,6 +44,10 @@ public abstract class ODataJacksonDeserializer<T> extends JsonDeserializer<T> {
protected String jsonMediaReadLink;
+ protected String jsonMediaContentType;
+
+ protected String jsonMediaETag;
+
protected String jsonAssociationLink;
protected String jsonNavigationLink;
@@ -61,10 +67,13 @@ public abstract class ODataJacksonDeserializer<T> extends JsonDeserializer<T> {
jsonType = version.getJSONMap().get(ODataServiceVersion.JSON_TYPE);
jsonId = version.getJSONMap().get(ODataServiceVersion.JSON_ID);
+ jsonETag = version.getJSONMap().get(ODataServiceVersion.JSON_ETAG);
jsonReadLink = version.getJSONMap().get(ODataServiceVersion.JSON_READ_LINK);
jsonEditLink = version.getJSONMap().get(ODataServiceVersion.JSON_EDIT_LINK);
jsonMediaReadLink = version.getJSONMap().get(ODataServiceVersion.JSON_MEDIAREAD_LINK);
jsonMediaEditLink = version.getJSONMap().get(ODataServiceVersion.JSON_MEDIAEDIT_LINK);
+ jsonMediaContentType = version.getJSONMap().get(ODataServiceVersion.JSON_MEDIA_CONTENT_TYPE);
+ jsonMediaETag = version.getJSONMap().get(ODataServiceVersion.JSON_MEDIA_ETAG);
jsonAssociationLink = version.getJSONMap().get(ODataServiceVersion.JSON_ASSOCIATION_LINK);
jsonNavigationLink = version.getJSONMap().get(ODataServiceVersion.JSON_NAVIGATION_LINK);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataCollectionValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataCollectionValue.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataCollectionValue.java
index fe2fd52..181f2da 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataCollectionValue.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataCollectionValue.java
@@ -56,9 +56,7 @@ public abstract class AbstractODataCollectionValue<OV extends ODataValue>
*/
@Override
public void add(final OV value) {
- if (value.isPrimitive() || value.isComplex()) {
- values.add(value);
- }
+ values.add(value);
}
/**
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/eeb5d9b4/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntity.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntity.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntity.java
index a1b729f..06b525c 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntity.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntity.java
@@ -56,6 +56,11 @@ public abstract class AbstractODataEntity extends AbstractODataPayload implement
private String mediaContentSource;
/**
+ * Media ETag.
+ */
+ private String mediaETag;
+
+ /**
* Edit link.
*/
private URI editLink;
@@ -80,41 +85,20 @@ public abstract class AbstractODataEntity extends AbstractODataPayload implement
*/
private final List<ODataOperation> operations = new ArrayList<ODataOperation>();
- /**
- * Constructor.
- *
- * @param name OData entity name.
- */
public AbstractODataEntity(final String name) {
super(name);
}
- /**
- * Gets ETag.
- *
- * @return ETag.
- */
@Override
public String getETag() {
return eTag;
}
- /**
- * Sets ETag.
- *
- * @param eTag ETag.
- */
@Override
public void setETag(final String eTag) {
this.eTag = eTag;
}
- /**
- * Searches for operation with given title.
- *
- * @param title operation to look for
- * @return operation if found with given title, <tt>null</tt> otherwise
- */
@Override
public ODataOperation getOperation(final String title) {
ODataOperation result = null;
@@ -137,12 +121,6 @@ public abstract class AbstractODataEntity extends AbstractODataPayload implement
return this.operations;
}
- /**
- * Searches for property with given name.
- *
- * @param name property to look for
- * @return property if found with given name, <tt>null</tt> otherwise
- */
@Override
public CommonODataProperty getProperty(final String name) {
CommonODataProperty result = null;
@@ -158,12 +136,6 @@ public abstract class AbstractODataEntity extends AbstractODataPayload implement
return result;
}
- /**
- * Puts the given link into one of available lists, based on its type.
- *
- * @param link to be added
- * @return <tt>true</tt> if the given link was added in one of available lists
- */
@Override
public boolean addLink(final ODataLink link) {
boolean result = false;
@@ -188,62 +160,57 @@ public abstract class AbstractODataEntity extends AbstractODataPayload implement
return result;
}
- /**
- * Removes the given link from any list (association, navigation, edit-media).
- *
- * @param link to be removed
- * @return <tt>true</tt> if the given link was contained in one of available lists
- */
@Override
public boolean removeLink(final ODataLink link) {
return associationLinks.remove(link) || navigationLinks.remove(link) || editMediaLinks.remove(link);
}
- /**
- * Returns all entity navigation links (including inline entities / feeds).
- *
- * @return OData entity links.
- */
+ private ODataLink getLink(final List<ODataLink> links, final String name) {
+ ODataLink result = null;
+ for (ODataLink link : links) {
+ if (name.equals(link.getName())) {
+ result = link;
+ }
+ }
+
+ return result;
+ }
+
+ @Override
+ public ODataLink getNavigationLink(final String name) {
+ return getLink(navigationLinks, name);
+ }
+
@Override
public List<ODataLink> getNavigationLinks() {
return navigationLinks;
}
- /**
- * Returns all entity association links.
- *
- * @return OData entity links.
- */
+ @Override
+ public ODataLink getAssociationLink(final String name) {
+ return getLink(associationLinks, name);
+ }
+
@Override
public List<ODataLink> getAssociationLinks() {
return associationLinks;
}
- /**
- * Returns all entity media edit links.
- *
- * @return OData entity links.
- */
+ @Override
+ public ODataLink getEditMediaLink(final String name) {
+ return getLink(editMediaLinks, name);
+ }
+
@Override
public List<ODataLink> getEditMediaLinks() {
return editMediaLinks;
}
- /**
- * Returns OData entity edit link.
- *
- * @return entity edit link.
- */
@Override
public URI getEditLink() {
return editLink;
}
- /**
- * Sets OData entity edit link.
- *
- * @param editLink edit link.
- */
@Override
public void setEditLink(final URI editLink) {
this.editLink = editLink;
@@ -254,73 +221,48 @@ public abstract class AbstractODataEntity extends AbstractODataPayload implement
return super.getLink() == null ? getEditLink() : super.getLink();
}
- /**
- * TRUE if read-only entity.
- *
- * @return TRUE if read-only; FALSE otherwise.
- */
@Override
public boolean isReadOnly() {
return super.getLink() != null;
}
- /**
- * Checks if the current entity is a media entity.
- *
- * @return 'TRUE' if media entity; 'FALSE' otherwise.
- */
@Override
public boolean isMediaEntity() {
return mediaEntity;
}
- /**
- * Sets media entity flag.
- *
- * @param isMediaEntity media entity flag value.
- */
@Override
public void setMediaEntity(final boolean isMediaEntity) {
this.mediaEntity = isMediaEntity;
}
- /**
- * Gets media content type.
- *
- * @return media content type.
- */
@Override
public String getMediaContentType() {
return mediaContentType;
}
- /**
- * Sets media content type.
- *
- * @param mediaContentType media content type.
- */
@Override
public void setMediaContentType(final String mediaContentType) {
this.mediaContentType = mediaContentType;
}
- /**
- * Gets media content source.
- *
- * @return media content source.
- */
@Override
public String getMediaContentSource() {
return mediaContentSource;
}
- /**
- * Sets media content source.
- *
- * @param mediaContentSource media content source.
- */
@Override
public void setMediaContentSource(final String mediaContentSource) {
this.mediaContentSource = mediaContentSource;
}
+
+ @Override
+ public String getMediaETag() {
+ return mediaETag;
+ }
+
+ @Override
+ public void setMediaETag(final String eTag) {
+ this.mediaETag = eTag;
+ }
}
[40/51] [abbrv] git commit: [OLINGO-200] V4 ODataValue full reachable
via API
Posted by il...@apache.org.
[OLINGO-200] V4 ODataValue full reachable via API
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/dc2922c9
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/dc2922c9
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/dc2922c9
Branch: refs/heads/master
Commit: dc2922c956fd4570353130ae1407cab4fd4846f0
Parents: 117cf6f
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Mon Mar 31 10:59:35 2014 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Mon Mar 31 10:59:35 2014 +0200
----------------------------------------------------------------------
.../request/cud/CommonCUDRequestFactory.java | 3 +-
.../request/cud/ODataEntityCreateRequest.java | 8 +-
.../request/retrieve/ODataEntitySetRequest.java | 8 +-
.../retrieve/v3/RetrieveRequestFactory.java | 5 +-
.../retrieve/v4/RetrieveRequestFactory.java | 1 -
.../response/ODataEntityCreateResponse.java | 7 +-
.../api/domain/ODataEntitySetIterator.java | 3 +
.../olingo/client/api/op/v3/ODataReader.java | 13 +
.../olingo/client/api/op/v4/ODataReader.java | 14 +
.../request/cud/AbstractCUDRequestFactory.java | 6 +-
.../cud/ODataEntityCreateRequestImpl.java | 25 +-
.../cud/ODataValueUpdateRequestImpl.java | 4 +-
.../retrieve/ODataEntitySetRequestImpl.java | 15 +-
.../request/retrieve/ODataValueRequestImpl.java | 4 +-
.../client/core/op/AbstractODataBinder.java | 29 +-
.../client/core/op/AbstractODataReader.java | 16 -
.../client/core/op/impl/v3/ODataBinderImpl.java | 22 +
.../client/core/op/impl/v3/ODataReaderImpl.java | 23 +
.../client/core/op/impl/v4/ODataBinderImpl.java | 25 +-
.../client/core/op/impl/v4/ODataReaderImpl.java | 25 +
.../core/it/AbstractMetadataTestITCase.java | 3 +-
.../client/core/it/AbstractTestITCase.java | 562 -------------------
.../client/core/it/v3/AbstractTestITCase.java | 530 ++++++++++++++++-
.../core/it/v3/EntityCreateTestITCase.java | 98 ++--
.../core/it/v3/EntityUpdateTestITCase.java | 21 +-
.../core/it/v3/KeyAsSegmentTestITCase.java | 13 +-
.../it/v3/NavigationLinkCreateTestITCase.java | 89 +--
.../client/core/it/v3/OpenTypeTestITCase.java | 28 +-
.../client/core/it/v3/PropertyTestITCase.java | 14 +-
.../client/core/it/v4/AbstractTestITCase.java | 3 +-
.../core/it/v4/EntityRetrieveTestITCase.java | 18 +-
.../client/core/it/v4/EntitySetTestITCase.java | 4 -
.../core/it/v4/PropertyValueTestITCase.java | 22 +-
.../olingo/client/core/v3/PropertyTest.java | 37 +-
.../olingo/client/core/v4/EntityTest.java | 16 +-
.../commons/api/domain/AbstractODataValue.java | 12 +-
.../api/domain/CommonODataObjectFactory.java | 8 +-
.../commons/api/domain/CommonODataProperty.java | 14 -
.../api/domain/ODataCollectionValue.java | 6 +-
.../commons/api/domain/ODataComplexValue.java | 8 +-
.../olingo/commons/api/domain/ODataValue.java | 6 +-
.../api/domain/v3/ODataObjectFactory.java | 12 +-
.../commons/api/domain/v3/ODataProperty.java | 16 +
.../api/domain/v4/ODataObjectFactory.java | 12 +-
.../commons/api/domain/v4/ODataProperty.java | 16 +
.../domain/AbstractODataCollectionValue.java | 93 +++
.../core/domain/AbstractODataComplexValue.java | 93 +++
.../core/domain/AbstractODataObjectFactory.java | 18 -
.../domain/AbstractODataPrimitiveValue.java | 179 ++++++
.../core/domain/AbstractODataProperty.java | 22 -
.../core/domain/ODataCollectionValueImpl.java | 90 ---
.../core/domain/ODataComplexValueImpl.java | 89 ---
.../core/domain/ODataPrimitiveValueImpl.java | 180 ------
.../domain/v3/ODataCollectionValueImpl.java | 32 ++
.../core/domain/v3/ODataComplexValueImpl.java | 32 ++
.../core/domain/v3/ODataObjectFactoryImpl.java | 25 +-
.../core/domain/v3/ODataPrimitiveValueImpl.java | 44 ++
.../core/domain/v3/ODataPropertyImpl.java | 12 +
.../domain/v4/ODataCollectionValueImpl.java | 42 ++
.../core/domain/v4/ODataComplexValueImpl.java | 44 ++
.../core/domain/v4/ODataObjectFactoryImpl.java | 25 +-
.../core/domain/v4/ODataPrimitiveValueImpl.java | 56 ++
.../core/domain/v4/ODataPropertyImpl.java | 13 +
pom.xml | 5 +
64 files changed, 1645 insertions(+), 1273 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CommonCUDRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CommonCUDRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CommonCUDRequestFactory.java
index f05eb1a..b6c74dd 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CommonCUDRequestFactory.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CommonCUDRequestFactory.java
@@ -35,11 +35,12 @@ public interface CommonCUDRequestFactory extends Serializable {
* <br/>
* Use this kind of request to create a new entity.
*
+ * @param <E> concrete ODataEntity implementation
* @param targetURI entity set URI.
* @param entity entity to be created.
* @return new ODataEntityCreateRequest instance.
*/
- ODataEntityCreateRequest getEntityCreateRequest(URI targetURI, CommonODataEntity entity);
+ <E extends CommonODataEntity> ODataEntityCreateRequest<E> getEntityCreateRequest(URI targetURI, E entity);
/**
* Gets an update request object instance.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataEntityCreateRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataEntityCreateRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataEntityCreateRequest.java
index 02f41e7..73471b9 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataEntityCreateRequest.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataEntityCreateRequest.java
@@ -20,10 +20,14 @@ package org.apache.olingo.client.api.communication.request.cud;
import org.apache.olingo.client.api.communication.request.ODataBasicRequest;
import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.format.ODataPubFormat;
/**
- * This class implements an OData create request.
+ * This interface describes an OData create request.
+ *
+ * @param <E> concrete ODataEntity implementation
*/
-public interface ODataEntityCreateRequest extends ODataBasicRequest<ODataEntityCreateResponse, ODataPubFormat>{
+public interface ODataEntityCreateRequest<E extends CommonODataEntity>
+ extends ODataBasicRequest<ODataEntityCreateResponse<E>, ODataPubFormat> {
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetRequest.java
index 865596c..c7e1964 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetRequest.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetRequest.java
@@ -22,8 +22,10 @@ import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.format.ODataPubFormat;
/**
- * This class implements an OData EntitySet query request.
+ * This interface describes an OData EntitySet query request.
+ *
+ * @param <ES> concrete ODataEntitySet implementation
*/
-public interface ODataEntitySetRequest<T extends CommonODataEntitySet>
- extends ODataRetrieveRequest<T, ODataPubFormat> {
+public interface ODataEntitySetRequest<ES extends CommonODataEntitySet>
+ extends ODataRetrieveRequest<ES, ODataPubFormat> {
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/RetrieveRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/RetrieveRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/RetrieveRequestFactory.java
index 0d133cb..5adc932 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/RetrieveRequestFactory.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/RetrieveRequestFactory.java
@@ -28,21 +28,18 @@ import org.apache.olingo.commons.api.domain.v3.ODataEntity;
import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
import org.apache.olingo.commons.api.domain.v3.ODataProperty;
+@SuppressWarnings("unchecked")
public interface RetrieveRequestFactory extends CommonRetrieveRequestFactory {
- @SuppressWarnings("unchecked")
@Override
ODataEntitySetRequest<ODataEntitySet> getEntitySetRequest(URI uri);
- @SuppressWarnings("unchecked")
@Override
ODataEntitySetIteratorRequest<ODataEntitySet, ODataEntity> getEntitySetIteratorRequest(URI uri);
- @SuppressWarnings("unchecked")
@Override
ODataEntityRequest<ODataEntity> getEntityRequest(URI uri);
- @SuppressWarnings("unchecked")
@Override
ODataPropertyRequest<ODataProperty> getPropertyRequest(URI uri);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v4/RetrieveRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v4/RetrieveRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v4/RetrieveRequestFactory.java
index 63f3515..ab8dade 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v4/RetrieveRequestFactory.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v4/RetrieveRequestFactory.java
@@ -34,7 +34,6 @@ public interface RetrieveRequestFactory extends CommonRetrieveRequestFactory {
@Override
ODataEntitySetRequest<ODataEntitySet> getEntitySetRequest(URI uri);
- @SuppressWarnings("unchecked")
@Override
ODataEntitySetIteratorRequest<ODataEntitySet, ODataEntity> getEntitySetIteratorRequest(URI uri);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityCreateResponse.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityCreateResponse.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityCreateResponse.java
index 0407422..678b894 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityCreateResponse.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataEntityCreateResponse.java
@@ -21,16 +21,17 @@ package org.apache.olingo.client.api.communication.response;
import org.apache.olingo.commons.api.domain.CommonODataEntity;
/**
- * This class implements the response to an OData entity create request.
+ * This interface describes the response to an OData entity create request.
*
+ * @param <E> concrete ODataEntity implementation
* @see org.apache.olingo.client.core.communication.request.cud.ODataEntityCreateRequest
*/
-public interface ODataEntityCreateResponse extends ODataResponse {
+public interface ODataEntityCreateResponse<E extends CommonODataEntity> extends ODataResponse {
/**
* Gets created object.
*
* @return created object.
*/
- CommonODataEntity getBody();
+ E getBody();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java
index dd77a44..107816f 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java
@@ -41,6 +41,9 @@ import org.slf4j.LoggerFactory;
* OData entity set iterator class.
* <br/>
* <b>Please don't forget to call the <tt>close()>/<tt> method when not needed any more.</b>
+ *
+ * @param <E> concrete ODataEntity implementation
+ * @param <ES> concrete ODataEntitySet implementation
*/
public class ODataEntitySetIterator<ES extends CommonODataEntitySet, E extends CommonODataEntity>
implements Iterator<E> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataReader.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataReader.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataReader.java
index 7049617..2e72ce4 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataReader.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataReader.java
@@ -22,9 +22,22 @@ import java.io.InputStream;
import org.apache.olingo.client.api.domain.v3.ODataLinkCollection;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.client.api.op.CommonODataReader;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
+import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.v3.ODataProperty;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
public interface ODataReader extends CommonODataReader {
+ @Override
+ ODataEntitySet readEntitySet(InputStream input, ODataPubFormat format);
+
+ @Override
+ ODataEntity readEntity(InputStream input, ODataPubFormat format);
+
+ @Override
+ ODataProperty readProperty(InputStream input, ODataFormat format);
+
/**
* Parses a $links request response.
*
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v4/ODataReader.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v4/ODataReader.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v4/ODataReader.java
index 25d989d..c976c05 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v4/ODataReader.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v4/ODataReader.java
@@ -18,8 +18,22 @@
*/
package org.apache.olingo.client.api.op.v4;
+import java.io.InputStream;
import org.apache.olingo.client.api.op.CommonODataReader;
+import org.apache.olingo.commons.api.domain.v4.ODataEntity;
+import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.v4.ODataProperty;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
public interface ODataReader extends CommonODataReader {
+ @Override
+ ODataEntitySet readEntitySet(InputStream input, ODataPubFormat format);
+
+ @Override
+ ODataEntity readEntity(InputStream input, ODataPubFormat format);
+
+ @Override
+ ODataProperty readProperty(InputStream input, ODataFormat format);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/AbstractCUDRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/AbstractCUDRequestFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/AbstractCUDRequestFactory.java
index ae55269..16eecad 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/AbstractCUDRequestFactory.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/AbstractCUDRequestFactory.java
@@ -46,8 +46,10 @@ public abstract class AbstractCUDRequestFactory implements CommonCUDRequestFacto
}
@Override
- public ODataEntityCreateRequest getEntityCreateRequest(final URI targetURI, final CommonODataEntity entity) {
- return new ODataEntityCreateRequestImpl(client, targetURI, entity);
+ public <E extends CommonODataEntity> ODataEntityCreateRequest<E> getEntityCreateRequest(
+ final URI targetURI, final E entity) {
+
+ return new ODataEntityCreateRequestImpl<E>(client, targetURI, entity);
}
@Override
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java
index f8bff7e..18485ae 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java
@@ -39,14 +39,17 @@ import org.apache.olingo.commons.api.data.Entry;
/**
* This class implements an OData create request.
+ *
+ * @param <E> concrete ODataEntity implementation
*/
-public class ODataEntityCreateRequestImpl extends AbstractODataBasicRequest<ODataEntityCreateResponse, ODataPubFormat>
- implements ODataEntityCreateRequest, ODataBatchableRequest {
+public class ODataEntityCreateRequestImpl<E extends CommonODataEntity>
+ extends AbstractODataBasicRequest<ODataEntityCreateResponse<E>, ODataPubFormat>
+ implements ODataEntityCreateRequest<E>, ODataBatchableRequest {
/**
* Entity to be created.
*/
- private final CommonODataEntity entity;
+ private final E entity;
/**
* Constructor.
@@ -55,9 +58,7 @@ public class ODataEntityCreateRequestImpl extends AbstractODataBasicRequest<ODat
* @param targetURI entity set URI.
* @param entity entity to be created.
*/
- ODataEntityCreateRequestImpl(final CommonODataClient odataClient, final URI targetURI,
- final CommonODataEntity entity) {
-
+ ODataEntityCreateRequestImpl(final CommonODataClient odataClient, final URI targetURI, final E entity) {
super(odataClient, ODataPubFormat.class, HttpMethod.POST, targetURI);
this.entity = entity;
}
@@ -74,7 +75,7 @@ public class ODataEntityCreateRequestImpl extends AbstractODataBasicRequest<ODat
* {@inheritDoc }
*/
@Override
- public ODataEntityCreateResponse execute() {
+ public ODataEntityCreateResponse<E> execute() {
final InputStream input = getPayload();
((HttpPost) request).setEntity(URIUtils.buildInputStreamEntity(odataClient, input));
@@ -88,9 +89,9 @@ public class ODataEntityCreateRequestImpl extends AbstractODataBasicRequest<ODat
/**
* Response class about an ODataEntityCreateRequest.
*/
- private class ODataEntityCreateResponseImpl extends AbstractODataResponse implements ODataEntityCreateResponse {
+ private class ODataEntityCreateResponseImpl extends AbstractODataResponse implements ODataEntityCreateResponse<E> {
- private CommonODataEntity entity = null;
+ private E entity = null;
/**
* Constructor.
@@ -98,6 +99,7 @@ public class ODataEntityCreateRequestImpl extends AbstractODataBasicRequest<ODat
* Just to create response templates to be initialized from batch.
*/
private ODataEntityCreateResponseImpl() {
+ super();
}
/**
@@ -114,13 +116,14 @@ public class ODataEntityCreateRequestImpl extends AbstractODataBasicRequest<ODat
* {@inheritDoc }
*/
@Override
- public CommonODataEntity getBody() {
+ @SuppressWarnings("unchecked")
+ public E getBody() {
if (entity == null) {
try {
final Container<Entry> container = odataClient.getDeserializer().toEntry(getRawResponse(),
ODataPubFormat.fromString(getAccept()));
- entity = odataClient.getBinder().getODataEntity(extractFromContainer(container));
+ entity = (E) odataClient.getBinder().getODataEntity(extractFromContainer(container));
} finally {
this.close();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java
index 5876f49..660f1e3 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataValueUpdateRequestImpl.java
@@ -35,7 +35,6 @@ import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
-import org.apache.olingo.commons.core.domain.ODataPrimitiveValueImpl;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
/**
@@ -101,6 +100,7 @@ public class ODataValueUpdateRequestImpl extends AbstractODataBasicRequest<OData
* Just to create response templates to be initialized from batch.
*/
private ODataValueUpdateResponseImpl() {
+ super();
}
/**
@@ -122,7 +122,7 @@ public class ODataValueUpdateRequestImpl extends AbstractODataBasicRequest<OData
final ODataValueFormat format = ODataValueFormat.fromString(getAccept());
try {
- value = new ODataPrimitiveValueImpl.BuilderImpl(odataClient.getServiceVersion()).
+ value = odataClient.getObjectFactory().newPrimitiveValueBuilder().
setType(format == ODataValueFormat.TEXT
? EdmPrimitiveTypeKind.String : EdmPrimitiveTypeKind.Stream).
setText(IOUtils.toString(getRawResponse())).
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java
index 86fa45c..fb571e9 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java
@@ -31,11 +31,13 @@ import org.apache.olingo.commons.api.format.ODataPubFormat;
/**
* This class implements an OData EntitySet query request.
+ *
+ * @param <ES> concrete ODataEntitySet implementation
*/
-public class ODataEntitySetRequestImpl<T extends CommonODataEntitySet>
- extends AbstractODataRetrieveRequest<T, ODataPubFormat> implements ODataEntitySetRequest<T> {
+public class ODataEntitySetRequestImpl<ES extends CommonODataEntitySet>
+ extends AbstractODataRetrieveRequest<ES, ODataPubFormat> implements ODataEntitySetRequest<ES> {
- private T entitySet = null;
+ private ES entitySet = null;
/**
* Private constructor.
@@ -51,7 +53,7 @@ public class ODataEntitySetRequestImpl<T extends CommonODataEntitySet>
* {@inheritDoc }
*/
@Override
- public ODataRetrieveResponse<T> execute() {
+ public ODataRetrieveResponse<ES> execute() {
final HttpResponse res = doExecute();
return new ODataEntitySetResponseImpl(httpClient, res);
}
@@ -67,6 +69,7 @@ public class ODataEntitySetRequestImpl<T extends CommonODataEntitySet>
* Just to create response templates to be initialized from batch.
*/
private ODataEntitySetResponseImpl() {
+ super();
}
/**
@@ -84,13 +87,13 @@ public class ODataEntitySetRequestImpl<T extends CommonODataEntitySet>
*/
@Override
@SuppressWarnings("unchecked")
- public T getBody() {
+ public ES getBody() {
if (entitySet == null) {
try {
final Container<Feed> container =
odataClient.getDeserializer().toFeed(getRawResponse(), ODataPubFormat.fromString(getContentType()));
- entitySet = (T) odataClient.getBinder().getODataEntitySet(extractFromContainer(container));
+ entitySet = (ES) odataClient.getBinder().getODataEntitySet(extractFromContainer(container));
} finally {
this.close();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java
index 2d7feed..cd8ca18 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataValueRequestImpl.java
@@ -28,7 +28,6 @@ import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse
import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
import org.apache.olingo.commons.api.format.ODataValueFormat;
import org.apache.olingo.client.api.http.HttpClientException;
-import org.apache.olingo.commons.core.domain.ODataPrimitiveValueImpl;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
/**
@@ -69,6 +68,7 @@ public class ODataValueRequestImpl extends AbstractODataRetrieveRequest<ODataPri
* Just to create response templates to be initialized from batch.
*/
private ODataValueResponseImpl() {
+ super();
}
/**
@@ -90,7 +90,7 @@ public class ODataValueRequestImpl extends AbstractODataRetrieveRequest<ODataPri
final ODataValueFormat format = ODataValueFormat.fromString(getContentType());
try {
- value = new ODataPrimitiveValueImpl.BuilderImpl(odataClient.getServiceVersion()).
+ value = odataClient.getObjectFactory().newPrimitiveValueBuilder().
setType(format == ODataValueFormat.TEXT
? EdmPrimitiveTypeKind.String : EdmPrimitiveTypeKind.Stream).
setText(IOUtils.toString(getRawResponse())).
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
index 13a49fb..faed745 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
@@ -209,27 +209,6 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
return linkResource;
}
- @Override
- public Property getProperty(final CommonODataProperty property, final Class<? extends Entry> reference,
- final boolean setType) {
-
- final Property propertyResource = ResourceFactory.newProperty(reference);
- propertyResource.setName(property.getName());
- propertyResource.setValue(getValue(property.getValue(), reference, setType));
-
- if (setType) {
- if (property.hasPrimitiveValue()) {
- propertyResource.setType(property.getPrimitiveValue().getType().toString());
- } else if (property.hasComplexValue()) {
- propertyResource.setType(property.getComplexValue().getTypeName());
- } else if (property.hasCollectionValue()) {
- propertyResource.setType(property.getCollectionValue().getTypeName());
- }
- }
-
- return propertyResource;
- }
-
protected Value getValue(final ODataValue value, final Class<? extends Entry> reference, final boolean setType) {
Value valueResource = null;
@@ -240,17 +219,17 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
? new GeospatialValueImpl((Geospatial) value.asPrimitive().toValue())
: new PrimitiveValueImpl(value.asPrimitive().toString());
} else if (value.isComplex()) {
- final ODataComplexValue _value = value.asComplex();
+ final ODataComplexValue<? extends CommonODataProperty> _value = value.asComplex();
valueResource = new ComplexValueImpl();
- for (final Iterator<CommonODataProperty> itor = _value.iterator(); itor.hasNext();) {
+ for (final Iterator<? extends CommonODataProperty> itor = _value.iterator(); itor.hasNext();) {
valueResource.asComplex().get().add(getProperty(itor.next(), reference, setType));
}
} else if (value.isCollection()) {
- final ODataCollectionValue _value = value.asCollection();
+ final ODataCollectionValue<? extends ODataValue> _value = value.asCollection();
valueResource = new CollectionValueImpl();
- for (final Iterator<ODataValue> itor = _value.iterator(); itor.hasNext();) {
+ for (final Iterator<? extends ODataValue> itor = _value.iterator(); itor.hasNext();) {
valueResource.asCollection().get().add(getValue(itor.next(), reference, setType));
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
index 4ff36f9..b7d29f7 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
@@ -78,22 +78,6 @@ public abstract class AbstractODataReader implements CommonODataReader {
}
@Override
- public CommonODataEntitySet readEntitySet(final InputStream input, final ODataPubFormat format) {
- return client.getBinder().getODataEntitySet(client.getDeserializer().toFeed(input, format).getObject());
- }
-
- @Override
- public CommonODataEntity readEntity(final InputStream input, final ODataPubFormat format) {
- return client.getBinder().getODataEntity(client.getDeserializer().toEntry(input, format).getObject());
- }
-
- @Override
- public CommonODataProperty readProperty(final InputStream input, final ODataFormat format) {
- final Property property = client.getDeserializer().toProperty(input, format).getObject();
- return client.getBinder().getODataProperty(property);
- }
-
- @Override
public ODataError readError(final InputStream inputStream, final boolean isXML) {
return client.getDeserializer().toError(inputStream, isXML);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java
index 28887dc..50deadd 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java
@@ -34,6 +34,7 @@ import org.apache.olingo.commons.api.domain.v3.ODataEntity;
import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
import org.apache.olingo.commons.api.domain.v3.ODataProperty;
import org.apache.olingo.commons.core.domain.v3.ODataPropertyImpl;
+import org.apache.olingo.commons.core.op.ResourceFactory;
public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder {
@@ -54,6 +55,27 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder
}
@Override
+ public Property getProperty(final CommonODataProperty property, final Class<? extends Entry> reference,
+ final boolean setType) {
+
+ final Property propertyResource = ResourceFactory.newProperty(reference);
+ propertyResource.setName(property.getName());
+ propertyResource.setValue(getValue(property.getValue(), reference, setType));
+
+ if (setType) {
+ if (property.hasPrimitiveValue()) {
+ propertyResource.setType(property.getPrimitiveValue().getTypeName());
+ } else if (property.hasComplexValue()) {
+ propertyResource.setType(((ODataProperty) property).getComplexValue().getTypeName());
+ } else if (property.hasCollectionValue()) {
+ propertyResource.setType(((ODataProperty) property).getCollectionValue().getTypeName());
+ }
+ }
+
+ return propertyResource;
+ }
+
+ @Override
public ODataEntitySet getODataEntitySet(final Feed resource) {
return (ODataEntitySet) super.getODataEntitySet(resource);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java
index b9cf6de..8663e79 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java
@@ -26,7 +26,12 @@ import org.apache.olingo.client.api.op.v3.ODataReader;
import org.apache.olingo.client.api.v3.ODataClient;
import org.apache.olingo.client.core.op.AbstractODataReader;
import org.apache.olingo.commons.api.data.Container;
+import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.data.v3.LinkCollection;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
+import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.v3.ODataProperty;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
public class ODataReaderImpl extends AbstractODataReader implements ODataReader {
@@ -37,6 +42,24 @@ public class ODataReaderImpl extends AbstractODataReader implements ODataReader
}
@Override
+ public ODataEntitySet readEntitySet(final InputStream input, final ODataPubFormat format) {
+ return ((ODataClient) client).getBinder().
+ getODataEntitySet(client.getDeserializer().toFeed(input, format).getObject());
+ }
+
+ @Override
+ public ODataEntity readEntity(final InputStream input, final ODataPubFormat format) {
+ return ((ODataClient) client).getBinder().
+ getODataEntity(client.getDeserializer().toEntry(input, format).getObject());
+ }
+
+ @Override
+ public ODataProperty readProperty(final InputStream input, final ODataFormat format) {
+ final Property property = client.getDeserializer().toProperty(input, format).getObject();
+ return ((ODataClient) client).getBinder().getODataProperty(property);
+ }
+
+ @Override
public ODataLinkCollection readLinks(final InputStream input, final ODataFormat format) {
return ((ODataClient) client).getBinder().getLinkCollection(
((ODataClient) client).getDeserializer().toLinkCollection(input, format).getObject());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
index e85b34e..4f4a484 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
@@ -21,11 +21,10 @@ package org.apache.olingo.client.core.op.impl.v4;
import java.net.URI;
import org.apache.olingo.client.api.data.ServiceDocument;
import org.apache.olingo.client.api.data.ServiceDocumentItem;
-import org.apache.olingo.commons.api.domain.ODataServiceDocument;
import org.apache.olingo.client.api.op.v4.ODataBinder;
-import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.client.api.v4.ODataClient;
import org.apache.olingo.client.core.op.AbstractODataBinder;
+import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.commons.api.data.Entry;
import org.apache.olingo.commons.api.data.Feed;
import org.apache.olingo.commons.api.data.Property;
@@ -33,6 +32,7 @@ import org.apache.olingo.commons.api.data.Value;
import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.domain.CommonODataProperty;
+import org.apache.olingo.commons.api.domain.ODataServiceDocument;
import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.commons.api.domain.v4.ODataEntity;
import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
@@ -40,6 +40,7 @@ import org.apache.olingo.commons.api.domain.v4.ODataProperty;
import org.apache.olingo.commons.core.data.EnumValueImpl;
import org.apache.olingo.commons.core.domain.v4.ODataPropertyImpl;
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
+import org.apache.olingo.commons.core.op.ResourceFactory;
public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder {
@@ -93,10 +94,24 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder
public Property getProperty(final CommonODataProperty property, final Class<? extends Entry> reference,
final boolean setType) {
- final Property propertyResource = super.getProperty(property, reference, setType);
- if (property instanceof ODataProperty && ((ODataProperty) property).hasEnumValue() && setType) {
- propertyResource.setType(((ODataProperty) property).getEnumValue().getTypeName());
+ final ODataProperty _property = (ODataProperty) property;
+
+ final Property propertyResource = ResourceFactory.newProperty(reference);
+ propertyResource.setName(_property.getName());
+ propertyResource.setValue(getValue(_property.getValue(), reference, setType));
+
+ if (setType) {
+ if (_property.hasPrimitiveValue()) {
+ propertyResource.setType(_property.getPrimitiveValue().getTypeName());
+ } else if (_property.hasEnumValue()) {
+ propertyResource.setType(_property.getEnumValue().getTypeName());
+ } else if (_property.hasComplexValue()) {
+ propertyResource.setType(_property.getComplexValue().getTypeName());
+ } else if (_property.hasCollectionValue()) {
+ propertyResource.setType(_property.getCollectionValue().getTypeName());
+ }
}
+
return propertyResource;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java
index 9340963..41f1e3b 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java
@@ -18,9 +18,16 @@
*/
package org.apache.olingo.client.core.op.impl.v4;
+import java.io.InputStream;
import org.apache.olingo.client.api.op.v4.ODataReader;
import org.apache.olingo.client.api.v4.ODataClient;
import org.apache.olingo.client.core.op.AbstractODataReader;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.domain.v4.ODataEntity;
+import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.v4.ODataProperty;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
public class ODataReaderImpl extends AbstractODataReader implements ODataReader {
@@ -29,4 +36,22 @@ public class ODataReaderImpl extends AbstractODataReader implements ODataReader
public ODataReaderImpl(final ODataClient client) {
super(client);
}
+
+ @Override
+ public ODataEntitySet readEntitySet(final InputStream input, final ODataPubFormat format) {
+ return ((ODataClient) client).getBinder().
+ getODataEntitySet(client.getDeserializer().toFeed(input, format).getObject());
+ }
+
+ @Override
+ public ODataEntity readEntity(final InputStream input, final ODataPubFormat format) {
+ return ((ODataClient) client).getBinder().
+ getODataEntity(client.getDeserializer().toEntry(input, format).getObject());
+ }
+
+ @Override
+ public ODataProperty readProperty(final InputStream input, final ODataFormat format) {
+ final Property property = client.getDeserializer().toProperty(input, format).getObject();
+ return ((ODataClient) client).getBinder().getODataProperty(property);
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractMetadataTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractMetadataTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractMetadataTestITCase.java
index 11b9104..4f65421 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractMetadataTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractMetadataTestITCase.java
@@ -20,9 +20,8 @@ package org.apache.olingo.client.core.it;
import org.apache.olingo.client.api.CommonODataClient;
-public abstract class AbstractMetadataTestITCase extends AbstractTestITCase {
+public abstract class AbstractMetadataTestITCase {
- @Override
protected abstract CommonODataClient getClient();
protected String getTestServiceRoot() {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
deleted file mode 100644
index 0a3b53d..0000000
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
+++ /dev/null
@@ -1,562 +0,0 @@
-/*
- * 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.client.core.it;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.StringWriter;
-import java.net.URI;
-import java.util.HashSet;
-import java.util.Locale;
-import java.util.Set;
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.client.api.CommonODataClient;
-import org.apache.olingo.client.api.communication.ODataClientErrorException;
-import org.apache.olingo.client.api.communication.request.cud.ODataDeleteRequest;
-import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest;
-import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest;
-import org.apache.olingo.client.api.communication.request.cud.UpdateType;
-import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
-import org.apache.olingo.client.api.communication.response.ODataDeleteResponse;
-import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
-import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse;
-import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.commons.api.data.Entry;
-import org.apache.olingo.commons.api.data.Feed;
-import org.apache.olingo.commons.api.domain.ODataCollectionValue;
-import org.apache.olingo.commons.api.domain.ODataComplexValue;
-import org.apache.olingo.commons.api.domain.CommonODataEntity;
-import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
-import org.apache.olingo.commons.api.domain.ODataInlineEntity;
-import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
-import org.apache.olingo.commons.api.domain.ODataLink;
-import org.apache.olingo.commons.api.domain.CommonODataProperty;
-import org.apache.olingo.commons.api.domain.ODataValue;
-import org.apache.olingo.commons.api.format.ODataPubFormat;
-import org.apache.olingo.client.api.http.HttpMethod;
-import org.apache.olingo.client.api.uri.CommonURIBuilder;
-import org.apache.olingo.client.core.uri.URIUtils;
-import org.apache.olingo.commons.core.data.AtomEntryImpl;
-import org.apache.olingo.commons.core.data.JSONEntryImpl;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.junit.BeforeClass;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public abstract class AbstractTestITCase {
-
- /**
- * Logger.
- */
- protected static final Logger LOG = LoggerFactory.getLogger(AbstractTestITCase.class);
-
- protected static final String TEST_PRODUCT_TYPE = "Microsoft.Test.OData.Services.AstoriaDefaultService.Product";
-
- protected static final String servicesODataServiceRootURL =
- "http://services.odata.org/V3/(S(csquyjnoaywmz5xcdbfhlc1p))/OData/OData.svc/";
-
- /**
- * This is needed for correct number handling (Double, for example).
- */
- @BeforeClass
- public static void setEnglishLocale() {
- Locale.setDefault(Locale.ENGLISH);
- }
-
- protected abstract CommonODataClient getClient();
-
- protected void checkLinks(final Collection<ODataLink> original, final Collection<ODataLink> actual) {
- assertTrue(original.size() <= actual.size());
-
- for (ODataLink originalLink : original) {
- ODataLink foundOriginal = null;
- ODataLink foundActual = null;
-
- for (ODataLink actualLink : actual) {
-
- if (actualLink.getType() == originalLink.getType()
- && (originalLink.getLink() == null
- || actualLink.getLink().toASCIIString().endsWith(originalLink.getLink().toASCIIString()))
- && actualLink.getName().equals(originalLink.getName())) {
-
- foundOriginal = originalLink;
- foundActual = actualLink;
- }
- }
-
- assertNotNull(foundOriginal);
- assertNotNull(foundActual);
-
- if (foundOriginal instanceof ODataInlineEntity && foundActual instanceof ODataInlineEntity) {
- final CommonODataEntity originalInline = ((ODataInlineEntity) foundOriginal).getEntity();
- assertNotNull(originalInline);
-
- final CommonODataEntity actualInline = ((ODataInlineEntity) foundActual).getEntity();
- assertNotNull(actualInline);
-
- checkProperties(originalInline.getProperties(), actualInline.getProperties());
- }
- }
- }
-
- protected void checkProperties(final Collection<? extends CommonODataProperty> original,
- final Collection<? extends CommonODataProperty> actual) {
-
- assertTrue(original.size() <= actual.size());
-
- // re-organize actual properties into a Map<String, ODataProperty>
- final Map<String, CommonODataProperty> actualProps = new HashMap<String, CommonODataProperty>(actual.size());
-
- for (CommonODataProperty prop : actual) {
- assertFalse(actualProps.containsKey(prop.getName()));
- actualProps.put(prop.getName(), prop);
- }
-
- assertTrue(actual.size() <= actualProps.size());
-
- for (CommonODataProperty prop : original) {
- assertNotNull(prop);
- if (actualProps.containsKey(prop.getName())) {
- final CommonODataProperty actualProp = actualProps.get(prop.getName());
- assertNotNull(actualProp);
-
- if (prop.getValue() != null && actualProp.getValue() != null) {
- checkPropertyValue(prop.getName(), prop.getValue(), actualProp.getValue());
- }
- } else {
- // nothing ... maybe :FC_KeepInContent="false"
- // ..... no assert can be done ....
- }
- }
- }
-
- protected void checkPropertyValue(final String propertyName,
- final ODataValue original, final ODataValue actual) {
-
- assertNotNull("Null original value for " + propertyName, original);
- assertNotNull("Null actual value for " + propertyName, actual);
-
- assertEquals("Type mismatch for '" + propertyName + "': "
- + original.getClass().getSimpleName() + "-" + actual.getClass().getSimpleName(),
- original.getClass().getSimpleName(), actual.getClass().getSimpleName());
-
- if (original.isComplex()) {
- final List<CommonODataProperty> originalFileds = new ArrayList<CommonODataProperty>();
- for (CommonODataProperty prop : original.asComplex()) {
- originalFileds.add(prop);
- }
-
- final List<CommonODataProperty> actualFileds = new ArrayList<CommonODataProperty>();
- for (CommonODataProperty prop : (ODataComplexValue) actual) {
- actualFileds.add(prop);
- }
-
- checkProperties(originalFileds, actualFileds);
- } else if (original.isCollection()) {
- assertTrue(original.asCollection().size() <= actual.asCollection().size());
-
- boolean found = original.asCollection().isEmpty();
-
- for (ODataValue originalValue : original.asCollection()) {
- for (ODataValue actualValue : actual.asCollection()) {
- try {
- checkPropertyValue(propertyName, originalValue, actualValue);
- found = true;
- } catch (AssertionError ignore) {
- // ignore
- }
- }
- }
-
- assertTrue("Found " + actual + " but expected " + original, found);
- } else {
- assertTrue("Primitive value for '" + propertyName + "' type mismatch: " + original.asPrimitive().
- getTypeKind() + "-" + actual.asPrimitive().getTypeKind(),
- original.asPrimitive().getTypeKind().equals(actual.asPrimitive().getTypeKind()));
-
- assertEquals("Primitive value for '" + propertyName + "' mismatch: " + original.asPrimitive().toString()
- + "-" + actual.asPrimitive().toString(),
- original.asPrimitive().toString(), actual.asPrimitive().toString());
- }
- }
-
- protected CommonODataEntity getSampleCustomerInfo(final int id, final String sampleinfo) {
- final CommonODataEntity entity = getClient().getObjectFactory().newEntity(
- "Microsoft.Test.OData.Services.AstoriaDefaultService.CustomerInfo");
- entity.setMediaEntity(true);
-
- getClient().getBinder().add(entity,
- getClient().getObjectFactory().newPrimitiveProperty("Information",
- getClient().getObjectFactory().newPrimitiveValueBuilder().setText(sampleinfo).
- setType(EdmPrimitiveTypeKind.String).build()));
-
- return entity;
- }
-
- protected CommonODataEntity getSampleCustomerProfile(
- final int id, final String sampleName, final boolean withInlineInfo) {
-
- final CommonODataEntity entity =
- getClient().getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.Customer");
-
- // add name attribute
- getClient().getBinder().add(entity,
- getClient().getObjectFactory().newPrimitiveProperty("Name",
- getClient().getObjectFactory().newPrimitiveValueBuilder().setText(sampleName).
- setType(EdmPrimitiveTypeKind.String).build()));
-
- // add key attribute
- getClient().getBinder().add(entity,
- getClient().getObjectFactory().newPrimitiveProperty("CustomerId",
- getClient().getObjectFactory().newPrimitiveValueBuilder().setText(String.valueOf(id)).
- setType(EdmPrimitiveTypeKind.Int32).build()));
-
- // add BackupContactInfo attribute (collection)
- final ODataCollectionValue backupContactInfoValue = getClient().getObjectFactory().newCollectionValue(
- "Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails)");
- getClient().getBinder().add(entity,
- getClient().getObjectFactory().newCollectionProperty("BackupContactInfo", backupContactInfoValue));
-
- // add BackupContactInfo.ContactDetails attribute (complex)
- final ODataComplexValue contactDetails = getClient().getObjectFactory().newComplexValue(
- "Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails");
- backupContactInfoValue.add(contactDetails);
-
- // add BackupContactInfo.ContactDetails.AlternativeNames attribute (collection)
- final ODataCollectionValue altNamesValue = getClient().getObjectFactory().
- newCollectionValue("Collection(Edm.String)");
- altNamesValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder().
- setText("myname").setType(EdmPrimitiveTypeKind.String).build());
- contactDetails.add(getClient().getObjectFactory().newCollectionProperty("AlternativeNames", altNamesValue));
-
- // add BackupContactInfo.ContactDetails.EmailBag attribute (collection)
- final ODataCollectionValue emailBagValue = getClient().getObjectFactory().
- newCollectionValue("Collection(Edm.String)");
- emailBagValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder().
- setText("myname@mydomain.com").setType(EdmPrimitiveTypeKind.String).build());
- contactDetails.add(getClient().getObjectFactory().newCollectionProperty("EmailBag", emailBagValue));
-
- // add BackupContactInfo.ContactDetails.ContactAlias attribute (complex)
- final ODataComplexValue contactAliasValue = getClient().getObjectFactory().newComplexValue(
- "Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases");
- contactDetails.add(getClient().getObjectFactory().newComplexProperty("ContactAlias", contactAliasValue));
-
- // add BackupContactInfo.ContactDetails.ContactAlias.AlternativeNames attribute (collection)
- final ODataCollectionValue aliasAltNamesValue = getClient().getObjectFactory().
- newCollectionValue("Collection(Edm.String)");
- aliasAltNamesValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder().
- setText("myAlternativeName").setType(EdmPrimitiveTypeKind.String).build());
- contactAliasValue.add(getClient().getObjectFactory().newCollectionProperty("AlternativeNames", aliasAltNamesValue));
-
- if (withInlineInfo) {
- final ODataInlineEntity inlineInfo = getClient().getObjectFactory().newInlineEntity(
- "Info",
- URI.create("Customer(" + id + ")/Info"),
- getSampleCustomerInfo(id, sampleName + "_Info"));
- inlineInfo.getEntity().setMediaEntity(true);
- entity.addLink(inlineInfo);
- }
-
- return entity;
- }
-
- protected void debugEntry(final Entry entry, final String message) {
- if (LOG.isDebugEnabled()) {
- final StringWriter writer = new StringWriter();
- getClient().getSerializer().entry(entry, writer);
- writer.flush();
- LOG.debug(message + "\n{}", writer.toString());
- }
- }
-
- protected void debugFeed(final Feed feed, final String message) {
- if (LOG.isDebugEnabled()) {
- final StringWriter writer = new StringWriter();
- getClient().getSerializer().feed(feed, writer);
- writer.flush();
- LOG.debug(message + "\n{}", writer.toString());
- }
- }
-
- protected void debugODataProperty(final CommonODataProperty property, final String message) {
- LOG.debug(message + "\n{}", property.toString());
- }
-
- protected void debugODataValue(final ODataValue value, final String message) {
- LOG.debug(message + "\n{}", value.toString());
- }
-
- protected void debugODataEntity(final CommonODataEntity entity, final String message) {
- if (LOG.isDebugEnabled()) {
- StringWriter writer = new StringWriter();
- getClient().getSerializer().entry(getClient().getBinder().getEntry(entity, AtomEntryImpl.class), writer);
- writer.flush();
- LOG.debug(message + " (Atom)\n{}", writer.toString());
-
- writer = new StringWriter();
- getClient().getSerializer().entry(getClient().getBinder().getEntry(entity, JSONEntryImpl.class), writer);
- writer.flush();
- LOG.debug(message + " (JSON)\n{}", writer.toString());
- }
- }
-
- protected void debugInputStream(final InputStream input, final String message) {
- if (LOG.isDebugEnabled()) {
- try {
- LOG.debug(message + "\n{}", IOUtils.toString(input));
- } catch (IOException e) {
- LOG.error("Error writing stream", e);
- } finally {
- IOUtils.closeQuietly(input);
- }
- }
- }
-
- protected String getETag(final URI uri) {
- final ODataRetrieveResponse<CommonODataEntity> res = getClient().getRetrieveRequestFactory().
- getEntityRequest(uri).execute();
- try {
- return res.getEtag();
- } finally {
- res.close();
- }
- }
-
- protected CommonODataEntity read(final ODataPubFormat format, final URI editLink) {
- final ODataEntityRequest<CommonODataEntity> req = getClient().getRetrieveRequestFactory().
- getEntityRequest(editLink);
- req.setFormat(format);
-
- final ODataRetrieveResponse<CommonODataEntity> res = req.execute();
- final CommonODataEntity entity = res.getBody();
-
- assertNotNull(entity);
-
- if (ODataPubFormat.JSON_FULL_METADATA == format || ODataPubFormat.ATOM == format) {
- assertEquals(req.getURI(), entity.getEditLink());
- }
-
- return entity;
- }
-
- protected CommonODataEntity createEntity(
- final String serviceRootURL,
- final ODataPubFormat format,
- final CommonODataEntity original,
- final String entitySetName) {
-
- final CommonURIBuilder<?> uriBuilder = getClient().getURIBuilder(serviceRootURL).
- appendEntitySetSegment(entitySetName);
-
- debugODataEntity(original, "About to create");
-
- final ODataEntityCreateRequest createReq =
- getClient().getCUDRequestFactory().getEntityCreateRequest(uriBuilder.build(), original);
- createReq.setFormat(format);
-
- final ODataEntityCreateResponse createRes = createReq.execute();
- assertEquals(201, createRes.getStatusCode());
- assertEquals("Created", createRes.getStatusMessage());
-
- final CommonODataEntity created = createRes.getBody();
- assertNotNull(created);
-
- debugODataEntity(created, "Just created");
-
- return created;
- }
-
- protected CommonODataEntity compareEntities(final String serviceRootURL,
- final ODataPubFormat format,
- final CommonODataEntity original,
- final int actualObjectId,
- final Collection<String> expands) {
-
- final CommonURIBuilder<?> uriBuilder = getClient().getURIBuilder(serviceRootURL).
- appendEntitySetSegment("Customer").appendKeySegment(actualObjectId);
-
- // search expanded
- if (expands != null) {
- for (String expand : expands) {
- uriBuilder.expand(expand);
- }
- }
-
- final ODataEntityRequest<CommonODataEntity> req = getClient().getRetrieveRequestFactory().
- getEntityRequest(uriBuilder.build());
- req.setFormat(format);
-
- final ODataRetrieveResponse<CommonODataEntity> res = req.execute();
- assertEquals(200, res.getStatusCode());
-
- final CommonODataEntity actual = res.getBody();
- assertNotNull(actual);
-
- // check defined links
- checkLinks(original.getAssociationLinks(), actual.getAssociationLinks());
- checkLinks(original.getEditMediaLinks(), actual.getEditMediaLinks());
- checkLinks(original.getNavigationLinks(), actual.getNavigationLinks());
-
- // check defined properties equality
- checkProperties(original.getProperties(), actual.getProperties());
-
- return actual;
- }
-
- protected void cleanAfterCreate(
- final ODataPubFormat format,
- final CommonODataEntity created,
- final boolean includeInline,
- final String baseUri) {
-
- final Set<URI> toBeDeleted = new HashSet<URI>();
- toBeDeleted.add(created.getEditLink());
-
- if (includeInline) {
- for (ODataLink link : created.getNavigationLinks()) {
- if (link instanceof ODataInlineEntity) {
- final CommonODataEntity inline = ((ODataInlineEntity) link).getEntity();
- if (inline.getEditLink() != null) {
- toBeDeleted.add(URIUtils.getURI(baseUri, inline.getEditLink().toASCIIString()));
- }
- }
-
- if (link instanceof ODataInlineEntitySet) {
- final CommonODataEntitySet inline = ((ODataInlineEntitySet) link).getEntitySet();
- for (CommonODataEntity entity : inline.getEntities()) {
- if (entity.getEditLink() != null) {
- toBeDeleted.add(URIUtils.getURI(baseUri, entity.getEditLink().toASCIIString()));
- }
- }
- }
- }
- }
-
- assertFalse(toBeDeleted.isEmpty());
-
- for (URI link : toBeDeleted) {
- final ODataDeleteRequest deleteReq = getClient().getCUDRequestFactory().getDeleteRequest(link);
- final ODataDeleteResponse deleteRes = deleteReq.execute();
-
- assertEquals(204, deleteRes.getStatusCode());
- assertEquals("No Content", deleteRes.getStatusMessage());
-
- deleteRes.close();
-
- final ODataEntityRequest<CommonODataEntity> retrieveReq = getClient().getRetrieveRequestFactory().
- getEntityRequest(link);
- // bug that needs to be fixed on the SampleService - cannot get entity not found with header
- // Accept: application/json;odata=minimalmetadata
- retrieveReq.setFormat(format == ODataPubFormat.JSON_FULL_METADATA ? ODataPubFormat.JSON : format);
-
- Exception exception = null;
- try {
- retrieveReq.execute();
- fail();
- } catch (ODataClientErrorException e) {
- exception = e;
- assertEquals(404, e.getStatusLine().getStatusCode());
- }
- assertNotNull(exception);
- }
- }
-
- protected void updateEntityDescription(
- final ODataPubFormat format, final CommonODataEntity changes, final UpdateType type) {
-
- updateEntityDescription(format, changes, type, null);
- }
-
- protected void updateEntityDescription(
- final ODataPubFormat format, final CommonODataEntity changes, final UpdateType type, final String etag) {
-
- updateEntityStringProperty("Description", format, changes, type, etag);
- }
-
- protected void updateEntityStringProperty(final String propertyName,
- final ODataPubFormat format, final CommonODataEntity changes, final UpdateType type, final String etag) {
-
- final URI editLink = changes.getEditLink();
-
- final String newm = "New " + propertyName + "(" + System.currentTimeMillis() + ")";
-
- CommonODataProperty propertyValue = changes.getProperty(propertyName);
-
- final String oldm;
- if (propertyValue == null) {
- oldm = null;
- } else {
- oldm = propertyValue.getValue().toString();
- changes.getProperties().remove(propertyValue);
- }
-
- assertNotEquals(newm, oldm);
-
- getClient().getBinder().add(changes,
- getClient().getObjectFactory().newPrimitiveProperty(propertyName,
- getClient().getObjectFactory().newPrimitiveValueBuilder().setText(newm).build()));
-
- update(type, changes, format, etag);
-
- final CommonODataEntity actual = read(format, editLink);
-
- propertyValue = null;
-
- for (CommonODataProperty prop : actual.getProperties()) {
- if (prop.getName().equals(propertyName)) {
- propertyValue = prop;
- }
- }
-
- assertNotNull(propertyValue);
- assertEquals(newm, propertyValue.getValue().toString());
- }
-
- protected void update(
- final UpdateType type, final CommonODataEntity changes, final ODataPubFormat format, final String etag) {
- final ODataEntityUpdateRequest req = getClient().getCUDRequestFactory().getEntityUpdateRequest(type, changes);
-
- if (getClient().getConfiguration().isUseXHTTPMethod()) {
- assertEquals(HttpMethod.POST, req.getMethod());
- } else {
- assertEquals(type.getMethod(), req.getMethod());
- }
- req.setFormat(format);
-
- if (StringUtils.isNotBlank(etag)) {
- req.setIfMatch(etag); // Product include ETag header into the response .....
- }
-
- final ODataEntityUpdateResponse res = req.execute();
- assertEquals(204, res.getStatusCode());
- }
-}
[43/51] [abbrv] git commit: [OLINGO-200] V3, V4 Error tests in
Posted by il...@apache.org.
[OLINGO-200] V3, V4 Error tests in
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/de591bb5
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/de591bb5
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/de591bb5
Branch: refs/heads/master
Commit: de591bb58303c185d0739ad5902732039916d97a
Parents: eeb5d9b
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Mon Mar 31 16:55:31 2014 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Mon Mar 31 16:55:31 2014 +0200
----------------------------------------------------------------------
.../ODataClientErrorException.java | 31 +--
.../communication/request/ODataRequestImpl.java | 23 +-
.../client/core/it/v3/ErrorTestITCase.java | 1 -
.../apache/olingo/client/core/v3/ErrorTest.java | 6 +-
.../apache/olingo/client/core/v4/ErrorTest.java | 61 +++++
.../org/apache/olingo/client/core/v3/error.xml | 2 +-
.../org/apache/olingo/client/core/v4/error.json | 14 ++
.../org/apache/olingo/client/core/v4/error.xml | 31 +++
.../apache/olingo/commons/api/Constants.java | 7 +
.../olingo/commons/api/domain/ODataError.java | 28 +--
.../api/edm/constants/ODataServiceVersion.java | 3 +
.../commons/core/data/AbstractAtomDealer.java | 13 +
.../commons/core/data/AbstractODataError.java | 58 +++++
.../commons/core/data/AbstractProperty.java | 80 +++++++
.../commons/core/data/AbstractPropertyImpl.java | 80 -------
.../commons/core/data/AtomDeserializer.java | 60 ++++-
.../commons/core/data/AtomPropertyImpl.java | 2 +-
.../commons/core/data/JSONErrorBundle.java | 50 ----
.../olingo/commons/core/data/JSONErrorImpl.java | 237 -------------------
.../core/data/JSONODataErrorDeserializer.java | 60 +++++
.../commons/core/data/JSONODataErrorImpl.java | 26 ++
.../commons/core/data/JSONPropertyImpl.java | 2 +-
.../core/data/ODataJacksonDeserializer.java | 3 +
.../olingo/commons/core/data/XMLErrorImpl.java | 213 -----------------
.../commons/core/data/XMLODataErrorImpl.java | 23 ++
.../core/op/AbstractODataDeserializer.java | 16 +-
26 files changed, 465 insertions(+), 665 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/ODataClientErrorException.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/ODataClientErrorException.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/ODataClientErrorException.java
index 85ae888..6dc2f07 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/ODataClientErrorException.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/ODataClientErrorException.java
@@ -18,11 +18,6 @@
*/
package org.apache.olingo.client.api.communication;
-import java.io.IOException;
-import java.io.StringReader;
-import java.util.Collections;
-import java.util.List;
-import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.StatusLine;
import org.apache.olingo.commons.api.domain.ODataError;
@@ -60,34 +55,10 @@ public class ODataClientErrorException extends RuntimeException {
*/
public ODataClientErrorException(final StatusLine statusLine, final ODataError error) {
super((StringUtils.isBlank(error.getCode()) ? StringUtils.EMPTY : "(" + error.getCode() + ") ")
- + error.getMessageValue() + " [" + statusLine.toString() + "]");
+ + error.getMessage() + " [" + statusLine.toString() + "]");
this.statusLine = statusLine;
this.error = error;
-
- if (this.error.getInnerErrorType() != null && this.error.getInnerErrorMessage() != null) {
- final RuntimeException cause =
- new RuntimeException(this.error.getInnerErrorType() + ": " + this.error.getInnerErrorMessage());
-
- if (this.error.getInnerErrorStacktrace() != null) {
- List<String> stLines;
- try {
- stLines = IOUtils.readLines(new StringReader(this.error.getInnerErrorStacktrace()));
- } catch (IOException e) {
- stLines = Collections.<String>emptyList();
- }
- StackTraceElement[] stElements = new StackTraceElement[stLines.size()];
- for (int i = 0; i < stLines.size(); i++) {
- final String stLine = stLines.get(i).substring(stLines.get(i).indexOf("at ") + 3);
- final int lastDotPos = stLine.lastIndexOf('.');
- stElements[i] = new StackTraceElement(
- stLine.substring(0, lastDotPos), stLine.substring(lastDotPos + 1), null, 0);
- }
- cause.setStackTrace(stElements);
- }
-
- initCause(cause);
- }
}
/**
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java
index 65cca8d..12696a6 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java
@@ -24,7 +24,6 @@ import java.io.InputStream;
import java.lang.reflect.Constructor;
import java.net.URI;
import java.util.Collection;
-import java.util.Collections;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.Header;
@@ -52,8 +51,8 @@ import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.commons.api.format.ODataMediaFormat;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.commons.api.format.ODataValueFormat;
-import org.apache.olingo.commons.core.data.JSONErrorImpl;
-import org.apache.olingo.commons.core.data.XMLErrorImpl;
+import org.apache.olingo.commons.core.data.JSONODataErrorImpl;
+import org.apache.olingo.commons.core.data.XMLODataErrorImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -479,19 +478,13 @@ public class ODataRequestImpl<T extends Format> implements ODataRequest {
private ODataError getGenericError(final int code, final String errorMsg, final boolean isXML) {
final ODataError error;
if (isXML) {
- error = new XMLErrorImpl();
- final XMLErrorImpl.Message msg = new XMLErrorImpl.Message(
- Collections.singletonMap("", (Object) errorMsg));
-
- ((XMLErrorImpl) error).setMessage(msg);
- ((XMLErrorImpl) error).setCode(String.valueOf(code));
+ error = new XMLODataErrorImpl();
+ ((XMLODataErrorImpl) error).setCode(String.valueOf(code));
+ ((XMLODataErrorImpl) error).setMessage(errorMsg);
} else {
- error = new JSONErrorImpl();
- final JSONErrorImpl.Message msg = new JSONErrorImpl.Message();
- msg.setValue(errorMsg);
-
- ((JSONErrorImpl) error).setMessage(msg);
- ((JSONErrorImpl) error).setCode(String.valueOf(code));
+ error = new JSONODataErrorImpl();
+ ((JSONODataErrorImpl) error).setCode(String.valueOf(code));
+ ((JSONODataErrorImpl) error).setMessage(errorMsg);
}
return error;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java
index 04c41de..efb818b 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java
@@ -99,7 +99,6 @@ public class ErrorTestITCase extends AbstractTestITCase {
} catch (ODataClientErrorException e) {
LOG.error("ODataClientErrorException found", e);
assertEquals(400, e.getStatusLine().getStatusCode());
- assertNotNull(e.getCause());
assertNotNull(e.getODataError());
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/ErrorTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/ErrorTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/ErrorTest.java
index 0b10d51..b2cf8e3 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/ErrorTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/ErrorTest.java
@@ -18,8 +18,8 @@
*/
package org.apache.olingo.client.core.v3;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
import org.apache.olingo.client.api.v3.ODataClient;
import org.apache.olingo.commons.api.domain.ODataError;
@@ -43,7 +43,7 @@ public class ErrorTest extends AbstractTest {
private void simple(final ODataPubFormat format) {
final ODataError error = error("error", format);
- assertNull(error.getInnerErrorStacktrace());
+ assertEquals("The URL representing the root of the service only supports GET requests.", error.getMessage());
}
@Test
@@ -58,7 +58,7 @@ public class ErrorTest extends AbstractTest {
private void stacktrace(final ODataPubFormat format) {
final ODataError error = error("stacktrace", format);
- assertNotNull(error.getInnerErrorStacktrace());
+ assertEquals("Unsupported media type requested.", error.getMessage());
}
@Test
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ErrorTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ErrorTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ErrorTest.java
new file mode 100644
index 0000000..c89fa39
--- /dev/null
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ErrorTest.java
@@ -0,0 +1,61 @@
+/*
+ * 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.client.core.v4;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.apache.olingo.client.api.v4.ODataClient;
+import org.apache.olingo.commons.api.domain.ODataError;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
+import org.apache.olingo.client.core.AbstractTest;
+import org.junit.Test;
+
+public class ErrorTest extends AbstractTest {
+
+ @Override
+ protected ODataClient getClient() {
+ return v4Client;
+ }
+
+ private ODataError error(final String name, final ODataPubFormat format) {
+ final ODataError error = getClient().getDeserializer().toError(
+ getClass().getResourceAsStream(name + "." + getSuffix(format)), format == ODataPubFormat.ATOM);
+ assertNotNull(error);
+ return error;
+ }
+
+ private void simple(final ODataPubFormat format) {
+ final ODataError error = error("error", format);
+ assertEquals("501", error.getCode());
+ assertEquals("Unsupported functionality", error.getMessage());
+ assertEquals("query", error.getTarget());
+ }
+
+ @Test
+ public void jsonSimple() {
+ simple(ODataPubFormat.JSON);
+ }
+
+ @Test
+ public void atomSimple() {
+ simple(ODataPubFormat.ATOM);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/error.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/error.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/error.xml
index 2ef78ad..9d999ff 100644
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/error.xml
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/error.xml
@@ -21,5 +21,5 @@
-->
<m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<m:code />
- <m:message xml:lang="en-US">The URI 'http://192.168.0.160:8080/DefaultService.svc/Customer(100)' is not valid for POST operation. For POST operations, the URI must refer to a service operation or an entity set.</m:message>
+ <m:message xml:lang="en-US">The URL representing the root of the service only supports GET requests.</m:message>
</m:error>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/error.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/error.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/error.json
new file mode 100644
index 0000000..30a50d8
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/error.json
@@ -0,0 +1,14 @@
+{
+ "error": {
+ "code": "501",
+ "message": "Unsupported functionality",
+ "target": "query",
+ "details": [
+ {
+ "code": "301",
+ "target": "$search",
+ "message": "$search query option not supported"
+ }
+ ]
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/error.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/error.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/error.xml
new file mode 100644
index 0000000..149b799
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/error.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+<error xmlns="http://docs.oasis-open.org/odata/ns/metadata">
+ <code>501</code>
+ <message>Unsupported functionality</message>
+ <target>query</target>
+ <details>
+ <detail>
+ <code>301</code>
+ <message>$search query option not supported</message>
+ <target>$search</target>
+ </detail>
+ </details>
+</error>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
index f41c30c..a1aec31 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
@@ -224,4 +224,11 @@ public interface Constants {
public static final String ATOM_ATTR_METADATAETAG = "metadata-etag";
+ // error stuff
+ public static final String ERROR_CODE = "code";
+
+ public static final String ERROR_MESSAGE = "message";
+
+ public static final String ERROR_TARGET = "target";
+
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataError.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataError.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataError.java
index 2993964..fc309d3 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataError.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataError.java
@@ -31,37 +31,17 @@ public interface ODataError {
String getCode();
/**
- * Gets error message language.
- *
- * @return error message language.
- */
- String getMessageLang();
-
- /**
* Gets error message.
*
* @return error message.
*/
- String getMessageValue();
-
- /**
- * Gets inner error message.
- *
- * @return inner error message.
- */
- String getInnerErrorMessage();
+ String getMessage();
/**
- * Gets inner error type.
+ * Gets error target.
*
- * @return inner error type.
+ * @return error message.
*/
- String getInnerErrorType();
+ String getTarget();
- /**
- * Gets inner error stack-trace.
- *
- * @return inner error stack-trace
- */
- String getInnerErrorStacktrace();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java
index 5442d1d..c6354ec 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java
@@ -69,6 +69,7 @@ public enum ODataServiceVersion {
public static final String JSON_ASSOCIATION_LINK = "jsonAssociationLink";
public static final String JSON_NAVIGATION_LINK = "jsonNavigationLink";
+ public static final String JSON_ERROR = "jsonError";
private static final Map<String, String> V30_NAMESPACES = Collections.unmodifiableMap(new HashMap<String, String>() {
@@ -100,6 +101,7 @@ public enum ODataServiceVersion {
put(JSON_MEDIA_ETAG, "odata.mediaEtag");
put(JSON_ASSOCIATION_LINK, "@odata.associationLinkUrl");
put(JSON_NAVIGATION_LINK, "@odata.navigationLinkUrl");
+ put(JSON_ERROR, "odata.error");
}
});
@@ -133,6 +135,7 @@ public enum ODataServiceVersion {
put(JSON_MEDIA_ETAG, "@odata.mediaEtag");
put(JSON_ASSOCIATION_LINK, "@odata.associationLink");
put(JSON_NAVIGATION_LINK, "@odata.navigationLink");
+ put(JSON_ERROR, "error");
}
});
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java
index 656207c..e9338f1 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java
@@ -60,6 +60,12 @@ abstract class AbstractAtomDealer {
protected final QName v4PropertyValueQName;
+ protected final QName errorCodeQName;
+
+ protected final QName errorMessageQName;
+
+ protected final QName errorTargetQName;
+
public AbstractAtomDealer(final ODataServiceVersion version) {
this.version = version;
@@ -90,6 +96,13 @@ abstract class AbstractAtomDealer {
new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ATOM_ELEM_ENTRY_REF);
this.v4PropertyValueQName =
new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.VALUE);
+
+ this.errorCodeQName =
+ new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ERROR_CODE);
+ this.errorMessageQName =
+ new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ERROR_MESSAGE);
+ this.errorTargetQName =
+ new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ERROR_TARGET);
}
protected void namespaces(final XMLStreamWriter writer) throws XMLStreamException {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractODataError.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractODataError.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractODataError.java
new file mode 100644
index 0000000..e5324d8
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractODataError.java
@@ -0,0 +1,58 @@
+/*
+ * 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.commons.core.data;
+
+import org.apache.olingo.commons.api.domain.ODataError;
+
+public abstract class AbstractODataError implements ODataError {
+
+ private String code;
+
+ private String message;
+
+ private String target;
+
+ @Override
+ public String getCode() {
+ return code;
+ }
+
+ public void setCode(final String code) {
+ this.code = code;
+ }
+
+ @Override
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(final String message) {
+ this.message = message;
+ }
+
+ @Override
+ public String getTarget() {
+ return target;
+ }
+
+ public void setTarget(final String target) {
+ this.target = target;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractProperty.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractProperty.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractProperty.java
new file mode 100644
index 0000000..940bf89
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractProperty.java
@@ -0,0 +1,80 @@
+/*
+ * 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.commons.core.data;
+
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.data.Value;
+
+public abstract class AbstractProperty implements Property {
+
+ private String name;
+
+ private String type;
+
+ private Value value;
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String getType() {
+ return type;
+ }
+
+ @Override
+ public void setType(final String type) {
+ this.type = type;
+ }
+
+ @Override
+ public Value getValue() {
+ return value;
+ }
+
+ @Override
+ public void setValue(final Value value) {
+ this.value = value;
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ return EqualsBuilder.reflectionEquals(this, obj);
+ }
+
+ @Override
+ public int hashCode() {
+ return HashCodeBuilder.reflectionHashCode(this);
+ }
+
+ @Override
+ public String toString() {
+ return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractPropertyImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractPropertyImpl.java
deleted file mode 100644
index e005f98..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractPropertyImpl.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * 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.commons.core.data;
-
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.data.Value;
-
-public abstract class AbstractPropertyImpl implements Property {
-
- private String name;
-
- private String type;
-
- private Value value;
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public void setName(final String name) {
- this.name = name;
- }
-
- @Override
- public String getType() {
- return type;
- }
-
- @Override
- public void setType(final String type) {
- this.type = type;
- }
-
- @Override
- public Value getValue() {
- return value;
- }
-
- @Override
- public void setValue(final Value value) {
- this.value = value;
- }
-
- @Override
- public boolean equals(final Object obj) {
- return EqualsBuilder.reflectionEquals(this, obj);
- }
-
- @Override
- public int hashCode() {
- return HashCodeBuilder.reflectionHashCode(this);
- }
-
- @Override
- public String toString() {
- return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
index c2ffd8e..a786803 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
@@ -386,11 +386,69 @@ public class AtomDeserializer extends AbstractAtomDealer {
return getContainer(start, feed(reader, start));
}
+ private XMLODataErrorImpl error(final XMLEventReader reader, final StartElement start) throws XMLStreamException {
+ final XMLODataErrorImpl error = new XMLODataErrorImpl();
+
+ boolean setCode = false;
+ boolean codeSet = false;
+ boolean setMessage = false;
+ boolean messageSet = false;
+ boolean setTarget = false;
+ boolean targetSet = false;
+
+ boolean foundEndElement = false;
+ while (reader.hasNext() && !foundEndElement) {
+ final XMLEvent event = reader.nextEvent();
+
+ if (event.isStartElement()) {
+ if (errorCodeQName.equals(event.asStartElement().getName())) {
+ setCode = true;
+ } else if (errorMessageQName.equals(event.asStartElement().getName())) {
+ setMessage = true;
+ } else if (errorTargetQName.equals(event.asStartElement().getName())) {
+ setTarget = true;
+ }
+ }
+
+ if (event.isCharacters() && !event.asCharacters().isWhiteSpace()) {
+ if (setCode && !codeSet) {
+ error.setCode(event.asCharacters().getData());
+ setCode = false;
+ codeSet = true;
+ }
+ if (setMessage && !messageSet) {
+ error.setMessage(event.asCharacters().getData());
+ setMessage = false;
+ messageSet = true;
+ }
+ if (setTarget && !targetSet) {
+ error.setTarget(event.asCharacters().getData());
+ setTarget = false;
+ targetSet = true;
+ }
+ }
+
+ if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
+ foundEndElement = true;
+ }
+ }
+
+ return error;
+ }
+
+ private Container<XMLODataErrorImpl> error(final InputStream input) throws XMLStreamException {
+ final XMLEventReader reader = FACTORY.createXMLEventReader(input);
+ final StartElement start = skipBeforeFirstStartElement(reader);
+ return getContainer(start, error(reader, start));
+ }
+
@SuppressWarnings("unchecked")
public <T, V extends T> Container<T> read(final InputStream input, final Class<V> reference)
throws XMLStreamException {
- if (AtomFeedImpl.class.equals(reference)) {
+ if (XMLODataErrorImpl.class.equals(reference)) {
+ return (Container<T>) error(input);
+ } else if (AtomFeedImpl.class.equals(reference)) {
return (Container<T>) feed(input);
} else if (AtomEntryImpl.class.equals(reference)) {
return (Container<T>) entry(input);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyImpl.java
index 9688db2..e0018bc 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomPropertyImpl.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.commons.core.data;
-public class AtomPropertyImpl extends AbstractPropertyImpl {
+public class AtomPropertyImpl extends AbstractProperty {
private static final long serialVersionUID = 48748492242474814L;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONErrorBundle.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONErrorBundle.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONErrorBundle.java
deleted file mode 100644
index 433b754..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONErrorBundle.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.commons.core.data;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * This class represents a bundle for an OData error returned as JSON.
- */
-public class JSONErrorBundle extends AbstractPayloadObject {
-
- private static final long serialVersionUID = -4784910226259754450L;
-
- @JsonProperty("odata.error")
- private JSONErrorImpl error;
-
- /**
- * Gets error.
- *
- * @return OData error object.
- */
- public JSONErrorImpl getError() {
- return error;
- }
-
- /**
- * Sets error.
- *
- * @param error OData error object.
- */
- public void setError(final JSONErrorImpl error) {
- this.error = error;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONErrorImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONErrorImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONErrorImpl.java
deleted file mode 100644
index 4c6cb4a..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONErrorImpl.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * 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.commons.core.data;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import org.apache.olingo.commons.api.domain.ODataError;
-
-/**
- * This class represents an OData error returned as JSON.
- */
-public class JSONErrorImpl extends AbstractPayloadObject implements ODataError {
-
- private static final long serialVersionUID = -3476499168507242932L;
-
- /**
- * Error message.
- */
- public static class Message extends AbstractPayloadObject {
-
- private static final long serialVersionUID = 2577818040815637859L;
-
- private String lang;
-
- private String value;
-
- /**
- * Gets language.
- *
- * @return language.
- */
- public String getLang() {
- return lang;
- }
-
- /**
- * Sets language.
- *
- * @param lang language.
- */
- public void setLang(final String lang) {
- this.lang = lang;
- }
-
- /**
- * Gets message.
- *
- * @return message.
- */
- public String getValue() {
- return value;
- }
-
- /**
- * Sets message.
- *
- * @param value message.
- */
- public void setValue(final String value) {
- this.value = value;
- }
- }
-
- /**
- * Inner error.
- */
- static class InnerError extends AbstractPayloadObject {
-
- private static final long serialVersionUID = -3920947476143537640L;
-
- private String message;
-
- private String type;
-
- private String stacktrace;
-
- private InnerError internalexception;
-
- /**
- * Gets inner message.
- *
- * @return message.
- */
- public String getMessage() {
- return message;
- }
-
- /**
- * Sets inner message.
- *
- * @param message message.
- */
- public void setMessage(final String message) {
- this.message = message;
- }
-
- /**
- * Gets type.
- *
- * @return type.
- */
- public String getType() {
- return type;
- }
-
- /**
- * Sets type.
- *
- * @param type type.
- */
- public void setType(final String type) {
- this.type = type;
- }
-
- /**
- * Gets stack-trace.
- *
- * @return stack-trace.
- */
- public String getStacktrace() {
- return stacktrace;
- }
-
- /**
- * Sets stack-trace.
- *
- * @param stacktrace stack-trace.
- */
- public void setStacktrace(final String stacktrace) {
- this.stacktrace = stacktrace;
- }
-
- public InnerError getInternalexception() {
- return internalexception;
- }
-
- public void setInternalexception(final InnerError internalexception) {
- this.internalexception = internalexception;
- }
- }
-
- private String code;
-
- @JsonProperty(value = "message")
- private Message message;
-
- @JsonProperty(value = "innererror", required = false)
- private InnerError innererror;
-
- /**
- * {@inheritDoc }
- */
- @Override
- public String getCode() {
- return code;
- }
-
- /**
- * Sets error code.
- *
- * @param code error code.
- */
- public void setCode(final String code) {
- this.code = code;
- }
-
- /**
- * {@inheritDoc }
- */
- @JsonIgnore
- @Override
- public String getMessageLang() {
- return this.message == null ? null : this.message.getLang();
- }
-
- /**
- * {@inheritDoc }
- */
- @JsonIgnore
- @Override
- public String getMessageValue() {
- return this.message == null ? null : this.message.getValue();
- }
-
- /**
- * Sets the value of the message property.
- *
- * @param value allowed object is {@link Error.Message }
- *
- */
- public void setMessage(final Message value) {
- this.message = value;
- }
-
- /**
- * {@inheritDoc }
- */
- @JsonIgnore
- @Override
- public String getInnerErrorMessage() {
- return this.innererror == null ? null : this.innererror.getMessage();
- }
-
- /**
- * {@inheritDoc }
- */
- @JsonIgnore
- @Override
- public String getInnerErrorType() {
- return this.innererror == null ? null : this.innererror.getType();
- }
-
- /**
- * {@inheritDoc }
- */
- @JsonIgnore
- @Override
- public String getInnerErrorStacktrace() {
- return this.innererror == null ? null : this.innererror.getStacktrace();
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONODataErrorDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONODataErrorDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONODataErrorDeserializer.java
new file mode 100644
index 0000000..f033de1
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONODataErrorDeserializer.java
@@ -0,0 +1,60 @@
+/*
+ * 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.commons.core.data;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import java.io.IOException;
+import org.apache.olingo.commons.api.Constants;
+
+public class JSONODataErrorDeserializer extends AbstractJsonDeserializer<JSONODataErrorImpl> {
+
+ @Override
+ protected JSONODataErrorImpl doDeserialize(final JsonParser parser, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final JSONODataErrorImpl error = new JSONODataErrorImpl();
+
+ final ObjectNode tree = parser.getCodec().readTree(parser);
+ if (tree.has(jsonError)) {
+ final JsonNode errorNode = tree.get(jsonError);
+
+ if (errorNode.has(Constants.ERROR_CODE)) {
+ error.setCode(errorNode.get(Constants.ERROR_CODE).textValue());
+ }
+ if (errorNode.has(Constants.ERROR_MESSAGE)) {
+ final JsonNode message = errorNode.get(Constants.ERROR_MESSAGE);
+ if (message.isValueNode()) {
+ error.setMessage(message.textValue());
+ } else if (message.isObject()) {
+ error.setMessage(message.get(Constants.VALUE).asText());
+ }
+ }
+ if (errorNode.has(Constants.ERROR_TARGET)) {
+ error.setTarget(errorNode.get(Constants.ERROR_TARGET).textValue());
+ }
+ }
+
+ return error;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONODataErrorImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONODataErrorImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONODataErrorImpl.java
new file mode 100644
index 0000000..c455d2d
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONODataErrorImpl.java
@@ -0,0 +1,26 @@
+/*
+ * 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.commons.core.data;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+@JsonDeserialize(using = JSONODataErrorDeserializer.class)
+public class JSONODataErrorImpl extends AbstractODataError {
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyImpl.java
index 1ef0294..1018666 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyImpl.java
@@ -26,7 +26,7 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
*/
@JsonSerialize(using = JSONPropertySerializer.class)
@JsonDeserialize(using = JSONPropertyDeserializer.class)
-public class JSONPropertyImpl extends AbstractPropertyImpl {
+public class JSONPropertyImpl extends AbstractProperty {
private static final long serialVersionUID = 553414431536637434L;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonDeserializer.java
index fa6e38f..7b05248 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/ODataJacksonDeserializer.java
@@ -52,6 +52,8 @@ public abstract class ODataJacksonDeserializer<T> extends JsonDeserializer<T> {
protected String jsonNavigationLink;
+ protected String jsonError;
+
protected abstract T doDeserialize(JsonParser jp, DeserializationContext ctxt)
throws IOException, JsonProcessingException;
@@ -76,6 +78,7 @@ public abstract class ODataJacksonDeserializer<T> extends JsonDeserializer<T> {
jsonMediaETag = version.getJSONMap().get(ODataServiceVersion.JSON_MEDIA_ETAG);
jsonAssociationLink = version.getJSONMap().get(ODataServiceVersion.JSON_ASSOCIATION_LINK);
jsonNavigationLink = version.getJSONMap().get(ODataServiceVersion.JSON_NAVIGATION_LINK);
+ jsonError = version.getJSONMap().get(ODataServiceVersion.JSON_ERROR);
return doDeserialize(jp, ctxt);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/XMLErrorImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/XMLErrorImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/XMLErrorImpl.java
deleted file mode 100644
index a8c3d84..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/XMLErrorImpl.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * 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.commons.core.data;
-
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlText;
-import java.util.Map;
-import org.apache.olingo.commons.api.domain.ODataError;
-
-/**
- * This class represents an OData error returned as JSON.
- */
-public class XMLErrorImpl extends AbstractPayloadObject implements ODataError {
-
- private static final long serialVersionUID = -3476499168507242932L;
-
- @JacksonXmlText(false)
- private String code;
-
- @JsonProperty
- private Message message;
-
- @JsonProperty(required = false)
- private InnerError innererror;
-
- @Override
- public String getCode() {
- return code;
- }
-
- /**
- * Sets error code.
- *
- * @param code error code.
- */
- public void setCode(final String code) {
- this.code = code;
- }
-
- @JsonIgnore
- @Override
- public String getMessageLang() {
- return this.message == null ? null : this.message.getLang();
- }
-
- @JsonIgnore
- @Override
- public String getMessageValue() {
- return this.message == null ? null : this.message.getValue();
- }
-
- /**
- * Sets the value of the message property.
- *
- * @param value allowed object is {@link Error.Message }
- *
- */
- public void setMessage(final Message value) {
- this.message = value;
- }
-
- @JsonIgnore
- @Override
- public String getInnerErrorMessage() {
- return this.innererror == null ? null : this.innererror.getMessage().getValue();
- }
-
- @JsonIgnore
- @Override
- public String getInnerErrorType() {
- return this.innererror == null ? null : this.innererror.getType().getValue();
- }
-
- @JsonIgnore
- @Override
- public String getInnerErrorStacktrace() {
- return this.innererror == null ? null : this.innererror.getStacktrace().getValue();
- }
-
- static class TextChildContainer extends AbstractPayloadObject {
-
- private static final long serialVersionUID = -8908394095210115904L;
-
- public TextChildContainer() {
- super();
- }
-
- public TextChildContainer(final String value) {
- super();
- this.value = value;
- }
-
- @JsonCreator
- public TextChildContainer(final Map<String, Object> props) {
- super();
- this.value = (String) props.get("");
- }
-
- private String value;
-
- public String getValue() {
- return value;
- }
-
- public void setValue(final String value) {
- this.value = value;
- }
- }
-
- /**
- * Error message.
- */
- public static class Message extends TextChildContainer {
-
- private static final long serialVersionUID = 2577818040815637859L;
-
- private String lang;
-
- public Message() {
- super();
- }
-
- @JsonCreator
- public Message(final Map<String, Object> props) {
- super(props);
- this.lang = (String) props.get("lang");
- }
-
- /**
- * Gets language.
- *
- * @return language.
- */
- public String getLang() {
- return lang;
- }
-
- /**
- * Sets language.
- *
- * @param lang language.
- */
- public void setLang(final String lang) {
- this.lang = lang;
- }
- }
-
- /**
- * Inner error.
- */
- static class InnerError extends AbstractPayloadObject {
-
- private static final long serialVersionUID = -3920947476143537640L;
-
- private TextChildContainer message;
-
- private TextChildContainer type;
-
- private TextChildContainer stacktrace;
-
- private InnerError internalexception;
-
- public TextChildContainer getMessage() {
- return message;
- }
-
- public void setMessage(final TextChildContainer message) {
- this.message = message;
- }
-
- public TextChildContainer getType() {
- return type;
- }
-
- public void setType(final TextChildContainer type) {
- this.type = type;
- }
-
- public TextChildContainer getStacktrace() {
- return stacktrace;
- }
-
- public void setStacktrace(final TextChildContainer stacktrace) {
- this.stacktrace = stacktrace;
- }
-
- public InnerError getInternalexception() {
- return internalexception;
- }
-
- public void setInternalexception(final InnerError internalexception) {
- this.internalexception = internalexception;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/XMLODataErrorImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/XMLODataErrorImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/XMLODataErrorImpl.java
new file mode 100644
index 0000000..36cb682
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/XMLODataErrorImpl.java
@@ -0,0 +1,23 @@
+/*
+ * 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.commons.core.data;
+
+public class XMLODataErrorImpl extends AbstractODataError {
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/de591bb5/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
index bf4bd57..616766b 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
@@ -39,10 +39,10 @@ import org.apache.olingo.commons.core.data.AtomEntryImpl;
import org.apache.olingo.commons.core.data.AtomFeedImpl;
import org.apache.olingo.commons.core.data.AtomPropertyImpl;
import org.apache.olingo.commons.core.data.JSONEntryImpl;
-import org.apache.olingo.commons.core.data.JSONErrorBundle;
import org.apache.olingo.commons.core.data.JSONFeedImpl;
+import org.apache.olingo.commons.core.data.JSONODataErrorImpl;
import org.apache.olingo.commons.core.data.JSONPropertyImpl;
-import org.apache.olingo.commons.core.data.XMLErrorImpl;
+import org.apache.olingo.commons.core.data.XMLODataErrorImpl;
public abstract class AbstractODataDeserializer extends AbstractJacksonTool implements CommonODataDeserializer {
@@ -80,8 +80,8 @@ public abstract class AbstractODataDeserializer extends AbstractJacksonTool impl
@Override
public ODataError toError(final InputStream input, final boolean isXML) {
return isXML
- ? this.<ODataError, XMLErrorImpl>xml(input, XMLErrorImpl.class).getObject()
- : this.<JSONErrorBundle, JSONErrorBundle>json(input, JSONErrorBundle.class).getObject().getError();
+ ? this.<ODataError, XMLODataErrorImpl>atom(input, XMLODataErrorImpl.class).getObject()
+ : this.<ODataError, JSONODataErrorImpl>json(input, JSONODataErrorImpl.class).getObject();
}
/*
@@ -90,21 +90,21 @@ public abstract class AbstractODataDeserializer extends AbstractJacksonTool impl
@SuppressWarnings("unchecked")
protected <T, V extends T> Container<T> xml(final InputStream input, final Class<V> reference) {
try {
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ final ByteArrayOutputStream baos = new ByteArrayOutputStream();
final XMLEventReader reader = AtomDeserializer.FACTORY.createXMLEventReader(input);
final StartElement start = atomDeserializer.skipBeforeFirstStartElement(reader);
- final XMLEventWriter writer = XMLOutputFactory.newFactory().createXMLEventWriter(bos);
+ final XMLEventWriter writer = XMLOutputFactory.newFactory().createXMLEventWriter(baos);
writer.add(start);
writer.add(reader);
writer.flush();
writer.close();
return (Container<T>) atomDeserializer.getContainer(
- start, getXmlMapper().readValue(new ByteArrayInputStream(bos.toByteArray()), reference));
-
+ start, getXmlMapper().readValue(new ByteArrayInputStream(baos.toByteArray()), reference));
} catch (Exception e) {
+ e.printStackTrace();
throw new IllegalArgumentException("While deserializing " + reference.getName(), e);
}
}
[51/51] [abbrv] git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/olingo-odata4
Posted by il...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/olingo-odata4
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/9806a273
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/9806a273
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/9806a273
Branch: refs/heads/master
Commit: 9806a2737cc50631b7372ee722714ea9d30e849f
Parents: 6aaec81 ac385b5
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Tue Apr 1 16:16:35 2014 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Tue Apr 1 16:16:35 2014 +0200
----------------------------------------------------------------------
.../resources/v3/Car/filter/VIN add 5 lt 11.xml | 61 +++---
.../resources/v3/Car/filter/VIN div 2 le 8.xml | 23 +--
.../v3/Car/filter/VIN le 18 and VIN gt 12.xml | 23 +--
.../resources/v3/Car/filter/VIN mul 2 le 30.xml | 23 +--
.../filter/day(PurchaseDate) eq 15.xml | 23 +--
.../filter/hour(PurchaseDate) eq 1.xml | 23 +--
.../filter/minute(PurchaseDate) eq 33.xml | 23 +--
.../filter/month(PurchaseDate) eq 12.xml | 23 +--
.../filter/second(PurchaseDate) eq 35.xml | 23 +--
.../filter/year(PurchaseDate) eq 2020.xml | 23 +--
.../filter/isof(Name,'Edm.String') eq true.xml | 22 +--
.../resources/v3/InStreamErrorGetCustomer.xml | 197 ++++++++++++-------
pom.xml | 71 ++++---
13 files changed, 210 insertions(+), 348 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9806a273/pom.xml
----------------------------------------------------------------------
[36/51] [abbrv] git commit: [OLINGO-200] V3/V4 specialization for
ODataEntitySetIterator
Posted by il...@apache.org.
[OLINGO-200] V3/V4 specialization for ODataEntitySetIterator
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/cd7ede00
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/cd7ede00
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/cd7ede00
Branch: refs/heads/master
Commit: cd7ede00e279252d5d85990b1e29ff90c8df6b1f
Parents: a884ad1
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Sat Mar 29 20:17:26 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Sat Mar 29 20:17:26 2014 +0100
----------------------------------------------------------------------
.../retrieve/CommonRetrieveRequestFactory.java | 5 ++++-
.../retrieve/ODataEntitySetIteratorRequest.java | 5 ++++-
.../request/retrieve/v3/RetrieveRequestFactory.java | 5 +++++
.../request/retrieve/v4/RetrieveRequestFactory.java | 5 +++++
.../client/api/domain/ODataEntitySetIterator.java | 13 ++++++++-----
.../retrieve/AbstractRetrieveRequestFactory.java | 6 ------
.../retrieve/ODataEntitySetIteratorRequestImpl.java | 16 +++++++++-------
.../retrieve/v3/RetrieveRequestFactoryImpl.java | 8 ++++++++
.../retrieve/v4/RetrieveRequestFactoryImpl.java | 8 ++++++++
.../client/core/it/v3/EntitySetTestITCase.java | 14 ++++++++------
.../client/core/it/v4/EntitySetTestITCase.java | 13 +++++++------
11 files changed, 66 insertions(+), 32 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cd7ede00/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/CommonRetrieveRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/CommonRetrieveRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/CommonRetrieveRequestFactory.java
index 02ca4ee..f8d48b3 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/CommonRetrieveRequestFactory.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/CommonRetrieveRequestFactory.java
@@ -74,10 +74,13 @@ public interface CommonRetrieveRequestFactory extends Serializable {
* Returned request gives the possibility to consume entities iterating on them without parsing and loading in memory
* the entire entity set.
*
+ * @param <ES> concreate ODataEntitySet implementation.
+ * @param <E> concrete ODataEntity implementation.
* @param uri request URI.
* @return new {@link ODataEntitySetIteratorRequest} instance.
*/
- ODataEntitySetIteratorRequest getEntitySetIteratorRequest(URI uri);
+ <ES extends CommonODataEntitySet, E extends CommonODataEntity>
+ ODataEntitySetIteratorRequest<ES, E> getEntitySetIteratorRequest(URI uri);
/**
* Gets a query request returning a single OData entity.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cd7ede00/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetIteratorRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetIteratorRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetIteratorRequest.java
index dd2cf46..724b644 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetIteratorRequest.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataEntitySetIteratorRequest.java
@@ -19,10 +19,13 @@
package org.apache.olingo.client.api.communication.request.retrieve;
import org.apache.olingo.client.api.domain.ODataEntitySetIterator;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.format.ODataPubFormat;
/**
* This class implements an OData EntitySet query request.
*/
-public interface ODataEntitySetIteratorRequest extends ODataRetrieveRequest<ODataEntitySetIterator, ODataPubFormat> {
+public interface ODataEntitySetIteratorRequest<ES extends CommonODataEntitySet, E extends CommonODataEntity>
+ extends ODataRetrieveRequest<ODataEntitySetIterator<ES, E>, ODataPubFormat> {
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cd7ede00/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/RetrieveRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/RetrieveRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/RetrieveRequestFactory.java
index 25276fe..00568bd 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/RetrieveRequestFactory.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/RetrieveRequestFactory.java
@@ -21,6 +21,7 @@ package org.apache.olingo.client.api.communication.request.retrieve.v3;
import java.net.URI;
import org.apache.olingo.client.api.communication.request.retrieve.CommonRetrieveRequestFactory;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
import org.apache.olingo.commons.api.domain.v3.ODataEntity;
@@ -35,6 +36,10 @@ public interface RetrieveRequestFactory extends CommonRetrieveRequestFactory {
@SuppressWarnings("unchecked")
@Override
+ ODataEntitySetIteratorRequest<ODataEntitySet, ODataEntity> getEntitySetIteratorRequest(URI uri);
+
+ @SuppressWarnings("unchecked")
+ @Override
ODataEntityRequest<ODataEntity> getEntityRequest(URI uri);
@SuppressWarnings("unchecked")
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cd7ede00/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v4/RetrieveRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v4/RetrieveRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v4/RetrieveRequestFactory.java
index 8d8184b..63f3515 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v4/RetrieveRequestFactory.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v4/RetrieveRequestFactory.java
@@ -21,6 +21,7 @@ package org.apache.olingo.client.api.communication.request.retrieve.v4;
import java.net.URI;
import org.apache.olingo.client.api.communication.request.retrieve.CommonRetrieveRequestFactory;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
import org.apache.olingo.commons.api.domain.v4.ODataEntity;
@@ -33,6 +34,10 @@ public interface RetrieveRequestFactory extends CommonRetrieveRequestFactory {
@Override
ODataEntitySetRequest<ODataEntitySet> getEntitySetRequest(URI uri);
+ @SuppressWarnings("unchecked")
+ @Override
+ ODataEntitySetIteratorRequest<ODataEntitySet, ODataEntity> getEntitySetIteratorRequest(URI uri);
+
@Override
ODataEntityRequest<ODataEntity> getEntityRequest(URI uri);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cd7ede00/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java
index 66e3476..dd77a44 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java
@@ -42,7 +42,8 @@ import org.slf4j.LoggerFactory;
* <br/>
* <b>Please don't forget to call the <tt>close()>/<tt> method when not needed any more.</b>
*/
-public class ODataEntitySetIterator implements Iterator<CommonODataEntity> {
+public class ODataEntitySetIterator<ES extends CommonODataEntitySet, E extends CommonODataEntity>
+ implements Iterator<E> {
/**
* Logger.
@@ -59,7 +60,7 @@ public class ODataEntitySetIterator implements Iterator<CommonODataEntity> {
private Entry cached;
- private CommonODataEntitySet entitySet;
+ private ES entitySet;
private final ByteArrayOutputStream osFeed;
@@ -104,6 +105,7 @@ public class ODataEntitySetIterator implements Iterator<CommonODataEntity> {
* {@inheritDoc }
*/
@Override
+ @SuppressWarnings("unchecked")
public boolean hasNext() {
if (available && cached == null) {
if (format == ODataPubFormat.ATOM) {
@@ -114,7 +116,7 @@ public class ODataEntitySetIterator implements Iterator<CommonODataEntity> {
if (cached == null) {
available = false;
- entitySet = odataClient.getReader().
+ entitySet = (ES) odataClient.getReader().
readEntitySet(new ByteArrayInputStream(osFeed.toByteArray()), format);
close();
}
@@ -127,9 +129,10 @@ public class ODataEntitySetIterator implements Iterator<CommonODataEntity> {
* {@inheritDoc }
*/
@Override
- public CommonODataEntity next() {
+ public E next() {
if (hasNext()) {
- final CommonODataEntity res = odataClient.getBinder().getODataEntity(cached);
+ @SuppressWarnings("unchecked")
+ final E res = (E) odataClient.getBinder().getODataEntity(cached);
cached = null;
return res;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cd7ede00/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractRetrieveRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractRetrieveRequestFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractRetrieveRequestFactory.java
index d8ec0f2..a801953 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractRetrieveRequestFactory.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractRetrieveRequestFactory.java
@@ -21,7 +21,6 @@ package org.apache.olingo.client.core.communication.request.retrieve;
import java.net.URI;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.CommonODataClient;
-import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataMediaRequest;
import org.apache.olingo.client.api.communication.request.retrieve.EdmMetadataRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataRawRequest;
@@ -40,11 +39,6 @@ public abstract class AbstractRetrieveRequestFactory implements CommonRetrieveRe
}
@Override
- public ODataEntitySetIteratorRequest getEntitySetIteratorRequest(final URI query) {
- return new ODataEntitySetIteratorRequestImpl(client, query);
- }
-
- @Override
public ODataValueRequest getValueRequest(final URI query) {
return new ODataValueRequestImpl(client, query);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cd7ede00/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetIteratorRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetIteratorRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetIteratorRequestImpl.java
index bfdddef..a1e9a8b 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetIteratorRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetIteratorRequestImpl.java
@@ -25,14 +25,16 @@ import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.domain.ODataEntitySetIterator;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.format.ODataPubFormat;
/**
* This class implements an OData EntitySet query request.
*/
-public class ODataEntitySetIteratorRequestImpl
- extends AbstractODataRetrieveRequest<ODataEntitySetIterator, ODataPubFormat>
- implements ODataEntitySetIteratorRequest {
+public class ODataEntitySetIteratorRequestImpl<ES extends CommonODataEntitySet, E extends CommonODataEntity>
+ extends AbstractODataRetrieveRequest<ODataEntitySetIterator<ES, E>, ODataPubFormat>
+ implements ODataEntitySetIteratorRequest<ES, E> {
private ODataEntitySetIterator feedIterator = null;
@@ -42,7 +44,7 @@ public class ODataEntitySetIteratorRequestImpl
* @param odataClient client instance getting this request
* @param query query to be executed.
*/
- ODataEntitySetIteratorRequestImpl(final CommonODataClient odataClient, final URI query) {
+ public ODataEntitySetIteratorRequestImpl(final CommonODataClient odataClient, final URI query) {
super(odataClient, ODataPubFormat.class, query);
}
@@ -50,7 +52,7 @@ public class ODataEntitySetIteratorRequestImpl
* {@inheritDoc }
*/
@Override
- public ODataRetrieveResponse<ODataEntitySetIterator> execute() {
+ public ODataRetrieveResponse<ODataEntitySetIterator<ES, E>> execute() {
final HttpResponse res = doExecute();
return new ODataEntitySetIteratorResponseImpl(httpClient, res);
}
@@ -75,9 +77,9 @@ public class ODataEntitySetIteratorRequestImpl
*/
@Override
@SuppressWarnings("unchecked")
- public ODataEntitySetIterator getBody() {
+ public ODataEntitySetIterator<ES, E> getBody() {
if (feedIterator == null) {
- feedIterator = new ODataEntitySetIterator(
+ feedIterator = new ODataEntitySetIterator<ES, E>(
odataClient, getRawResponse(), ODataPubFormat.fromString(getContentType()));
}
return feedIterator;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cd7ede00/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/RetrieveRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/RetrieveRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/RetrieveRequestFactoryImpl.java
index b32dd30..3943747 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/RetrieveRequestFactoryImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/RetrieveRequestFactoryImpl.java
@@ -20,6 +20,7 @@ package org.apache.olingo.client.core.communication.request.retrieve.v3;
import java.net.URI;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
import org.apache.olingo.client.api.communication.request.retrieve.XMLMetadataRequest;
@@ -28,6 +29,7 @@ import org.apache.olingo.client.api.communication.request.retrieve.v3.ODataLinkC
import org.apache.olingo.client.api.communication.request.retrieve.v3.RetrieveRequestFactory;
import org.apache.olingo.client.core.communication.request.retrieve.AbstractRetrieveRequestFactory;
import org.apache.olingo.client.core.communication.request.retrieve.ODataEntityRequestImpl;
+import org.apache.olingo.client.core.communication.request.retrieve.ODataEntitySetIteratorRequestImpl;
import org.apache.olingo.client.core.communication.request.retrieve.ODataEntitySetRequestImpl;
import org.apache.olingo.client.core.communication.request.retrieve.ODataPropertyRequestImpl;
import org.apache.olingo.commons.api.domain.v3.ODataEntity;
@@ -62,6 +64,12 @@ public class RetrieveRequestFactoryImpl extends AbstractRetrieveRequestFactory
@SuppressWarnings("unchecked")
@Override
+ public ODataEntitySetIteratorRequest<ODataEntitySet, ODataEntity> getEntitySetIteratorRequest(URI uri) {
+ return new ODataEntitySetIteratorRequestImpl<ODataEntitySet, ODataEntity>(client, uri);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
public ODataEntityRequest<ODataEntity> getEntityRequest(final URI query) {
return new ODataEntityRequestImpl<ODataEntity>(client, query);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cd7ede00/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java
index a32a153..96419c2 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java
@@ -20,6 +20,7 @@ package org.apache.olingo.client.core.communication.request.retrieve.v4;
import java.net.URI;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
import org.apache.olingo.client.api.communication.request.retrieve.XMLMetadataRequest;
@@ -27,6 +28,7 @@ import org.apache.olingo.client.api.communication.request.retrieve.v4.RetrieveRe
import org.apache.olingo.client.api.v4.ODataClient;
import org.apache.olingo.client.core.communication.request.retrieve.AbstractRetrieveRequestFactory;
import org.apache.olingo.client.core.communication.request.retrieve.ODataEntityRequestImpl;
+import org.apache.olingo.client.core.communication.request.retrieve.ODataEntitySetIteratorRequestImpl;
import org.apache.olingo.client.core.communication.request.retrieve.ODataEntitySetRequestImpl;
import org.apache.olingo.client.core.communication.request.retrieve.ODataPropertyRequestImpl;
import org.apache.olingo.commons.api.domain.v4.ODataEntity;
@@ -56,6 +58,12 @@ public class RetrieveRequestFactoryImpl extends AbstractRetrieveRequestFactory
@SuppressWarnings("unchecked")
@Override
+ public ODataEntitySetIteratorRequest<ODataEntitySet, ODataEntity> getEntitySetIteratorRequest(URI uri) {
+ return new ODataEntitySetIteratorRequestImpl<ODataEntitySet, ODataEntity>(client, uri);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
public ODataEntityRequest<ODataEntity> getEntityRequest(final URI query) {
return new ODataEntityRequestImpl<ODataEntity>(client, query);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cd7ede00/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
index 446b41d..0aaed01 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
@@ -18,6 +18,10 @@
*/
package org.apache.olingo.client.core.it.v3;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import java.io.IOException;
import java.net.URI;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest;
@@ -29,12 +33,10 @@ import org.apache.olingo.client.api.domain.ODataEntitySetIterator;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.commons.core.op.ResourceFactory;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
import org.junit.Test;
/**
@@ -115,12 +117,12 @@ public class EntitySetTestITCase extends AbstractTestITCase {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
uriBuilder.appendEntitySetSegment("Customer");
- final ODataEntitySetIteratorRequest req =
+ final ODataEntitySetIteratorRequest<ODataEntitySet, ODataEntity> req =
client.getRetrieveRequestFactory().getEntitySetIteratorRequest(uriBuilder.build());
req.setFormat(format);
- final ODataRetrieveResponse<ODataEntitySetIterator> res = req.execute();
- final ODataEntitySetIterator feedIterator = res.getBody();
+ final ODataRetrieveResponse<ODataEntitySetIterator<ODataEntitySet, ODataEntity>> res = req.execute();
+ final ODataEntitySetIterator<ODataEntitySet, ODataEntity> feedIterator = res.getBody();
assertNotNull(feedIterator);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/cd7ede00/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
index a73ce7a..c354a1d 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
@@ -18,6 +18,10 @@
*/
package org.apache.olingo.client.core.it.v4;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import java.io.IOException;
import java.net.URI;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest;
@@ -29,13 +33,10 @@ import org.apache.olingo.client.api.domain.ODataEntitySetIterator;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
+import org.apache.olingo.commons.api.domain.v4.ODataEntity;
import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.commons.core.op.ResourceFactory;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
import org.junit.Ignore;
import org.junit.Test;
@@ -124,11 +125,11 @@ public class EntitySetTestITCase extends AbstractTestITCase {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
uriBuilder.appendEntitySetSegment("People");
- final ODataEntitySetIteratorRequest req =
+ final ODataEntitySetIteratorRequest<ODataEntitySet, ODataEntity> req =
client.getRetrieveRequestFactory().getEntitySetIteratorRequest(uriBuilder.build());
req.setFormat(format);
- final ODataRetrieveResponse<ODataEntitySetIterator> res = req.execute();
+ final ODataRetrieveResponse<ODataEntitySetIterator<ODataEntitySet, ODataEntity>> res = req.execute();
final ODataEntitySetIterator feedIterator = res.getBody();
assertNotNull(feedIterator);
[07/51] [abbrv] git commit: Removing unnecessary Locale settings
(types are smarter now)
Posted by il...@apache.org.
Removing unnecessary Locale settings (types are smarter now)
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/d12ab652
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/d12ab652
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/d12ab652
Branch: refs/heads/master
Commit: d12ab65270c795b1e1b65a2d7dc43a836c806e33
Parents: 3e53ac5
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Wed Mar 26 18:18:15 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Wed Mar 26 18:18:15 2014 +0100
----------------------------------------------------------------------
.../java/org/apache/olingo/client/core/AbstractTest.java | 8 --------
1 file changed, 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d12ab652/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractTest.java
index b579962..473b25e 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractTest.java
@@ -43,14 +43,6 @@ public abstract class AbstractTest {
XMLUnit.setCompareUnmatched(false);
}
- /**
- * This is needed for correct number handling (Double, for example).
- */
- @BeforeClass
- public static void setEnglishLocale() {
- Locale.setDefault(Locale.ENGLISH);
- }
-
@BeforeClass
public static void setClientInstances() {
v3Client = ODataClientFactory.getV3();
[05/51] [abbrv] git commit: [OLINGO-205] pruned merge for v4
Posted by il...@apache.org.
[OLINGO-205] pruned merge for v4
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/2f77689c
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/2f77689c
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/2f77689c
Branch: refs/heads/master
Commit: 2f77689c720ad48f29a060364c7f476de98ad619
Parents: 2e33a68
Author: fmartelli <fa...@gmail.com>
Authored: Wed Mar 26 17:58:02 2014 +0100
Committer: fmartelli <fa...@gmail.com>
Committed: Wed Mar 26 17:58:02 2014 +0100
----------------------------------------------------------------------
.../communication/request/cud/UpdateType.java | 31 ++++++++++++++++++++
1 file changed, 31 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2f77689c/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/UpdateType.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/UpdateType.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/UpdateType.java
new file mode 100644
index 0000000..eba17e0
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/UpdateType.java
@@ -0,0 +1,31 @@
+/*
+ * 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.client.api.communication.request.cud;
+
+import org.apache.olingo.client.api.http.HttpMethod;
+
+public interface UpdateType {
+
+ /**
+ * Gets HTTP request method.
+ *
+ * @return HTTP request method.
+ */
+ HttpMethod getMethod();
+}
[35/51] [abbrv] git commit: Redundant is redundant
Posted by il...@apache.org.
Redundant is redundant
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/a884ad12
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/a884ad12
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/a884ad12
Branch: refs/heads/master
Commit: a884ad128d94e58d5657b9eb8bd24ffa1a44fc67
Parents: abe0e15
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Sat Mar 29 16:58:19 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Sat Mar 29 16:58:19 2014 +0100
----------------------------------------------------------------------
.../apache/olingo/client/core/uri/URIUtils.java | 38 ++++++++++----------
1 file changed, 19 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a884ad12/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
index 4159e76..17cfcd0 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
@@ -225,12 +225,12 @@ public final class URIUtils {
return version == ODataServiceVersion.V30
? prefix(version, EdmPrimitiveTypeKind.DateTime)
+ URLEncoder.encode(EdmDateTime.getInstance().
- valueToString(timestamp, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
- Constants.UTF8)
+ valueToString(timestamp, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
+ Constants.UTF8)
+ suffix(version, EdmPrimitiveTypeKind.DateTime)
: URLEncoder.encode(EdmDateTimeOffset.getInstance().
- valueToString(timestamp, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
- Constants.UTF8);
+ valueToString(timestamp, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
+ Constants.UTF8);
}
private static String calendar(final ODataServiceVersion version, final Calendar calendar)
@@ -241,8 +241,8 @@ public final class URIUtils {
if (version == ODataServiceVersion.V30) {
result = prefix(version, EdmPrimitiveTypeKind.DateTime)
+ URLEncoder.encode(EdmDateTime.getInstance().
- valueToString(calendar, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
- Constants.UTF8)
+ valueToString(calendar, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
+ Constants.UTF8)
+ suffix(version, EdmPrimitiveTypeKind.DateTime);
} else {
if (calendar.get(Calendar.YEAR) == 0 && calendar.get(Calendar.MONTH) == 0
@@ -260,8 +260,8 @@ public final class URIUtils {
} else {
result = prefix(version, EdmPrimitiveTypeKind.DateTimeOffset)
+ URLEncoder.encode(EdmDateTimeOffset.getInstance().
- valueToString(calendar, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
- Constants.UTF8)
+ valueToString(calendar, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
+ Constants.UTF8)
+ suffix(version, EdmPrimitiveTypeKind.DateTimeOffset);
}
@@ -273,11 +273,11 @@ public final class URIUtils {
return version == ODataServiceVersion.V30
? EdmTime.getInstance().toUriLiteral(URLEncoder.encode(EdmTime.getInstance().
- valueToString(duration, null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null), Constants.UTF8))
+ valueToString(duration, null, null,
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null), Constants.UTF8))
: EdmDuration.getInstance().toUriLiteral(URLEncoder.encode(EdmDuration.getInstance().
- valueToString(duration, null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null), Constants.UTF8));
+ valueToString(duration, null, null,
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null), Constants.UTF8));
}
private static String quoteString(final String string, final boolean singleQuoteEscape)
@@ -339,7 +339,7 @@ public final class URIUtils {
value = buffer.toString();
} else {
value = (obj instanceof ParameterAlias)
- ? "@" + ((ParameterAlias) obj).getAlias().toString()
+ ? "@" + ((ParameterAlias) obj).getAlias()
: (obj instanceof Boolean)
? BooleanUtils.toStringTrueFalse((Boolean) obj)
: (obj instanceof UUID)
@@ -356,24 +356,24 @@ public final class URIUtils {
? duration(version, (Duration) obj)
: (obj instanceof BigDecimal)
? EdmDecimal.getInstance().valueToString(obj, null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
+ suffix(version, EdmPrimitiveTypeKind.Decimal)
: (obj instanceof Double)
? EdmDouble.getInstance().valueToString(obj, null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
+ suffix(version, EdmPrimitiveTypeKind.Double)
: (obj instanceof Float)
? EdmSingle.getInstance().valueToString(obj, null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
+ suffix(version, EdmPrimitiveTypeKind.Single)
: (obj instanceof Long)
? EdmInt64.getInstance().valueToString(obj, null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
+ suffix(version, EdmPrimitiveTypeKind.Int64)
: (obj instanceof Geospatial)
? URLEncoder.encode(EdmPrimitiveTypeFactory.getInstance(((Geospatial) obj).getEdmPrimitiveTypeKind()).
- valueToString(obj, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
- Constants.UTF8)
+ valueToString(obj, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
+ Constants.UTF8)
: (obj instanceof String)
? quoteString((String) obj, singleQuoteEscape)
: obj.toString();
[11/51] [abbrv] git commit: [OLINGO-212] Reference/Include handling
implemented
Posted by il...@apache.org.
[OLINGO-212] Reference/Include handling implemented
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/26142187
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/26142187
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/26142187
Branch: refs/heads/master
Commit: 26142187b8840845525b7d13d532746e5b1a1d0c
Parents: 59d54d8
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Thu Mar 27 15:11:15 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Thu Mar 27 15:11:15 2014 +0100
----------------------------------------------------------------------
.../org/apache/olingo/fit/AbstractServices.java | 12 +-
.../java/org/apache/olingo/fit/V4NorthWind.java | 46 +++
.../org/apache/olingo/fit/V4NorthWindExt.java | 46 +++
.../main/resources/v4/northwind-metadata.xml | 91 +++++
.../main/resources/v4/northwindExt-metadata.xml | 408 +++++++++++++++++++
.../main/webapp/WEB-INF/applicationContext.xml | 4 +-
.../retrieve/CommonRetrieveRequestFactory.java | 62 +--
.../request/retrieve/EdmMetadataRequest.java | 28 ++
.../request/retrieve/ODataMetadataRequest.java | 28 --
.../request/retrieve/XMLMetadataRequest.java | 29 ++
.../olingo/client/api/op/CommonODataReader.java | 13 +-
.../communication/request/ODataRequestImpl.java | 2 +-
.../retrieve/AbstractMetadataRequestImpl.java | 52 +++
.../retrieve/AbstractODataRetrieveRequest.java | 4 +
.../AbstractRetrieveRequestFactory.java | 7 +-
.../retrieve/EdmMetadataRequestImpl.java | 73 ++++
.../retrieve/ODataMetadataRequestImpl.java | 108 -----
.../retrieve/v3/RetrieveRequestFactoryImpl.java | 8 +-
.../retrieve/v3/XMLMetadataRequestImpl.java | 79 ++++
.../retrieve/v4/RetrieveRequestFactoryImpl.java | 7 +
.../retrieve/v4/XMLMetadataRequestImpl.java | 122 ++++++
.../edm/AbstractEdmServiceMetadataImpl.java | 24 +-
.../olingo/client/core/edm/EdmClientImpl.java | 46 ++-
.../client/core/edm/EdmEntityContainerImpl.java | 48 +--
.../olingo/client/core/edm/EdmSchemaImpl.java | 9 +-
.../client/core/edm/v3/EdmEntitySetProxy.java | 11 +-
.../core/edm/v3/EdmServiceMetadataImpl.java | 9 +-
.../core/edm/v4/EdmServiceMetadataImpl.java | 24 +-
.../client/core/edm/xml/v4/XMLMetadataImpl.java | 1 +
.../client/core/op/AbstractODataReader.java | 19 +
.../core/op/impl/v3/ODataDeserializerImpl.java | 3 +-
.../client/core/op/impl/v3/ODataReaderImpl.java | 15 -
.../client/core/op/impl/v4/ODataReaderImpl.java | 16 -
.../core/it/AbstractMetadataTestITCase.java | 4 +
.../client/core/it/v4/MetadataTestITCase.java | 22 +-
.../olingo/client/core/v4/MetadataTest.java | 1 -
.../olingo/client/core/v4/fromdoc1-metadata.xml | 2 +-
37 files changed, 1188 insertions(+), 295 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/26142187/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java b/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java
index 1ffba94..e25908f 100644
--- a/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java
+++ b/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java
@@ -68,9 +68,10 @@ public abstract class AbstractServices {
*/
protected static final Logger LOG = LoggerFactory.getLogger(AbstractServices.class);
- private static Set<ODataVersion> initialized = EnumSet.noneOf(ODataVersion.class);
+ private static final Set<ODataVersion> INITIALIZED = EnumSet.noneOf(ODataVersion.class);
protected abstract ODataVersion getVersion();
+
protected final AbstractXMLUtilities xml;
protected final AbstractJSONUtilities json;
@@ -84,9 +85,9 @@ public abstract class AbstractServices {
this.json = new org.apache.olingo.fit.utils.v4.JSONUtilities();
}
- if (!initialized.contains(getVersion())) {
+ if (!INITIALIZED.contains(getVersion())) {
xml.retrieveLinkInfoFromMetadata();
- initialized.add(getVersion());
+ INITIALIZED.add(getVersion());
}
}
@@ -136,10 +137,9 @@ public abstract class AbstractServices {
return getMetadata("large" + StringUtils.capitalize(METADATA));
}
- private Response getMetadata(final String filename) {
+ protected Response getMetadata(final String filename) {
try {
- return xml.
- createResponse(FSManager.instance(getVersion()).readFile(filename, Accept.XML), null, Accept.XML);
+ return xml.createResponse(FSManager.instance(getVersion()).readFile(filename, Accept.XML), null, Accept.XML);
} catch (Exception e) {
return xml.createFaultResponse(Accept.XML.toString(getVersion()), e);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/26142187/fit/src/main/java/org/apache/olingo/fit/V4NorthWind.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/V4NorthWind.java b/fit/src/main/java/org/apache/olingo/fit/V4NorthWind.java
new file mode 100644
index 0000000..5ef82d7
--- /dev/null
+++ b/fit/src/main/java/org/apache/olingo/fit/V4NorthWind.java
@@ -0,0 +1,46 @@
+/*
+ * 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.fit;
+
+import org.apache.olingo.fit.utils.ODataVersion;
+import org.apache.olingo.fit.utils.XHTTPMethodInterceptor;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Response;
+import org.apache.cxf.interceptor.InInterceptors;
+import static org.apache.olingo.fit.utils.Constants.METADATA;
+
+@Path("/V40/NorthWind.svc")
+@InInterceptors(classes = XHTTPMethodInterceptor.class)
+public class V4NorthWind extends AbstractServices {
+
+ public V4NorthWind() throws Exception {
+ super();
+ }
+
+ @Override
+ protected ODataVersion getVersion() {
+ return ODataVersion.v4;
+ }
+
+ @Override
+ public Response getMetadata() {
+ return getMetadata("northwind-" + METADATA);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/26142187/fit/src/main/java/org/apache/olingo/fit/V4NorthWindExt.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/V4NorthWindExt.java b/fit/src/main/java/org/apache/olingo/fit/V4NorthWindExt.java
new file mode 100644
index 0000000..0dad6ac
--- /dev/null
+++ b/fit/src/main/java/org/apache/olingo/fit/V4NorthWindExt.java
@@ -0,0 +1,46 @@
+/*
+ * 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.fit;
+
+import org.apache.olingo.fit.utils.ODataVersion;
+import org.apache.olingo.fit.utils.XHTTPMethodInterceptor;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Response;
+import org.apache.cxf.interceptor.InInterceptors;
+import static org.apache.olingo.fit.utils.Constants.METADATA;
+
+@Path("/V40/NorthWindExt.svc")
+@InInterceptors(classes = XHTTPMethodInterceptor.class)
+public class V4NorthWindExt extends AbstractServices {
+
+ public V4NorthWindExt() throws Exception {
+ super();
+ }
+
+ @Override
+ protected ODataVersion getVersion() {
+ return ODataVersion.v4;
+ }
+
+ @Override
+ public Response getMetadata() {
+ return getMetadata("northwindExt-" + METADATA);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/26142187/fit/src/main/resources/v4/northwind-metadata.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v4/northwind-metadata.xml b/fit/src/main/resources/v4/northwind-metadata.xml
new file mode 100644
index 0000000..85f260f
--- /dev/null
+++ b/fit/src/main/resources/v4/northwind-metadata.xml
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ 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.
+
+-->
+<edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
+ <edmx:Reference Uri="http://localhost:${cargo.servlet.port}/StaticService/V40/NorthWindExt.svc">
+ <edmx:Include Namespace="NorthwindModel"/>
+ </edmx:Reference>
+ <edmx:DataServices>
+ <Schema Namespace="ODataWebExperimental.Northwind.Model" xmlns="http://docs.oasis-open.org/odata/ns/edm">
+ <EntityContainer Name="NorthwindEntities" p4:LazyLoadingEnabled="true" xmlns:p4="http://schemas.microsoft.com/ado/2009/02/edm/annotation">
+ <EntitySet Name="Categories" EntityType="NorthwindModel.Category">
+ <NavigationPropertyBinding Path="Products" Target="Products" />
+ </EntitySet>
+ <EntitySet Name="CustomerDemographics" EntityType="NorthwindModel.CustomerDemographic">
+ <NavigationPropertyBinding Path="Customers" Target="Customers" />
+ </EntitySet>
+ <EntitySet Name="Customers" EntityType="NorthwindModel.Customer">
+ <NavigationPropertyBinding Path="CustomerDemographics" Target="CustomerDemographics" />
+ <NavigationPropertyBinding Path="Orders" Target="Orders" />
+ </EntitySet>
+ <EntitySet Name="Employees" EntityType="NorthwindModel.Employee">
+ <NavigationPropertyBinding Path="Employees1" Target="Employees" />
+ <NavigationPropertyBinding Path="Employee1" Target="Employees" />
+ <NavigationPropertyBinding Path="Orders" Target="Orders" />
+ <NavigationPropertyBinding Path="Territories" Target="Territories" />
+ </EntitySet>
+ <EntitySet Name="Order_Details" EntityType="NorthwindModel.Order_Detail">
+ <NavigationPropertyBinding Path="Order" Target="Orders" />
+ <NavigationPropertyBinding Path="Product" Target="Products" />
+ </EntitySet>
+ <EntitySet Name="Orders" EntityType="NorthwindModel.Order">
+ <NavigationPropertyBinding Path="Customer" Target="Customers" />
+ <NavigationPropertyBinding Path="Employee" Target="Employees" />
+ <NavigationPropertyBinding Path="Order_Details" Target="Order_Details" />
+ <NavigationPropertyBinding Path="Shipper" Target="Shippers" />
+ </EntitySet>
+ <EntitySet Name="Products" EntityType="NorthwindModel.Product">
+ <NavigationPropertyBinding Path="Category" Target="Categories" />
+ <NavigationPropertyBinding Path="Order_Details" Target="Order_Details" />
+ <NavigationPropertyBinding Path="Supplier" Target="Suppliers" />
+ </EntitySet>
+ <EntitySet Name="Regions" EntityType="NorthwindModel.Region">
+ <NavigationPropertyBinding Path="Territories" Target="Territories" />
+ </EntitySet>
+ <EntitySet Name="Shippers" EntityType="NorthwindModel.Shipper">
+ <NavigationPropertyBinding Path="Orders" Target="Orders" />
+ </EntitySet>
+ <EntitySet Name="Suppliers" EntityType="NorthwindModel.Supplier">
+ <NavigationPropertyBinding Path="Products" Target="Products" />
+ </EntitySet>
+ <EntitySet Name="Territories" EntityType="NorthwindModel.Territory">
+ <NavigationPropertyBinding Path="Employees" Target="Employees" />
+ <NavigationPropertyBinding Path="Region" Target="Regions" />
+ </EntitySet>
+ <EntitySet Name="Alphabetical_list_of_products" EntityType="NorthwindModel.Alphabetical_list_of_product" />
+ <EntitySet Name="Category_Sales_for_1997" EntityType="NorthwindModel.Category_Sales_for_1997" />
+ <EntitySet Name="Current_Product_Lists" EntityType="NorthwindModel.Current_Product_List" />
+ <EntitySet Name="Customer_and_Suppliers_by_Cities" EntityType="NorthwindModel.Customer_and_Suppliers_by_City" />
+ <EntitySet Name="Invoices" EntityType="NorthwindModel.Invoice" />
+ <EntitySet Name="Order_Details_Extendeds" EntityType="NorthwindModel.Order_Details_Extended" />
+ <EntitySet Name="Order_Subtotals" EntityType="NorthwindModel.Order_Subtotal" />
+ <EntitySet Name="Orders_Qries" EntityType="NorthwindModel.Orders_Qry" />
+ <EntitySet Name="Product_Sales_for_1997" EntityType="NorthwindModel.Product_Sales_for_1997" />
+ <EntitySet Name="Products_Above_Average_Prices" EntityType="NorthwindModel.Products_Above_Average_Price" />
+ <EntitySet Name="Products_by_Categories" EntityType="NorthwindModel.Products_by_Category" />
+ <EntitySet Name="Sales_by_Categories" EntityType="NorthwindModel.Sales_by_Category" />
+ <EntitySet Name="Sales_Totals_by_Amounts" EntityType="NorthwindModel.Sales_Totals_by_Amount" />
+ <EntitySet Name="Summary_of_Sales_by_Quarters" EntityType="NorthwindModel.Summary_of_Sales_by_Quarter" />
+ <EntitySet Name="Summary_of_Sales_by_Years" EntityType="NorthwindModel.Summary_of_Sales_by_Year" />
+ </EntityContainer>
+ </Schema>
+ </edmx:DataServices>
+</edmx:Edmx>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/26142187/fit/src/main/resources/v4/northwindExt-metadata.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v4/northwindExt-metadata.xml b/fit/src/main/resources/v4/northwindExt-metadata.xml
new file mode 100644
index 0000000..fa1832b
--- /dev/null
+++ b/fit/src/main/resources/v4/northwindExt-metadata.xml
@@ -0,0 +1,408 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ 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.
+
+-->
+<edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
+ <edmx:DataServices>
+ <Schema Namespace="NorthwindModel" xmlns="http://docs.oasis-open.org/odata/ns/edm">
+ <EntityType Name="Category">
+ <Key>
+ <PropertyRef Name="CategoryID" />
+ </Key>
+ <Property Name="CategoryID" Type="Edm.Int32" Nullable="false" p5:StoreGeneratedPattern="Identity" xmlns:p5="http://schemas.microsoft.com/ado/2009/02/edm/annotation" />
+ <Property Name="CategoryName" Type="Edm.String" Nullable="false" MaxLength="15" />
+ <Property Name="Description" Type="Edm.String" MaxLength="max" />
+ <Property Name="Picture" Type="Edm.Binary" MaxLength="max" />
+ <NavigationProperty Name="Products" Type="Collection(NorthwindModel.Product)" Partner="Category" />
+ </EntityType>
+ <EntityType Name="CustomerDemographic">
+ <Key>
+ <PropertyRef Name="CustomerTypeID" />
+ </Key>
+ <Property Name="CustomerTypeID" Type="Edm.String" Nullable="false" MaxLength="10" />
+ <Property Name="CustomerDesc" Type="Edm.String" MaxLength="max" />
+ <NavigationProperty Name="Customers" Type="Collection(NorthwindModel.Customer)" Partner="CustomerDemographics" />
+ </EntityType>
+ <EntityType Name="Customer">
+ <Key>
+ <PropertyRef Name="CustomerID" />
+ </Key>
+ <Property Name="CustomerID" Type="Edm.String" Nullable="false" MaxLength="5" />
+ <Property Name="CompanyName" Type="Edm.String" Nullable="false" MaxLength="40" />
+ <Property Name="ContactName" Type="Edm.String" MaxLength="30" />
+ <Property Name="ContactTitle" Type="Edm.String" MaxLength="30" />
+ <Property Name="Address" Type="Edm.String" MaxLength="60" />
+ <Property Name="City" Type="Edm.String" MaxLength="15" />
+ <Property Name="Region" Type="Edm.String" MaxLength="15" />
+ <Property Name="PostalCode" Type="Edm.String" MaxLength="10" />
+ <Property Name="Country" Type="Edm.String" MaxLength="15" />
+ <Property Name="Phone" Type="Edm.String" MaxLength="24" />
+ <Property Name="Fax" Type="Edm.String" MaxLength="24" />
+ <NavigationProperty Name="Orders" Type="Collection(NorthwindModel.Order)" Partner="Customer" />
+ <NavigationProperty Name="CustomerDemographics" Type="Collection(NorthwindModel.CustomerDemographic)" Partner="Customers" />
+ </EntityType>
+ <EntityType Name="Employee">
+ <Key>
+ <PropertyRef Name="EmployeeID" />
+ </Key>
+ <Property Name="EmployeeID" Type="Edm.Int32" Nullable="false" p5:StoreGeneratedPattern="Identity" xmlns:p5="http://schemas.microsoft.com/ado/2009/02/edm/annotation" />
+ <Property Name="LastName" Type="Edm.String" Nullable="false" MaxLength="20" />
+ <Property Name="FirstName" Type="Edm.String" Nullable="false" MaxLength="10" />
+ <Property Name="Title" Type="Edm.String" MaxLength="30" />
+ <Property Name="TitleOfCourtesy" Type="Edm.String" MaxLength="25" />
+ <Property Name="BirthDate" Type="Edm.DateTimeOffset" />
+ <Property Name="HireDate" Type="Edm.DateTimeOffset" />
+ <Property Name="Address" Type="Edm.String" MaxLength="60" />
+ <Property Name="City" Type="Edm.String" MaxLength="15" />
+ <Property Name="Region" Type="Edm.String" MaxLength="15" />
+ <Property Name="PostalCode" Type="Edm.String" MaxLength="10" />
+ <Property Name="Country" Type="Edm.String" MaxLength="15" />
+ <Property Name="HomePhone" Type="Edm.String" MaxLength="24" />
+ <Property Name="Extension" Type="Edm.String" MaxLength="4" />
+ <Property Name="Photo" Type="Edm.Binary" MaxLength="max" />
+ <Property Name="Notes" Type="Edm.String" MaxLength="max" />
+ <Property Name="ReportsTo" Type="Edm.Int32" />
+ <Property Name="PhotoPath" Type="Edm.String" MaxLength="255" />
+ <NavigationProperty Name="Employees1" Type="Collection(NorthwindModel.Employee)" Partner="Employee1" />
+ <NavigationProperty Name="Employee1" Type="NorthwindModel.Employee" Partner="Employees1">
+ <ReferentialConstraint Property="ReportsTo" ReferencedProperty="EmployeeID" />
+ </NavigationProperty>
+ <NavigationProperty Name="Orders" Type="Collection(NorthwindModel.Order)" Partner="Employee" />
+ <NavigationProperty Name="Territories" Type="Collection(NorthwindModel.Territory)" Partner="Employees" />
+ </EntityType>
+ <EntityType Name="Order_Detail">
+ <Key>
+ <PropertyRef Name="OrderID" />
+ <PropertyRef Name="ProductID" />
+ </Key>
+ <Property Name="OrderID" Type="Edm.Int32" Nullable="false" />
+ <Property Name="ProductID" Type="Edm.Int32" Nullable="false" />
+ <Property Name="UnitPrice" Type="Edm.Decimal" Nullable="false" Precision="19" Scale="4" />
+ <Property Name="Quantity" Type="Edm.Int16" Nullable="false" />
+ <Property Name="Discount" Type="Edm.Single" Nullable="false" />
+ <NavigationProperty Name="Order" Type="NorthwindModel.Order" Nullable="false" Partner="Order_Details">
+ <ReferentialConstraint Property="OrderID" ReferencedProperty="OrderID" />
+ </NavigationProperty>
+ <NavigationProperty Name="Product" Type="NorthwindModel.Product" Nullable="false" Partner="Order_Details">
+ <ReferentialConstraint Property="ProductID" ReferencedProperty="ProductID" />
+ </NavigationProperty>
+ </EntityType>
+ <EntityType Name="Order">
+ <Key>
+ <PropertyRef Name="OrderID" />
+ </Key>
+ <Property Name="OrderID" Type="Edm.Int32" Nullable="false" p5:StoreGeneratedPattern="Identity" xmlns:p5="http://schemas.microsoft.com/ado/2009/02/edm/annotation" />
+ <Property Name="CustomerID" Type="Edm.String" MaxLength="5" />
+ <Property Name="EmployeeID" Type="Edm.Int32" />
+ <Property Name="OrderDate" Type="Edm.DateTimeOffset" />
+ <Property Name="RequiredDate" Type="Edm.DateTimeOffset" />
+ <Property Name="ShippedDate" Type="Edm.DateTimeOffset" />
+ <Property Name="ShipVia" Type="Edm.Int32" />
+ <Property Name="Freight" Type="Edm.Decimal" Precision="19" Scale="4" />
+ <Property Name="ShipName" Type="Edm.String" MaxLength="40" />
+ <Property Name="ShipAddress" Type="Edm.String" MaxLength="60" />
+ <Property Name="ShipCity" Type="Edm.String" MaxLength="15" />
+ <Property Name="ShipRegion" Type="Edm.String" MaxLength="15" />
+ <Property Name="ShipPostalCode" Type="Edm.String" MaxLength="10" />
+ <Property Name="ShipCountry" Type="Edm.String" MaxLength="15" />
+ <NavigationProperty Name="Customer" Type="NorthwindModel.Customer" Partner="Orders">
+ <ReferentialConstraint Property="CustomerID" ReferencedProperty="CustomerID" />
+ </NavigationProperty>
+ <NavigationProperty Name="Employee" Type="NorthwindModel.Employee" Partner="Orders">
+ <ReferentialConstraint Property="EmployeeID" ReferencedProperty="EmployeeID" />
+ </NavigationProperty>
+ <NavigationProperty Name="Order_Details" Type="Collection(NorthwindModel.Order_Detail)" Partner="Order" />
+ <NavigationProperty Name="Shipper" Type="NorthwindModel.Shipper" Partner="Orders">
+ <ReferentialConstraint Property="ShipVia" ReferencedProperty="ShipperID" />
+ </NavigationProperty>
+ </EntityType>
+ <EntityType Name="Product">
+ <Key>
+ <PropertyRef Name="ProductID" />
+ </Key>
+ <Property Name="ProductID" Type="Edm.Int32" Nullable="false" p5:StoreGeneratedPattern="Identity" xmlns:p5="http://schemas.microsoft.com/ado/2009/02/edm/annotation" />
+ <Property Name="ProductName" Type="Edm.String" Nullable="false" MaxLength="40" />
+ <Property Name="SupplierID" Type="Edm.Int32" />
+ <Property Name="CategoryID" Type="Edm.Int32" />
+ <Property Name="QuantityPerUnit" Type="Edm.String" MaxLength="20" />
+ <Property Name="UnitPrice" Type="Edm.Decimal" Precision="19" Scale="4" />
+ <Property Name="UnitsInStock" Type="Edm.Int16" />
+ <Property Name="UnitsOnOrder" Type="Edm.Int16" />
+ <Property Name="ReorderLevel" Type="Edm.Int16" />
+ <Property Name="Discontinued" Type="Edm.Boolean" Nullable="false" />
+ <NavigationProperty Name="Category" Type="NorthwindModel.Category" Partner="Products">
+ <ReferentialConstraint Property="CategoryID" ReferencedProperty="CategoryID" />
+ </NavigationProperty>
+ <NavigationProperty Name="Order_Details" Type="Collection(NorthwindModel.Order_Detail)" Partner="Product" />
+ <NavigationProperty Name="Supplier" Type="NorthwindModel.Supplier" Partner="Products">
+ <ReferentialConstraint Property="SupplierID" ReferencedProperty="SupplierID" />
+ </NavigationProperty>
+ </EntityType>
+ <EntityType Name="Region">
+ <Key>
+ <PropertyRef Name="RegionID" />
+ </Key>
+ <Property Name="RegionID" Type="Edm.Int32" Nullable="false" />
+ <Property Name="RegionDescription" Type="Edm.String" Nullable="false" MaxLength="50" />
+ <NavigationProperty Name="Territories" Type="Collection(NorthwindModel.Territory)" Partner="Region" />
+ </EntityType>
+ <EntityType Name="Shipper">
+ <Key>
+ <PropertyRef Name="ShipperID" />
+ </Key>
+ <Property Name="ShipperID" Type="Edm.Int32" Nullable="false" p5:StoreGeneratedPattern="Identity" xmlns:p5="http://schemas.microsoft.com/ado/2009/02/edm/annotation" />
+ <Property Name="CompanyName" Type="Edm.String" Nullable="false" MaxLength="40" />
+ <Property Name="Phone" Type="Edm.String" MaxLength="24" />
+ <NavigationProperty Name="Orders" Type="Collection(NorthwindModel.Order)" Partner="Shipper" />
+ </EntityType>
+ <EntityType Name="Supplier">
+ <Key>
+ <PropertyRef Name="SupplierID" />
+ </Key>
+ <Property Name="SupplierID" Type="Edm.Int32" Nullable="false" p5:StoreGeneratedPattern="Identity" xmlns:p5="http://schemas.microsoft.com/ado/2009/02/edm/annotation" />
+ <Property Name="CompanyName" Type="Edm.String" Nullable="false" MaxLength="40" />
+ <Property Name="ContactName" Type="Edm.String" MaxLength="30" />
+ <Property Name="ContactTitle" Type="Edm.String" MaxLength="30" />
+ <Property Name="Address" Type="Edm.String" MaxLength="60" />
+ <Property Name="City" Type="Edm.String" MaxLength="15" />
+ <Property Name="Region" Type="Edm.String" MaxLength="15" />
+ <Property Name="PostalCode" Type="Edm.String" MaxLength="10" />
+ <Property Name="Country" Type="Edm.String" MaxLength="15" />
+ <Property Name="Phone" Type="Edm.String" MaxLength="24" />
+ <Property Name="Fax" Type="Edm.String" MaxLength="24" />
+ <Property Name="HomePage" Type="Edm.String" MaxLength="max" />
+ <NavigationProperty Name="Products" Type="Collection(NorthwindModel.Product)" Partner="Supplier" />
+ </EntityType>
+ <EntityType Name="Territory">
+ <Key>
+ <PropertyRef Name="TerritoryID" />
+ </Key>
+ <Property Name="TerritoryID" Type="Edm.String" Nullable="false" MaxLength="20" />
+ <Property Name="TerritoryDescription" Type="Edm.String" Nullable="false" MaxLength="50" />
+ <Property Name="RegionID" Type="Edm.Int32" Nullable="false" />
+ <NavigationProperty Name="Region" Type="NorthwindModel.Region" Nullable="false" Partner="Territories">
+ <ReferentialConstraint Property="RegionID" ReferencedProperty="RegionID" />
+ </NavigationProperty>
+ <NavigationProperty Name="Employees" Type="Collection(NorthwindModel.Employee)" Partner="Territories" />
+ </EntityType>
+ <EntityType Name="Alphabetical_list_of_product">
+ <Key>
+ <PropertyRef Name="CategoryName" />
+ <PropertyRef Name="Discontinued" />
+ <PropertyRef Name="ProductID" />
+ <PropertyRef Name="ProductName" />
+ </Key>
+ <Property Name="ProductID" Type="Edm.Int32" Nullable="false" />
+ <Property Name="ProductName" Type="Edm.String" Nullable="false" MaxLength="40" />
+ <Property Name="SupplierID" Type="Edm.Int32" />
+ <Property Name="CategoryID" Type="Edm.Int32" />
+ <Property Name="QuantityPerUnit" Type="Edm.String" MaxLength="20" />
+ <Property Name="UnitPrice" Type="Edm.Decimal" Precision="19" Scale="4" />
+ <Property Name="UnitsInStock" Type="Edm.Int16" />
+ <Property Name="UnitsOnOrder" Type="Edm.Int16" />
+ <Property Name="ReorderLevel" Type="Edm.Int16" />
+ <Property Name="Discontinued" Type="Edm.Boolean" Nullable="false" />
+ <Property Name="CategoryName" Type="Edm.String" Nullable="false" MaxLength="15" />
+ </EntityType>
+ <EntityType Name="Category_Sales_for_1997">
+ <Key>
+ <PropertyRef Name="CategoryName" />
+ </Key>
+ <Property Name="CategoryName" Type="Edm.String" Nullable="false" MaxLength="15" />
+ <Property Name="CategorySales" Type="Edm.Decimal" Precision="19" Scale="4" />
+ </EntityType>
+ <EntityType Name="Current_Product_List">
+ <Key>
+ <PropertyRef Name="ProductID" />
+ <PropertyRef Name="ProductName" />
+ </Key>
+ <Property Name="ProductID" Type="Edm.Int32" Nullable="false" p5:StoreGeneratedPattern="Identity" xmlns:p5="http://schemas.microsoft.com/ado/2009/02/edm/annotation" />
+ <Property Name="ProductName" Type="Edm.String" Nullable="false" MaxLength="40" />
+ </EntityType>
+ <EntityType Name="Customer_and_Suppliers_by_City">
+ <Key>
+ <PropertyRef Name="CompanyName" />
+ <PropertyRef Name="Relationship" />
+ </Key>
+ <Property Name="City" Type="Edm.String" MaxLength="15" />
+ <Property Name="CompanyName" Type="Edm.String" Nullable="false" MaxLength="40" />
+ <Property Name="ContactName" Type="Edm.String" MaxLength="30" />
+ <Property Name="Relationship" Type="Edm.String" Nullable="false" MaxLength="9" Unicode="false" />
+ </EntityType>
+ <EntityType Name="Invoice">
+ <Key>
+ <PropertyRef Name="CustomerName" />
+ <PropertyRef Name="Discount" />
+ <PropertyRef Name="OrderID" />
+ <PropertyRef Name="ProductID" />
+ <PropertyRef Name="ProductName" />
+ <PropertyRef Name="Quantity" />
+ <PropertyRef Name="Salesperson" />
+ <PropertyRef Name="ShipperName" />
+ <PropertyRef Name="UnitPrice" />
+ </Key>
+ <Property Name="ShipName" Type="Edm.String" MaxLength="40" />
+ <Property Name="ShipAddress" Type="Edm.String" MaxLength="60" />
+ <Property Name="ShipCity" Type="Edm.String" MaxLength="15" />
+ <Property Name="ShipRegion" Type="Edm.String" MaxLength="15" />
+ <Property Name="ShipPostalCode" Type="Edm.String" MaxLength="10" />
+ <Property Name="ShipCountry" Type="Edm.String" MaxLength="15" />
+ <Property Name="CustomerID" Type="Edm.String" MaxLength="5" />
+ <Property Name="CustomerName" Type="Edm.String" Nullable="false" MaxLength="40" />
+ <Property Name="Address" Type="Edm.String" MaxLength="60" />
+ <Property Name="City" Type="Edm.String" MaxLength="15" />
+ <Property Name="Region" Type="Edm.String" MaxLength="15" />
+ <Property Name="PostalCode" Type="Edm.String" MaxLength="10" />
+ <Property Name="Country" Type="Edm.String" MaxLength="15" />
+ <Property Name="Salesperson" Type="Edm.String" Nullable="false" MaxLength="31" />
+ <Property Name="OrderID" Type="Edm.Int32" Nullable="false" />
+ <Property Name="OrderDate" Type="Edm.DateTimeOffset" />
+ <Property Name="RequiredDate" Type="Edm.DateTimeOffset" />
+ <Property Name="ShippedDate" Type="Edm.DateTimeOffset" />
+ <Property Name="ShipperName" Type="Edm.String" Nullable="false" MaxLength="40" />
+ <Property Name="ProductID" Type="Edm.Int32" Nullable="false" />
+ <Property Name="ProductName" Type="Edm.String" Nullable="false" MaxLength="40" />
+ <Property Name="UnitPrice" Type="Edm.Decimal" Nullable="false" Precision="19" Scale="4" />
+ <Property Name="Quantity" Type="Edm.Int16" Nullable="false" />
+ <Property Name="Discount" Type="Edm.Single" Nullable="false" />
+ <Property Name="ExtendedPrice" Type="Edm.Decimal" Precision="19" Scale="4" />
+ <Property Name="Freight" Type="Edm.Decimal" Precision="19" Scale="4" />
+ </EntityType>
+ <EntityType Name="Order_Details_Extended">
+ <Key>
+ <PropertyRef Name="Discount" />
+ <PropertyRef Name="OrderID" />
+ <PropertyRef Name="ProductID" />
+ <PropertyRef Name="ProductName" />
+ <PropertyRef Name="Quantity" />
+ <PropertyRef Name="UnitPrice" />
+ </Key>
+ <Property Name="OrderID" Type="Edm.Int32" Nullable="false" />
+ <Property Name="ProductID" Type="Edm.Int32" Nullable="false" />
+ <Property Name="ProductName" Type="Edm.String" Nullable="false" MaxLength="40" />
+ <Property Name="UnitPrice" Type="Edm.Decimal" Nullable="false" Precision="19" Scale="4" />
+ <Property Name="Quantity" Type="Edm.Int16" Nullable="false" />
+ <Property Name="Discount" Type="Edm.Single" Nullable="false" />
+ <Property Name="ExtendedPrice" Type="Edm.Decimal" Precision="19" Scale="4" />
+ </EntityType>
+ <EntityType Name="Order_Subtotal">
+ <Key>
+ <PropertyRef Name="OrderID" />
+ </Key>
+ <Property Name="OrderID" Type="Edm.Int32" Nullable="false" />
+ <Property Name="Subtotal" Type="Edm.Decimal" Precision="19" Scale="4" />
+ </EntityType>
+ <EntityType Name="Orders_Qry">
+ <Key>
+ <PropertyRef Name="CompanyName" />
+ <PropertyRef Name="OrderID" />
+ </Key>
+ <Property Name="OrderID" Type="Edm.Int32" Nullable="false" />
+ <Property Name="CustomerID" Type="Edm.String" MaxLength="5" />
+ <Property Name="EmployeeID" Type="Edm.Int32" />
+ <Property Name="OrderDate" Type="Edm.DateTimeOffset" />
+ <Property Name="RequiredDate" Type="Edm.DateTimeOffset" />
+ <Property Name="ShippedDate" Type="Edm.DateTimeOffset" />
+ <Property Name="ShipVia" Type="Edm.Int32" />
+ <Property Name="Freight" Type="Edm.Decimal" Precision="19" Scale="4" />
+ <Property Name="ShipName" Type="Edm.String" MaxLength="40" />
+ <Property Name="ShipAddress" Type="Edm.String" MaxLength="60" />
+ <Property Name="ShipCity" Type="Edm.String" MaxLength="15" />
+ <Property Name="ShipRegion" Type="Edm.String" MaxLength="15" />
+ <Property Name="ShipPostalCode" Type="Edm.String" MaxLength="10" />
+ <Property Name="ShipCountry" Type="Edm.String" MaxLength="15" />
+ <Property Name="CompanyName" Type="Edm.String" Nullable="false" MaxLength="40" />
+ <Property Name="Address" Type="Edm.String" MaxLength="60" />
+ <Property Name="City" Type="Edm.String" MaxLength="15" />
+ <Property Name="Region" Type="Edm.String" MaxLength="15" />
+ <Property Name="PostalCode" Type="Edm.String" MaxLength="10" />
+ <Property Name="Country" Type="Edm.String" MaxLength="15" />
+ </EntityType>
+ <EntityType Name="Product_Sales_for_1997">
+ <Key>
+ <PropertyRef Name="CategoryName" />
+ <PropertyRef Name="ProductName" />
+ </Key>
+ <Property Name="CategoryName" Type="Edm.String" Nullable="false" MaxLength="15" />
+ <Property Name="ProductName" Type="Edm.String" Nullable="false" MaxLength="40" />
+ <Property Name="ProductSales" Type="Edm.Decimal" Precision="19" Scale="4" />
+ </EntityType>
+ <EntityType Name="Products_Above_Average_Price">
+ <Key>
+ <PropertyRef Name="ProductName" />
+ </Key>
+ <Property Name="ProductName" Type="Edm.String" Nullable="false" MaxLength="40" />
+ <Property Name="UnitPrice" Type="Edm.Decimal" Precision="19" Scale="4" />
+ </EntityType>
+ <EntityType Name="Products_by_Category">
+ <Key>
+ <PropertyRef Name="CategoryName" />
+ <PropertyRef Name="Discontinued" />
+ <PropertyRef Name="ProductName" />
+ </Key>
+ <Property Name="CategoryName" Type="Edm.String" Nullable="false" MaxLength="15" />
+ <Property Name="ProductName" Type="Edm.String" Nullable="false" MaxLength="40" />
+ <Property Name="QuantityPerUnit" Type="Edm.String" MaxLength="20" />
+ <Property Name="UnitsInStock" Type="Edm.Int16" />
+ <Property Name="Discontinued" Type="Edm.Boolean" Nullable="false" />
+ </EntityType>
+ <EntityType Name="Sales_by_Category">
+ <Key>
+ <PropertyRef Name="CategoryID" />
+ <PropertyRef Name="CategoryName" />
+ <PropertyRef Name="ProductName" />
+ </Key>
+ <Property Name="CategoryID" Type="Edm.Int32" Nullable="false" />
+ <Property Name="CategoryName" Type="Edm.String" Nullable="false" MaxLength="15" />
+ <Property Name="ProductName" Type="Edm.String" Nullable="false" MaxLength="40" />
+ <Property Name="ProductSales" Type="Edm.Decimal" Precision="19" Scale="4" />
+ </EntityType>
+ <EntityType Name="Sales_Totals_by_Amount">
+ <Key>
+ <PropertyRef Name="CompanyName" />
+ <PropertyRef Name="OrderID" />
+ </Key>
+ <Property Name="SaleAmount" Type="Edm.Decimal" Precision="19" Scale="4" />
+ <Property Name="OrderID" Type="Edm.Int32" Nullable="false" />
+ <Property Name="CompanyName" Type="Edm.String" Nullable="false" MaxLength="40" />
+ <Property Name="ShippedDate" Type="Edm.DateTimeOffset" />
+ </EntityType>
+ <EntityType Name="Summary_of_Sales_by_Quarter">
+ <Key>
+ <PropertyRef Name="OrderID" />
+ </Key>
+ <Property Name="ShippedDate" Type="Edm.DateTimeOffset" />
+ <Property Name="OrderID" Type="Edm.Int32" Nullable="false" />
+ <Property Name="Subtotal" Type="Edm.Decimal" Precision="19" Scale="4" />
+ </EntityType>
+ <EntityType Name="Summary_of_Sales_by_Year">
+ <Key>
+ <PropertyRef Name="OrderID" />
+ </Key>
+ <Property Name="ShippedDate" Type="Edm.DateTimeOffset" />
+ <Property Name="OrderID" Type="Edm.Int32" Nullable="false" />
+ <Property Name="Subtotal" Type="Edm.Decimal" Precision="19" Scale="4" />
+ </EntityType>
+ <Annotations Target="ODataWebExperimental.Northwind.Model.NorthwindEntities">
+ <Annotation Term="Com.Microsoft.OData.Service.Conventions.V1.UrlConventions" String="KeyAsSegment" />
+ </Annotations>
+ </Schema>
+ </edmx:DataServices>
+</edmx:Edmx>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/26142187/fit/src/main/webapp/WEB-INF/applicationContext.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/webapp/WEB-INF/applicationContext.xml b/fit/src/main/webapp/WEB-INF/applicationContext.xml
index f351ba6..18b555d 100644
--- a/fit/src/main/webapp/WEB-INF/applicationContext.xml
+++ b/fit/src/main/webapp/WEB-INF/applicationContext.xml
@@ -39,8 +39,10 @@
<jaxrs:server id="services" address="/">
<jaxrs:serviceBeans>
- <bean class="org.apache.olingo.fit.V4Services"/>
<bean class="org.apache.olingo.fit.V3Services"/>
+ <bean class="org.apache.olingo.fit.V4Services"/>
+ <bean class="org.apache.olingo.fit.V4NorthWind"/>
+ <bean class="org.apache.olingo.fit.V4NorthWindExt"/>
</jaxrs:serviceBeans>
<jaxrs:providers>
<bean class="com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider"/>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/26142187/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/CommonRetrieveRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/CommonRetrieveRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/CommonRetrieveRequestFactory.java
index 89777da..f613cbc 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/CommonRetrieveRequestFactory.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/CommonRetrieveRequestFactory.java
@@ -27,30 +27,42 @@ import java.net.URI;
public interface CommonRetrieveRequestFactory extends Serializable {
/**
- * Gets a service document request instance.
+ * Gets a metadata request instance.
+ * <br/>
+ * Compared to {@link #getMetadataRequest(java.lang.String)}, this method returns a request instance for fetching
+ * low-level metadata representation.
*
* @param serviceRoot absolute URL (schema, host and port included) representing the location of the root of the data
* service.
- * @return new ODataServiceDocumentRequest instance.
+ * @return new {@link XMLMetadataRequest} instance.
*/
- ODataServiceDocumentRequest getServiceDocumentRequest(String serviceRoot);
+ XMLMetadataRequest getXMLMetadataRequest(String serviceRoot);
/**
* Gets a metadata request instance.
*
* @param serviceRoot absolute URL (schema, host and port included) representing the location of the root of the data
* service.
- * @return new ODataMetadataRequest instance.
+ * @return new {@link EdmMetadataRequest} instance.
+ */
+ EdmMetadataRequest getMetadataRequest(String serviceRoot);
+
+ /**
+ * Gets a service document request instance.
+ *
+ * @param serviceRoot absolute URL (schema, host and port included) representing the location of the root of the data
+ * service.
+ * @return new {@link ODataServiceDocumentRequest} instance.
*/
- ODataMetadataRequest getMetadataRequest(String serviceRoot);
+ ODataServiceDocumentRequest getServiceDocumentRequest(String serviceRoot);
/**
* Gets a query request returning a set of one or more OData entities.
*
- * @param query query to be performed.
- * @return new ODataEntitySetRequest instance.
+ * @param uri request URI.
+ * @return new {@link ODataEntitySetRequest} instance.
*/
- ODataEntitySetRequest getEntitySetRequest(URI query);
+ ODataEntitySetRequest getEntitySetRequest(URI uri);
/**
* Gets a query request returning a set of one or more OData entities.
@@ -58,48 +70,48 @@ public interface CommonRetrieveRequestFactory extends Serializable {
* Returned request gives the possibility to consume entities iterating on them without parsing and loading in memory
* the entire entity set.
*
- * @param query query to be performed.
- * @return new ODataEntitySetIteratorRequest instance.
+ * @param uri request URI.
+ * @return new {@link ODataEntitySetIteratorRequest} instance.
*/
- ODataEntitySetIteratorRequest getEntitySetIteratorRequest(URI query);
+ ODataEntitySetIteratorRequest getEntitySetIteratorRequest(URI uri);
/**
* Gets a query request returning a single OData entity.
*
- * @param query query to be performed.
- * @return new ODataEntityRequest instance.
+ * @param uri request URI.
+ * @return new {@link ODataEntityRequest} instance.
*/
- ODataEntityRequest getEntityRequest(URI query);
+ ODataEntityRequest getEntityRequest(URI uri);
/**
* Gets a query request returning a single OData entity property.
*
- * @param query query to be performed.
- * @return new ODataPropertyRequest instance.
+ * @param uri request URI.
+ * @return new {@link ODataPropertyRequest} instance.
*/
- ODataPropertyRequest getPropertyRequest(URI query);
+ ODataPropertyRequest getPropertyRequest(URI uri);
/**
* Gets a query request returning a single OData entity property value.
*
- * @param query query to be performed.
- * @return new ODataValueRequest instance.
+ * @param uri request URI.
+ * @return new {@link ODataValueRequest} instance.
*/
- ODataValueRequest getValueRequest(URI query);
+ ODataValueRequest getValueRequest(URI uri);
/**
* Gets a query request returning a media stream.
*
- * @param query query to be performed.
- * @return new ODataMediaRequest instance.
+ * @param uri request URI.
+ * @return new {@link ODataMediaRequest} instance.
*/
- ODataMediaRequest getMediaRequest(URI query);
+ ODataMediaRequest getMediaRequest(URI uri);
/**
* Implements a raw request request without specifying any return type.
*
- * @param uri query to be performed.
- * @return new ODataRawRequest instance.
+ * @param uri request URI.
+ * @return new {@link ODataRawRequest} instance.
*/
ODataRawRequest getRawRequest(URI uri);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/26142187/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/EdmMetadataRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/EdmMetadataRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/EdmMetadataRequest.java
new file mode 100644
index 0000000..d4ea45b
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/EdmMetadataRequest.java
@@ -0,0 +1,28 @@
+/*
+ * 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.client.api.communication.request.retrieve;
+
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.format.ODataFormat;
+
+/**
+ * This class implements a metadata query request.
+ */
+public interface EdmMetadataRequest extends ODataRetrieveRequest<Edm, ODataFormat> {
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/26142187/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataMetadataRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataMetadataRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataMetadataRequest.java
deleted file mode 100644
index 3dcc81b..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/ODataMetadataRequest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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.client.api.communication.request.retrieve;
-
-import org.apache.olingo.commons.api.format.ODataPubFormat;
-import org.apache.olingo.commons.api.edm.Edm;
-
-/**
- * This class implements a metadata query request.
- */
-public interface ODataMetadataRequest extends ODataRetrieveRequest<Edm, ODataPubFormat> {
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/26142187/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/XMLMetadataRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/XMLMetadataRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/XMLMetadataRequest.java
new file mode 100644
index 0000000..fbeff8f
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/XMLMetadataRequest.java
@@ -0,0 +1,29 @@
+/*
+ * 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.client.api.communication.request.retrieve;
+
+import java.util.List;
+import org.apache.olingo.client.api.edm.xml.Schema;
+import org.apache.olingo.commons.api.format.ODataFormat;
+
+/**
+ * This class implements an XML metadata request.
+ */
+public interface XMLMetadataRequest extends ODataRetrieveRequest<List<? extends Schema>, ODataFormat> {
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/26142187/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataReader.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataReader.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataReader.java
index 829c5a7..9164918 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataReader.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataReader.java
@@ -20,14 +20,16 @@ package org.apache.olingo.client.api.op;
import java.io.InputStream;
import java.io.Serializable;
+import java.util.List;
+import org.apache.olingo.client.api.edm.xml.Schema;
import org.apache.olingo.commons.api.domain.ODataError;
import org.apache.olingo.commons.api.domain.ODataEntity;
import org.apache.olingo.commons.api.domain.ODataEntitySet;
import org.apache.olingo.commons.api.domain.ODataProperty;
import org.apache.olingo.commons.api.domain.ODataServiceDocument;
+import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.format.ODataPubFormat;
-import org.apache.olingo.commons.api.edm.Edm;
/**
* OData reader.
@@ -47,6 +49,15 @@ public interface CommonODataReader extends Serializable {
Edm readMetadata(InputStream input);
/**
+ * Parses a stream into metadata representation, including referenced metadata documents.
+ *
+ * @param xmlSchemas XML representation of the requested metadata document + any other referenced (via
+ * <tt><edmx:Reference/></tt>) metadata document
+ * @return metadata representation.
+ */
+ Edm readMetadata(List<? extends Schema> xmlSchemas);
+
+ /**
* Parses an OData service document.
*
* @param input stream to de-serialize.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/26142187/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java
index 0a8c495..65cca8d 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/ODataRequestImpl.java
@@ -80,7 +80,7 @@ public class ODataRequestImpl<T extends Format> implements ODataRequest {
protected final CommonODataClient odataClient;
- protected final Class<T> formatRef;
+ private final Class<T> formatRef;
/**
* OData request method.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/26142187/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractMetadataRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractMetadataRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractMetadataRequestImpl.java
new file mode 100644
index 0000000..c851b49
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractMetadataRequestImpl.java
@@ -0,0 +1,52 @@
+/*
+ * 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.client.core.communication.request.retrieve;
+
+import java.net.URI;
+import org.apache.http.entity.ContentType;
+import org.apache.olingo.client.api.CommonODataClient;
+import org.apache.olingo.client.api.communication.request.ODataRequest;
+import org.apache.olingo.commons.api.format.ODataFormat;
+
+public abstract class AbstractMetadataRequestImpl<V> extends AbstractODataRetrieveRequest<V, ODataFormat> {
+
+ public AbstractMetadataRequestImpl(final CommonODataClient odataClient, final URI query) {
+ super(odataClient, ODataFormat.class, query);
+ super.setAccept(ContentType.APPLICATION_XML.getMimeType());
+ super.setContentType(ContentType.APPLICATION_XML.getMimeType());
+ }
+
+ @Override
+ public ODataFormat getDefaultFormat() {
+ return ODataFormat.XML;
+ }
+
+ @Override
+ public ODataRequest setAccept(final String value) {
+ // do nothing: Accept is application/xml
+ return this;
+ }
+
+ @Override
+ public ODataRequest setContentType(final String value) {
+ // do nothing: Content-Type is application/xml
+ return this;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/26142187/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractODataRetrieveRequest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractODataRetrieveRequest.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractODataRetrieveRequest.java
index 7fd3966..53e46c1 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractODataRetrieveRequest.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractODataRetrieveRequest.java
@@ -89,6 +89,10 @@ public abstract class AbstractODataRetrieveRequest<V, T extends Format>
super(client, res);
}
+ protected HttpResponse getHttpResponse() {
+ return res;
+ }
+
/**
* {@inheritDoc }
*/
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/26142187/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractRetrieveRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractRetrieveRequestFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractRetrieveRequestFactory.java
index ddbfd10..3eeabed 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractRetrieveRequestFactory.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractRetrieveRequestFactory.java
@@ -25,7 +25,7 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRe
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataMediaRequest;
-import org.apache.olingo.client.api.communication.request.retrieve.ODataMetadataRequest;
+import org.apache.olingo.client.api.communication.request.retrieve.EdmMetadataRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataRawRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataServiceDocumentRequest;
@@ -78,8 +78,9 @@ public abstract class AbstractRetrieveRequestFactory implements CommonRetrieveRe
}
@Override
- public ODataMetadataRequest getMetadataRequest(final String serviceRoot) {
- return new ODataMetadataRequestImpl(client, client.getURIBuilder(serviceRoot).appendMetadataSegment().build());
+ public EdmMetadataRequest getMetadataRequest(final String serviceRoot) {
+ return new EdmMetadataRequestImpl(client, serviceRoot,
+ client.getURIBuilder(serviceRoot).appendMetadataSegment().build());
}
@Override
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/26142187/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/EdmMetadataRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/EdmMetadataRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/EdmMetadataRequestImpl.java
new file mode 100644
index 0000000..96df2d6
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/EdmMetadataRequestImpl.java
@@ -0,0 +1,73 @@
+/*
+ * 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.client.core.communication.request.retrieve;
+
+import java.net.URI;
+import java.util.List;
+import org.apache.olingo.client.api.CommonODataClient;
+import org.apache.olingo.client.api.communication.request.retrieve.EdmMetadataRequest;
+import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
+import org.apache.olingo.client.api.edm.xml.Schema;
+import org.apache.olingo.commons.api.edm.Edm;
+
+/**
+ * This class implements a metadata query request.
+ */
+class EdmMetadataRequestImpl extends AbstractMetadataRequestImpl<Edm> implements EdmMetadataRequest {
+
+ private final String serviceRoot;
+
+ /**
+ * Constructor.
+ *
+ * @param odataClient client instance getting this request
+ * @param uri metadata URI.
+ */
+ EdmMetadataRequestImpl(final CommonODataClient odataClient, final String serviceRoot, final URI uri) {
+ super(odataClient, uri);
+ this.serviceRoot = serviceRoot;
+ }
+
+ @Override
+ public ODataRetrieveResponse<Edm> execute() {
+ final ODataRetrieveResponse<List<? extends Schema>> xmlMetadataResponse =
+ odataClient.getRetrieveRequestFactory().getXMLMetadataRequest(serviceRoot).execute();
+
+ return new ODataRetrieveResponseImpl() {
+ private Edm metadata = null;
+
+ @Override
+ public void close() {
+ xmlMetadataResponse.close();
+ }
+
+ @Override
+ public Edm getBody() {
+ if (metadata == null) {
+ try {
+ metadata = odataClient.getReader().readMetadata(xmlMetadataResponse.getBody());
+ } finally {
+ this.close();
+ }
+ }
+ return metadata;
+ }
+ };
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/26142187/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataMetadataRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataMetadataRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataMetadataRequestImpl.java
deleted file mode 100644
index d5ee545..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataMetadataRequestImpl.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * 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.client.core.communication.request.retrieve;
-
-import java.net.URI;
-import org.apache.http.HttpResponse;
-import org.apache.http.client.HttpClient;
-import org.apache.http.entity.ContentType;
-import org.apache.olingo.client.api.CommonODataClient;
-import org.apache.olingo.client.api.communication.request.ODataRequest;
-import org.apache.olingo.client.api.communication.request.retrieve.ODataMetadataRequest;
-import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.commons.api.format.ODataPubFormat;
-import org.apache.olingo.commons.api.edm.Edm;
-
-/**
- * This class implements a metadata query request.
- */
-class ODataMetadataRequestImpl extends AbstractODataRetrieveRequest<Edm, ODataPubFormat>
- implements ODataMetadataRequest {
-
- /**
- * Constructor.
- *
- * @param odataClient client instance getting this request
- * @param uri metadata URI.
- */
- ODataMetadataRequestImpl(final CommonODataClient odataClient, final URI uri) {
- super(odataClient, ODataPubFormat.class, uri);
- super.setAccept(ContentType.APPLICATION_XML.getMimeType());
- super.setContentType(ContentType.APPLICATION_XML.getMimeType());
- }
-
- @Override
- public ODataRequest setAccept(final String value) {
- // do nothing: Accept is application/XML
- return this;
- }
-
- @Override
- public ODataRequest setContentType(final String value) {
- // do nothing: Accept is application/XML
- return this;
- }
-
- @Override
- public ODataRetrieveResponse<Edm> execute() {
- final HttpResponse res = doExecute();
- return new ODataMetadataResponseImpl(httpClient, res);
- }
-
- /**
- * Response class about an ODataMetadataRequest.
- */
- protected class ODataMetadataResponseImpl extends ODataRetrieveResponseImpl {
-
- private Edm metadata = null;
-
- /**
- * Constructor.
- * <p>
- * Just to create response templates to be initialized from batch.
- */
- public ODataMetadataResponseImpl() {
- }
-
- /**
- * Constructor.
- *
- * @param client HTTP client.
- * @param res HTTP response.
- */
- private ODataMetadataResponseImpl(final HttpClient client, final HttpResponse res) {
- super(client, res);
- }
-
- /**
- * {@inheritDoc }
- */
- @Override
- public Edm getBody() {
- if (metadata == null) {
- try {
- metadata = odataClient.getReader().readMetadata(getRawResponse());
- } finally {
- this.close();
- }
- }
- return metadata;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/26142187/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/RetrieveRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/RetrieveRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/RetrieveRequestFactoryImpl.java
index 3e07579..f6ba5c1 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/RetrieveRequestFactoryImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/RetrieveRequestFactoryImpl.java
@@ -18,8 +18,8 @@
*/
package org.apache.olingo.client.core.communication.request.retrieve.v3;
-import org.apache.olingo.client.core.communication.request.retrieve.v3.ODataLinkCollectionRequestImpl;
import java.net.URI;
+import org.apache.olingo.client.api.communication.request.retrieve.XMLMetadataRequest;
import org.apache.olingo.client.api.v3.ODataClient;
import org.apache.olingo.client.api.communication.request.retrieve.v3.ODataLinkCollectionRequest;
import org.apache.olingo.client.api.communication.request.retrieve.v3.RetrieveRequestFactory;
@@ -35,6 +35,12 @@ public class RetrieveRequestFactoryImpl extends AbstractRetrieveRequestFactory
}
@Override
+ public XMLMetadataRequest getXMLMetadataRequest(final String serviceRoot) {
+ return new XMLMetadataRequestImpl(((ODataClient) client),
+ client.getURIBuilder(serviceRoot).appendMetadataSegment().build());
+ }
+
+ @Override
public ODataLinkCollectionRequest getLinkCollectionRequest(final URI targetURI, final String linkName) {
return new ODataLinkCollectionRequestImpl((ODataClient) client, targetURI, linkName);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/26142187/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/XMLMetadataRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/XMLMetadataRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/XMLMetadataRequestImpl.java
new file mode 100644
index 0000000..cf1be41
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/XMLMetadataRequestImpl.java
@@ -0,0 +1,79 @@
+/*
+ * 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.client.core.communication.request.retrieve.v3;
+
+import java.net.URI;
+import java.util.List;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.HttpClient;
+import org.apache.olingo.client.api.communication.request.retrieve.XMLMetadataRequest;
+import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
+import org.apache.olingo.client.api.edm.xml.Schema;
+import org.apache.olingo.client.api.edm.xml.XMLMetadata;
+import org.apache.olingo.client.api.v3.ODataClient;
+import org.apache.olingo.client.core.communication.request.retrieve.AbstractMetadataRequestImpl;
+
+public class XMLMetadataRequestImpl extends AbstractMetadataRequestImpl<List<? extends Schema>>
+ implements XMLMetadataRequest {
+
+ XMLMetadataRequestImpl(final ODataClient odataClient, final URI query) {
+ super(odataClient, query);
+ }
+
+ @Override
+ public ODataRetrieveResponse<List<? extends Schema>> execute() {
+ return new XMLMetadataResponseImpl(httpClient, doExecute());
+ }
+
+ public class XMLMetadataResponseImpl extends ODataRetrieveResponseImpl {
+
+ private XMLMetadata metadata = null;
+
+ /**
+ * Constructor.
+ * <br/>
+ * Just to create response templates to be initialized from batch.
+ */
+ private XMLMetadataResponseImpl() {
+ super();
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param client HTTP client.
+ * @param res HTTP response.
+ */
+ private XMLMetadataResponseImpl(final HttpClient client, final HttpResponse res) {
+ super(client, res);
+ }
+
+ @Override
+ public List<? extends Schema> getBody() {
+ if (metadata == null) {
+ try {
+ metadata = odataClient.getDeserializer().toMetadata(getRawResponse());
+ } finally {
+ this.close();
+ }
+ }
+ return metadata.getSchemas();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/26142187/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java
index 016320f..69f6f2a 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java
@@ -18,6 +18,7 @@
*/
package org.apache.olingo.client.core.communication.request.retrieve.v4;
+import org.apache.olingo.client.api.communication.request.retrieve.XMLMetadataRequest;
import org.apache.olingo.client.api.v4.ODataClient;
import org.apache.olingo.client.api.communication.request.retrieve.v4.RetrieveRequestFactory;
import org.apache.olingo.client.core.communication.request.retrieve.AbstractRetrieveRequestFactory;
@@ -30,4 +31,10 @@ public class RetrieveRequestFactoryImpl extends AbstractRetrieveRequestFactory
public RetrieveRequestFactoryImpl(final ODataClient client) {
super(client);
}
+
+ @Override
+ public XMLMetadataRequest getXMLMetadataRequest(final String serviceRoot) {
+ return new XMLMetadataRequestImpl(((ODataClient) client),
+ client.getURIBuilder(serviceRoot).appendMetadataSegment().build());
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/26142187/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/XMLMetadataRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/XMLMetadataRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/XMLMetadataRequestImpl.java
new file mode 100644
index 0000000..db141eb
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/XMLMetadataRequestImpl.java
@@ -0,0 +1,122 @@
+/*
+ * 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.client.core.communication.request.retrieve.v4;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.client.api.communication.request.retrieve.XMLMetadataRequest;
+import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
+import org.apache.olingo.client.api.edm.xml.Schema;
+import org.apache.olingo.client.api.edm.xml.v4.Include;
+import org.apache.olingo.client.api.edm.xml.v4.Reference;
+import org.apache.olingo.client.api.edm.xml.v4.XMLMetadata;
+import org.apache.olingo.client.api.v4.ODataClient;
+import org.apache.olingo.client.core.communication.request.retrieve.AbstractMetadataRequestImpl;
+
+public class XMLMetadataRequestImpl extends AbstractMetadataRequestImpl<List<? extends Schema>>
+ implements XMLMetadataRequest {
+
+ XMLMetadataRequestImpl(final ODataClient odataClient, final URI uri) {
+ super(odataClient, uri);
+ }
+
+ @Override
+ public ODataRetrieveResponse<List<? extends Schema>> execute() {
+ final SingleXMLMetadatRequestImpl rootReq = new SingleXMLMetadatRequestImpl((ODataClient) odataClient, uri);
+ final ODataRetrieveResponse<XMLMetadata> rootRes = rootReq.execute();
+
+ final XMLMetadataResponseImpl response = new XMLMetadataResponseImpl();
+
+ final XMLMetadata rootMetadata = rootRes.getBody();
+ response.getSchemas().addAll(rootMetadata.getSchemas());
+
+ if (!rootMetadata.getReferences().isEmpty()) {
+ for (Reference reference : rootMetadata.getReferences()) {
+ final SingleXMLMetadatRequestImpl includeReq = new SingleXMLMetadatRequestImpl((ODataClient) odataClient,
+ odataClient.getURIBuilder(reference.getUri().toASCIIString()).appendMetadataSegment().build());
+ final XMLMetadata includeMetadata = includeReq.execute().getBody();
+
+ for (Include include : reference.getIncludes()) {
+ Schema includedSchema = includeMetadata.getSchema(include.getNamespace());
+ if (includedSchema == null && StringUtils.isNotBlank(include.getAlias())) {
+ includedSchema = includeMetadata.getSchema(include.getAlias());
+ }
+ if (includedSchema != null) {
+ response.getSchemas().add(includedSchema);
+ }
+ }
+ }
+ }
+
+ return response;
+ }
+
+ private class SingleXMLMetadatRequestImpl extends AbstractMetadataRequestImpl<XMLMetadata> {
+
+ public SingleXMLMetadatRequestImpl(final ODataClient odataClient, final URI uri) {
+ super(odataClient, uri);
+ }
+
+ @Override
+ public ODataRetrieveResponse<XMLMetadata> execute() {
+ return new ODataRetrieveResponseImpl(httpClient, doExecute()) {
+
+ @Override
+ public XMLMetadata getBody() {
+ try {
+ return ((ODataClient) odataClient).getDeserializer().toMetadata(getRawResponse());
+ } finally {
+ this.close();
+ }
+ }
+ };
+ }
+ }
+
+ public class XMLMetadataResponseImpl extends ODataRetrieveResponseImpl {
+
+ private final List<Schema> schemas = new ArrayList<Schema>();
+
+ /**
+ * Constructor.
+ * <br/>
+ * Just to create response templates to be initialized from batch.
+ */
+ private XMLMetadataResponseImpl() {
+ super();
+ }
+
+ @Override
+ public void close() {
+ // just do nothing, this is a placeholder response
+ }
+
+ public List<Schema> getSchemas() {
+ return schemas;
+ }
+
+ @Override
+ public List<? extends Schema> getBody() {
+ return getSchemas();
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/26142187/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/AbstractEdmServiceMetadataImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/AbstractEdmServiceMetadataImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/AbstractEdmServiceMetadataImpl.java
index 6508224..12463d3 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/AbstractEdmServiceMetadataImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/edm/AbstractEdmServiceMetadataImpl.java
@@ -29,16 +29,16 @@ import org.apache.commons.lang3.builder.ToStringStyle;
import org.apache.olingo.client.api.edm.xml.EntityContainer;
import org.apache.olingo.client.api.edm.xml.EntitySet;
import org.apache.olingo.client.api.edm.xml.Schema;
-import org.apache.olingo.client.api.edm.xml.XMLMetadata;
import org.apache.olingo.commons.api.edm.EdmActionImportInfo;
import org.apache.olingo.commons.api.edm.EdmEntitySetInfo;
import org.apache.olingo.commons.api.edm.EdmFunctionImportInfo;
import org.apache.olingo.commons.api.edm.EdmServiceMetadata;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.commons.core.edm.EdmEntitySetInfoImpl;
public abstract class AbstractEdmServiceMetadataImpl implements EdmServiceMetadata {
- protected final XMLMetadata xmlMetadata;
+ protected final List<? extends Schema> xmlSchemas;
private List<EdmEntitySetInfo> entitySetInfos;
@@ -46,17 +46,16 @@ public abstract class AbstractEdmServiceMetadataImpl implements EdmServiceMetada
protected List<EdmActionImportInfo> actionImportInfos;
- public static EdmServiceMetadata getInstance(final XMLMetadata xmlMetadata) {
- return xmlMetadata instanceof org.apache.olingo.client.core.edm.xml.v3.XMLMetadataImpl
- ? new org.apache.olingo.client.core.edm.v3.EdmServiceMetadataImpl(
- (org.apache.olingo.client.core.edm.xml.v3.XMLMetadataImpl) xmlMetadata)
- : new org.apache.olingo.client.core.edm.v4.EdmServiceMetadataImpl(
- (org.apache.olingo.client.core.edm.xml.v4.XMLMetadataImpl) xmlMetadata);
+ public static EdmServiceMetadata getInstance(final ODataServiceVersion version,
+ final List<? extends Schema> xmlSchemas) {
+ return version == ODataServiceVersion.V30
+ ? new org.apache.olingo.client.core.edm.v3.EdmServiceMetadataImpl(xmlSchemas)
+ : new org.apache.olingo.client.core.edm.v4.EdmServiceMetadataImpl(xmlSchemas);
}
- public AbstractEdmServiceMetadataImpl(final XMLMetadata xmlMetadata) {
- this.xmlMetadata = xmlMetadata;
+ public AbstractEdmServiceMetadataImpl(final List<? extends Schema> xmlSchemas) {
+ this.xmlSchemas = xmlSchemas;
}
@Override
@@ -69,11 +68,10 @@ public abstract class AbstractEdmServiceMetadataImpl implements EdmServiceMetada
synchronized (this) {
if (entitySetInfos == null) {
entitySetInfos = new ArrayList<EdmEntitySetInfo>();
- for (Schema schema : xmlMetadata.getSchemas()) {
+ for (Schema schema : xmlSchemas) {
for (EntityContainer entityContainer : schema.getEntityContainers()) {
for (EntitySet entitySet : entityContainer.getEntitySets()) {
- entitySetInfos.add(
- new EdmEntitySetInfoImpl(entityContainer.getName(), entitySet.getName()));
+ entitySetInfos.add(new EdmEntitySetInfoImpl(entityContainer.getName(), entitySet.getName()));
}
}
}
[12/51] [abbrv] git commit: Merge branch 'olingo200' of
https://git-wip-us.apache.org/repos/asf/olingo-odata4 into olingo200
Posted by il...@apache.org.
Merge branch 'olingo200' of https://git-wip-us.apache.org/repos/asf/olingo-odata4 into olingo200
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/cde94fc0
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/cde94fc0
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/cde94fc0
Branch: refs/heads/master
Commit: cde94fc09b9972d7be053aed28d8fb8b9f776ec0
Parents: fc2881f 2614218
Author: fmartelli <fa...@gmail.com>
Authored: Thu Mar 27 15:35:14 2014 +0100
Committer: fmartelli <fa...@gmail.com>
Committed: Thu Mar 27 15:35:14 2014 +0100
----------------------------------------------------------------------
.../org/apache/olingo/fit/AbstractServices.java | 12 +-
.../java/org/apache/olingo/fit/V4NorthWind.java | 46 +++
.../org/apache/olingo/fit/V4NorthWindExt.java | 46 +++
.../main/resources/v4/northwind-metadata.xml | 91 +++++
.../main/resources/v4/northwindExt-metadata.xml | 408 +++++++++++++++++++
.../main/webapp/WEB-INF/applicationContext.xml | 4 +-
.../retrieve/CommonRetrieveRequestFactory.java | 62 +--
.../request/retrieve/EdmMetadataRequest.java | 28 ++
.../request/retrieve/ODataMetadataRequest.java | 28 --
.../request/retrieve/XMLMetadataRequest.java | 29 ++
.../olingo/client/api/op/CommonODataReader.java | 13 +-
.../communication/request/ODataRequestImpl.java | 2 +-
.../retrieve/AbstractMetadataRequestImpl.java | 52 +++
.../retrieve/AbstractODataRetrieveRequest.java | 4 +
.../AbstractRetrieveRequestFactory.java | 7 +-
.../retrieve/EdmMetadataRequestImpl.java | 73 ++++
.../retrieve/ODataMetadataRequestImpl.java | 108 -----
.../retrieve/v3/RetrieveRequestFactoryImpl.java | 8 +-
.../retrieve/v3/XMLMetadataRequestImpl.java | 79 ++++
.../retrieve/v4/RetrieveRequestFactoryImpl.java | 7 +
.../retrieve/v4/XMLMetadataRequestImpl.java | 122 ++++++
.../edm/AbstractEdmServiceMetadataImpl.java | 24 +-
.../olingo/client/core/edm/EdmClientImpl.java | 46 ++-
.../client/core/edm/EdmEntityContainerImpl.java | 48 +--
.../olingo/client/core/edm/EdmSchemaImpl.java | 9 +-
.../client/core/edm/v3/EdmEntitySetProxy.java | 11 +-
.../core/edm/v3/EdmServiceMetadataImpl.java | 9 +-
.../core/edm/v4/EdmServiceMetadataImpl.java | 24 +-
.../client/core/edm/xml/v4/XMLMetadataImpl.java | 1 +
.../client/core/op/AbstractODataReader.java | 19 +
.../core/op/impl/v3/ODataDeserializerImpl.java | 3 +-
.../client/core/op/impl/v3/ODataReaderImpl.java | 15 -
.../client/core/op/impl/v4/ODataReaderImpl.java | 16 -
.../core/it/AbstractMetadataTestITCase.java | 4 +
.../client/core/it/v4/MetadataTestITCase.java | 22 +-
.../olingo/client/core/v4/MetadataTest.java | 1 -
.../olingo/client/core/v4/fromdoc1-metadata.xml | 2 +-
37 files changed, 1188 insertions(+), 295 deletions(-)
----------------------------------------------------------------------
[04/51] [abbrv] git commit: [OLINGO-205] pruned merge for v4
Posted by il...@apache.org.
[OLINGO-205] pruned merge for v4
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/2e33a68b
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/2e33a68b
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/2e33a68b
Branch: refs/heads/master
Commit: 2e33a68bf4b52a8e573c8505c1199e99ae89f8f5
Parents: 1a6a548
Author: fmartelli <fa...@gmail.com>
Authored: Wed Mar 26 17:57:46 2014 +0100
Committer: fmartelli <fa...@gmail.com>
Committed: Wed Mar 26 17:57:46 2014 +0100
----------------------------------------------------------------------
.../api/communication/request/UpdateType.java | 55 -------------------
.../request/cud/CommonCUDRequestFactory.java | 3 +-
.../request/cud/v3/UpdateType.java | 56 ++++++++++++++++++++
.../request/cud/v4/UpdateType.java | 52 ++++++++++++++++++
.../request/cud/AbstractCUDRequestFactory.java | 2 +-
.../request/invoke/ODataInvokeRequestImpl.java | 2 +-
.../client/core/it/AbstractTestITCase.java | 8 +--
.../client/core/it/v3/AsyncTestITCase.java | 2 +-
.../core/it/v3/EntityCreateTestITCase.java | 2 +-
.../core/it/v3/EntityUpdateTestITCase.java | 2 +-
.../core/it/v3/KeyAsSegmentTestITCase.java | 2 +-
.../client/core/it/v3/LinkTestITCase.java | 2 +-
.../client/core/it/v3/PropertyTestITCase.java | 6 +--
.../core/it/v4/PropertyValueTestITCase.java | 2 +-
.../olingo/commons/api/format/ContentType.java | 28 +++++++++-
.../olingo/commons/api/format/ODataFormat.java | 36 ++++++-------
.../commons/api/format/ODataPubFormat.java | 31 +++--------
17 files changed, 175 insertions(+), 116 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2e33a68b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/UpdateType.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/UpdateType.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/UpdateType.java
deleted file mode 100644
index 0e6a831..0000000
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/UpdateType.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.client.api.communication.request;
-
-import org.apache.olingo.client.api.http.HttpMethod;
-
-/**
- * Update type.
- */
-public enum UpdateType {
-
- /**
- * Replace all and remove missing attributes.
- */
- REPLACE(HttpMethod.PUT),
- /**
- * Differential update with whole entity as input (non-standard). Differences will be retrieved by the server itself.
- */
- MERGE(HttpMethod.MERGE),
- /**
- * Differential update with only specified input property values to be replaced.
- */
- PATCH(HttpMethod.PATCH);
-
- private final HttpMethod method;
-
- private UpdateType(final HttpMethod method) {
- this.method = method;
- }
-
- /**
- * Gets HTTP request method.
- *
- * @return HTTP request method.
- */
- public HttpMethod getMethod() {
- return method;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2e33a68b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CommonCUDRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CommonCUDRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CommonCUDRequestFactory.java
index 6f6f502..48786be 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CommonCUDRequestFactory.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/CommonCUDRequestFactory.java
@@ -20,7 +20,6 @@ package org.apache.olingo.client.api.communication.request.cud;
import java.io.Serializable;
import java.net.URI;
-import org.apache.olingo.client.api.communication.request.UpdateType;
import org.apache.olingo.commons.api.domain.ODataEntity;
import org.apache.olingo.commons.api.domain.ODataLink;
import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
@@ -50,7 +49,7 @@ public interface CommonCUDRequestFactory extends Serializable {
* @param changes changes to be applied.
* @return new ODataEntityUpdateRequest instance.
*/
- ODataEntityUpdateRequest getEntityUpdateRequest(URI targetURI, UpdateType type, ODataEntity changes);
+ <UT extends UpdateType> ODataEntityUpdateRequest getEntityUpdateRequest(URI targetURI, UT type, ODataEntity changes);
/**
* Gets an update request object instance; uses entity's edit link as endpoint.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2e33a68b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/v3/UpdateType.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/v3/UpdateType.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/v3/UpdateType.java
new file mode 100644
index 0000000..4bcb150
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/v3/UpdateType.java
@@ -0,0 +1,56 @@
+/*
+ * 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.client.api.communication.request.cud.v3;
+
+import org.apache.olingo.client.api.http.HttpMethod;
+
+/**
+ * Update type.
+ */
+public enum UpdateType implements org.apache.olingo.client.api.communication.request.cud.UpdateType {
+
+ /**
+ * Replace all and remove missing attributes.
+ */
+ REPLACE(HttpMethod.PUT),
+ /**
+ * Differential update with whole entity as input (non-standard). Differences will be retrieved by the server itself.
+ */
+ MERGE(HttpMethod.MERGE),
+ /**
+ * Differential update with only specified input property values to be replaced.
+ */
+ PATCH(HttpMethod.PATCH);
+
+ private final HttpMethod method;
+
+ private UpdateType(final HttpMethod method) {
+ this.method = method;
+ }
+
+ /**
+ * Gets HTTP request method.
+ *
+ * @return HTTP request method.
+ */
+ @Override
+ public HttpMethod getMethod() {
+ return method;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2e33a68b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/v4/UpdateType.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/v4/UpdateType.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/v4/UpdateType.java
new file mode 100644
index 0000000..9d8ec25
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/v4/UpdateType.java
@@ -0,0 +1,52 @@
+/*
+ * 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.client.api.communication.request.cud.v4;
+
+import org.apache.olingo.client.api.http.HttpMethod;
+
+/**
+ * Update type.
+ */
+public enum UpdateType implements org.apache.olingo.client.api.communication.request.cud.UpdateType {
+
+ /**
+ * Replace all and remove missing attributes.
+ */
+ REPLACE(HttpMethod.PUT),
+ /**
+ * Differential update with only specified input property values to be replaced.
+ */
+ PATCH(HttpMethod.PATCH);
+
+ private final HttpMethod method;
+
+ private UpdateType(final HttpMethod method) {
+ this.method = method;
+ }
+
+ /**
+ * Gets HTTP request method.
+ *
+ * @return HTTP request method.
+ */
+ @Override
+ public HttpMethod getMethod() {
+ return method;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2e33a68b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/AbstractCUDRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/AbstractCUDRequestFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/AbstractCUDRequestFactory.java
index cb82cbd..e5bb42e 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/AbstractCUDRequestFactory.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/AbstractCUDRequestFactory.java
@@ -20,7 +20,6 @@ package org.apache.olingo.client.core.communication.request.cud;
import java.net.URI;
import org.apache.olingo.client.api.CommonODataClient;
-import org.apache.olingo.client.api.communication.request.UpdateType;
import org.apache.olingo.client.api.communication.request.cud.CommonCUDRequestFactory;
import org.apache.olingo.client.api.communication.request.cud.ODataDeleteRequest;
import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest;
@@ -29,6 +28,7 @@ import org.apache.olingo.client.api.communication.request.cud.ODataLinkCreateReq
import org.apache.olingo.client.api.communication.request.cud.ODataLinkUpdateRequest;
import org.apache.olingo.client.api.communication.request.cud.ODataPropertyUpdateRequest;
import org.apache.olingo.client.api.communication.request.cud.ODataValueUpdateRequest;
+import org.apache.olingo.client.api.communication.request.cud.UpdateType;
import org.apache.olingo.commons.api.domain.ODataEntity;
import org.apache.olingo.commons.api.domain.ODataLink;
import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2e33a68b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java
index ac6d162..5f7a430 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/invoke/ODataInvokeRequestImpl.java
@@ -99,7 +99,7 @@ public class ODataInvokeRequestImpl<T extends ODataInvokeResult>
@Override
public void setFormat(final ODataPubFormat format) {
final String _format = (reference.isAssignableFrom(ODataProperty.class) && format == ODataPubFormat.ATOM)
- ? ODataFormat.XML.toString()
+ ? ODataFormat.XML.toString(odataClient.getServiceVersion())
: format.toString(odataClient.getServiceVersion());
setAccept(_format);
setContentType(_format);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2e33a68b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
index 9b4bd39..73e6f2b 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
@@ -41,10 +41,10 @@ import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.ODataClientErrorException;
-import org.apache.olingo.client.api.communication.request.UpdateType;
import org.apache.olingo.client.api.communication.request.cud.ODataDeleteRequest;
import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest;
import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest;
+import org.apache.olingo.client.api.communication.request.cud.UpdateType;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.response.ODataDeleteResponse;
import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
@@ -214,7 +214,7 @@ public abstract class AbstractTestITCase {
entity.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("Information",
getClient().getPrimitiveValueBuilder().setText(sampleinfo).setType(
- EdmPrimitiveTypeKind.String).build()));
+ EdmPrimitiveTypeKind.String).build()));
return entity;
}
@@ -228,12 +228,12 @@ public abstract class AbstractTestITCase {
// add name attribute
entity.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("Name",
getClient().getPrimitiveValueBuilder().setText(sampleName).setType(
- EdmPrimitiveTypeKind.String).build()));
+ EdmPrimitiveTypeKind.String).build()));
// add key attribute
entity.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("CustomerId",
getClient().getPrimitiveValueBuilder().setText(String.valueOf(id)).setType(
- EdmPrimitiveTypeKind.Int32).build()));
+ EdmPrimitiveTypeKind.Int32).build()));
// add BackupContactInfo attribute (collection)
final ODataCollectionValue backupContactInfoValue = new ODataCollectionValue(
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2e33a68b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
index 21d3717..689c1f5 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
@@ -27,7 +27,7 @@ import java.net.URI;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import org.apache.commons.io.IOUtils;
-import org.apache.olingo.client.api.communication.request.UpdateType;
+import org.apache.olingo.client.api.communication.request.cud.v3.UpdateType;
import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataMediaRequest;
import org.apache.olingo.client.api.communication.request.streamed.MediaEntityCreateStreamManager;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2e33a68b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
index 1c331e5..6e4484c 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
@@ -31,9 +31,9 @@ import java.util.Set;
import org.apache.http.entity.ContentType;
import org.apache.olingo.client.api.communication.header.HeaderName;
import org.apache.olingo.client.api.communication.header.ODataPreferences;
-import org.apache.olingo.client.api.communication.request.UpdateType;
import org.apache.olingo.client.api.communication.request.cud.ODataDeleteRequest;
import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest;
+import org.apache.olingo.client.api.communication.request.cud.v3.UpdateType;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
import org.apache.olingo.client.api.communication.response.ODataDeleteResponse;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2e33a68b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
index 8a9f93f..40afeac 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
@@ -27,7 +27,7 @@ import java.util.LinkedHashMap;
import org.apache.olingo.client.api.communication.ODataClientErrorException;
import org.apache.olingo.client.api.communication.header.HeaderName;
import org.apache.olingo.client.api.communication.header.ODataPreferences;
-import org.apache.olingo.client.api.communication.request.UpdateType;
+import org.apache.olingo.client.api.communication.request.cud.v3.UpdateType;
import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2e33a68b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/KeyAsSegmentTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/KeyAsSegmentTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/KeyAsSegmentTestITCase.java
index 9c2a9f5..dac96e6 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/KeyAsSegmentTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/KeyAsSegmentTestITCase.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.client.core.it.v3;
-import org.apache.olingo.client.api.communication.request.UpdateType;
+import org.apache.olingo.client.api.communication.request.cud.v3.UpdateType;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.commons.api.domain.ODataEntity;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2e33a68b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/LinkTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/LinkTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/LinkTestITCase.java
index b56dde6..dbd964f 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/LinkTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/LinkTestITCase.java
@@ -26,9 +26,9 @@ import java.io.IOException;
import java.net.URI;
import java.util.Collections;
import java.util.List;
-import org.apache.olingo.client.api.communication.request.UpdateType;
import org.apache.olingo.client.api.communication.request.cud.ODataLinkCreateRequest;
import org.apache.olingo.client.api.communication.request.cud.ODataLinkUpdateRequest;
+import org.apache.olingo.client.api.communication.request.cud.v3.UpdateType;
import org.apache.olingo.client.api.communication.request.retrieve.v3.ODataLinkCollectionRequest;
import org.apache.olingo.client.api.communication.response.ODataLinkOperationResponse;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2e33a68b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
index 28d487f..93384bb 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
@@ -24,9 +24,9 @@ import static org.junit.Assert.assertTrue;
import java.io.IOException;
import org.apache.olingo.client.api.communication.ODataClientErrorException;
-import org.apache.olingo.client.api.communication.request.UpdateType;
import org.apache.olingo.client.api.communication.request.cud.ODataPropertyUpdateRequest;
import org.apache.olingo.client.api.communication.request.cud.ODataValueUpdateRequest;
+import org.apache.olingo.client.api.communication.request.cud.v3.UpdateType;
import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataRawRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataValueRequest;
@@ -273,7 +273,7 @@ public class PropertyTestITCase extends AbstractTestITCase {
final ODataPropertyUpdateRequest updateReq =
client.getCUDRequestFactory().getPropertyCollectionValueUpdateRequest(uriBuilder.build(),
- alternativeNames);
+ alternativeNames);
if (client.getConfiguration().isUseXHTTPMethod()) {
assertEquals(HttpMethod.POST, updateReq.getMethod());
} else {
@@ -344,7 +344,7 @@ public class PropertyTestITCase extends AbstractTestITCase {
appendEntitySetSegment("Customer").appendKeySegment(-10).appendPropertySegment("BackupContactInfo");
final ODataRawRequest req = client.getRetrieveRequestFactory().getRawRequest(uriBuilder.build());
- req.setFormat(format.toString());
+ req.setFormat(format.toString(client.getServiceVersion()));
final ODataRawResponse res = req.execute();
assertNotNull(res);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2e33a68b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/PropertyValueTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/PropertyValueTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/PropertyValueTestITCase.java
index 3a8b9e9..93ee5fe 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/PropertyValueTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/PropertyValueTestITCase.java
@@ -116,7 +116,7 @@ public class PropertyValueTestITCase extends AbstractTestITCase {
appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("PDC").
appendValueSegment();
final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
- req.setAccept(ODataFormat.XML.toString());
+ req.setAccept(ODataFormat.XML.toString(client.getServiceVersion()));
req.execute().getBody();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2e33a68b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ContentType.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ContentType.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ContentType.java
index 21ed548..c41cfc5 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ContentType.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ContentType.java
@@ -18,7 +18,12 @@
*/
package org.apache.olingo.commons.api.format;
-public interface ContentType {
+import java.util.EnumMap;
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+
+public abstract class ContentType {
public static final String APPLICATION_ATOM_XML = "application/atom+xml";
@@ -44,4 +49,25 @@ public interface ContentType {
public static final String WILDCARD = "*/*";
+ public static final EnumMap<ODataServiceVersion, Map<String, String>> formatPerVersion =
+ new EnumMap<ODataServiceVersion, Map<String, String>>(ODataServiceVersion.class);
+
+ static {
+
+ final Map<String, String> v3 = new HashMap<String, String>();
+ v3.put(ODataPubFormat.JSON_NO_METADATA.name(), ContentType.APPLICATION_JSON + ";odata=nometadata");
+ v3.put(ODataPubFormat.JSON.name(), ContentType.APPLICATION_JSON + ";odata=minimalmetadata");
+ v3.put(ODataPubFormat.JSON_FULL_METADATA.name(), ContentType.APPLICATION_JSON + ";odata=fullmetadata");
+ v3.put(ODataPubFormat.ATOM.name(), ContentType.APPLICATION_ATOM_XML);
+ v3.put(ODataFormat.XML.name(), ContentType.APPLICATION_XML);
+ formatPerVersion.put(ODataServiceVersion.V30, v3);
+
+ final Map<String, String> v4 = new HashMap<String, String>();
+ v4.put(ODataPubFormat.JSON_NO_METADATA.name(), ContentType.APPLICATION_JSON + ";odata.metadata=none");
+ v4.put(ODataPubFormat.JSON.name(), ContentType.APPLICATION_JSON + ";odata.metadata=minimal");
+ v4.put(ODataPubFormat.JSON_FULL_METADATA.name(), ContentType.APPLICATION_JSON + ";odata.metadata=full");
+ v4.put(ODataPubFormat.ATOM.name(), ContentType.APPLICATION_ATOM_XML);
+ v4.put(ODataFormat.XML.name(), ContentType.APPLICATION_XML);
+ formatPerVersion.put(ODataServiceVersion.V40, v4);
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2e33a68b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataFormat.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataFormat.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataFormat.java
index 7401e0b..301ada9 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataFormat.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataFormat.java
@@ -23,39 +23,43 @@ import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
/**
* Available formats to be used in various contexts.
*/
-public enum ODataFormat implements Format{
+public enum ODataFormat implements Format {
/**
* JSON format with no metadata.
*/
- JSON_NO_METADATA(ContentType.APPLICATION_JSON + ";odata=nometadata"),
+ JSON_NO_METADATA,
/**
* JSON format with minimal metadata (default).
*/
- JSON(ContentType.APPLICATION_JSON + ";odata=minimalmetadata"),
+ JSON,
/**
* JSON format with no metadata.
*/
- JSON_FULL_METADATA(ContentType.APPLICATION_JSON + ";odata=fullmetadata"),
+ JSON_FULL_METADATA,
/**
* XML format.
*/
- XML(ContentType.APPLICATION_XML);
-
- private final String format;
-
- ODataFormat(final String format) {
- this.format = format;
- }
+ XML;
/**
* Gets format as a string.
*
+ * @param version OData service version.
* @return format as a string.
*/
@Override
+ public String toString(final ODataServiceVersion version) {
+ if (version.ordinal() < ODataServiceVersion.V30.ordinal()) {
+ throw new IllegalArgumentException("Unsupported version " + version);
+ }
+
+ return ContentType.formatPerVersion.get(version).get(this.name());
+ }
+
+ @Override
public String toString() {
- return format;
+ throw new UnsupportedOperationException();
}
/**
@@ -82,7 +86,8 @@ public enum ODataFormat implements Format{
if (result == null) {
final String candidate = _format.toString();
for (ODataFormat value : values()) {
- if (candidate.equals(value.toString())) {
+ if (candidate.equals(value.toString(ODataServiceVersion.V30))
+ || candidate.equals(value.toString(ODataServiceVersion.V40))) {
result = value;
}
}
@@ -94,9 +99,4 @@ public enum ODataFormat implements Format{
return result;
}
-
- @Override
- public String toString(final ODataServiceVersion version) {
- return this.toString();
- }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/2e33a68b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataPubFormat.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataPubFormat.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataPubFormat.java
index 62dc61b..4b4c063 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataPubFormat.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataPubFormat.java
@@ -18,7 +18,6 @@
*/
package org.apache.olingo.commons.api.format;
-import java.util.EnumMap;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
/**
@@ -29,42 +28,24 @@ public enum ODataPubFormat implements Format {
/**
* JSON format with no metadata.
*/
- JSON_NO_METADATA(),
+ JSON_NO_METADATA,
/**
* JSON format with minimal metadata (default).
*/
- JSON(),
+ JSON,
/**
* JSON format with no metadata.
*/
- JSON_FULL_METADATA(),
+ JSON_FULL_METADATA,
/**
* Atom format.
*/
- ATOM();
-
- final static EnumMap<ODataServiceVersion, EnumMap<ODataPubFormat, String>> formatPerVersion =
- new EnumMap<ODataServiceVersion, EnumMap<ODataPubFormat, String>>(ODataServiceVersion.class);
-
- static {
- final EnumMap<ODataPubFormat, String> v3 = new EnumMap<ODataPubFormat, String>(ODataPubFormat.class);
- v3.put(JSON_NO_METADATA, ContentType.APPLICATION_JSON + ";odata=nometadata");
- v3.put(JSON, ContentType.APPLICATION_JSON + ";odata=minimalmetadata");
- v3.put(JSON_FULL_METADATA, ContentType.APPLICATION_JSON + ";odata=fullmetadata");
- v3.put(ATOM, ContentType.APPLICATION_ATOM_XML);
- formatPerVersion.put(ODataServiceVersion.V30, v3);
-
- final EnumMap<ODataPubFormat, String> v4 = new EnumMap<ODataPubFormat, String>(ODataPubFormat.class);
- v4.put(JSON_NO_METADATA, ContentType.APPLICATION_JSON + ";odata.metadata=none");
- v4.put(JSON, ContentType.APPLICATION_JSON + ";odata.metadata=minimal");
- v4.put(JSON_FULL_METADATA, ContentType.APPLICATION_JSON + ";odata.metadata=full");
- v4.put(ATOM, ContentType.APPLICATION_ATOM_XML);
- formatPerVersion.put(ODataServiceVersion.V40, v4);
- }
+ ATOM;
/**
* Gets format as a string.
*
+ * @param version OData service version.
* @return format as a string.
*/
@Override
@@ -73,7 +54,7 @@ public enum ODataPubFormat implements Format {
throw new IllegalArgumentException("Unsupported version " + version);
}
- return ODataPubFormat.formatPerVersion.get(version).get(this);
+ return ContentType.formatPerVersion.get(version).get(this.name());
}
@Override
[28/51] [abbrv] git commit: [OLINGO-175,
OLINGO-205] provided parameter aliases support
Posted by il...@apache.org.
[OLINGO-175, OLINGO-205] provided parameter aliases support
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/4931b30b
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/4931b30b
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/4931b30b
Branch: refs/heads/master
Commit: 4931b30b41354a66805bb1bc55f09e3c2cfb1cd4
Parents: e0d1b6f
Author: fmartelli <fa...@gmail.com>
Authored: Sat Mar 29 15:19:40 2014 +0100
Committer: fmartelli <fa...@gmail.com>
Committed: Sat Mar 29 15:19:40 2014 +0100
----------------------------------------------------------------------
.../olingo/client/api/uri/CommonURIBuilder.java | 13 ++++--
.../client/core/uri/AbstractURIBuilder.java | 24 +++++++++-
.../olingo/client/core/uri/ParameterAlias.java | 48 ++++++++++++++++++++
.../apache/olingo/client/core/uri/URIUtils.java | 40 ++++++++--------
.../client/core/uri/v3/URIBuilderTest.java | 13 ++++++
5 files changed, 115 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4931b30b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/CommonURIBuilder.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/CommonURIBuilder.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/CommonURIBuilder.java
index 3f10262..6a8ce0e 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/CommonURIBuilder.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/CommonURIBuilder.java
@@ -18,7 +18,6 @@
*/
package org.apache.olingo.client.api.uri;
-
import java.net.URI;
import java.util.Map;
@@ -41,11 +40,20 @@ public interface CommonURIBuilder<UB extends CommonURIBuilder<?>> {
*
* @param option query option.
* @param value query option value.
- * @return current URIBuilder instance
+ * @return current URIBuilder instance.
*/
UB addQueryOption(String option, String value);
/**
+ * Adds the specified (custom) parameter alias to the URI.
+ *
+ * @param alias parameter alias.
+ * @param exp expression value.
+ * @return current URIBuilder instance.
+ */
+ UB addParameterAlias(final String alias, final String exp);
+
+ /**
* Appends EntitySet segment to the URI.
*
* @param segmentValue segment value.
@@ -220,5 +228,4 @@ public interface CommonURIBuilder<UB extends CommonURIBuilder<?>> {
* @return OData URI.
*/
URI build();
-
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4931b30b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractURIBuilder.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractURIBuilder.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractURIBuilder.java
index 906b62c..10feb7e 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractURIBuilder.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractURIBuilder.java
@@ -18,8 +18,10 @@
*/
package org.apache.olingo.client.core.uri;
+import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URISyntaxException;
+import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashMap;
@@ -73,6 +75,11 @@ public abstract class AbstractURIBuilder<UB extends CommonURIBuilder<?>> impleme
protected final Map<String, String> queryOptions = new LinkedHashMap<String, String>();
/**
+ * Insertion-order map of parameter aliases.
+ */
+ protected final Map<String, String> parameters = new LinkedHashMap<String, String>();
+
+ /**
* Constructor.
*
* @param serviceRoot absolute URL (schema, host and port included) representing the location of the root of the data
@@ -97,6 +104,12 @@ public abstract class AbstractURIBuilder<UB extends CommonURIBuilder<?>> impleme
}
@Override
+ public UB addParameterAlias(final String alias, final String exp) {
+ parameters.put(alias, exp);
+ return getThis();
+ }
+
+ @Override
public UB appendEntitySetSegment(final String segmentValue) {
segments.add(new Segment(SegmentType.ENTITYSET, segmentValue));
return getThis();
@@ -193,7 +206,12 @@ public abstract class AbstractURIBuilder<UB extends CommonURIBuilder<?>> impleme
@Override
public UB filter(final URIFilter filter) {
- return addQueryOption(QueryOption.FILTER, filter.build());
+ try {
+ // decode in order to support @ in parameter aliases
+ return addQueryOption(QueryOption.FILTER, URLDecoder.decode(filter.build(), "UTF-8"));
+ } catch (UnsupportedEncodingException ex) {
+ return addQueryOption(QueryOption.FILTER, filter.build());
+ }
}
@Override
@@ -271,6 +289,10 @@ public abstract class AbstractURIBuilder<UB extends CommonURIBuilder<?>> impleme
builder.addParameter("$" + option.getKey(), option.getValue());
}
+ for (Map.Entry<String, String> parameter : parameters.entrySet()) {
+ builder.addParameter("@" + parameter.getKey(), parameter.getValue());
+ }
+
return builder.build().normalize();
} catch (URISyntaxException e) {
throw new IllegalArgumentException("Could not build valid URI", e);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4931b30b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/ParameterAlias.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/ParameterAlias.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/ParameterAlias.java
new file mode 100644
index 0000000..dd3d67b
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/ParameterAlias.java
@@ -0,0 +1,48 @@
+/*
+ * 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.client.core.uri;
+
+/**
+ * Object to be used to communicate parameter alias into filter or orderBy expression.
+ */
+public class ParameterAlias {
+
+ /**
+ * Parameter alias.
+ */
+ final String alias;
+
+ /**
+ * Constructor.
+ *
+ * @param alias parameter alias.
+ */
+ public ParameterAlias(final String alias) {
+ this.alias = alias;
+ }
+
+ /**
+ * Gets parameter alias.
+ *
+ * @return
+ */
+ public String getAlias() {
+ return alias;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4931b30b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
index 8dce061..4159e76 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java
@@ -225,12 +225,12 @@ public final class URIUtils {
return version == ODataServiceVersion.V30
? prefix(version, EdmPrimitiveTypeKind.DateTime)
+ URLEncoder.encode(EdmDateTime.getInstance().
- valueToString(timestamp, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
- Constants.UTF8)
+ valueToString(timestamp, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
+ Constants.UTF8)
+ suffix(version, EdmPrimitiveTypeKind.DateTime)
: URLEncoder.encode(EdmDateTimeOffset.getInstance().
- valueToString(timestamp, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
- Constants.UTF8);
+ valueToString(timestamp, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
+ Constants.UTF8);
}
private static String calendar(final ODataServiceVersion version, final Calendar calendar)
@@ -241,8 +241,8 @@ public final class URIUtils {
if (version == ODataServiceVersion.V30) {
result = prefix(version, EdmPrimitiveTypeKind.DateTime)
+ URLEncoder.encode(EdmDateTime.getInstance().
- valueToString(calendar, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
- Constants.UTF8)
+ valueToString(calendar, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
+ Constants.UTF8)
+ suffix(version, EdmPrimitiveTypeKind.DateTime);
} else {
if (calendar.get(Calendar.YEAR) == 0 && calendar.get(Calendar.MONTH) == 0
@@ -260,8 +260,8 @@ public final class URIUtils {
} else {
result = prefix(version, EdmPrimitiveTypeKind.DateTimeOffset)
+ URLEncoder.encode(EdmDateTimeOffset.getInstance().
- valueToString(calendar, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
- Constants.UTF8)
+ valueToString(calendar, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
+ Constants.UTF8)
+ suffix(version, EdmPrimitiveTypeKind.DateTimeOffset);
}
@@ -273,11 +273,11 @@ public final class URIUtils {
return version == ODataServiceVersion.V30
? EdmTime.getInstance().toUriLiteral(URLEncoder.encode(EdmTime.getInstance().
- valueToString(duration, null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null), Constants.UTF8))
+ valueToString(duration, null, null,
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null), Constants.UTF8))
: EdmDuration.getInstance().toUriLiteral(URLEncoder.encode(EdmDuration.getInstance().
- valueToString(duration, null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null), Constants.UTF8));
+ valueToString(duration, null, null,
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null), Constants.UTF8));
}
private static String quoteString(final String string, final boolean singleQuoteEscape)
@@ -338,7 +338,9 @@ public final class URIUtils {
value = buffer.toString();
} else {
- value = (obj instanceof Boolean)
+ value = (obj instanceof ParameterAlias)
+ ? "@" + ((ParameterAlias) obj).getAlias().toString()
+ : (obj instanceof Boolean)
? BooleanUtils.toStringTrueFalse((Boolean) obj)
: (obj instanceof UUID)
? prefix(version, EdmPrimitiveTypeKind.Guid)
@@ -354,24 +356,24 @@ public final class URIUtils {
? duration(version, (Duration) obj)
: (obj instanceof BigDecimal)
? EdmDecimal.getInstance().valueToString(obj, null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
+ suffix(version, EdmPrimitiveTypeKind.Decimal)
: (obj instanceof Double)
? EdmDouble.getInstance().valueToString(obj, null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
+ suffix(version, EdmPrimitiveTypeKind.Double)
: (obj instanceof Float)
? EdmSingle.getInstance().valueToString(obj, null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
+ suffix(version, EdmPrimitiveTypeKind.Single)
: (obj instanceof Long)
? EdmInt64.getInstance().valueToString(obj, null, null,
- Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
+ Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null)
+ suffix(version, EdmPrimitiveTypeKind.Int64)
: (obj instanceof Geospatial)
? URLEncoder.encode(EdmPrimitiveTypeFactory.getInstance(((Geospatial) obj).getEdmPrimitiveTypeKind()).
- valueToString(obj, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
- Constants.UTF8)
+ valueToString(obj, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null),
+ Constants.UTF8)
: (obj instanceof String)
? quoteString((String) obj, singleQuoteEscape)
: obj.toString();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4931b30b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v3/URIBuilderTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v3/URIBuilderTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v3/URIBuilderTest.java
index e949780..6bfe116 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v3/URIBuilderTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/uri/v3/URIBuilderTest.java
@@ -29,6 +29,7 @@ import java.util.Map;
import org.apache.olingo.client.api.v3.ODataClient;
import org.apache.olingo.client.api.uri.v3.URIBuilder;
import org.apache.olingo.client.core.AbstractTest;
+import org.apache.olingo.client.core.uri.ParameterAlias;
import org.junit.Test;
public class URIBuilderTest extends AbstractTest {
@@ -101,6 +102,18 @@ public class URIBuilderTest extends AbstractTest {
}
@Test
+ public void filterWithParameter() throws URISyntaxException {
+ // http://host/service.svc/Employees?$filter=Region eq @p1&@p1='WA'
+ final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).appendEntitySetSegment("Employees").
+ filter(getClient().getFilterFactory().eq("Region", new ParameterAlias("p1"))).
+ addParameterAlias("p1", "'WA'");
+
+ assertEquals(new org.apache.http.client.utils.URIBuilder(SERVICE_ROOT + "/Employees").
+ addParameter("$filter", "(Region eq @p1)").addParameter("@p1", "'WA'").build(),
+ uriBuilder.build());
+ }
+
+ @Test
public void unboundAction() throws URISyntaxException {
final URIBuilder uriBuilder = getClient().getURIBuilder(SERVICE_ROOT).
appendOperationCallSegment("ProductsByCategoryId",
[32/51] [abbrv] [OLINGO-200] Introducing specialization for V3 and V4
domain objects
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java
index 69f6f2a..a32a153 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java
@@ -18,10 +18,20 @@
*/
package org.apache.olingo.client.core.communication.request.retrieve.v4;
+import java.net.URI;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
import org.apache.olingo.client.api.communication.request.retrieve.XMLMetadataRequest;
-import org.apache.olingo.client.api.v4.ODataClient;
import org.apache.olingo.client.api.communication.request.retrieve.v4.RetrieveRequestFactory;
+import org.apache.olingo.client.api.v4.ODataClient;
import org.apache.olingo.client.core.communication.request.retrieve.AbstractRetrieveRequestFactory;
+import org.apache.olingo.client.core.communication.request.retrieve.ODataEntityRequestImpl;
+import org.apache.olingo.client.core.communication.request.retrieve.ODataEntitySetRequestImpl;
+import org.apache.olingo.client.core.communication.request.retrieve.ODataPropertyRequestImpl;
+import org.apache.olingo.commons.api.domain.v4.ODataEntity;
+import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.v4.ODataProperty;
public class RetrieveRequestFactoryImpl extends AbstractRetrieveRequestFactory
implements RetrieveRequestFactory {
@@ -37,4 +47,22 @@ public class RetrieveRequestFactoryImpl extends AbstractRetrieveRequestFactory
return new XMLMetadataRequestImpl(((ODataClient) client),
client.getURIBuilder(serviceRoot).appendMetadataSegment().build());
}
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public ODataEntitySetRequest<ODataEntitySet> getEntitySetRequest(final URI query) {
+ return new ODataEntitySetRequestImpl<ODataEntitySet>(client, query);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public ODataEntityRequest<ODataEntity> getEntityRequest(final URI query) {
+ return new ODataEntityRequestImpl<ODataEntity>(client, query);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public ODataPropertyRequest<ODataProperty> getPropertyRequest(final URI query) {
+ return new ODataPropertyRequestImpl<ODataProperty>(client, query);
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityCreateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityCreateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityCreateRequestImpl.java
index f7e5ffa..2c1dd22 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityCreateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityCreateRequestImpl.java
@@ -28,7 +28,7 @@ import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
import org.apache.olingo.client.api.communication.request.streamed.MediaEntityCreateStreamManager;
import org.apache.olingo.client.api.communication.request.streamed.ODataMediaEntityCreateRequest;
import org.apache.olingo.client.api.communication.response.ODataMediaEntityCreateResponse;
-import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.core.communication.request.AbstractODataStreamManager;
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
@@ -98,7 +98,7 @@ public class ODataMediaEntityCreateRequestImpl
private class ODataMediaEntityCreateResponseImpl extends AbstractODataResponse
implements ODataMediaEntityCreateResponse {
- private ODataEntity entity = null;
+ private CommonODataEntity entity = null;
/**
* Constructor.
@@ -122,7 +122,7 @@ public class ODataMediaEntityCreateRequestImpl
* {@inheritDoc }
*/
@Override
- public ODataEntity getBody() {
+ public CommonODataEntity getBody() {
if (entity == null) {
try {
final Container<Entry> container = odataClient.getDeserializer().toEntry(getRawResponse(), getFormat());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java
index a22843f..614baa1 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java
@@ -28,7 +28,7 @@ import org.apache.olingo.client.api.communication.request.ODataBatchableRequest;
import org.apache.olingo.client.api.communication.request.streamed.MediaEntityUpdateStreamManager;
import org.apache.olingo.client.api.communication.request.streamed.ODataMediaEntityUpdateRequest;
import org.apache.olingo.client.api.communication.response.ODataMediaEntityUpdateResponse;
-import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.core.communication.request.AbstractODataStreamManager;
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
@@ -101,7 +101,7 @@ public class ODataMediaEntityUpdateRequestImpl
private class ODataMediaEntityUpdateResponseImpl extends AbstractODataResponse
implements ODataMediaEntityUpdateResponse {
- private ODataEntity entity = null;
+ private CommonODataEntity entity = null;
/**
* Constructor.
@@ -125,7 +125,7 @@ public class ODataMediaEntityUpdateRequestImpl
* {@inheritDoc }
*/
@Override
- public ODataEntity getBody() {
+ public CommonODataEntity getBody() {
if (entity == null) {
try {
final Container<Entry> container = odataClient.getDeserializer().toEntry(getRawResponse(), getFormat());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
index 2a0ea4f..4c86604 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
@@ -35,14 +35,13 @@ import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.data.Value;
import org.apache.olingo.commons.api.domain.ODataCollectionValue;
import org.apache.olingo.commons.api.domain.ODataComplexValue;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.domain.ODataInlineEntity;
import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
import org.apache.olingo.commons.api.domain.ODataLink;
import org.apache.olingo.commons.api.domain.ODataOperation;
-import org.apache.olingo.commons.api.domain.ODataProperty;
-import org.apache.olingo.commons.core.domain.ODataPropertyImpl;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataServiceDocument;
import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
@@ -89,7 +88,7 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
}
@Override
- public Feed getFeed(final ODataEntitySet entitySet, final Class<? extends Feed> reference) {
+ public Feed getFeed(final CommonODataEntitySet entitySet, final Class<? extends Feed> reference) {
final Feed feed = ResourceFactory.newFeed(reference);
feed.setCount(entitySet.getCount());
@@ -99,7 +98,7 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
feed.setNext(next);
}
- for (ODataEntity entity : entitySet.getEntities()) {
+ for (CommonODataEntity entity : entitySet.getEntities()) {
feed.getEntries().add(getEntry(entity, ResourceFactory.entryClassForFeed(reference)));
}
@@ -107,15 +106,14 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
}
@Override
- public Entry getEntry(final ODataEntity entity, final Class<? extends Entry> reference) {
+ public Entry getEntry(final CommonODataEntity entity, final Class<? extends Entry> reference) {
return getEntry(entity, reference, true);
}
@Override
- public Entry getEntry(final ODataEntity entity, final Class<? extends Entry> reference, final boolean setType) {
+ public Entry getEntry(final CommonODataEntity entity, final Class<? extends Entry> reference, final boolean setType) {
final Entry entry = ResourceFactory.newEntry(reference);
- entry.setId(entity.getReference());
entry.setType(entity.getName());
// -------------------------------------------------------------
@@ -176,7 +174,7 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
entry.setMediaContentType(entity.getMediaContentType());
}
- for (ODataProperty property : entity.getProperties()) {
+ for (CommonODataProperty property : entity.getProperties()) {
entry.getProperties().add(getProperty(property, reference, setType));
}
@@ -194,13 +192,13 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
if (link instanceof ODataInlineEntity) {
// append inline entity
- final ODataEntity inlineEntity = ((ODataInlineEntity) link).getEntity();
+ final CommonODataEntity inlineEntity = ((ODataInlineEntity) link).getEntity();
LOG.debug("Append in-line entity\n{}", inlineEntity);
linkResource.setInlineEntry(getEntry(inlineEntity, ResourceFactory.entryClassForFormat(isXML)));
} else if (link instanceof ODataInlineEntitySet) {
// append inline feed
- final ODataEntitySet InlineFeed = ((ODataInlineEntitySet) link).getEntitySet();
+ final CommonODataEntitySet InlineFeed = ((ODataInlineEntitySet) link).getEntitySet();
LOG.debug("Append in-line feed\n{}", InlineFeed);
linkResource.setInlineFeed(getFeed(InlineFeed, ResourceFactory.feedClassForFormat(isXML)));
@@ -210,7 +208,7 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
}
@Override
- public Property getProperty(final ODataProperty property, final Class<? extends Entry> reference,
+ public Property getProperty(final CommonODataProperty property, final Class<? extends Entry> reference,
final boolean setType) {
final Property propertyResource = ResourceFactory.newProperty(reference);
@@ -243,7 +241,7 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
final ODataComplexValue _value = value.asComplex();
valueResource = new ComplexValueImpl();
- for (final Iterator<ODataProperty> itor = _value.iterator(); itor.hasNext();) {
+ for (final Iterator<CommonODataProperty> itor = _value.iterator(); itor.hasNext();) {
valueResource.asComplex().get().add(getProperty(itor.next(), reference, setType));
}
} else if (value.isCollection()) {
@@ -259,12 +257,14 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
}
@Override
- public ODataEntitySet getODataEntitySet(final Feed resource) {
+ public CommonODataEntitySet getODataEntitySet(final Feed resource) {
return getODataEntitySet(resource, null);
}
+ protected abstract boolean add(CommonODataEntitySet entitySet, CommonODataEntity entity);
+
@Override
- public ODataEntitySet getODataEntitySet(final Feed resource, final URI defaultBaseURI) {
+ public CommonODataEntitySet getODataEntitySet(final Feed resource, final URI defaultBaseURI) {
if (LOG.isDebugEnabled()) {
final StringWriter writer = new StringWriter();
client.getSerializer().feed(resource, writer);
@@ -276,7 +276,7 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
final URI next = resource.getNext();
- final ODataEntitySet entitySet = next == null
+ final CommonODataEntitySet entitySet = next == null
? client.getObjectFactory().newEntitySet()
: client.getObjectFactory().newEntitySet(URIUtils.getURI(base, next.toASCIIString()));
@@ -285,19 +285,19 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
}
for (Entry entryResource : resource.getEntries()) {
- entitySet.getEntities().add(getODataEntity(entryResource));
+ add(entitySet, getODataEntity(entryResource));
}
return entitySet;
}
@Override
- public ODataEntity getODataEntity(final Entry resource) {
+ public CommonODataEntity getODataEntity(final Entry resource) {
return getODataEntity(resource, null);
}
@Override
- public ODataEntity getODataEntity(final Entry resource, final URI defaultBaseURI) {
+ public CommonODataEntity getODataEntity(final Entry resource, final URI defaultBaseURI) {
if (LOG.isDebugEnabled()) {
final StringWriter writer = new StringWriter();
client.getSerializer().entry(resource, writer);
@@ -307,13 +307,11 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
final URI base = defaultBaseURI == null ? resource.getBaseURI() : defaultBaseURI;
- final ODataEntity entity = resource.getSelfLink() == null
+ final CommonODataEntity entity = resource.getSelfLink() == null
? client.getObjectFactory().newEntity(resource.getType())
: client.getObjectFactory().newEntity(resource.getType(),
URIUtils.getURI(base, resource.getSelfLink().getHref()));
- entity.setReference(resource.getId());
-
if (StringUtils.isNotBlank(resource.getETag())) {
entity.setETag(resource.getETag());
}
@@ -362,18 +360,13 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
}
for (Property property : resource.getProperties()) {
- entity.getProperties().add(getODataProperty(property));
+ add(entity, getODataProperty(property));
}
return entity;
}
- @Override
- public ODataProperty getODataProperty(final Property property) {
- return new ODataPropertyImpl(property.getName(), getODataValue(property));
- }
-
- private ODataValue getODataValue(final Property resource) {
+ protected ODataValue getODataValue(final Property resource) {
ODataValue value = null;
if (resource.getValue().isPrimitive()) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
index f21f16a..4ff36f9 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
@@ -25,11 +25,11 @@ import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.data.ServiceDocument;
import org.apache.olingo.commons.api.domain.ODataError;
import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.client.api.domain.ODataEntitySetIterator;
import org.apache.olingo.client.api.edm.xml.Schema;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataServiceDocument;
import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.client.api.edm.xml.XMLMetadata;
@@ -78,17 +78,17 @@ public abstract class AbstractODataReader implements CommonODataReader {
}
@Override
- public ODataEntitySet readEntitySet(final InputStream input, final ODataPubFormat format) {
+ public CommonODataEntitySet readEntitySet(final InputStream input, final ODataPubFormat format) {
return client.getBinder().getODataEntitySet(client.getDeserializer().toFeed(input, format).getObject());
}
@Override
- public ODataEntity readEntity(final InputStream input, final ODataPubFormat format) {
+ public CommonODataEntity readEntity(final InputStream input, final ODataPubFormat format) {
return client.getBinder().getODataEntity(client.getDeserializer().toEntry(input, format).getObject());
}
@Override
- public ODataProperty readProperty(final InputStream input, final ODataFormat format) {
+ public CommonODataProperty readProperty(final InputStream input, final ODataFormat format) {
final Property property = client.getDeserializer().toProperty(input, format).getObject();
return client.getBinder().getODataProperty(property);
}
@@ -107,19 +107,19 @@ public abstract class AbstractODataReader implements CommonODataReader {
if (ODataEntitySetIterator.class.isAssignableFrom(reference)) {
res = new Container<T>(
null, null, (T) new ODataEntitySetIterator(client, src, ODataPubFormat.fromString(format)));
- } else if (ODataEntitySet.class.isAssignableFrom(reference)) {
+ } else if (CommonODataEntitySet.class.isAssignableFrom(reference)) {
final Container<Feed> container = client.getDeserializer().toFeed(src, ODataPubFormat.fromString(format));
res = new Container<T>(
container.getContextURL(),
container.getMetadataETag(),
(T) client.getBinder().getODataEntitySet(container.getObject()));
- } else if (ODataEntity.class.isAssignableFrom(reference)) {
+ } else if (CommonODataEntity.class.isAssignableFrom(reference)) {
final Container<Entry> container = client.getDeserializer().toEntry(src, ODataPubFormat.fromString(format));
res = new Container<T>(
container.getContextURL(),
container.getMetadataETag(),
(T) client.getBinder().getODataEntity(container.getObject()));
- } else if (ODataProperty.class.isAssignableFrom(reference)) {
+ } else if (CommonODataProperty.class.isAssignableFrom(reference)) {
final Container<Property> container = client.getDeserializer().toProperty(src, ODataFormat.fromString(format));
res = new Container<T>(
container.getContextURL(),
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataWriterImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataWriterImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataWriterImpl.java
index 2b914b4..7ea9c99 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataWriterImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/ODataWriterImpl.java
@@ -26,9 +26,9 @@ import java.util.Collection;
import java.util.Collections;
import org.apache.commons.io.IOUtils;
import org.apache.olingo.client.api.CommonODataClient;
-import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.domain.ODataLink;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.op.ODataWriter;
@@ -44,17 +44,17 @@ public class ODataWriterImpl implements ODataWriter {
}
@Override
- public InputStream writeEntities(final Collection<ODataEntity> entities, final ODataPubFormat format) {
+ public InputStream writeEntities(final Collection<CommonODataEntity> entities, final ODataPubFormat format) {
return writeEntities(entities, format, true);
}
@Override
public InputStream writeEntities(
- final Collection<ODataEntity> entities, final ODataPubFormat format, final boolean outputType) {
+ final Collection<CommonODataEntity> entities, final ODataPubFormat format, final boolean outputType) {
final ByteArrayOutputStream output = new ByteArrayOutputStream();
try {
- for (ODataEntity entity : entities) {
+ for (CommonODataEntity entity : entities) {
client.getSerializer().entry(client.getBinder().getEntry(
entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM), outputType), output);
}
@@ -66,17 +66,19 @@ public class ODataWriterImpl implements ODataWriter {
}
@Override
- public InputStream writeEntity(final ODataEntity entity, final ODataPubFormat format) {
+ public InputStream writeEntity(final CommonODataEntity entity, final ODataPubFormat format) {
return writeEntity(entity, format, true);
}
@Override
- public InputStream writeEntity(final ODataEntity entity, final ODataPubFormat format, final boolean outputType) {
- return writeEntities(Collections.<ODataEntity>singleton(entity), format, outputType);
+ public InputStream writeEntity(final CommonODataEntity entity, final ODataPubFormat format,
+ final boolean outputType) {
+
+ return writeEntities(Collections.<CommonODataEntity>singleton(entity), format, outputType);
}
@Override
- public InputStream writeProperty(final ODataProperty property, final ODataFormat format) {
+ public InputStream writeProperty(final CommonODataProperty property, final ODataFormat format) {
final ByteArrayOutputStream output = new ByteArrayOutputStream();
try {
client.getSerializer().property(client.getBinder().getProperty(
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java
index 3c5f5a4..28887dc 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java
@@ -18,11 +18,22 @@
*/
package org.apache.olingo.client.core.op.impl.v3;
+import java.net.URI;
import org.apache.olingo.commons.api.data.v3.LinkCollection;
import org.apache.olingo.client.api.domain.v3.ODataLinkCollection;
import org.apache.olingo.client.api.op.v3.ODataBinder;
import org.apache.olingo.client.core.op.AbstractODataBinder;
import org.apache.olingo.client.core.v3.ODataClientImpl;
+import org.apache.olingo.commons.api.data.Entry;
+import org.apache.olingo.commons.api.data.Feed;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
+import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.v3.ODataProperty;
+import org.apache.olingo.commons.core.domain.v3.ODataPropertyImpl;
public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder {
@@ -33,6 +44,41 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder
}
@Override
+ public boolean add(final CommonODataEntity entity, final CommonODataProperty property) {
+ return ((ODataEntity) entity).getProperties().add((ODataProperty) property);
+ }
+
+ @Override
+ protected boolean add(final CommonODataEntitySet entitySet, final CommonODataEntity entity) {
+ return ((ODataEntitySet) entitySet).getEntities().add((ODataEntity) entity);
+ }
+
+ @Override
+ public ODataEntitySet getODataEntitySet(final Feed resource) {
+ return (ODataEntitySet) super.getODataEntitySet(resource);
+ }
+
+ @Override
+ public ODataEntitySet getODataEntitySet(final Feed resource, final URI defaultBaseURI) {
+ return (ODataEntitySet) super.getODataEntitySet(resource, defaultBaseURI);
+ }
+
+ @Override
+ public ODataEntity getODataEntity(final Entry resource) {
+ return (ODataEntity) super.getODataEntity(resource);
+ }
+
+ @Override
+ public ODataEntity getODataEntity(final Entry resource, final URI defaultBaseURI) {
+ return (ODataEntity) super.getODataEntity(resource, defaultBaseURI);
+ }
+
+ @Override
+ public ODataProperty getODataProperty(final Property property) {
+ return new ODataPropertyImpl(property.getName(), getODataValue(property));
+ }
+
+ @Override
public ODataLinkCollection getLinkCollection(final LinkCollection linkCollection) {
final ODataLinkCollection collection = new ODataLinkCollection(linkCollection.getNext());
collection.setLinks(linkCollection.getLinks());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
index 9c81baf..0acc7d1 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
@@ -18,6 +18,7 @@
*/
package org.apache.olingo.client.core.op.impl.v4;
+import java.net.URI;
import org.apache.olingo.client.api.data.ServiceDocument;
import org.apache.olingo.client.api.data.ServiceDocumentItem;
import org.apache.olingo.commons.api.domain.ODataServiceDocument;
@@ -25,6 +26,16 @@ import org.apache.olingo.client.api.op.v4.ODataBinder;
import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.client.api.v4.ODataClient;
import org.apache.olingo.client.core.op.AbstractODataBinder;
+import org.apache.olingo.commons.api.data.Entry;
+import org.apache.olingo.commons.api.data.Feed;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
+import org.apache.olingo.commons.api.domain.v4.ODataEntity;
+import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.v4.ODataProperty;
+import org.apache.olingo.commons.core.domain.v4.ODataPropertyImpl;
public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder {
@@ -35,6 +46,16 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder
}
@Override
+ public boolean add(final CommonODataEntity entity, final CommonODataProperty property) {
+ return ((ODataEntity) entity).getProperties().add((ODataProperty) property);
+ }
+
+ @Override
+ protected boolean add(final CommonODataEntitySet entitySet, final CommonODataEntity entity) {
+ return ((ODataEntitySet) entitySet).getEntities().add((ODataEntity) entity);
+ }
+
+ @Override
public ODataServiceDocument getODataServiceDocument(final ServiceDocument resource) {
final ODataServiceDocument serviceDocument = super.getODataServiceDocument(resource);
@@ -56,4 +77,39 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder
return serviceDocument;
}
+
+ @Override
+ public Entry getEntry(final CommonODataEntity entity, final Class<? extends Entry> reference, final boolean setType) {
+ final Entry entry = super.getEntry(entity, reference, setType);
+ entry.setId(((ODataEntity) entity).getReference());
+ return entry;
+ }
+
+ @Override
+ public ODataEntitySet getODataEntitySet(final Feed resource) {
+ return (ODataEntitySet) super.getODataEntitySet(resource);
+ }
+
+ @Override
+ public ODataEntitySet getODataEntitySet(final Feed resource, final URI defaultBaseURI) {
+ return (ODataEntitySet) super.getODataEntitySet(resource, defaultBaseURI);
+ }
+
+ @Override
+ public ODataEntity getODataEntity(final Entry resource) {
+ return (ODataEntity) super.getODataEntity(resource);
+ }
+
+ @Override
+ public ODataEntity getODataEntity(final Entry resource, final URI defaultBaseURI) {
+ final ODataEntity entity = (ODataEntity) super.getODataEntity(resource, defaultBaseURI);
+ entity.setReference(resource.getId());
+ return entity;
+ }
+
+ @Override
+ public ODataProperty getODataProperty(final Property property) {
+ return new ODataPropertyImpl(property.getName(), getODataValue(property));
+ }
+
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/main/java/org/apache/olingo/client/core/v3/ODataClientImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/v3/ODataClientImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/v3/ODataClientImpl.java
index d6d5e36..f1b5d23 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/v3/ODataClientImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/v3/ODataClientImpl.java
@@ -46,7 +46,9 @@ import org.apache.olingo.client.core.op.impl.v3.ODataReaderImpl;
import org.apache.olingo.client.core.op.impl.v3.ODataSerializerImpl;
import org.apache.olingo.client.core.uri.v3.URIBuilderImpl;
import org.apache.olingo.client.core.uri.v3.FilterFactoryImpl;
+import org.apache.olingo.commons.api.domain.v3.ODataObjectFactory;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.core.domain.v3.ODataObjectFactoryImpl;
public class ODataClientImpl extends AbstractODataClient implements ODataClient {
@@ -64,6 +66,8 @@ public class ODataClientImpl extends AbstractODataClient implements ODataClient
private final ODataBinder binder = new ODataBinderImpl(this);
+ private final ODataObjectFactory objectFactory = new ODataObjectFactoryImpl(getServiceVersion());
+
private final RetrieveRequestFactory retrieveReqFact = new RetrieveRequestFactoryImpl(this);
private final CUDRequestFactory cudReqFact = new CUDRequestFactoryImpl(this);
@@ -124,6 +128,11 @@ public class ODataClientImpl extends AbstractODataClient implements ODataClient
}
@Override
+ public ODataObjectFactory getObjectFactory() {
+ return objectFactory;
+ }
+
+ @Override
public RetrieveRequestFactory getRetrieveRequestFactory() {
return retrieveReqFact;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/ODataClientImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/ODataClientImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/ODataClientImpl.java
index a5aafab..d379bcf 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/ODataClientImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/ODataClientImpl.java
@@ -46,7 +46,9 @@ import org.apache.olingo.client.core.op.impl.v4.ODataReaderImpl;
import org.apache.olingo.client.core.op.impl.v4.ODataSerializerImpl;
import org.apache.olingo.client.core.uri.v4.URIBuilderImpl;
import org.apache.olingo.client.core.uri.v4.FilterFactoryImpl;
+import org.apache.olingo.commons.api.domain.v4.ODataObjectFactory;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.core.domain.v4.ODataObjectFactoryImpl;
public class ODataClientImpl extends AbstractODataClient implements ODataClient {
@@ -64,6 +66,8 @@ public class ODataClientImpl extends AbstractODataClient implements ODataClient
private final ODataBinder binder = new ODataBinderImpl(this);
+ private final ODataObjectFactory objectFactory = new ODataObjectFactoryImpl(getServiceVersion());
+
private final RetrieveRequestFactory retrieveReqFact = new RetrieveRequestFactoryImpl(this);
private final CUDRequestFactory cudReqFact = new CUDRequestFactoryImpl(this);
@@ -123,6 +127,11 @@ public class ODataClientImpl extends AbstractODataClient implements ODataClient
}
@Override
+ public ODataObjectFactory getObjectFactory() {
+ return objectFactory;
+ }
+
+ @Override
public RetrieveRequestFactory getRetrieveRequestFactory() {
return retrieveReqFact;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
index bba68de..0a3b53d 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
@@ -54,12 +54,12 @@ import org.apache.olingo.commons.api.data.Entry;
import org.apache.olingo.commons.api.data.Feed;
import org.apache.olingo.commons.api.domain.ODataCollectionValue;
import org.apache.olingo.commons.api.domain.ODataComplexValue;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.domain.ODataInlineEntity;
import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
import org.apache.olingo.commons.api.domain.ODataLink;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.http.HttpMethod;
@@ -117,10 +117,10 @@ public abstract class AbstractTestITCase {
assertNotNull(foundActual);
if (foundOriginal instanceof ODataInlineEntity && foundActual instanceof ODataInlineEntity) {
- final ODataEntity originalInline = ((ODataInlineEntity) foundOriginal).getEntity();
+ final CommonODataEntity originalInline = ((ODataInlineEntity) foundOriginal).getEntity();
assertNotNull(originalInline);
- final ODataEntity actualInline = ((ODataInlineEntity) foundActual).getEntity();
+ final CommonODataEntity actualInline = ((ODataInlineEntity) foundActual).getEntity();
assertNotNull(actualInline);
checkProperties(originalInline.getProperties(), actualInline.getProperties());
@@ -128,23 +128,25 @@ public abstract class AbstractTestITCase {
}
}
- protected void checkProperties(final Collection<ODataProperty> original, final Collection<ODataProperty> actual) {
+ protected void checkProperties(final Collection<? extends CommonODataProperty> original,
+ final Collection<? extends CommonODataProperty> actual) {
+
assertTrue(original.size() <= actual.size());
// re-organize actual properties into a Map<String, ODataProperty>
- final Map<String, ODataProperty> actualProps = new HashMap<String, ODataProperty>(actual.size());
+ final Map<String, CommonODataProperty> actualProps = new HashMap<String, CommonODataProperty>(actual.size());
- for (ODataProperty prop : actual) {
+ for (CommonODataProperty prop : actual) {
assertFalse(actualProps.containsKey(prop.getName()));
actualProps.put(prop.getName(), prop);
}
assertTrue(actual.size() <= actualProps.size());
- for (ODataProperty prop : original) {
+ for (CommonODataProperty prop : original) {
assertNotNull(prop);
if (actualProps.containsKey(prop.getName())) {
- final ODataProperty actualProp = actualProps.get(prop.getName());
+ final CommonODataProperty actualProp = actualProps.get(prop.getName());
assertNotNull(actualProp);
if (prop.getValue() != null && actualProp.getValue() != null) {
@@ -168,13 +170,13 @@ public abstract class AbstractTestITCase {
original.getClass().getSimpleName(), actual.getClass().getSimpleName());
if (original.isComplex()) {
- final List<ODataProperty> originalFileds = new ArrayList<ODataProperty>();
- for (ODataProperty prop : original.asComplex()) {
+ final List<CommonODataProperty> originalFileds = new ArrayList<CommonODataProperty>();
+ for (CommonODataProperty prop : original.asComplex()) {
originalFileds.add(prop);
}
- final List<ODataProperty> actualFileds = new ArrayList<ODataProperty>();
- for (ODataProperty prop : (ODataComplexValue) actual) {
+ final List<CommonODataProperty> actualFileds = new ArrayList<CommonODataProperty>();
+ for (CommonODataProperty prop : (ODataComplexValue) actual) {
actualFileds.add(prop);
}
@@ -207,39 +209,42 @@ public abstract class AbstractTestITCase {
}
}
- protected ODataEntity getSampleCustomerInfo(final int id, final String sampleinfo) {
- final ODataEntity entity = getClient().getObjectFactory().newEntity(
+ protected CommonODataEntity getSampleCustomerInfo(final int id, final String sampleinfo) {
+ final CommonODataEntity entity = getClient().getObjectFactory().newEntity(
"Microsoft.Test.OData.Services.AstoriaDefaultService.CustomerInfo");
entity.setMediaEntity(true);
- entity.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("Information",
- getClient().getObjectFactory().newPrimitiveValueBuilder().setText(sampleinfo).setType(
- EdmPrimitiveTypeKind.String).build()));
+ getClient().getBinder().add(entity,
+ getClient().getObjectFactory().newPrimitiveProperty("Information",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().setText(sampleinfo).
+ setType(EdmPrimitiveTypeKind.String).build()));
return entity;
}
- protected ODataEntity getSampleCustomerProfile(
+ protected CommonODataEntity getSampleCustomerProfile(
final int id, final String sampleName, final boolean withInlineInfo) {
- final ODataEntity entity =
+ final CommonODataEntity entity =
getClient().getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.Customer");
// add name attribute
- entity.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("Name",
- getClient().getObjectFactory().newPrimitiveValueBuilder().setText(sampleName).setType(
- EdmPrimitiveTypeKind.String).build()));
+ getClient().getBinder().add(entity,
+ getClient().getObjectFactory().newPrimitiveProperty("Name",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().setText(sampleName).
+ setType(EdmPrimitiveTypeKind.String).build()));
// add key attribute
- entity.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("CustomerId",
- getClient().getObjectFactory().newPrimitiveValueBuilder().setText(String.valueOf(id)).setType(
- EdmPrimitiveTypeKind.Int32).build()));
+ getClient().getBinder().add(entity,
+ getClient().getObjectFactory().newPrimitiveProperty("CustomerId",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().setText(String.valueOf(id)).
+ setType(EdmPrimitiveTypeKind.Int32).build()));
// add BackupContactInfo attribute (collection)
final ODataCollectionValue backupContactInfoValue = getClient().getObjectFactory().newCollectionValue(
"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails)");
- entity.getProperties().add(getClient().getObjectFactory().newCollectionProperty("BackupContactInfo",
- backupContactInfoValue));
+ getClient().getBinder().add(entity,
+ getClient().getObjectFactory().newCollectionProperty("BackupContactInfo", backupContactInfoValue));
// add BackupContactInfo.ContactDetails attribute (complex)
final ODataComplexValue contactDetails = getClient().getObjectFactory().newComplexValue(
@@ -302,7 +307,7 @@ public abstract class AbstractTestITCase {
}
}
- protected void debugODataProperty(final ODataProperty property, final String message) {
+ protected void debugODataProperty(final CommonODataProperty property, final String message) {
LOG.debug(message + "\n{}", property.toString());
}
@@ -310,7 +315,7 @@ public abstract class AbstractTestITCase {
LOG.debug(message + "\n{}", value.toString());
}
- protected void debugODataEntity(final ODataEntity entity, final String message) {
+ protected void debugODataEntity(final CommonODataEntity entity, final String message) {
if (LOG.isDebugEnabled()) {
StringWriter writer = new StringWriter();
getClient().getSerializer().entry(getClient().getBinder().getEntry(entity, AtomEntryImpl.class), writer);
@@ -337,7 +342,7 @@ public abstract class AbstractTestITCase {
}
protected String getETag(final URI uri) {
- final ODataRetrieveResponse<ODataEntity> res = getClient().getRetrieveRequestFactory().
+ final ODataRetrieveResponse<CommonODataEntity> res = getClient().getRetrieveRequestFactory().
getEntityRequest(uri).execute();
try {
return res.getEtag();
@@ -346,12 +351,13 @@ public abstract class AbstractTestITCase {
}
}
- protected ODataEntity read(final ODataPubFormat format, final URI editLink) {
- final ODataEntityRequest req = getClient().getRetrieveRequestFactory().getEntityRequest(editLink);
+ protected CommonODataEntity read(final ODataPubFormat format, final URI editLink) {
+ final ODataEntityRequest<CommonODataEntity> req = getClient().getRetrieveRequestFactory().
+ getEntityRequest(editLink);
req.setFormat(format);
- final ODataRetrieveResponse<ODataEntity> res = req.execute();
- final ODataEntity entity = res.getBody();
+ final ODataRetrieveResponse<CommonODataEntity> res = req.execute();
+ final CommonODataEntity entity = res.getBody();
assertNotNull(entity);
@@ -362,10 +368,10 @@ public abstract class AbstractTestITCase {
return entity;
}
- protected ODataEntity createEntity(
+ protected CommonODataEntity createEntity(
final String serviceRootURL,
final ODataPubFormat format,
- final ODataEntity original,
+ final CommonODataEntity original,
final String entitySetName) {
final CommonURIBuilder<?> uriBuilder = getClient().getURIBuilder(serviceRootURL).
@@ -381,7 +387,7 @@ public abstract class AbstractTestITCase {
assertEquals(201, createRes.getStatusCode());
assertEquals("Created", createRes.getStatusMessage());
- final ODataEntity created = createRes.getBody();
+ final CommonODataEntity created = createRes.getBody();
assertNotNull(created);
debugODataEntity(created, "Just created");
@@ -389,9 +395,9 @@ public abstract class AbstractTestITCase {
return created;
}
- protected ODataEntity compareEntities(final String serviceRootURL,
+ protected CommonODataEntity compareEntities(final String serviceRootURL,
final ODataPubFormat format,
- final ODataEntity original,
+ final CommonODataEntity original,
final int actualObjectId,
final Collection<String> expands) {
@@ -405,13 +411,14 @@ public abstract class AbstractTestITCase {
}
}
- final ODataEntityRequest req = getClient().getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ final ODataEntityRequest<CommonODataEntity> req = getClient().getRetrieveRequestFactory().
+ getEntityRequest(uriBuilder.build());
req.setFormat(format);
- final ODataRetrieveResponse<ODataEntity> res = req.execute();
+ final ODataRetrieveResponse<CommonODataEntity> res = req.execute();
assertEquals(200, res.getStatusCode());
- final ODataEntity actual = res.getBody();
+ final CommonODataEntity actual = res.getBody();
assertNotNull(actual);
// check defined links
@@ -427,7 +434,7 @@ public abstract class AbstractTestITCase {
protected void cleanAfterCreate(
final ODataPubFormat format,
- final ODataEntity created,
+ final CommonODataEntity created,
final boolean includeInline,
final String baseUri) {
@@ -437,15 +444,15 @@ public abstract class AbstractTestITCase {
if (includeInline) {
for (ODataLink link : created.getNavigationLinks()) {
if (link instanceof ODataInlineEntity) {
- final ODataEntity inline = ((ODataInlineEntity) link).getEntity();
+ final CommonODataEntity inline = ((ODataInlineEntity) link).getEntity();
if (inline.getEditLink() != null) {
toBeDeleted.add(URIUtils.getURI(baseUri, inline.getEditLink().toASCIIString()));
}
}
if (link instanceof ODataInlineEntitySet) {
- final ODataEntitySet inline = ((ODataInlineEntitySet) link).getEntitySet();
- for (ODataEntity entity : inline.getEntities()) {
+ final CommonODataEntitySet inline = ((ODataInlineEntitySet) link).getEntitySet();
+ for (CommonODataEntity entity : inline.getEntities()) {
if (entity.getEditLink() != null) {
toBeDeleted.add(URIUtils.getURI(baseUri, entity.getEditLink().toASCIIString()));
}
@@ -465,7 +472,8 @@ public abstract class AbstractTestITCase {
deleteRes.close();
- final ODataEntityRequest retrieveReq = getClient().getRetrieveRequestFactory().getEntityRequest(link);
+ final ODataEntityRequest<CommonODataEntity> retrieveReq = getClient().getRetrieveRequestFactory().
+ getEntityRequest(link);
// bug that needs to be fixed on the SampleService - cannot get entity not found with header
// Accept: application/json;odata=minimalmetadata
retrieveReq.setFormat(format == ODataPubFormat.JSON_FULL_METADATA ? ODataPubFormat.JSON : format);
@@ -483,25 +491,25 @@ public abstract class AbstractTestITCase {
}
protected void updateEntityDescription(
- final ODataPubFormat format, final ODataEntity changes, final UpdateType type) {
+ final ODataPubFormat format, final CommonODataEntity changes, final UpdateType type) {
updateEntityDescription(format, changes, type, null);
}
protected void updateEntityDescription(
- final ODataPubFormat format, final ODataEntity changes, final UpdateType type, final String etag) {
+ final ODataPubFormat format, final CommonODataEntity changes, final UpdateType type, final String etag) {
updateEntityStringProperty("Description", format, changes, type, etag);
}
protected void updateEntityStringProperty(final String propertyName,
- final ODataPubFormat format, final ODataEntity changes, final UpdateType type, final String etag) {
+ final ODataPubFormat format, final CommonODataEntity changes, final UpdateType type, final String etag) {
final URI editLink = changes.getEditLink();
final String newm = "New " + propertyName + "(" + System.currentTimeMillis() + ")";
- ODataProperty propertyValue = changes.getProperty(propertyName);
+ CommonODataProperty propertyValue = changes.getProperty(propertyName);
final String oldm;
if (propertyValue == null) {
@@ -513,16 +521,17 @@ public abstract class AbstractTestITCase {
assertNotEquals(newm, oldm);
- changes.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty(propertyName,
- getClient().getObjectFactory().newPrimitiveValueBuilder().setText(newm).build()));
+ getClient().getBinder().add(changes,
+ getClient().getObjectFactory().newPrimitiveProperty(propertyName,
+ getClient().getObjectFactory().newPrimitiveValueBuilder().setText(newm).build()));
update(type, changes, format, etag);
- final ODataEntity actual = read(format, editLink);
+ final CommonODataEntity actual = read(format, editLink);
propertyValue = null;
- for (ODataProperty prop : actual.getProperties()) {
+ for (CommonODataProperty prop : actual.getProperties()) {
if (prop.getName().equals(propertyName)) {
propertyValue = prop;
}
@@ -533,7 +542,7 @@ public abstract class AbstractTestITCase {
}
protected void update(
- final UpdateType type, final ODataEntity changes, final ODataPubFormat format, final String etag) {
+ final UpdateType type, final CommonODataEntity changes, final ODataPubFormat format, final String etag) {
final ODataEntityUpdateRequest req = getClient().getCUDRequestFactory().getEntityUpdateRequest(type, changes);
if (getClient().getConfiguration().isUseXHTTPMethod()) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
index b77ebf8..01e0d7b 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
@@ -19,25 +19,26 @@
package org.apache.olingo.client.core.it.v3;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
import java.io.InputStream;
import java.net.URI;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import org.apache.commons.io.IOUtils;
-import org.apache.olingo.client.api.communication.request.cud.v3.UpdateType;
import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest;
+import org.apache.olingo.client.api.communication.request.cud.v3.UpdateType;
import org.apache.olingo.client.api.communication.request.retrieve.ODataMediaRequest;
import org.apache.olingo.client.api.communication.request.streamed.MediaEntityCreateStreamManager;
import org.apache.olingo.client.api.communication.request.streamed.ODataMediaEntityCreateRequest;
import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse;
import org.apache.olingo.client.api.communication.response.ODataMediaEntityCreateResponse;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
+import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
import org.junit.Ignore;
import org.junit.Test;
@@ -68,14 +69,15 @@ public class AsyncTestITCase extends AbstractTestITCase {
final ODataRetrieveResponse<ODataEntity> entityRes = client.getRetrieveRequestFactory().
getEntityRequest(uri).execute();
- final ODataEntity entity = entityRes.getBody();
+ final CommonODataEntity entity = entityRes.getBody();
entity.getAssociationLinks().clear();
entity.getNavigationLinks().clear();
entity.getEditMediaLinks().clear();
entity.getProperties().remove(entity.getProperty("Description"));
- entity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Description",
- client.getObjectFactory().newPrimitiveValueBuilder().setText("AsyncTest#updateEntity").build()));
+ getClient().getBinder().add(entity,
+ client.getObjectFactory().newPrimitiveProperty("Description",
+ client.getObjectFactory().newPrimitiveValueBuilder().setText("AsyncTest#updateEntity").build()));
final ODataEntityUpdateRequest updateReq =
client.getCUDRequestFactory().getEntityUpdateRequest(uri, UpdateType.MERGE, entity);
@@ -116,7 +118,7 @@ public class AsyncTestITCase extends AbstractTestITCase {
assertEquals(201, createRes.getStatusCode());
- final ODataEntity created = createRes.getBody();
+ final CommonODataEntity created = createRes.getBody();
assertNotNull(created);
assertEquals(2, created.getProperties().size());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
index 1ebe190..bd1419f 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
@@ -18,11 +18,6 @@
*/
package org.apache.olingo.client.core.it.v3;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
import java.net.URI;
import java.util.Collections;
import java.util.HashSet;
@@ -39,17 +34,24 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySe
import org.apache.olingo.client.api.communication.response.ODataDeleteResponse;
import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
-import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
-import org.apache.olingo.commons.api.domain.ODataLink;
-import org.apache.olingo.commons.api.domain.ODataProperty;
-import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.http.NoContentException;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.core.uri.URIUtils;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
+import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
+import org.apache.olingo.commons.api.domain.ODataLink;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
+import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import org.junit.Ignore;
import org.junit.Test;
@@ -66,10 +68,10 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
public void createAsAtom() {
final ODataPubFormat format = ODataPubFormat.ATOM;
final int id = 1;
- final ODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
+ final CommonODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
createEntity(getServiceRoot(), format, original, "Customer");
- final ODataEntity actual = compareEntities(getServiceRoot(), format, original, id, null);
+ final CommonODataEntity actual = compareEntities(getServiceRoot(), format, original, id, null);
cleanAfterCreate(format, actual, false, getServiceRoot());
}
@@ -78,10 +80,10 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
public void createAsJSON() {
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
final int id = 2;
- final ODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
+ final CommonODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
createEntity(getServiceRoot(), format, original, "Customer");
- final ODataEntity actual = compareEntities(getServiceRoot(), format, original, id, null);
+ final CommonODataEntity actual = compareEntities(getServiceRoot(), format, original, id, null);
cleanAfterCreate(format, actual, false, getServiceRoot());
}
@@ -90,10 +92,10 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
public void createWithInlineAsAtom() {
final ODataPubFormat format = ODataPubFormat.ATOM;
final int id = 3;
- final ODataEntity original = getSampleCustomerProfile(id, "Sample customer", true);
+ final CommonODataEntity original = getSampleCustomerProfile(id, "Sample customer", true);
createEntity(getServiceRoot(), format, original, "Customer");
- final ODataEntity actual =
+ final CommonODataEntity actual =
compareEntities(getServiceRoot(), format, original, id, Collections.<String>singleton("Info"));
cleanAfterCreate(format, actual, true, getServiceRoot());
@@ -104,10 +106,10 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
// this needs to be full, otherwise there is no mean to recognize links
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
final int id = 4;
- final ODataEntity original = getSampleCustomerProfile(id, "Sample customer", true);
+ final CommonODataEntity original = getSampleCustomerProfile(id, "Sample customer", true);
createEntity(getServiceRoot(), format, original, "Customer");
- final ODataEntity actual =
+ final CommonODataEntity actual =
compareEntities(getServiceRoot(), format, original, id, Collections.<String>singleton("Info"));
cleanAfterCreate(format, actual, true, getServiceRoot());
@@ -117,13 +119,13 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
public void createInlineWithoutLinkAsAtom() {
final ODataPubFormat format = ODataPubFormat.ATOM;
final int id = 5;
- final ODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
+ final CommonODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
original.addLink(client.getObjectFactory().newInlineEntity(
"Info", null, getSampleCustomerInfo(id, "Sample Customer_Info")));
createEntity(getServiceRoot(), format, original, "Customer");
- final ODataEntity actual =
+ final CommonODataEntity actual =
compareEntities(getServiceRoot(), format, original, id, Collections.<String>singleton("Info"));
boolean found = false;
@@ -144,13 +146,13 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
public void createInlineWithoutLinkAsJSON() {
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
final int id = 6;
- final ODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
+ final CommonODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
original.addLink(client.getObjectFactory().newInlineEntity(
"Info", null, getSampleCustomerInfo(id, "Sample Customer_Info")));
createEntity(getServiceRoot(), format, original, "Customer");
- final ODataEntity actual =
+ final CommonODataEntity actual =
compareEntities(getServiceRoot(), format, original, id, Collections.<String>singleton("Info"));
boolean found = false;
@@ -170,7 +172,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
@Test
public void createWithNavigationAsAtom() {
final ODataPubFormat format = ODataPubFormat.ATOM;
- final ODataEntity actual = createWithNavigationLink(format, 5);
+ final CommonODataEntity actual = createWithNavigationLink(format, 5);
cleanAfterCreate(format, actual, false, getServiceRoot());
}
@@ -178,14 +180,14 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
public void createWithNavigationAsJSON() {
// this needs to be full, otherwise there is no mean to recognize links
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
- final ODataEntity actual = createWithNavigationLink(format, 6);
+ final CommonODataEntity actual = createWithNavigationLink(format, 6);
cleanAfterCreate(format, actual, false, getServiceRoot());
}
@Test
public void createWithFeedNavigationAsAtom() throws EdmPrimitiveTypeException {
final ODataPubFormat format = ODataPubFormat.ATOM;
- final ODataEntity actual = createWithFeedNavigationLink(format, 7);
+ final CommonODataEntity actual = createWithFeedNavigationLink(format, 7);
cleanAfterCreate(format, actual, false, getServiceRoot());
}
@@ -193,14 +195,14 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
public void createWithFeedNavigationAsJSON() throws EdmPrimitiveTypeException {
// this needs to be full, otherwise there is no mean to recognize links
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
- final ODataEntity actual = createWithFeedNavigationLink(format, 8);
+ final CommonODataEntity actual = createWithFeedNavigationLink(format, 8);
cleanAfterCreate(format, actual, false, getServiceRoot());
}
@Test
public void createWithBackNavigationAsAtom() throws EdmPrimitiveTypeException {
final ODataPubFormat format = ODataPubFormat.ATOM;
- final ODataEntity actual = createWithBackNavigationLink(format, 9);
+ final CommonODataEntity actual = createWithBackNavigationLink(format, 9);
cleanAfterCreate(format, actual, true, getServiceRoot());
}
@@ -208,7 +210,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
public void createWithBackNavigationAsJSON() throws EdmPrimitiveTypeException {
// this needs to be full, otherwise there is no mean to recognize links
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
- final ODataEntity actual = createWithBackNavigationLink(format, 10);
+ final CommonODataEntity actual = createWithBackNavigationLink(format, 10);
cleanAfterCreate(format, actual, true, getServiceRoot());
}
@@ -225,7 +227,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
@Test
public void createReturnNoContent() {
final int id = 1;
- final ODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
+ final CommonODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
final ODataEntityCreateRequest createReq = client.getCUDRequestFactory().getEntityCreateRequest(
client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Customer").build(), original);
@@ -253,7 +255,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
@Ignore
public void issue135() {
final int id = 2;
- final ODataEntity original = getSampleCustomerProfile(id, "Sample customer for issue 135", false);
+ final CommonODataEntity original = getSampleCustomerProfile(id, "Sample customer for issue 135", false);
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Customer");
final ODataEntityCreateRequest createReq =
@@ -276,26 +278,28 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
}
}
- private ODataEntity createWithFeedNavigationLink(final ODataPubFormat format, final int id)
+ private CommonODataEntity createWithFeedNavigationLink(final ODataPubFormat format, final int id)
throws EdmPrimitiveTypeException {
final String sampleName = "Sample customer";
- final ODataEntity original = getSampleCustomerProfile(id, sampleName, false);
+ final CommonODataEntity original = getSampleCustomerProfile(id, sampleName, false);
final Set<Integer> keys = new HashSet<Integer>();
keys.add(-100);
keys.add(-101);
for (Integer key : keys) {
- final ODataEntity order =
+ final CommonODataEntity order =
client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.Order");
- order.getProperties().add(client.getObjectFactory().newPrimitiveProperty("OrderId",
- client.getObjectFactory().newPrimitiveValueBuilder().setValue(key).setType(EdmPrimitiveTypeKind.Int32)
- .build()));
- order.getProperties().add(client.getObjectFactory().newPrimitiveProperty("CustomerId",
- client.getObjectFactory().newPrimitiveValueBuilder().setValue(id).setType(EdmPrimitiveTypeKind.Int32)
- .build()));
+ getClient().getBinder().add(order,
+ client.getObjectFactory().newPrimitiveProperty("OrderId",
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue(key).
+ setType(EdmPrimitiveTypeKind.Int32).build()));
+ getClient().getBinder().add(order,
+ client.getObjectFactory().newPrimitiveProperty("CustomerId",
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue(id).
+ setType(EdmPrimitiveTypeKind.Int32).build()));
final ODataEntityCreateRequest createReq = client.getCUDRequestFactory().getEntityCreateRequest(
client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Order").build(), order);
@@ -306,24 +310,25 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
createReq.execute().getBody().getEditLink()));
}
- final ODataEntity created = createEntity(getServiceRoot(), format, original, "Customer");
+ final CommonODataEntity created = createEntity(getServiceRoot(), format, original, "Customer");
// now, compare the created one with the actual one and go deeply into the associated customer info.....
- final ODataEntity actual = compareEntities(getServiceRoot(), format, created, id, null);
+ final CommonODataEntity actual = compareEntities(getServiceRoot(), format, created, id, null);
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
uriBuilder.appendEntitySetSegment("Customer").appendKeySegment(id).appendEntitySetSegment("Orders");
- final ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
+ final ODataEntitySetRequest<ODataEntitySet> req = client.getRetrieveRequestFactory().
+ getEntitySetRequest(uriBuilder.build());
req.setFormat(format);
final ODataRetrieveResponse<ODataEntitySet> res = req.execute();
assertEquals(200, res.getStatusCode());
- final ODataEntitySet entitySet = res.getBody();
+ final CommonODataEntitySet entitySet = res.getBody();
assertNotNull(entitySet);
assertEquals(2, entitySet.getCount());
- for (ODataEntity entity : entitySet.getEntities()) {
+ for (CommonODataEntity entity : entitySet.getEntities()) {
final Integer key = entity.getProperty("OrderId").getPrimitiveValue().toCastValue(Integer.class);
final Integer customerId = entity.getProperty("CustomerId").getPrimitiveValue().toCastValue(Integer.class);
assertTrue(keys.contains(key));
@@ -340,32 +345,32 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
return actual;
}
- private ODataEntity createWithNavigationLink(final ODataPubFormat format, final int id) {
+ private CommonODataEntity createWithNavigationLink(final ODataPubFormat format, final int id) {
final String sampleName = "Sample customer";
- final ODataEntity original = getSampleCustomerProfile(id, sampleName, false);
+ final CommonODataEntity original = getSampleCustomerProfile(id, sampleName, false);
original.addLink(client.getObjectFactory().newEntityNavigationLink(
"Info", URI.create(getServiceRoot() + "/CustomerInfo(12)")));
- final ODataEntity created = createEntity(getServiceRoot(), format, original, "Customer");
+ final CommonODataEntity created = createEntity(getServiceRoot(), format, original, "Customer");
// now, compare the created one with the actual one and go deeply into the associated customer info.....
- final ODataEntity actual = compareEntities(getServiceRoot(), format, created, id, null);
+ final CommonODataEntity actual = compareEntities(getServiceRoot(), format, created, id, null);
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
uriBuilder.appendEntitySetSegment("Customer").appendKeySegment(id).appendEntitySetSegment("Info");
- final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setFormat(format);
final ODataRetrieveResponse<ODataEntity> res = req.execute();
assertEquals(200, res.getStatusCode());
- final ODataEntity info = res.getBody();
+ final CommonODataEntity info = res.getBody();
assertNotNull(info);
boolean found = false;
- for (ODataProperty prop : info.getProperties()) {
+ for (CommonODataProperty prop : info.getProperties()) {
if ("CustomerInfoId".equals(prop.getName())) {
assertEquals("12", prop.getValue().toString());
found = true;
@@ -377,27 +382,29 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
return actual;
}
- private ODataEntity createWithBackNavigationLink(final ODataPubFormat format, final int id)
+ private CommonODataEntity createWithBackNavigationLink(final ODataPubFormat format, final int id)
throws EdmPrimitiveTypeException {
final String sampleName = "Sample customer";
- ODataEntity customer = getSampleCustomerProfile(id, sampleName, false);
- customer = createEntity(getServiceRoot(), format, customer, "Customer");
+ ODataEntity customer = (ODataEntity) getSampleCustomerProfile(id, sampleName, false);
+ customer = (ODataEntity) createEntity(getServiceRoot(), format, customer, "Customer");
ODataEntity order = client.getObjectFactory().newEntity(
"Microsoft.Test.OData.Services.AstoriaDefaultService.Order");
- order.getProperties().add(client.getObjectFactory().newPrimitiveProperty("CustomerId",
- client.getObjectFactory().newPrimitiveValueBuilder().setValue(id).
- setType(EdmPrimitiveTypeKind.Int32).build()));
- order.getProperties().add(client.getObjectFactory().newPrimitiveProperty("OrderId",
- client.getObjectFactory().newPrimitiveValueBuilder().setValue(id).
- setType(EdmPrimitiveTypeKind.Int32).build()));
+ getClient().getBinder().add(order,
+ client.getObjectFactory().newPrimitiveProperty("CustomerId",
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue(id).
+ setType(EdmPrimitiveTypeKind.Int32).build()));
+ getClient().getBinder().add(order,
+ client.getObjectFactory().newPrimitiveProperty("OrderId",
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue(id).
+ setType(EdmPrimitiveTypeKind.Int32).build()));
order.addLink(client.getObjectFactory().newEntityNavigationLink(
"Customer", URIUtils.getURI(getServiceRoot(), customer.getEditLink().toASCIIString())));
- order = createEntity(getServiceRoot(), format, order, "Order");
+ order = (ODataEntity) createEntity(getServiceRoot(), format, order, "Order");
ODataEntity changes = client.getObjectFactory().newEntity(
"Microsoft.Test.OData.Services.AstoriaDefaultService.Customer");
@@ -406,7 +413,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
"Orders", URIUtils.getURI(getServiceRoot(), order.getEditLink().toASCIIString())));
update(UpdateType.PATCH, changes, format, null);
- final ODataEntityRequest customerreq = client.getRetrieveRequestFactory().getEntityRequest(
+ final ODataEntityRequest<ODataEntity> customerreq = client.getRetrieveRequestFactory().getEntityRequest(
URIUtils.getURI(getServiceRoot(), order.getEditLink().toASCIIString() + "/Customer"));
customerreq.setFormat(format);
@@ -415,7 +422,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
assertEquals(Integer.valueOf(id),
customer.getProperty("CustomerId").getPrimitiveValue().toCastValue(Integer.class));
- final ODataEntitySetRequest orderreq = client.getRetrieveRequestFactory().getEntitySetRequest(
+ final ODataEntitySetRequest<ODataEntitySet> orderreq = client.getRetrieveRequestFactory().getEntitySetRequest(
URIUtils.getURI(getServiceRoot(), customer.getEditLink().toASCIIString() + "/Orders"));
orderreq.setFormat(format);
@@ -426,7 +433,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
orderres.getBody().getEntities().get(0).getProperty("OrderId").getPrimitiveValue().
toCastValue(Integer.class));
- final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(
+ final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(
URIUtils.getURI(getServiceRoot(), customer.getEditLink().toASCIIString() + "?$expand=Orders"));
req.setFormat(format);
@@ -444,27 +451,33 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
}
private void multiKey(final ODataPubFormat format) {
- final ODataEntity message = client.getObjectFactory().newEntity(
+ final CommonODataEntity message = client.getObjectFactory().newEntity(
"Microsoft.Test.OData.Services.AstoriaDefaultService.Message");
- message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("MessageId",
- client.getObjectFactory().newPrimitiveValueBuilder().setValue(1000).
- setType(EdmPrimitiveTypeKind.Int32).build()));
- message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("FromUsername",
- client.getObjectFactory().newPrimitiveValueBuilder().setValue("1").
- setType(EdmPrimitiveTypeKind.String).build()));
- message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("ToUsername",
- client.getObjectFactory().newPrimitiveValueBuilder().setValue("xlodhxzzusxecbzptxlfxprneoxkn").
- setType(EdmPrimitiveTypeKind.String).build()));
- message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Subject",
- client.getObjectFactory().newPrimitiveValueBuilder().setValue("Test subject").
- setType(EdmPrimitiveTypeKind.String).build()));
- message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Body",
- client.getObjectFactory().newPrimitiveValueBuilder().setValue("Test body").
- setType(EdmPrimitiveTypeKind.String).build()));
- message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("IsRead",
- client.getObjectFactory().newPrimitiveValueBuilder().setValue(false).
- setType(EdmPrimitiveTypeKind.Boolean).build()));
+ getClient().getBinder().add(message,
+ client.getObjectFactory().newPrimitiveProperty("MessageId",
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue(1000).
+ setType(EdmPrimitiveTypeKind.Int32).build()));
+ getClient().getBinder().add(message,
+ client.getObjectFactory().newPrimitiveProperty("FromUsername",
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue("1").
+ setType(EdmPrimitiveTypeKind.String).build()));
+ getClient().getBinder().add(message,
+ client.getObjectFactory().newPrimitiveProperty("ToUsername",
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue("xlodhxzzusxecbzptxlfxprneoxkn").
+ setType(EdmPrimitiveTypeKind.String).build()));
+ getClient().getBinder().add(message,
+ client.getObjectFactory().newPrimitiveProperty("Subject",
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue("Test subject").
+ setType(EdmPrimitiveTypeKind.String).build()));
+ getClient().getBinder().add(message,
+ client.getObjectFactory().newPrimitiveProperty("Body",
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue("Test body").
+ setType(EdmPrimitiveTypeKind.String).build()));
+ getClient().getBinder().add(message,
+ client.getObjectFactory().newPrimitiveProperty("IsRead",
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue(false).
+ setType(EdmPrimitiveTypeKind.Boolean).build()));
final CommonURIBuilder<?> builder =
client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Message");
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java
index ddcd342..1b43c47 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityRetrieveTestITCase.java
@@ -18,11 +18,6 @@
*/
package org.apache.olingo.client.core.it.v3;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
import java.util.LinkedHashMap;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
@@ -30,16 +25,22 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRe
import org.apache.olingo.client.api.communication.request.retrieve.ODataRawRequest;
import org.apache.olingo.client.api.communication.response.ODataRawResponse;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataInlineEntity;
import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
import org.apache.olingo.commons.api.domain.ODataLink;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.format.ODataPubFormat;
-import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.commons.core.op.ResourceFactory;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
import org.junit.Test;
/**
@@ -55,7 +56,7 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Customer").appendKeySegment(-10).expand("Info");
- final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setFormat(format);
final ODataRetrieveResponse<ODataEntity> res = req.execute();
@@ -72,13 +73,13 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
for (ODataLink link : entity.getNavigationLinks()) {
if (link instanceof ODataInlineEntity) {
- final ODataEntity inline = ((ODataInlineEntity) link).getEntity();
+ final CommonODataEntity inline = ((ODataInlineEntity) link).getEntity();
assertNotNull(inline);
debugEntry(client.getBinder().getEntry(
inline, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)), "Just read");
- final List<ODataProperty> properties = inline.getProperties();
+ final List<? extends CommonODataProperty> properties = inline.getProperties();
assertEquals(2, properties.size());
assertTrue(properties.get(0).getName().equals("CustomerInfoId")
@@ -108,7 +109,7 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Customer").appendKeySegment(-10).expand("Orders");
- final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setFormat(format);
final ODataRetrieveResponse<ODataEntity> res = req.execute();
@@ -119,7 +120,7 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
for (ODataLink link : entity.getNavigationLinks()) {
if (link instanceof ODataInlineEntitySet) {
- final ODataEntitySet inline = ((ODataInlineEntitySet) link).getEntitySet();
+ final CommonODataEntitySet inline = ((ODataInlineEntitySet) link).getEntitySet();
assertNotNull(inline);
debugFeed(client.getBinder().getFeed(inline, ResourceFactory.feedClassForFormat(
@@ -153,10 +154,10 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
final ODataRawResponse res = req.execute();
assertNotNull(res);
- final ODataEntitySet entitySet = res.getBodyAs(ODataEntitySet.class);
+ final CommonODataEntitySet entitySet = res.getBodyAs(CommonODataEntitySet.class);
assertNull(entitySet);
- final ODataEntity entity = res.getBodyAs(ODataEntity.class);
+ final CommonODataEntity entity = res.getBodyAs(CommonODataEntity.class);
assertNotNull(entity);
}
@@ -179,7 +180,7 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Message").appendKeySegment(multiKey);
- final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setFormat(format);
final ODataRetrieveResponse<ODataEntity> res = req.execute();
@@ -212,7 +213,7 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
final CommonURIBuilder<?> uriBuilder =
client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Product").appendKeySegment(-10);
- final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setFormat(format);
final ODataRetrieveResponse<ODataEntity> res = req.execute();
@@ -221,7 +222,7 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
final String etag = res.getEtag();
assertTrue(StringUtils.isNotBlank(etag));
- final ODataEntity product = res.getBody();
+ final CommonODataEntity product = res.getBody();
assertEquals(etag, product.getETag());
}
@@ -229,7 +230,7 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
public void issue99() {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Car");
- final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setFormat(ODataPubFormat.JSON);
// this statement should cause an IllegalArgumentException bearing JsonParseException
[22/51] [abbrv] git commit: Consolidating ServiceDocument IT tests
Posted by il...@apache.org.
Consolidating ServiceDocument IT tests
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/8c58e3ea
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/8c58e3ea
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/8c58e3ea
Branch: refs/heads/master
Commit: 8c58e3ea8d75316d25acae49cb0f6610ec39356b
Parents: 72b264e
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Sat Mar 29 06:39:30 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Sat Mar 29 06:39:30 2014 +0100
----------------------------------------------------------------------
.../v3/ServiceDocumentRetrieveTestITCase.java | 73 -------------------
.../v4/ServiceDocumentRetrieveTestITCase.java | 74 --------------------
.../core/it/v4/ServiceDocumentTestITCase.java | 8 ++-
3 files changed, 7 insertions(+), 148 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8c58e3ea/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ServiceDocumentRetrieveTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ServiceDocumentRetrieveTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ServiceDocumentRetrieveTestITCase.java
deleted file mode 100644
index f5a9fa9..0000000
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ServiceDocumentRetrieveTestITCase.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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.client.core.it.v3;
-
-import static org.junit.Assert.*;
-import java.net.URI;
-import org.apache.olingo.client.api.communication.ODataClientErrorException;
-import org.apache.olingo.client.api.communication.request.retrieve.ODataServiceDocumentRequest;
-import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.commons.api.domain.ODataServiceDocument;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.junit.Test;
-
-public class ServiceDocumentRetrieveTestITCase extends AbstractTestITCase {
-
- private void retrieveServiceDocumentTest(final ODataFormat reqFormat, final String acceptFormat) {
- final ODataServiceDocumentRequest req =
- client.getRetrieveRequestFactory().getServiceDocumentRequest(testStaticServiceRootURL);
- req.setFormat(reqFormat);
- req.setAccept(acceptFormat);
- final ODataRetrieveResponse<ODataServiceDocument> res = req.execute();
- assertEquals(200, res.getStatusCode());
- final ODataServiceDocument serviceDocument = res.getBody();
- assertEquals(24, serviceDocument.getEntitySetTitles().size());
- assertEquals(URI.create(testStaticServiceRootURL + "/Customer"), serviceDocument.getEntitySetURI("Customer"));
- }
-
- @Test
- public void jsonTest() {
- retrieveServiceDocumentTest(ODataFormat.JSON, "application/json");
- }
-
- @Test
- public void jsonNoMetadataTest() {
- retrieveServiceDocumentTest(ODataFormat.JSON_NO_METADATA, "application/json");
- }
-
- @Test
- public void xmlTest() {
- retrieveServiceDocumentTest(ODataFormat.XML, "application/xml");
- }
-
- @Test(expected = ODataClientErrorException.class)
- public void atomAcceptTest() {
- retrieveServiceDocumentTest(ODataFormat.XML, "application/atom+xml");
- }
-
- @Test
- public void nullAcceptTest() {
- retrieveServiceDocumentTest(ODataFormat.XML, null);
- }
-
- @Test
- public void nullServiceFormatTest() {
- retrieveServiceDocumentTest(null, "application/xml");
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8c58e3ea/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/ServiceDocumentRetrieveTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/ServiceDocumentRetrieveTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/ServiceDocumentRetrieveTestITCase.java
deleted file mode 100644
index 0562670..0000000
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/ServiceDocumentRetrieveTestITCase.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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.client.core.it.v4;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.net.URI;
-import org.apache.olingo.client.api.communication.ODataClientErrorException;
-import org.apache.olingo.client.api.communication.request.retrieve.ODataServiceDocumentRequest;
-import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.commons.api.domain.ODataServiceDocument;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class ServiceDocumentRetrieveTestITCase extends AbstractTestITCase {
-
- private void retrieveServiceDocumentTest(final ODataFormat reqFormat, final String acceptFormat) {
- final ODataServiceDocumentRequest req =
- client.getRetrieveRequestFactory().getServiceDocumentRequest(testStaticServiceRootURL);
- req.setFormat(reqFormat);
- req.setAccept(acceptFormat);
- final ODataRetrieveResponse<ODataServiceDocument> res = req.execute();
- assertEquals(200, res.getStatusCode());
- final ODataServiceDocument serviceDocument = res.getBody();
- assertEquals(12, serviceDocument.getEntitySetTitles().size());
- assertEquals(URI.create(testStaticServiceRootURL + "/Customers"), serviceDocument.getEntitySetURI("Customers"));
- assertTrue(res.getContextURL().toASCIIString().endsWith("/StaticService/V40/Static.svc/$metadata"));
- }
-
- @Test
- @Ignore
- public void jsonTest() {
- retrieveServiceDocumentTest(ODataFormat.JSON, "application/json");
- }
-
- @Test
- @Ignore
- public void jsonNoMetadataTest() {
- retrieveServiceDocumentTest(ODataFormat.JSON_NO_METADATA, "application/json");
- }
-
- @Test
- public void xmlTest() {
- retrieveServiceDocumentTest(ODataFormat.XML, "application/xml");
- }
-
- @Test(expected = ODataClientErrorException.class)
- public void atomAcceptTest() {
- retrieveServiceDocumentTest(ODataFormat.XML, "application/atom+xml");
- }
-
- @Test
- public void nullServiceFormatTest() {
- retrieveServiceDocumentTest(null, "application/xml");
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8c58e3ea/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/ServiceDocumentTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/ServiceDocumentTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/ServiceDocumentTestITCase.java
index 4d7f5d7..7a28ed1 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/ServiceDocumentTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/ServiceDocumentTestITCase.java
@@ -41,10 +41,16 @@ public class ServiceDocumentTestITCase extends AbstractTestITCase {
final ODataServiceDocument serviceDocument = res.getBody();
assertEquals(12, serviceDocument.getEntitySetTitles().size());
+ assertEquals(6, serviceDocument.getSingletonTitles().size());
+ assertEquals(6, serviceDocument.getFunctionImportTitles().size());
+ assertTrue(res.getContextURL().toASCIIString().endsWith("/StaticService/V40/Static.svc/$metadata"));
assertEquals(URI.create(testStaticServiceRootURL + "/ProductDetails"),
serviceDocument.getEntitySetURI("ProductDetails"));
- assertTrue(res.getContextURL().toASCIIString().endsWith("/StaticService/V40/Static.svc/$metadata"));
+ assertEquals(URI.create(testStaticServiceRootURL + "/Boss"),
+ serviceDocument.getSingletonURI("Boss"));
+ assertEquals(URI.create(testStaticServiceRootURL + "/GetPerson"),
+ serviceDocument.getFunctionImportURI("GetPerson"));
}
@Test
[44/51] [abbrv] [OLINGO-205,
OLINGO-175] provided JSON integration tests + refactoring and fixes
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/JSONServiceDocumentImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/JSONServiceDocumentImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/JSONServiceDocumentImpl.java
index ace5487..af957a1 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/JSONServiceDocumentImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/JSONServiceDocumentImpl.java
@@ -20,11 +20,9 @@ package org.apache.olingo.client.core.data.v3;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import java.net.URI;
import org.apache.olingo.client.core.data.AbstractServiceDocument;
import org.apache.olingo.client.core.data.JSONServiceDocumentDeserializer;
-import org.apache.olingo.commons.api.Constants;
/**
* Service document, represented via JSON.
@@ -34,34 +32,4 @@ public class JSONServiceDocumentImpl extends AbstractServiceDocument {
private static final long serialVersionUID = 4195734928526398830L;
- private String metadata;
-
- @Override
- public URI getBaseURI() {
- URI baseURI = null;
- if (metadata != null) {
- final String metadataURI = getMetadata();
- baseURI = URI.create(metadataURI.substring(0, metadataURI.indexOf(Constants.METADATA)));
- }
-
- return baseURI;
- }
-
- /**
- * Gets the metadata URI.
- *
- * @return the metadata URI
- */
- public String getMetadata() {
- return metadata;
- }
-
- /**
- * Sets the metadata URI.
- *
- * @param metadata metadata URI.
- */
- public void setMetadata(final String metadata) {
- this.metadata = metadata;
- }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/XMLServiceDocumentImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/XMLServiceDocumentImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/XMLServiceDocumentImpl.java
index 682f500..e09b092 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/XMLServiceDocumentImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v3/XMLServiceDocumentImpl.java
@@ -20,7 +20,6 @@ package org.apache.olingo.client.core.data.v3;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import java.net.URI;
import org.apache.olingo.client.api.data.ServiceDocument;
import org.apache.olingo.client.core.data.AbstractServiceDocument;
@@ -28,21 +27,4 @@ import org.apache.olingo.client.core.data.XMLServiceDocumentDeserializer;
@JsonDeserialize(using = XMLServiceDocumentDeserializer.class)
public class XMLServiceDocumentImpl extends AbstractServiceDocument implements ServiceDocument {
-
- private URI baseURI;
-
- @Override
- public URI getBaseURI() {
- return this.baseURI;
- }
-
- /**
- * Sets base URI.
- *
- * @param baseURI base URI.
- */
- public void setBaseURI(final URI baseURI) {
- this.baseURI = baseURI;
- }
-
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/AbstractServiceDocument.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/AbstractServiceDocument.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/AbstractServiceDocument.java
index 47f294f..45ce766 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/AbstractServiceDocument.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/AbstractServiceDocument.java
@@ -18,7 +18,6 @@
*/
package org.apache.olingo.client.core.data.v4;
-import java.net.URI;
import java.util.ArrayList;
import java.util.List;
@@ -27,12 +26,6 @@ import org.apache.olingo.client.api.data.ServiceDocumentItem;
public abstract class AbstractServiceDocument
extends org.apache.olingo.client.core.data.AbstractServiceDocument {
- private URI baseURI;
-
- private String metadataContext;
-
- private String metadataETag;
-
private List<ServiceDocumentItem> functionImports = new ArrayList<ServiceDocumentItem>();
private List<ServiceDocumentItem> singletons = new ArrayList<ServiceDocumentItem>();
@@ -40,38 +33,6 @@ public abstract class AbstractServiceDocument
private List<ServiceDocumentItem> relatedServiceDocuments = new ArrayList<ServiceDocumentItem>();
@Override
- public URI getBaseURI() {
- return this.baseURI;
- }
-
- /**
- * Sets base URI.
- *
- * @param baseURI base URI.
- */
- public void setBaseURI(final URI baseURI) {
- this.baseURI = baseURI;
- }
-
- @Override
- public String getMetadataContext() {
- return metadataContext;
- }
-
- public void setMetadataContext(final String metadataContext) {
- this.metadataContext = metadataContext;
- }
-
- @Override
- public String getMetadataETag() {
- return metadataETag;
- }
-
- public void setMetadataETag(final String metadataETag) {
- this.metadataETag = metadataETag;
- }
-
- @Override
public List<ServiceDocumentItem> getFunctionImports() {
return functionImports;
}
@@ -85,5 +46,4 @@ public abstract class AbstractServiceDocument
public List<ServiceDocumentItem> getRelatedServiceDocuments() {
return relatedServiceDocuments;
}
-
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/JSONServiceDocumentImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/JSONServiceDocumentImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/JSONServiceDocumentImpl.java
index b5c352b..f3dfd91 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/JSONServiceDocumentImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/JSONServiceDocumentImpl.java
@@ -23,21 +23,6 @@ import org.apache.olingo.client.core.data.JSONServiceDocumentDeserializer;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import java.net.URI;
-import org.apache.olingo.commons.api.Constants;
-
@JsonDeserialize(using = JSONServiceDocumentDeserializer.class)
public class JSONServiceDocumentImpl extends AbstractServiceDocument implements ServiceDocument {
-
- @Override
- public URI getBaseURI() {
- URI baseURI = null;
- if (getMetadataContext() != null) {
- final String metadataURI = getMetadataContext();
- baseURI = URI.create(metadataURI.substring(0, metadataURI.indexOf(Constants.METADATA)));
- }
-
- return baseURI;
- }
-
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/XMLServiceDocumentImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/XMLServiceDocumentImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/XMLServiceDocumentImpl.java
index 2885658..b3c64b6 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/XMLServiceDocumentImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/data/v4/XMLServiceDocumentImpl.java
@@ -25,5 +25,4 @@ import org.apache.olingo.client.core.data.XMLServiceDocumentDeserializer;
@JsonDeserialize(using = XMLServiceDocumentDeserializer.class)
public class XMLServiceDocumentImpl extends AbstractServiceDocument implements ServiceDocument {
-
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
index c41ad6b..c9b6b0e 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
@@ -292,7 +292,7 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
final CommonODataEntity entity = resource.getSelfLink() == null
? client.getObjectFactory().newEntity(resource.getType())
: client.getObjectFactory().newEntity(resource.getType(),
- URIUtils.getURI(base, resource.getSelfLink().getHref()));
+ URIUtils.getURI(base, resource.getSelfLink().getHref()));
if (StringUtils.isNotBlank(resource.getETag())) {
entity.setETag(resource.getETag());
@@ -321,12 +321,12 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
entity.addLink(client.getObjectFactory().newInlineEntity(
link.getTitle(), base, link.getHref(),
getODataEntity(inlineEntry,
- inlineEntry.getBaseURI() == null ? base : inlineEntry.getBaseURI())));
+ inlineEntry.getBaseURI() == null ? base : inlineEntry.getBaseURI())));
} else {
entity.addLink(client.getObjectFactory().newInlineEntitySet(
link.getTitle(), base, link.getHref(),
getODataEntitySet(inlineFeed,
- inlineFeed.getBaseURI() == null ? base : inlineFeed.getBaseURI())));
+ inlineFeed.getBaseURI() == null ? base : inlineFeed.getBaseURI())));
}
}
@@ -363,18 +363,18 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
value = client.getObjectFactory().newPrimitiveValueBuilder().
setText(resource.getValue().asPrimitive().get()).
setType(typeInfo == null
- ? null
- : EdmPrimitiveTypeKind.valueOfFQN(
- client.getServiceVersion(), typeInfo.getFullQualifiedName().toString())).build();
+ ? null
+ : EdmPrimitiveTypeKind.valueOfFQN(
+ client.getServiceVersion(), typeInfo.getFullQualifiedName().toString())).build();
} else if (resource.getValue().isGeospatial()) {
value = client.getObjectFactory().newPrimitiveValueBuilder().
setValue(resource.getValue().asGeospatial().get()).
setType(typeInfo == null
- || EdmPrimitiveTypeKind.Geography.getFullQualifiedName().equals(typeInfo.getFullQualifiedName())
- || EdmPrimitiveTypeKind.Geometry.getFullQualifiedName().equals(typeInfo.getFullQualifiedName())
- ? resource.getValue().asGeospatial().get().getEdmPrimitiveTypeKind()
- : EdmPrimitiveTypeKind.valueOfFQN(
- client.getServiceVersion(), typeInfo.getFullQualifiedName().toString())).build();
+ || EdmPrimitiveTypeKind.Geography.getFullQualifiedName().equals(typeInfo.getFullQualifiedName())
+ || EdmPrimitiveTypeKind.Geometry.getFullQualifiedName().equals(typeInfo.getFullQualifiedName())
+ ? resource.getValue().asGeospatial().get().getEdmPrimitiveTypeKind()
+ : EdmPrimitiveTypeKind.valueOfFQN(
+ client.getServiceVersion(), typeInfo.getFullQualifiedName().toString())).build();
} else if (resource.getValue().isComplex()) {
value = client.getObjectFactory().newComplexValue(typeInfo == null
? null : typeInfo.getFullQualifiedName().toString());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
index 4f4a484..226d8b8 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
@@ -64,19 +64,19 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder
public ODataServiceDocument getODataServiceDocument(final ServiceDocument resource) {
final ODataServiceDocument serviceDocument = super.getODataServiceDocument(resource);
- serviceDocument.setMetadataContext(URIUtils.getURI(resource.getBaseURI(), resource.getMetadataContext()));
- serviceDocument.setMetadataETag(resource.getMetadataETag());
-
for (ServiceDocumentItem functionImport : resource.getFunctionImports()) {
- serviceDocument.getFunctionImports().put(functionImport.getTitle(),
+ serviceDocument.getFunctionImports().put(
+ functionImport.getName() == null ? functionImport.getHref() : functionImport.getName(),
URIUtils.getURI(resource.getBaseURI(), functionImport.getHref()));
}
for (ServiceDocumentItem singleton : resource.getSingletons()) {
- serviceDocument.getSingletons().put(singleton.getTitle(),
+ serviceDocument.getSingletons().put(
+ singleton.getName() == null ? singleton.getHref() : singleton.getName(),
URIUtils.getURI(resource.getBaseURI(), singleton.getHref()));
}
for (ServiceDocumentItem sdoc : resource.getRelatedServiceDocuments()) {
- serviceDocument.getRelatedServiceDocuments().put(sdoc.getTitle(),
+ serviceDocument.getRelatedServiceDocuments().put(
+ sdoc.getName() == null ? sdoc.getHref() : sdoc.getName(),
URIUtils.getURI(resource.getBaseURI(), sdoc.getHref()));
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
index 01e0d7b..04ad089 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
@@ -97,7 +97,6 @@ public class AsyncTestITCase extends AbstractTestITCase {
* @see MediaEntityTest#createMediaEntity(com.msopentech.odatajclient.engine.format.ODataPubFormat)
*/
@Test
- @Ignore
public void createMediaEntity() throws Exception {
CommonURIBuilder<?> builder = client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Car");
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
deleted file mode 100644
index 1972fec..0000000
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
+++ /dev/null
@@ -1,534 +0,0 @@
-/*
- * 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.client.core.it.v3;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import org.apache.olingo.client.api.communication.request.cud.ODataDeleteRequest;
-import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest;
-import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
-import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
-import org.apache.olingo.client.api.communication.response.ODataDeleteResponse;
-import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
-import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.client.api.http.HttpClientException;
-import org.apache.olingo.client.api.uri.CommonURIBuilder;
-import org.apache.olingo.client.core.uri.URIUtils;
-import org.apache.olingo.commons.api.domain.CommonODataEntity;
-import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
-import org.apache.olingo.commons.api.domain.CommonODataProperty;
-import org.apache.olingo.commons.api.domain.ODataCollectionValue;
-import org.apache.olingo.commons.api.domain.ODataComplexValue;
-import org.apache.olingo.commons.api.domain.ODataInlineEntity;
-import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
-import org.apache.olingo.commons.api.domain.ODataLink;
-import org.apache.olingo.commons.api.domain.ODataValue;
-import org.apache.olingo.commons.api.domain.v3.ODataEntity;
-import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
-import org.apache.olingo.commons.api.domain.v3.ODataProperty;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.format.ODataPubFormat;
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
-
- // create navigation link with ATOM
- @Test
- public void createNavWithAtom() {
- final ODataPubFormat format = ODataPubFormat.ATOM;
- final String contentType = "application/atom+xml";
- final String prefer = "return-content";
- final ODataEntity actual = createNavigation(format, 20, contentType, prefer);
- delete(format, actual, false, testStaticServiceRootURL);
- }
- // create navigation link with JSON full metadata
-
- @Test
- public void createNavWithJSONFullMetadata() {
- final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
- final String contentType = "application/json;odata=fullmetadata";
- final String prefer = "return-content";
- final ODataEntity actual = createNavigation(format, 21, contentType, prefer);
- delete(format, actual, false, testStaticServiceRootURL);
- }
- // throws Null pointer exception when the format is JSON No metadata
-
- @Test(expected = HttpClientException.class)
- public void createNavWithJSONNoMetadata() {
- final ODataPubFormat format = ODataPubFormat.JSON_NO_METADATA;
- final String contentType = "application/json;odata=nometadata";
- final String prefer = "return-content";
- final ODataEntity actual = createNavigation(format, 22, contentType, prefer);
- delete(format, actual, false, testStaticServiceRootURL);
- }
- // test with JSON accept and atom content type
-
- @Test
- @Ignore
- public void createNavWithJSONAndATOM() {
- final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
- final String contentType = "application/atom+xml";
- final String prefer = "return-content";
- final ODataEntity actual = createNavigation(format, 23, contentType, prefer);
- delete(format, actual, false, testStaticServiceRootURL);
- }
- // test with JSON full metadata in format and json no metadata in content type
-
- @Test
- public void createNavWithDiffJSON() {
- final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
- final String contentType = "application/json;odata=nometadata";
- final String prefer = "return-content";
- final ODataEntity actual = createNavigation(format, 24, contentType, prefer);
- delete(format, actual, false, testStaticServiceRootURL);
- }
- // test with JSON no metadata format and json no metadata in content type
-
- @Test(expected = HttpClientException.class)
- public void createNavWithNoMetadata() {
- final ODataPubFormat format = ODataPubFormat.JSON_NO_METADATA;
- final String contentType = "application/json;odata=fullmetadata";
- final String prefer = "return-content";
- final ODataEntity actual = createNavigation(format, 25, contentType, prefer);
- delete(format, actual, false, testStaticServiceRootURL);
- }
- // create collection navigation link with ATOM
-
- @Test
- public void createCollectionNavWithAtom() throws EdmPrimitiveTypeException {
- final ODataPubFormat format = ODataPubFormat.ATOM;
- final String contentType = "application/atom+xml";
- final String prefer = "return-content";
- final ODataEntity actual = createCollectionNavigation(format, 55, contentType, prefer);
- delete(format, actual, false, testStaticServiceRootURL);
- }
- // create collection navigation link with JSON
-
- @Test
- public void createCollectionNavWithJSON() throws EdmPrimitiveTypeException {
- final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
- final String contentType = "application/json;odata=fullmetadata";
- final String prefer = "return-content";
- final ODataEntity actual = createCollectionNavigation(format, 77, contentType, prefer);
- delete(format, actual, false, testStaticServiceRootURL);
- }
-
- // create a navigation link
- public ODataEntity createNavigation(final ODataPubFormat format, final int id, final String contenttype,
- final String prefer) {
- final String name = "Customer Navigation test";
-
- final ODataEntity original = getNewCustomer(id, name, false);
- original.addLink(client.getObjectFactory().newEntityNavigationLink(
- "Info", URI.create(testStaticServiceRootURL + "/CustomerInfo(11)")));
- final ODataEntity created = createNav(testStaticServiceRootURL, format, original, "Customer", contenttype,
- prefer);
-
- final ODataEntity actual = validateEntities(testStaticServiceRootURL, format, created, id, null, "Customer");
-
- final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL);
- uriBuilder.appendEntitySetSegment("Customer").appendKeySegment(id).appendEntitySetSegment("Info");
-
- final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
- req.setFormat(format);
- req.setContentType(contenttype);
- req.setPrefer(prefer);
- final ODataRetrieveResponse<ODataEntity> res = req.execute();
- assertEquals(200, res.getStatusCode());
- assertTrue(res.getHeader("DataServiceVersion").contains("3.0;"));
- final ODataEntity entity = res.getBody();
- assertNotNull(entity);
- for (ODataProperty prop : entity.getProperties()) {
- if ("CustomerInfoId".equals(prop.getName())) {
- assertEquals("11", prop.getValue().toString());
- }
- }
- return actual;
- }
-
- // create a navigation link
- public ODataEntity createNav(final String url, final ODataPubFormat format, final ODataEntity original,
- final String entitySetName, final String contentType, final String prefer) {
- final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(url);
- uriBuilder.appendEntitySetSegment(entitySetName);
- final ODataEntityCreateRequest<ODataEntity> createReq =
- client.getCUDRequestFactory().getEntityCreateRequest(uriBuilder.build(), original);
- createReq.setFormat(format);
- createReq.setContentType(contentType);
- createReq.setPrefer(prefer);
- final ODataEntityCreateResponse<ODataEntity> createRes = createReq.execute();
- assertEquals(201, createRes.getStatusCode());
-
- assertEquals("Created", createRes.getStatusMessage());
-
- final ODataEntity created = createRes.getBody();
- assertNotNull(created);
- return created;
- }
- // create collection navigation link
-
- public ODataEntity createCollectionNavigation(final ODataPubFormat format, final int id,
- final String contentType, final String prefer) throws EdmPrimitiveTypeException {
- {
- final String name = "Collection Navigation Key Customer";
- final ODataEntity original = getNewCustomer(id, name, false);
-
- final Set<Integer> navigationKeys = new HashSet<Integer>();
- navigationKeys.add(-118);
- navigationKeys.add(-119);
-
- for (Integer key : navigationKeys) {
- final ODataEntity orderEntity =
- client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.Order");
-
- getClient().getBinder().add(orderEntity,
- client.getObjectFactory().newPrimitiveProperty("OrderId",
- client.getObjectFactory().newPrimitiveValueBuilder().setValue(key).
- setType(EdmPrimitiveTypeKind.Int32).build()));
- getClient().getBinder().add(orderEntity,
- client.getObjectFactory().newPrimitiveProperty("CustomerId",
- client.getObjectFactory().newPrimitiveValueBuilder().setValue(id).
- setType(EdmPrimitiveTypeKind.Int32).build()));
-
- final ODataEntityCreateRequest<ODataEntity> createReq = client.getCUDRequestFactory().getEntityCreateRequest(
- client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Order").build(),
- orderEntity);
- createReq.setFormat(format);
- createReq.setContentType(contentType);
- original.addLink(client.getObjectFactory().newEntitySetNavigationLink(
- "Orders",
- createReq.execute().getBody().getEditLink()));
- }
- final ODataEntity createdEntity = createNav(testStaticServiceRootURL, format, original, "Customer",
- contentType, prefer);
- final ODataEntity actualEntity =
- validateEntities(testStaticServiceRootURL, format, createdEntity, id, null, "Customer");
-
- final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL);
- uriBuilder.appendEntitySetSegment("Customer").appendKeySegment(id).appendEntitySetSegment("Orders");
-
- final ODataEntitySetRequest<ODataEntitySet> req = client.getRetrieveRequestFactory().
- getEntitySetRequest(uriBuilder.build());
- req.setFormat(format);
-
- final ODataRetrieveResponse<ODataEntitySet> res = req.execute();
- assertEquals(200, res.getStatusCode());
-
- final ODataEntitySet entitySet = res.getBody();
- assertNotNull(entitySet);
-
- assertEquals(2, entitySet.getCount());
-
- for (ODataEntity entity : entitySet.getEntities()) {
- final Integer key = entity.getProperty("OrderId").getPrimitiveValue().toCastValue(Integer.class);
- final Integer customerId = entity.getProperty("CustomerId").getPrimitiveValue().toCastValue(Integer.class);
- assertTrue(navigationKeys.contains(key));
- assertEquals(Integer.valueOf(id), customerId);
- navigationKeys.remove(key);
- final ODataDeleteRequest deleteReq = client.getCUDRequestFactory().getDeleteRequest(
- URIUtils.getURI(testStaticServiceRootURL, entity.getEditLink().toASCIIString()));
-
- deleteReq.setFormat(format);
- assertEquals(204, deleteReq.execute().getStatusCode());
- }
-
- return actualEntity;
- }
- }
- // get a Customer entity to be created
-
- public ODataEntity getNewCustomer(
- final int id, final String name, final boolean withInlineInfo) {
-
- final ODataEntity entity =
- client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.Customer");
-
- // add name attribute
- getClient().getBinder().add(entity,
- client.getObjectFactory().newPrimitiveProperty("Name",
- client.getObjectFactory().newPrimitiveValueBuilder().setText(name).
- setType(EdmPrimitiveTypeKind.String).build()));
-
- // add key attribute
- if (id != 0) {
- getClient().getBinder().add(entity,
- client.getObjectFactory().newPrimitiveProperty("CustomerId",
- client.getObjectFactory().newPrimitiveValueBuilder().setText(String.valueOf(id)).
- setType(EdmPrimitiveTypeKind.Int32).build()));
- }
- final ODataCollectionValue<ODataValue> backupContactInfoValue = getClient().getObjectFactory().newCollectionValue(
- "Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails)");
-
- final ODataComplexValue<ODataProperty> contactDetails = getClient().getObjectFactory().newComplexValue(
- "Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails");
-
- final ODataCollectionValue<ODataValue> altNamesValue = getClient().getObjectFactory().
- newCollectionValue("Collection(Edm.String)");
- altNamesValue.add(client.getObjectFactory().newPrimitiveValueBuilder().
- setText("My Alternative name").setType(EdmPrimitiveTypeKind.String).build());
- contactDetails.add(client.getObjectFactory().newCollectionProperty("AlternativeNames", altNamesValue));
-
- final ODataCollectionValue<ODataValue> emailBagValue = getClient().getObjectFactory().
- newCollectionValue("Collection(Edm.String)");
- emailBagValue.add(client.getObjectFactory().newPrimitiveValueBuilder().
- setText("altname@mydomain.com").setType(EdmPrimitiveTypeKind.String).build());
- contactDetails.add(client.getObjectFactory().newCollectionProperty("EmailBag", emailBagValue));
-
- final ODataComplexValue<ODataProperty> contactAliasValue = getClient().getObjectFactory().newComplexValue(
- "Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases");
- contactDetails.add(client.getObjectFactory().newComplexProperty("ContactAlias", contactAliasValue));
-
- final ODataCollectionValue<ODataValue> aliasAltNamesValue = getClient().getObjectFactory().
- newCollectionValue("Collection(Edm.String)");
- aliasAltNamesValue.add(client.getObjectFactory().newPrimitiveValueBuilder().
- setText("myAlternativeName").setType(EdmPrimitiveTypeKind.String).build());
- contactAliasValue.add(client.getObjectFactory().newCollectionProperty("AlternativeNames", aliasAltNamesValue));
-
- final ODataComplexValue<ODataProperty> homePhone = getClient().getObjectFactory().newComplexValue(
- "Microsoft.Test.OData.Services.AstoriaDefaultService.Phone");
- homePhone.add(client.getObjectFactory().newPrimitiveProperty("PhoneNumber",
- client.getObjectFactory().newPrimitiveValueBuilder().setText("8437568356834568").
- setType(EdmPrimitiveTypeKind.String).build()));
- homePhone.add(client.getObjectFactory().newPrimitiveProperty("Extension",
- client.getObjectFactory().newPrimitiveValueBuilder().setText("124365426534621534423ttrf").
- setType(EdmPrimitiveTypeKind.String).
- build()));
- contactDetails.add(client.getObjectFactory().newComplexProperty("HomePhone", homePhone));
-
- backupContactInfoValue.add(contactDetails);
- getClient().getBinder().add(entity,
- client.getObjectFactory().newCollectionProperty("BackupContactInfo", backupContactInfoValue));
- if (withInlineInfo) {
- final ODataInlineEntity inlineInfo = client.getObjectFactory().newInlineEntity("Info", URI.create(
- "Customer(" + id
- + ")/Info"), getInfo(id, name + "_Info"));
- inlineInfo.getEntity().setMediaEntity(true);
- entity.addLink(inlineInfo);
- }
-
- return entity;
- }
- //delete an entity and associated links after creation
-
- public void delete(final ODataPubFormat format, final ODataEntity created, final boolean includeInline,
- final String baseUri) {
- final Set<URI> toBeDeleted = new HashSet<URI>();
- toBeDeleted.add(created.getEditLink());
-
- if (includeInline) {
- for (ODataLink link : created.getNavigationLinks()) {
- if (link instanceof ODataInlineEntity) {
- final CommonODataEntity inline = ((ODataInlineEntity) link).getEntity();
- if (inline.getEditLink() != null) {
- toBeDeleted.add(URIUtils.getURI(baseUri, inline.getEditLink().toASCIIString()));
- }
- }
-
- if (link instanceof ODataInlineEntitySet) {
- final CommonODataEntitySet inline = ((ODataInlineEntitySet) link).getEntitySet();
- for (CommonODataEntity entity : inline.getEntities()) {
- if (entity.getEditLink() != null) {
- toBeDeleted.add(URIUtils.getURI(baseUri, entity.getEditLink().toASCIIString()));
- }
- }
- }
- }
- }
- assertFalse(toBeDeleted.isEmpty());
-
- for (URI link : toBeDeleted) {
- final ODataDeleteRequest deleteReq = client.getCUDRequestFactory().getDeleteRequest(link);
- final ODataDeleteResponse deleteRes = deleteReq.execute();
-
- assertEquals(204, deleteRes.getStatusCode());
- assertEquals("No Content", deleteRes.getStatusMessage());
-
- deleteRes.close();
- }
- }
- // add Information property
-
- public ODataEntity getInfo(final int id, final String info) {
- final ODataEntity entity =
- client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.CustomerInfo");
- entity.setMediaEntity(true);
-
- getClient().getBinder().add(entity, client.getObjectFactory().newPrimitiveProperty("Information",
- client.getObjectFactory().newPrimitiveValueBuilder().setText(info).
- setType(EdmPrimitiveTypeKind.String).build()));
- return entity;
- }
- // validate newly created entities
-
- public ODataEntity validateEntities(final String serviceRootURL,
- final ODataPubFormat format,
- final ODataEntity original,
- final int actualObjectId,
- final Collection<String> expands, final String entitySetName) {
-
- final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(serviceRootURL).
- appendEntitySetSegment(entitySetName).appendKeySegment(actualObjectId);
-
- if (expands != null) {
- for (String expand : expands) {
- uriBuilder.expand(expand);
- }
- }
- final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
- req.setFormat(format);
-
- final ODataRetrieveResponse<ODataEntity> res = req.execute();
- assertEquals(200, res.getStatusCode());
-
- final ODataEntity actual = res.getBody();
- assertNotNull(actual);
-
- validateLinks(original.getAssociationLinks(), actual.getAssociationLinks());
- validateLinks(original.getEditMediaLinks(), actual.getEditMediaLinks());
- validateLinks(original.getNavigationLinks(), actual.getNavigationLinks());
-
- checkProperties(original.getProperties(), actual.getProperties());
- return actual;
- }
- // compares links of the newly created entity with the previous
-
- public void validateLinks(final Collection<ODataLink> original, final Collection<ODataLink> actual) {
- assertTrue(original.size() <= actual.size());
-
- for (ODataLink originalLink : original) {
- ODataLink foundOriginal = null;
- ODataLink foundActual = null;
-
- for (ODataLink actualLink : actual) {
-
- if (actualLink.getType() == originalLink.getType()
- && (originalLink.getLink() == null
- || actualLink.getLink().toASCIIString().endsWith(originalLink.getLink().toASCIIString()))
- && actualLink.getName().equals(originalLink.getName())) {
-
- foundOriginal = originalLink;
- foundActual = actualLink;
- }
- }
-
- assertNotNull(foundOriginal);
- assertNotNull(foundActual);
-
- if (foundOriginal instanceof ODataInlineEntity && foundActual instanceof ODataInlineEntity) {
- final CommonODataEntity originalInline = ((ODataInlineEntity) foundOriginal).getEntity();
- assertNotNull(originalInline);
-
- final CommonODataEntity actualInline = ((ODataInlineEntity) foundActual).getEntity();
- assertNotNull(actualInline);
-
- checkProperties(originalInline.getProperties(), actualInline.getProperties());
- }
- }
- }
- // compares properties of the newly created entity with the properties that were originally provided
-
- @Override
- public void checkProperties(final Collection<? extends CommonODataProperty> original,
- final Collection<? extends CommonODataProperty> actual) {
-
- assertTrue(original.size() <= actual.size());
-
- final Map<String, CommonODataProperty> actualProperties = new HashMap<String, CommonODataProperty>(actual.size());
-
- for (CommonODataProperty prop : actual) {
- assertFalse(actualProperties.containsKey(prop.getName()));
- actualProperties.put(prop.getName(), prop);
- }
-
- assertTrue(actual.size() <= actualProperties.size());
-
- for (CommonODataProperty prop : original) {
- assertNotNull(prop);
- if (actualProperties.containsKey(prop.getName())) {
- final CommonODataProperty actualProp = actualProperties.get(prop.getName());
- assertNotNull(actualProp);
-
- if (prop.getValue() != null && actualProp.getValue() != null) {
- checkPropertyValue(prop.getName(), prop.getValue(), actualProp.getValue());
- }
- }
- }
- }
- // compares property value of the newly created entity with the property value that were originally provided
-
- @Override
- public void checkPropertyValue(final String propertyName,
- final ODataValue original, final ODataValue actual) {
-
- assertNotNull("Null original value for " + propertyName, original);
- assertNotNull("Null actual value for " + propertyName, actual);
-
- assertEquals("Type mismatch for '" + propertyName + "'",
- original.getClass().getSimpleName(), actual.getClass().getSimpleName());
-
- if (original.isComplex()) {
- final List<CommonODataProperty> originalPropertyValue = new ArrayList<CommonODataProperty>();
- for (CommonODataProperty prop : original.asComplex()) {
- originalPropertyValue.add(prop);
- }
-
- final List<CommonODataProperty> actualPropertyValue = new ArrayList<CommonODataProperty>();
- for (CommonODataProperty prop : actual.asComplex()) {
- actualPropertyValue.add(prop);
- }
-
- checkProperties(originalPropertyValue, actualPropertyValue);
- } else if (original.isCollection()) {
- assertTrue(original.asCollection().size() <= actual.asCollection().size());
-
- boolean found = original.asCollection().isEmpty();
-
- for (ODataValue originalValue : original.asCollection()) {
- for (ODataValue actualValue : actual.asCollection()) {
- try {
- checkPropertyValue(propertyName, originalValue, actualValue);
- found = true;
- } catch (AssertionError error) {
- }
- }
- }
-
- assertTrue("Found " + actual + " and expected " + original, found);
- } else {
- assertTrue("Primitive value for '" + propertyName + "' type mismatch",
- original.asPrimitive().getTypeKind() == actual.asPrimitive().getTypeKind());
-
- assertEquals("Primitive value for '" + propertyName + "' mismatch",
- original.asPrimitive().toString(), actual.asPrimitive().toString());
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
index f98e12a..0204f78 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
@@ -253,7 +253,7 @@ public class PropertyTestITCase extends AbstractTestITCase {
private void updateCollectionProperty(final ODataFormat format) throws IOException {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
- uriBuilder.appendEntitySetSegment("Customer").appendKeySegment(-9).
+ uriBuilder.appendEntitySetSegment("Customer").appendKeySegment(-10).
appendPropertySegment("PrimaryContactInfo").appendPropertySegment("AlternativeNames");
ODataPropertyRequest<ODataProperty> retrieveReq = client.getRetrieveRequestFactory().
@@ -277,7 +277,7 @@ public class PropertyTestITCase extends AbstractTestITCase {
final ODataPropertyUpdateRequest updateReq =
client.getCUDRequestFactory().getPropertyCollectionValueUpdateRequest(uriBuilder.build(),
- alternativeNames);
+ alternativeNames);
if (client.getConfiguration().isUseXHTTPMethod()) {
assertEquals(HttpMethod.POST, updateReq.getMethod());
} else {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityRetrieveTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityRetrieveTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityRetrieveTestITCase.java
index 989dd98..94e316f 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityRetrieveTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityRetrieveTestITCase.java
@@ -22,6 +22,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
import java.net.URI;
import java.util.LinkedHashMap;
@@ -42,7 +43,7 @@ import org.apache.olingo.commons.api.domain.v4.ODataEntity;
import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.format.ODataPubFormat;
-import org.junit.Ignore;
+
import org.junit.Test;
/**
@@ -70,7 +71,13 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
assertEquals(getServiceRoot() + "/Customers(PersonID=1)", entity.getEditLink().toASCIIString());
assertEquals(3, entity.getNavigationLinks().size());
- assertTrue(entity.getAssociationLinks().isEmpty());
+
+ if (ODataPubFormat.ATOM == format) {
+ assertTrue(entity.getAssociationLinks().isEmpty());
+ } else {
+ // In JSON, association links for each $ref link will exist.
+ assertFalse(entity.getAssociationLinks().isEmpty());
+ }
boolean found = false;
@@ -106,7 +113,6 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
}
@Test
- @Ignore
public void withInlineEntryFromJSON() {
// this needs to be full, otherwise there is no mean to recognize links
withInlineEntry(ODataPubFormat.JSON_FULL_METADATA);
@@ -144,7 +150,6 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
}
@Test
- @Ignore
public void withInlineFeedFromJSON() {
// this needs to be full, otherwise there is no mean to recognize links
withInlineFeed(ODataPubFormat.JSON_FULL_METADATA);
@@ -173,7 +178,6 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
}
@Test
- @Ignore
public void rawRequestAsJSON() {
// this needs to be full, otherwise actions will not be provided
rawRequest(ODataPubFormat.JSON_FULL_METADATA);
@@ -203,7 +207,6 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
}
@Test
- @Ignore
public void multiKeyAsJSON() throws EdmPrimitiveTypeException {
multiKey(ODataPubFormat.JSON_FULL_METADATA);
}
@@ -214,7 +217,6 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
}
@Test
- @Ignore
public void checkForETagAsJSON() {
checkForETag(ODataPubFormat.JSON_FULL_METADATA);
}
@@ -237,9 +239,8 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
}
@Test(expected = IllegalArgumentException.class)
- @Ignore
public void issue99() {
- final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Car");
+ final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Orders");
final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setFormat(ODataPubFormat.JSON);
@@ -255,7 +256,6 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
}
@Test
- @Ignore
public void retrieveEntityViaReferenceAsJSON() {
retrieveEntityViaReference(ODataPubFormat.JSON_FULL_METADATA);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
index bc0905c..c120415 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
@@ -36,7 +36,6 @@ import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.domain.v4.ODataEntity;
import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
import org.apache.olingo.commons.api.format.ODataPubFormat;
-import org.junit.Ignore;
import org.junit.Test;
/**
@@ -54,7 +53,6 @@ public class EntitySetTestITCase extends AbstractTestITCase {
}
@Test
- @Ignore
public void rawRequestAsJSON() throws IOException {
rawRequest(ODataPubFormat.JSON);
}
@@ -65,19 +63,16 @@ public class EntitySetTestITCase extends AbstractTestITCase {
}
@Test
- @Ignore
public void readODataEntitySetIteratorFromJSON() {
readODataEntitySetIterator(ODataPubFormat.JSON);
}
@Test
- @Ignore
public void readODataEntitySetIteratorFromJSONFullMeta() {
readODataEntitySetIterator(ODataPubFormat.JSON_FULL_METADATA);
}
@Test
- @Ignore
public void readODataEntitySetIteratorFromJSONNoMeta() {
readODataEntitySetIterator(ODataPubFormat.JSON_NO_METADATA);
}
@@ -88,7 +83,6 @@ public class EntitySetTestITCase extends AbstractTestITCase {
}
@Test
- @Ignore
public void readODataEntitySetWithNextFromJSON() {
readEntitySetWithNextLink(ODataPubFormat.JSON_FULL_METADATA);
}
@@ -126,7 +120,7 @@ public class EntitySetTestITCase extends AbstractTestITCase {
req.setFormat(format);
final ODataRetrieveResponse<ODataEntitySetIterator<ODataEntitySet, ODataEntity>> res = req.execute();
- final ODataEntitySetIterator feedIterator = res.getBody();
+ final ODataEntitySetIterator<ODataEntitySet, ODataEntity> feedIterator = res.getBody();
assertNotNull(feedIterator);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/ServiceDocumentTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/ServiceDocumentTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/ServiceDocumentTestITCase.java
index 7a28ed1..133c929 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/ServiceDocumentTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/ServiceDocumentTestITCase.java
@@ -26,7 +26,6 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataServiceD
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.commons.api.domain.ODataServiceDocument;
import org.apache.olingo.commons.api.format.ODataFormat;
-import org.junit.Ignore;
import org.junit.Test;
public class ServiceDocumentTestITCase extends AbstractTestITCase {
@@ -40,9 +39,9 @@ public class ServiceDocumentTestITCase extends AbstractTestITCase {
assertEquals(200, res.getStatusCode());
final ODataServiceDocument serviceDocument = res.getBody();
- assertEquals(12, serviceDocument.getEntitySetTitles().size());
- assertEquals(6, serviceDocument.getSingletonTitles().size());
- assertEquals(6, serviceDocument.getFunctionImportTitles().size());
+ assertEquals(12, serviceDocument.getEntitySets().size());
+ assertEquals(6, serviceDocument.getSingletons().size());
+ assertEquals(6, serviceDocument.getFunctionImports().size());
assertTrue(res.getContextURL().toASCIIString().endsWith("/StaticService/V40/Static.svc/$metadata"));
assertEquals(URI.create(testStaticServiceRootURL + "/ProductDetails"),
@@ -59,7 +58,6 @@ public class ServiceDocumentTestITCase extends AbstractTestITCase {
}
@Test
- @Ignore
public void retrieveServiceDocumentAsJSON() {
retrieveServiceDocument(ODataFormat.JSON);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ServiceDocumentTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ServiceDocumentTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ServiceDocumentTest.java
index 4dc4fae..08067ab 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ServiceDocumentTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/ServiceDocumentTest.java
@@ -23,11 +23,13 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.net.URI;
+import org.apache.olingo.client.api.data.ServiceDocument;
import org.apache.olingo.client.api.v4.ODataClient;
import org.apache.olingo.commons.api.domain.ODataServiceDocument;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.client.core.AbstractTest;
+import org.apache.olingo.commons.api.data.Container;
import org.junit.Test;
public class ServiceDocumentTest extends AbstractTest {
@@ -42,13 +44,18 @@ public class ServiceDocumentTest extends AbstractTest {
}
private ODataServiceDocument parse(final ODataFormat format) {
- final ODataServiceDocument serviceDocument = getClient().getReader().readServiceDocument(
+ Container<ServiceDocument> service = getClient().getDeserializer().toServiceDocument(
getClass().getResourceAsStream("serviceDocument." + getFileExtension(format)), format);
+
+ assertEquals(URI.create("http://host/service/$metadata"), service.getContextURL());
+ assertEquals("W/\"MjAxMy0wNS0xM1QxNDo1NFo=\"", service.getMetadataETag());
+
+ final ODataServiceDocument serviceDocument = getClient().getBinder().getODataServiceDocument(service.getObject());
assertNotNull(serviceDocument);
- assertEquals(URI.create("http://host/service/$metadata"), serviceDocument.getMetadataContext());
+
assertTrue(serviceDocument.getEntitySetTitles().contains("Order Details"));
assertEquals(URI.create("http://host/service/TopProducts"),
- serviceDocument.getFunctionImportURI("Best-Selling Products"));
+ serviceDocument.getFunctionImportURI("TopProducts"));
assertEquals(URI.create("http://host/HR/"),
serviceDocument.getRelatedServiceDocumentsURIs().iterator().next());
@@ -63,6 +70,5 @@ public class ServiceDocumentTest extends AbstractTest {
@Test
public void xml() {
final ODataServiceDocument serviceDocument = parse(ODataFormat.XML);
- assertEquals("W/\"MjAxMy0wNS0xM1QxNDo1NFo=\"", serviceDocument.getMetadataETag());
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/serviceDocument.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/serviceDocument.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/serviceDocument.json
index 2e7f066..a51cd30 100644
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/serviceDocument.json
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/serviceDocument.json
@@ -1,5 +1,6 @@
{
"@odata.context": "http://host/service/$metadata",
+ "@odata.metadataEtag": "W/\"MjAxMy0wNS0xM1QxNDo1NFo=\"",
"value": [
{
"name": "Orders",
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataServiceDocument.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataServiceDocument.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataServiceDocument.java
index 13f807b..281bd18 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataServiceDocument.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataServiceDocument.java
@@ -25,10 +25,6 @@ import java.util.Map;
public class ODataServiceDocument {
- private URI metadataContext;
-
- private String metadataETag;
-
private final Map<String, URI> entitySets = new HashMap<String, URI>();
private final Map<String, URI> functionImports = new HashMap<String, URI>();
@@ -37,22 +33,6 @@ public class ODataServiceDocument {
private final Map<String, URI> relatedServiceDocuments = new HashMap<String, URI>();
- public URI getMetadataContext() {
- return metadataContext;
- }
-
- public void setMetadataContext(final URI metadataContext) {
- this.metadataContext = metadataContext;
- }
-
- public String getMetadataETag() {
- return metadataETag;
- }
-
- public void setMetadataETag(final String metadataETag) {
- this.metadataETag = metadataETag;
- }
-
public Map<String, URI> getEntitySets() {
return entitySets;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonDeserializer.java
index 4ba9671..6731259 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonDeserializer.java
@@ -25,12 +25,13 @@ import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.commons.api.data.CollectionValue;
import org.apache.olingo.commons.api.data.ComplexValue;
+import org.apache.olingo.commons.api.data.Container;
import org.apache.olingo.commons.api.data.Value;
import org.apache.olingo.commons.api.domain.ODataPropertyType;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
-abstract class AbstractJsonDeserializer<T> extends ODataJacksonDeserializer<T> {
+abstract class AbstractJsonDeserializer<T> extends ODataJacksonDeserializer<Container<T>> {
private JSONGeoValueDeserializer geoDeserializer;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryDeserializer.java
index ef3eaf1..8abd3f3 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONEntryDeserializer.java
@@ -22,6 +22,7 @@ import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.ObjectCodec;
+import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ArrayNode;
@@ -33,6 +34,7 @@ import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.Container;
import org.apache.olingo.commons.api.data.Link;
import org.apache.olingo.commons.api.domain.ODataLinkType;
import org.apache.olingo.commons.api.domain.ODataOperation;
@@ -58,7 +60,10 @@ public class JSONEntryDeserializer extends AbstractJsonDeserializer<JSONEntryImp
if (inline instanceof ObjectNode) {
link.setType(ODataLinkType.ENTITY_NAVIGATION.toString());
- link.setInlineEntry(inline.traverse(codec).readValuesAs(JSONEntryImpl.class).next());
+
+ link.setInlineEntry(inline.traverse(codec).<Container<JSONEntryImpl>>readValueAs(
+ new TypeReference<JSONEntryImpl>() {
+ }).getObject());
}
if (inline instanceof ArrayNode) {
@@ -67,7 +72,9 @@ public class JSONEntryDeserializer extends AbstractJsonDeserializer<JSONEntryImp
final JSONFeedImpl feed = new JSONFeedImpl();
final Iterator<JsonNode> entries = ((ArrayNode) inline).elements();
while (entries.hasNext()) {
- feed.getEntries().add(entries.next().traverse(codec).readValuesAs(JSONEntryImpl.class).next());
+ feed.getEntries().add(entries.next().traverse(codec).<Container<JSONEntryImpl>>readValuesAs(
+ new TypeReference<JSONEntryImpl>() {
+ }).next().getObject());
}
link.setInlineFeed(feed);
@@ -77,7 +84,7 @@ public class JSONEntryDeserializer extends AbstractJsonDeserializer<JSONEntryImp
}
@Override
- protected JSONEntryImpl doDeserialize(final JsonParser parser, final DeserializationContext ctxt)
+ protected Container<JSONEntryImpl> doDeserialize(final JsonParser parser, final DeserializationContext ctxt)
throws IOException, JsonProcessingException {
final ObjectNode tree = (ObjectNode) parser.getCodec().readTree(parser);
@@ -86,18 +93,30 @@ public class JSONEntryDeserializer extends AbstractJsonDeserializer<JSONEntryImp
throw new JsonParseException("Expected OData Entity, found EntitySet", parser.getCurrentLocation());
}
+ final String metadataETag;
+ final URI contextURL;
final JSONEntryImpl entry = new JSONEntryImpl();
- String contextURL = null;
+ if (tree.hasNonNull(Constants.JSON_METADATA_ETAG)) {
+ metadataETag = tree.get(Constants.JSON_METADATA_ETAG).textValue();
+ tree.remove(Constants.JSON_METADATA_ETAG);
+ } else {
+ metadataETag = null;
+ }
+
if (tree.hasNonNull(Constants.JSON_CONTEXT)) {
- contextURL = tree.get(Constants.JSON_CONTEXT).textValue();
+ contextURL = URI.create(tree.get(Constants.JSON_CONTEXT).textValue());
tree.remove(Constants.JSON_CONTEXT);
} else if (tree.hasNonNull(Constants.JSON_METADATA)) {
- contextURL = tree.get(Constants.JSON_METADATA).textValue();
+ contextURL = URI.create(tree.get(Constants.JSON_METADATA).textValue());
tree.remove(Constants.JSON_METADATA);
+ } else {
+ contextURL = null;
}
+
if (contextURL != null) {
- entry.setBaseURI(contextURL.substring(0, contextURL.indexOf(Constants.METADATA)));
+ String url = contextURL.toASCIIString();
+ entry.setBaseURI(url.substring(0, url.indexOf(Constants.METADATA)));
}
if (tree.hasNonNull(jsonETag)) {
@@ -237,6 +256,6 @@ public class JSONEntryDeserializer extends AbstractJsonDeserializer<JSONEntryImp
}
}
- return entry;
+ return new Container<JSONEntryImpl>(contextURL, metadataETag, entry);
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedDeserializer.java
index d278a34..3c180b9 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedDeserializer.java
@@ -20,6 +20,7 @@ package org.apache.olingo.commons.core.data;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
@@ -27,6 +28,7 @@ import java.io.IOException;
import java.net.URI;
import java.util.Iterator;
import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.Container;
/**
* Reads JSON string into a feed.
@@ -36,7 +38,7 @@ import org.apache.olingo.commons.api.Constants;
public class JSONFeedDeserializer extends AbstractJsonDeserializer<JSONFeedImpl> {
@Override
- protected JSONFeedImpl doDeserialize(final JsonParser parser, final DeserializationContext ctxt)
+ protected Container<JSONFeedImpl> doDeserialize(final JsonParser parser, final DeserializationContext ctxt)
throws IOException, JsonProcessingException {
final ObjectNode tree = (ObjectNode) parser.getCodec().readTree(parser);
@@ -45,16 +47,29 @@ public class JSONFeedDeserializer extends AbstractJsonDeserializer<JSONFeedImpl>
return null;
}
+ final String metadataETag;
+ final URI contextURL;
final JSONFeedImpl feed = new JSONFeedImpl();
+ if (tree.hasNonNull(Constants.JSON_METADATA_ETAG)) {
+ metadataETag = tree.get(Constants.JSON_METADATA_ETAG).textValue();
+ tree.remove(Constants.JSON_METADATA_ETAG);
+ } else {
+ metadataETag = null;
+ }
+
if (tree.hasNonNull(Constants.JSON_CONTEXT)) {
- feed.setContextURL(URI.create(tree.get(Constants.JSON_CONTEXT).textValue()));
+ contextURL = URI.create(tree.get(Constants.JSON_CONTEXT).textValue());
tree.remove(Constants.JSON_CONTEXT);
} else if (tree.hasNonNull(Constants.JSON_METADATA)) {
- feed.setContextURL(URI.create(tree.get(Constants.JSON_METADATA).textValue()));
+ contextURL = URI.create(tree.get(Constants.JSON_METADATA).textValue());
tree.remove(Constants.JSON_METADATA);
+ } else {
+ contextURL = null;
}
+ feed.setMetadataContextURL(contextURL);
+
if (tree.hasNonNull(Constants.JSON_COUNT)) {
feed.setCount(tree.get(Constants.JSON_COUNT).asInt());
}
@@ -64,10 +79,13 @@ public class JSONFeedDeserializer extends AbstractJsonDeserializer<JSONFeedImpl>
if (tree.hasNonNull(Constants.VALUE)) {
for (final Iterator<JsonNode> itor = tree.get(Constants.VALUE).iterator(); itor.hasNext();) {
- feed.getEntries().add(itor.next().traverse(parser.getCodec()).readValueAs(JSONEntryImpl.class));
+ feed.getEntries().add(
+ itor.next().traverse(parser.getCodec()).<Container<JSONEntryImpl>>readValueAs(
+ new TypeReference<JSONEntryImpl>() {
+ }).getObject());
}
}
- return feed;
+ return new Container<JSONFeedImpl>(contextURL, metadataETag, feed);
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedImpl.java
index 8994e88..0a4db73 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONFeedImpl.java
@@ -38,7 +38,7 @@ public class JSONFeedImpl extends AbstractPayloadObject implements Feed {
private static final long serialVersionUID = -3576372289800799417L;
- private URI contextURL;
+ private URI metadataContextURL;
private String id;
@@ -51,16 +51,16 @@ public class JSONFeedImpl extends AbstractPayloadObject implements Feed {
@Override
public URI getBaseURI() {
URI baseURI = null;
- if (contextURL != null) {
- final String metadataURI = contextURL.toASCIIString();
+ if (metadataContextURL != null) {
+ final String metadataURI = metadataContextURL.toASCIIString();
baseURI = URI.create(metadataURI.substring(0, metadataURI.indexOf(Constants.METADATA)));
}
return baseURI;
}
- public void setContextURL(final URI context) {
- this.contextURL = context;
+ public void setMetadataContextURL(final URI metadataContextURL) {
+ this.metadataContextURL = metadataContextURL;
}
@Override
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONODataErrorDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONODataErrorDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONODataErrorDeserializer.java
index f033de1..de3ffa1 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONODataErrorDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONODataErrorDeserializer.java
@@ -25,11 +25,12 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import java.io.IOException;
import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.Container;
public class JSONODataErrorDeserializer extends AbstractJsonDeserializer<JSONODataErrorImpl> {
@Override
- protected JSONODataErrorImpl doDeserialize(final JsonParser parser, final DeserializationContext ctxt)
+ protected Container<JSONODataErrorImpl> doDeserialize(final JsonParser parser, final DeserializationContext ctxt)
throws IOException, JsonProcessingException {
final JSONODataErrorImpl error = new JSONODataErrorImpl();
@@ -54,7 +55,6 @@ public class JSONODataErrorDeserializer extends AbstractJsonDeserializer<JSONODa
}
}
- return error;
+ return new Container<JSONODataErrorImpl>(null, null, error);
}
-
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java
index 737ed53..381b6d4 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/JSONPropertyDeserializer.java
@@ -23,8 +23,10 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.node.ObjectNode;
import java.io.IOException;
+import java.net.URI;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.data.Container;
/**
* Parse JSON string into <tt>JSONPropertyImpl</tt>.
@@ -34,27 +36,35 @@ import org.apache.olingo.commons.api.Constants;
public class JSONPropertyDeserializer extends AbstractJsonDeserializer<JSONPropertyImpl> {
@Override
- protected JSONPropertyImpl doDeserialize(final JsonParser parser, final DeserializationContext ctxt)
+ protected Container<JSONPropertyImpl> doDeserialize(final JsonParser parser, final DeserializationContext ctxt)
throws IOException, JsonProcessingException {
final ObjectNode tree = (ObjectNode) parser.getCodec().readTree(parser);
+ final String metadataETag;
+ final URI contextURL;
final JSONPropertyImpl property = new JSONPropertyImpl();
+ if (tree.hasNonNull(Constants.JSON_METADATA_ETAG)) {
+ metadataETag = tree.get(Constants.JSON_METADATA_ETAG).textValue();
+ tree.remove(Constants.JSON_METADATA_ETAG);
+ } else {
+ metadataETag = null;
+ }
+
if (tree.hasNonNull(Constants.JSON_CONTEXT)) {
- final String contextURL = tree.get(Constants.JSON_CONTEXT).textValue();
- property.setName(StringUtils.substringAfterLast(contextURL, "/"));
+ contextURL = URI.create(tree.get(Constants.JSON_CONTEXT).textValue());
+ property.setName(StringUtils.substringAfterLast(contextURL.toASCIIString(), "/"));
tree.remove(Constants.JSON_CONTEXT);
} else if (tree.hasNonNull(Constants.JSON_METADATA)) {
- final String metadata = tree.get(Constants.JSON_METADATA).textValue();
- final int dashIdx = metadata.lastIndexOf('#');
- if (dashIdx != -1) {
- property.setType(metadata.substring(dashIdx + 1));
- }
+ contextURL = URI.create(tree.get(Constants.JSON_METADATA).textValue());
+ property.setType(StringUtils.substringAfterLast(contextURL.toASCIIString(), "#"));
tree.remove(Constants.JSON_METADATA);
+ } else {
+ contextURL = null;
}
- if (tree.has(jsonType) && property.getType() == null) {
+ if (tree.has(jsonType)) {
property.setType(tree.get(jsonType).asText());
}
@@ -66,6 +76,6 @@ public class JSONPropertyDeserializer extends AbstractJsonDeserializer<JSONPrope
value(property, tree.has(Constants.VALUE) ? tree.get(Constants.VALUE) : tree);
}
- return property;
+ return new Container<JSONPropertyImpl>(contextURL, metadataETag, property);
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPoint.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPoint.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPoint.java
index 9249055..c393bb5 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPoint.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeographyMultiPoint.java
@@ -22,7 +22,6 @@ import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
import org.apache.olingo.commons.api.edm.geo.MultiPoint;
-import org.apache.olingo.commons.api.edm.geo.Point;
public final class EdmGeographyMultiPoint extends AbstractGeospatialType<MultiPoint> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryCollection.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryCollection.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryCollection.java
index 3c5a0e2..3000e84 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryCollection.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/primitivetype/EdmGeometryCollection.java
@@ -22,7 +22,6 @@ import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
import org.apache.olingo.commons.api.edm.geo.Geospatial.Type;
import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
-import org.apache.olingo.commons.api.edm.geo.Point;
public final class EdmGeometryCollection extends AbstractGeospatialType<GeospatialCollection> {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/c73772f0/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
index 616766b..96043c7 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
@@ -18,9 +18,11 @@
*/
package org.apache.olingo.commons.core.op;
+import com.fasterxml.jackson.core.type.TypeReference;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
+import java.lang.reflect.Type;
import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLEventWriter;
import javax.xml.stream.XMLOutputFactory;
@@ -101,10 +103,9 @@ public abstract class AbstractODataDeserializer extends AbstractJacksonTool impl
writer.flush();
writer.close();
- return (Container<T>) atomDeserializer.getContainer(
- start, getXmlMapper().readValue(new ByteArrayInputStream(baos.toByteArray()), reference));
+ final V obj = getXmlMapper().readValue(new ByteArrayInputStream(baos.toByteArray()), reference);
+ return (Container<T>) (obj instanceof Container ? obj : atomDeserializer.getContainer(start, obj));
} catch (Exception e) {
- e.printStackTrace();
throw new IllegalArgumentException("While deserializing " + reference.getName(), e);
}
}
@@ -119,7 +120,14 @@ public abstract class AbstractODataDeserializer extends AbstractJacksonTool impl
protected <T, V extends T> Container<T> json(final InputStream input, final Class<V> reference) {
try {
- return new Container<T>(null, null, getObjectMapper().readValue(input, reference));
+ T obj = getObjectMapper().readValue(input, new TypeReference<V>() {
+ @Override
+ public Type getType() {
+ return reference;
+ }
+ });
+
+ return obj instanceof Container ? (Container<T>) obj : new Container<T>(null, null, obj);
} catch (Exception e) {
throw new IllegalArgumentException("While deserializing " + reference.getName(), e);
}
[46/51] [abbrv] git commit: [OLINGO-175] V4 Entity create test
Posted by il...@apache.org.
[OLINGO-175] V4 Entity create test
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/850d44e0
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/850d44e0
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/850d44e0
Branch: refs/heads/master
Commit: 850d44e00ebf4a8e9a588b0cf5a46ae4d4a5fb55
Parents: c73772f
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Mon Mar 31 17:57:31 2014 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Mon Mar 31 17:57:31 2014 +0200
----------------------------------------------------------------------
.../olingo/fit/utils/AbstractUtilities.java | 13 +++
.../org/apache/olingo/fit/utils/Commons.java | 1 +
.../core/it/v4/EntityCreateTestITCase.java | 84 ++++++++++++++++++++
3 files changed, 98 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/850d44e0/fit/src/main/java/org/apache/olingo/fit/utils/AbstractUtilities.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/AbstractUtilities.java b/fit/src/main/java/org/apache/olingo/fit/utils/AbstractUtilities.java
index 5b23366..b4d71b5 100644
--- a/fit/src/main/java/org/apache/olingo/fit/utils/AbstractUtilities.java
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/AbstractUtilities.java
@@ -511,6 +511,19 @@ public abstract class AbstractUtilities {
}
}
sequence.put(entitySetName, Integer.valueOf(res));
+ } else if ("Orders".equals(entitySetName)) {
+ try {
+ final Map<String, InputStream> value =
+ getPropertyValues(entity, Collections.<String>singletonList("OrderID"));
+ res = value.isEmpty() ? null : IOUtils.toString(value.values().iterator().next());
+ } catch (Exception e) {
+ if (sequence.containsKey(entitySetName)) {
+ res = String.valueOf(sequence.get(entitySetName) + 1);
+ } else {
+ throw new Exception(String.format("Unable to retrieve entity key value for %s", entitySetName));
+ }
+ }
+ sequence.put(entitySetName, Integer.valueOf(res));
} else if ("Customer".equals(entitySetName)) {
try {
final Map<String, InputStream> value =
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/850d44e0/fit/src/main/java/org/apache/olingo/fit/utils/Commons.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/Commons.java b/fit/src/main/java/org/apache/olingo/fit/utils/Commons.java
index c0031f1..a1c658a 100644
--- a/fit/src/main/java/org/apache/olingo/fit/utils/Commons.java
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/Commons.java
@@ -67,6 +67,7 @@ public abstract class Commons {
sequence.put("Order", 1000);
sequence.put("ComputerDetail", 1000);
sequence.put("AllGeoTypesSet", 1000);
+ sequence.put("Orders", 1000);
mediaContent.put("CustomerInfo", "CustomerinfoId");
mediaContent.put("Car", "VIN");
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/850d44e0/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityCreateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityCreateTestITCase.java
new file mode 100644
index 0000000..0044e73
--- /dev/null
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityCreateTestITCase.java
@@ -0,0 +1,84 @@
+/*
+ * 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.client.core.it.v4;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.v4.ODataEntity;
+import org.apache.olingo.commons.api.domain.v4.ODataProperty;
+import org.apache.olingo.commons.api.domain.ODataValue;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
+import org.apache.olingo.commons.core.domain.v3.ODataCollectionValueImpl;
+import org.apache.olingo.commons.core.domain.v4.ODataEntityImpl;
+import org.junit.Test;
+
+public class EntityCreateTestITCase extends AbstractTestITCase {
+
+ private void createOrder(final ODataPubFormat format, final int id) {
+ final ODataEntity order = new ODataEntityImpl("Microsoft.Test.OData.Services.ODataWCFService.Order");
+
+ final ODataProperty orderId = getClient().getObjectFactory().newPrimitiveProperty("OrderID",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.Int32).setValue(id).build());
+ order.getProperties().add(orderId);
+
+ final ODataProperty orderDate = getClient().getObjectFactory().newPrimitiveProperty("OrderDate",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.DateTimeOffset).setText("2011-03-04T16:03:57Z").build());
+ order.getProperties().add(orderDate);
+
+ final ODataProperty shelfLife = getClient().getObjectFactory().newPrimitiveProperty("ShelfLife",
+ getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.Duration).setText("PT0.0000001S").build());
+ order.getProperties().add(shelfLife);
+
+ // TODO: this should be possible via getClient().getObjectFactory().newCollectionValue()
+ final ODataCollectionValue<ODataValue> orderShelfLifesValue =
+ new ODataCollectionValueImpl("Collection(Duration)");
+ orderShelfLifesValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.Duration).setText("PT0.0000001S").build());
+ orderShelfLifesValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.Duration).setText("PT0.0000002S").build());
+ final ODataProperty orderShelfLifes = getClient().getObjectFactory().newCollectionProperty("OrderShelfLifes",
+ orderShelfLifesValue);
+ order.getProperties().add(orderShelfLifes);
+
+ final ODataEntityCreateRequest<ODataEntity> req = getClient().getCUDRequestFactory().getEntityCreateRequest(
+ getClient().getURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("Orders").build(), order);
+ req.setFormat(format);
+ final ODataEntity created = req.execute().getBody();
+ assertNotNull(created);
+ assertEquals(2, created.getProperty("OrderShelfLifes").getCollectionValue().size());
+ }
+
+ @Test
+ public void atom() {
+ createOrder(ODataPubFormat.ATOM, 1000);
+ }
+
+ @Test
+ public void json() {
+ createOrder(ODataPubFormat.JSON, 1001);
+ }
+}
[50/51] [abbrv] git commit: [OLINGO-200] More ref tests
Posted by il...@apache.org.
[OLINGO-200] More ref tests
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/6aaec814
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/6aaec814
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/6aaec814
Branch: refs/heads/master
Commit: 6aaec814c423d14c20db3285b1bbd78173a35ec9
Parents: 525767c
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Tue Apr 1 16:04:24 2014 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Tue Apr 1 16:04:24 2014 +0200
----------------------------------------------------------------------
.../olingo/client/core/v4/EntitySetTest.java | 32 +++++++++++++--
.../olingo/client/core/v4/EntityTest.java | 23 +++++++++++
.../apache/olingo/client/core/v4/JSONTest.java | 19 +++++++++
.../apache/olingo/client/core/v4/Customers.xml | 42 ++++++++++----------
.../core/v4/collectionOfEntityReferences.json | 11 +++++
.../core/v4/collectionOfEntityReferences.xml | 25 ++++++++++++
.../olingo/client/core/v4/entityReference.json | 4 ++
.../olingo/client/core/v4/entityReference.xml | 22 ++++++++++
.../apache/olingo/commons/api/Constants.java | 4 +-
.../commons/core/data/AbstractAtomDealer.java | 4 +-
.../commons/core/data/AtomDeserializer.java | 27 +++++++------
.../commons/core/data/AtomSerializer.java | 28 ++++++++++---
12 files changed, 195 insertions(+), 46 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6aaec814/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntitySetTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntitySetTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntitySetTest.java
index 6708be6..cbca942 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntitySetTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntitySetTest.java
@@ -25,9 +25,9 @@ import static org.junit.Assert.assertEquals;
import java.io.IOException;
import java.io.InputStream;
import org.apache.olingo.client.api.v4.ODataClient;
-import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.core.AbstractTest;
+import org.apache.olingo.commons.api.domain.v4.ODataEntity;
import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
import org.apache.olingo.commons.core.op.ResourceFactory;
import org.junit.Test;
@@ -48,8 +48,8 @@ public class EntitySetTest extends AbstractTest {
assertEquals(2, entitySet.getEntities().size());
assertNull(entitySet.getNext());
- final CommonODataEntitySet written = getClient().getBinder().getODataEntitySet(getClient().
- getBinder().getFeed(entitySet, ResourceFactory.feedClassForFormat(format == ODataPubFormat.ATOM)));
+ final ODataEntitySet written = getClient().getBinder().getODataEntitySet(getClient().getBinder().
+ getFeed(entitySet, ResourceFactory.feedClassForFormat(format == ODataPubFormat.ATOM)));
assertEquals(entitySet, written);
}
@@ -62,4 +62,30 @@ public class EntitySetTest extends AbstractTest {
public void fromJSON() throws IOException {
read(ODataPubFormat.JSON);
}
+
+ private void ref(final ODataPubFormat format) {
+ final InputStream input = getClass().getResourceAsStream("collectionOfEntityReferences." + getSuffix(format));
+ final ODataEntitySet entitySet = getClient().getBinder().getODataEntitySet(
+ getClient().getDeserializer().toFeed(input, format).getObject());
+ assertNotNull(entitySet);
+
+ for (ODataEntity entity : entitySet.getEntities()) {
+ assertNotNull(entity.getReference());
+ }
+ entitySet.setCount(entitySet.getEntities().size());
+
+ final ODataEntitySet written = getClient().getBinder().getODataEntitySet(getClient().getBinder().
+ getFeed(entitySet, ResourceFactory.feedClassForFormat(format == ODataPubFormat.ATOM)));
+ assertEquals(entitySet, written);
+ }
+
+ @Test
+ public void atomRef() {
+ ref(ODataPubFormat.ATOM);
+ }
+
+ @Test
+ public void jsonRef() {
+ ref(ODataPubFormat.JSON);
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6aaec814/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
index e061be6..5b8f586 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
@@ -224,4 +224,27 @@ public class EntityTest extends AbstractTest {
public void jsonWithStream() {
withStream(ODataPubFormat.JSON_FULL_METADATA);
}
+
+ private void ref(final ODataPubFormat format) {
+ final InputStream input = getClass().getResourceAsStream("entityReference." + getSuffix(format));
+ final ODataEntity entity = getClient().getBinder().getODataEntity(
+ getClient().getDeserializer().toEntry(input, format).getObject());
+ assertNotNull(entity);
+
+ assertNotNull(entity.getReference());
+
+ final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
+ getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
+ assertEquals(entity, written);
+ }
+
+ @Test
+ public void atomRef() {
+ ref(ODataPubFormat.ATOM);
+ }
+
+ @Test
+ public void jsonRef() {
+ ref(ODataPubFormat.JSON);
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6aaec814/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java
index 770f112..791c1c7 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java
@@ -115,6 +115,20 @@ public class JSONTest extends AbstractTest {
assertEquals(orig, OBJECT_MAPPER.readTree(new ByteArrayInputStream(actual.getBytes())));
}
+ protected void feed(final String filename, final ODataPubFormat format) throws Exception {
+ final StringWriter writer = new StringWriter();
+ getClient().getSerializer().feed(getClient().getDeserializer().toFeed(
+ getClass().getResourceAsStream(filename + "." + getSuffix(format)), format).getObject(), writer);
+
+ assertSimilar(filename + "." + getSuffix(format), writer.toString());
+ }
+
+ @Test
+ public void feeds() throws Exception {
+ feed("Customers", getODataPubFormat());
+ feed("collectionOfEntityReferences", getODataPubFormat());
+ }
+
protected void entry(final String filename, final ODataPubFormat format) throws Exception {
final StringWriter writer = new StringWriter();
getClient().getSerializer().entry(getClient().getDeserializer().toEntry(
@@ -137,6 +151,8 @@ public class JSONTest extends AbstractTest {
public void entries() throws Exception {
entry("Products_5", getODataPubFormat());
entry("VipCustomer", getODataPubFormat());
+ entry("Advertisements_f89dee73-af9f-4cd4-b330-db93c25ff3c7", getODataPubFormat());
+ entry("entityReference", getODataPubFormat());
}
protected void property(final String filename, final ODataFormat format) throws Exception {
@@ -150,5 +166,8 @@ public class JSONTest extends AbstractTest {
@Test
public void properties() throws Exception {
property("Products_5_SkinColor", getODataFormat());
+ property("Products_5_CoverColors", getODataFormat());
+ property("Employees_3_HomeAddress", getODataFormat());
+ property("Employees_3_HomeAddress", getODataFormat());
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6aaec814/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customers.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customers.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customers.xml
index 9b3d870..aa416d2 100644
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customers.xml
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Customers.xml
@@ -28,26 +28,26 @@
m:context="http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Customers">
<m:count>2</m:count>
<id>http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers</id>
- <title />
+ <title/>
<updated>2014-03-31T09:35:14Z</updated>
<entry>
<id>http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)</id>
- <category term="#Microsoft.Test.OData.Services.ODataWCFService.Customer" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
- <link rel="edit" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)" />
- <link rel="http://docs.oasis-open.org/odata/ns/related/Parent" type="application/atom+xml;type=entry" title="Parent" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)/Parent" />
- <link rel="http://docs.oasis-open.org/odata/ns/related/Orders" type="application/atom+xml;type=feed" title="Orders" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)/Orders" />
- <link rel="http://docs.oasis-open.org/odata/ns/related/Company" type="application/atom+xml;type=entry" title="Company" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)/Company" />
- <title />
+ <category term="#Microsoft.Test.OData.Services.ODataWCFService.Customer" scheme="http://docs.oasis-open.org/odata/ns/scheme"/>
+ <link rel="edit" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)"/>
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Parent" type="application/atom+xml;type=entry" title="Parent" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)/Parent"/>
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Orders" type="application/atom+xml;type=feed" title="Orders" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)/Orders"/>
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Company" type="application/atom+xml;type=entry" title="Company" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=1)/Company"/>
+ <title/>
<updated>2014-03-31T09:35:14Z</updated>
<author>
- <name />
+ <name/>
</author>
<content type="application/xml">
<m:properties>
<d:PersonID m:type="Int32">1</d:PersonID>
<d:FirstName>Bob</d:FirstName>
<d:LastName>Cat</d:LastName>
- <d:MiddleName m:null="true" />
+ <d:MiddleName m:null="true"/>
<d:HomeAddress m:type="#Microsoft.Test.OData.Services.ODataWCFService.HomeAddress">
<d:Street>1 Microsoft Way</d:Street>
<d:City>London</d:City>
@@ -73,30 +73,30 @@
</entry>
<entry>
<id>http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=2)</id>
- <category term="#Microsoft.Test.OData.Services.ODataWCFService.Customer" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
- <link rel="edit" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=2)" />
- <link rel="http://docs.oasis-open.org/odata/ns/related/Parent" type="application/atom+xml;type=entry" title="Parent" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=2)/Parent" />
- <link rel="http://docs.oasis-open.org/odata/ns/related/Orders" type="application/atom+xml;type=feed" title="Orders" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=2)/Orders" />
- <link rel="http://docs.oasis-open.org/odata/ns/related/Company" type="application/atom+xml;type=entry" title="Company" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=2)/Company" />
- <title />
+ <category term="#Microsoft.Test.OData.Services.ODataWCFService.Customer" scheme="http://docs.oasis-open.org/odata/ns/scheme"/>
+ <link rel="edit" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=2)"/>
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Parent" type="application/atom+xml;type=entry" title="Parent" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=2)/Parent"/>
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Orders" type="application/atom+xml;type=feed" title="Orders" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=2)/Orders"/>
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Company" type="application/atom+xml;type=entry" title="Company" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Customers(PersonID=2)/Company"/>
+ <title/>
<updated>2014-03-31T09:35:14Z</updated>
<author>
- <name />
+ <name/>
</author>
<content type="application/xml">
<m:properties>
<d:PersonID m:type="Int32">2</d:PersonID>
<d:FirstName>Jill</d:FirstName>
<d:LastName>Jones</d:LastName>
- <d:MiddleName m:null="true" />
- <d:HomeAddress m:null="true" />
+ <d:MiddleName m:null="true"/>
+ <d:HomeAddress m:null="true"/>
<d:Home m:type="GeographyPoint">
<gml:Point gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
- <gml:pos>15 161.8</gml:pos>
+ <gml:pos>15.0 161.8</gml:pos>
</gml:Point>
</d:Home>
- <d:Numbers m:type="#Collection(String)" />
- <d:Emails m:type="#Collection(String)" />
+ <d:Numbers m:type="#Collection(String)"/>
+ <d:Emails m:type="#Collection(String)"/>
<d:City>Sydney</d:City>
<d:Birthday m:type="DateTimeOffset">1983-01-15T00:00:00Z</d:Birthday>
<d:TimeBetweenLastTwoOrders m:type="Duration">PT0.0000002S</d:TimeBetweenLastTwoOrders>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6aaec814/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/collectionOfEntityReferences.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/collectionOfEntityReferences.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/collectionOfEntityReferences.json
new file mode 100644
index 0000000..7646ee8
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/collectionOfEntityReferences.json
@@ -0,0 +1,11 @@
+{
+ "@odata.context": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Collection($ref)",
+ "value": [
+ {
+ "@odata.id": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/OrderDetails(OrderID=7,ProductID=5)"
+ },
+ {
+ "@odata.id": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/OrderDetails(OrderID=7,ProductID=6)"
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6aaec814/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/collectionOfEntityReferences.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/collectionOfEntityReferences.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/collectionOfEntityReferences.xml
new file mode 100644
index 0000000..9534270
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/collectionOfEntityReferences.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+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.
+-->
+<feed xmlns:m="http://docs.oasis-open.org/odata/ns/metadata"
+ m:context="http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Collection($ref)"
+ xmlns="http://www.w3.org/2005/Atom">
+ <m:ref id="http://odatae2etest.azurewebsites.net/javatest/DefaultService/OrderDetails(OrderID=7,ProductID=5)"/>
+ <m:ref id="http://odatae2etest.azurewebsites.net/javatest/DefaultService/OrderDetails(OrderID=7,ProductID=6)"/>
+</feed>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6aaec814/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entityReference.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entityReference.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entityReference.json
new file mode 100644
index 0000000..d0b6960
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entityReference.json
@@ -0,0 +1,4 @@
+{
+ "@odata.context": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#$ref",
+ "@odata.id": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/Employees(PersonID=3)"
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6aaec814/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entityReference.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entityReference.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entityReference.xml
new file mode 100644
index 0000000..d04613b
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entityReference.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+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.
+-->
+<m:ref m:context="http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#$ref"
+ id="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Employees(PersonID=3)"
+ xmlns:m="http://docs.oasis-open.org/odata/ns/metadata"/>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6aaec814/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
index a1aec31..882c811 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
@@ -170,9 +170,9 @@ public interface Constants {
public final static String ATOM_ELEM_ENTRY_REF = "ref";
- public final static String ATOM_ELEM_ENTRY_REF_ID = "id";
+ public final static String ATOM_ATTR_ID = "id";
- public final static QName QNAME_ATOM_ELEM_ENTRY_REF_ID = new QName(ATOM_ELEM_ENTRY_REF_ID);
+ public final static QName QNAME_ATOM_ATTR_ID = new QName(ATOM_ATTR_ID);
public static final QName QNAME_ATOM_ELEM_ENTRY = new QName(NS_ATOM, ATOM_ELEM_ENTRY);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6aaec814/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java
index e9338f1..f4944d6 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java
@@ -56,7 +56,7 @@ abstract class AbstractAtomDealer {
protected final QName contextQName;
- protected final QName entityRefQName;
+ protected final QName entryRefQName;
protected final QName v4PropertyValueQName;
@@ -92,7 +92,7 @@ abstract class AbstractAtomDealer {
new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_DATASERVICES), Constants.NEXT_LINK_REL);
this.contextQName =
new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.CONTEXT);
- this.entityRefQName =
+ this.entryRefQName =
new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ATOM_ELEM_ENTRY_REF);
this.v4PropertyValueQName =
new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.VALUE);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6aaec814/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
index 722ea50..c748f59 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
@@ -171,9 +171,20 @@ public class AtomDeserializer extends AbstractAtomDealer {
}
}
+ private AtomEntryImpl entryRef(final StartElement start) throws XMLStreamException {
+ final AtomEntryImpl entry = new AtomEntryImpl();
+
+ final Attribute entryRefId = start.getAttributeByName(Constants.QNAME_ATOM_ATTR_ID);
+ if (entryRefId != null) {
+ entry.setId(entryRefId.getValue());
+ }
+
+ return entry;
+ }
+
private AtomEntryImpl entry(final XMLEventReader reader, final StartElement start) throws XMLStreamException {
final AtomEntryImpl entry;
- if (entityRefQName.equals(start.getName())) {
+ if (entryRefQName.equals(start.getName())) {
entry = entryRef(start);
} else if (Constants.QNAME_ATOM_ELEM_ENTRY.equals(start.getName())) {
entry = new AtomEntryImpl();
@@ -296,18 +307,6 @@ public class AtomDeserializer extends AbstractAtomDealer {
return entry;
}
- private AtomEntryImpl entryRef(final StartElement start) throws XMLStreamException {
- final AtomEntryImpl entry = new AtomEntryImpl();
-
- final Attribute entryRefId = start.getAttributeByName(Constants.QNAME_ATOM_ELEM_ENTRY_REF_ID);
-
- if (entryRefId != null) {
- entry.setId(entryRefId.getValue());
- }
-
- return entry;
- }
-
private Container<AtomEntryImpl> entry(final InputStream input) throws XMLStreamException {
final XMLEventReader reader = FACTORY.createXMLEventReader(input);
final StartElement start = skipBeforeFirstStartElement(reader);
@@ -365,6 +364,8 @@ public class AtomDeserializer extends AbstractAtomDealer {
}
} else if (Constants.QNAME_ATOM_ELEM_ENTRY.equals(event.asStartElement().getName())) {
feed.getEntries().add(entry(reader, event.asStartElement()));
+ } else if (entryRefQName.equals(event.asStartElement().getName())) {
+ feed.getEntries().add(entryRef(event.asStartElement()));
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/6aaec814/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomSerializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomSerializer.java
index c3be420..f89aaee 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomSerializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomSerializer.java
@@ -171,12 +171,25 @@ public class AtomSerializer extends AbstractAtomDealer {
writer.writeEndElement();
}
+ private void entryRef(final XMLStreamWriter writer, final Entry entry) throws XMLStreamException {
+ writer.writeStartElement(Constants.ATOM_ELEM_ENTRY_REF);
+ writer.writeNamespace(StringUtils.EMPTY, version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA));
+ writer.writeAttribute(Constants.ATOM_ATTR_ID, entry.getId());
+ }
+
private void entry(final Writer outWriter, final Entry entry) throws XMLStreamException {
final XMLStreamWriter writer = FACTORY.createXMLStreamWriter(outWriter);
- startDocument(writer, Constants.ATOM_ELEM_ENTRY);
+ if (entry.getType() == null && entry.getProperties().isEmpty()) {
+ writer.writeStartDocument();
+ writer.setDefaultNamespace(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA));
+
+ entryRef(writer, entry);
+ } else {
+ startDocument(writer, Constants.ATOM_ELEM_ENTRY);
- entry(writer, entry);
+ entry(writer, entry);
+ }
writer.writeEndElement();
writer.writeEndDocument();
@@ -206,9 +219,14 @@ public class AtomSerializer extends AbstractAtomDealer {
}
for (Entry entry : feed.getEntries()) {
- writer.writeStartElement(Constants.ATOM_ELEM_ENTRY);
- entry(writer, entry);
- writer.writeEndElement();
+ if (entry.getType() == null && entry.getProperties().isEmpty()) {
+ entryRef(writer, entry);
+ writer.writeEndElement();
+ } else {
+ writer.writeStartElement(Constants.ATOM_ELEM_ENTRY);
+ entry(writer, entry);
+ writer.writeEndElement();
+ }
}
if (feed.getNext() != null) {
[26/51] [abbrv] [OLINGO-200] Introducing interfaces for domain object
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataCollectionValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataCollectionValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataCollectionValueImpl.java
new file mode 100644
index 0000000..1189aae
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataCollectionValueImpl.java
@@ -0,0 +1,90 @@
+/*
+ * 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.commons.core.domain;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import org.apache.olingo.commons.api.domain.AbstractODataValue;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataValue;
+
+/**
+ * OData collection property value.
+ */
+public class ODataCollectionValueImpl extends AbstractODataValue implements ODataCollectionValue {
+
+ private static final long serialVersionUID = -3665659846001987187L;
+
+ /**
+ * Values.
+ */
+ private final List<ODataValue> values = new ArrayList<ODataValue>();
+
+ /**
+ * Constructor.
+ *
+ * @param typeName type name.
+ */
+ public ODataCollectionValueImpl(final String typeName) {
+ super(typeName);
+ }
+
+ /**
+ * Adds a value to the collection.
+ *
+ * @param value value to be added.
+ */
+ @Override
+ public void add(final ODataValue value) {
+ if (value.isPrimitive() || value.isComplex()) {
+ values.add(value);
+ }
+ }
+
+ /**
+ * Value iterator.
+ *
+ * @return value iterator.
+ */
+ @Override
+ public Iterator<ODataValue> iterator() {
+ return values.iterator();
+ }
+
+ /**
+ * Gets collection size.
+ *
+ * @return collection size.
+ */
+ @Override
+ public int size() {
+ return values.size();
+ }
+
+ /**
+ * Checks if collection is empty.
+ *
+ * @return 'TRUE' if empty; 'FALSE' otherwise.
+ */
+ @Override
+ public boolean isEmpty() {
+ return values.isEmpty();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataComplexValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataComplexValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataComplexValueImpl.java
new file mode 100644
index 0000000..07d6055
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataComplexValueImpl.java
@@ -0,0 +1,89 @@
+/*
+ * 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.commons.core.domain;
+
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import org.apache.olingo.commons.api.domain.AbstractODataValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.ODataProperty;
+
+/**
+ * OData complex property value.
+ */
+public class ODataComplexValueImpl extends AbstractODataValue implements ODataComplexValue {
+
+ private static final long serialVersionUID = -1878555027714020431L;
+
+ /**
+ * Complex type fields.
+ */
+ private final Map<String, ODataProperty> fields = new LinkedHashMap<String, ODataProperty>();
+
+ /**
+ * Constructor.
+ *
+ * @param typeName type name.
+ */
+ public ODataComplexValueImpl(final String typeName) {
+ super(typeName);
+ }
+
+ /**
+ * Adds field to the complex type.
+ *
+ * @param field field to be added.
+ */
+ @Override
+ public void add(final ODataProperty field) {
+ fields.put(field.getName(), field);
+ }
+
+ /**
+ * Gets field.
+ *
+ * @param name name of the field to be retrieved.
+ * @return requested field.
+ */
+ @Override
+ public ODataProperty get(final String name) {
+ return fields.get(name);
+ }
+
+ /**
+ * Complex property fields iterator.
+ *
+ * @return fields iterator.
+ */
+ @Override
+ public Iterator<ODataProperty> iterator() {
+ return fields.values().iterator();
+ }
+
+ /**
+ * Gets number of fields.
+ *
+ * @return number of fields.
+ */
+ @Override
+ public int size() {
+ return fields.size();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntityImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntityImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntityImpl.java
new file mode 100644
index 0000000..62d1e42
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntityImpl.java
@@ -0,0 +1,372 @@
+/*
+ * 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.commons.core.domain;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.commons.api.domain.AbstractODataPayload;
+import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.ODataLink;
+import org.apache.olingo.commons.api.domain.ODataOperation;
+import org.apache.olingo.commons.api.domain.ODataProperty;
+
+/**
+ * OData entity.
+ */
+public class ODataEntityImpl extends AbstractODataPayload implements ODataEntity {
+
+ private static final long serialVersionUID = 8360640095932811034L;
+
+ /**
+ * Entity reference.
+ */
+ private String reference;
+
+ /**
+ * ETag.
+ */
+ private String eTag;
+
+ /**
+ * Media entity flag.
+ */
+ private boolean mediaEntity = false;
+
+ /**
+ * In case of media entity, media content type.
+ */
+ private String mediaContentType;
+
+ /**
+ * In case of media entity, media content source.
+ */
+ private String mediaContentSource;
+
+ /**
+ * Edit link.
+ */
+ private URI editLink;
+
+ /**
+ * Navigation links (might contain in-line entities or feeds).
+ */
+ private final List<ODataLink> navigationLinks = new ArrayList<ODataLink>();
+
+ /**
+ * Association links.
+ */
+ private final List<ODataLink> associationLinks = new ArrayList<ODataLink>();
+
+ /**
+ * Media edit links.
+ */
+ private final List<ODataLink> editMediaLinks = new ArrayList<ODataLink>();
+
+ /**
+ * Operations (legacy, functions, actions).
+ */
+ private final List<ODataOperation> operations = new ArrayList<ODataOperation>();
+
+ /**
+ * Entity properties.
+ */
+ private final List<ODataProperty> properties = new ArrayList<ODataProperty>();
+
+ /**
+ * Constructor.
+ *
+ * @param name OData entity name.
+ */
+ public ODataEntityImpl(final String name) {
+ super(name);
+ }
+
+ /**
+ * To request entity references in place of the actual entities, the client issues a GET request with /$ref appended
+ * to the resource path.
+ * <br />
+ * If the resource path does not identify an entity or a collection of entities, the service returns 404 Not Found.
+ * <br />
+ * If the resource path terminates on a collection, the response MUST be the format-specific representation of a
+ * collection of entity references pointing to the related entities. If no entities are related, the response is the
+ * format-specific representation of an empty collection.
+ * <br />
+ * If the resource path terminates on a single entity, the response MUST be the format-specific representation of an
+ * entity reference pointing to the related single entity. If the resource path terminates on a single entity and no
+ * such entity exists, the service returns 404 Not Found.
+ *
+ * @return entity reference.
+ */
+ @Override
+ public String getReference() {
+ return reference;
+ }
+
+ @Override
+ public void setReference(final String reference) {
+ this.reference = reference;
+ }
+
+ /**
+ * Gets ETag.
+ *
+ * @return ETag.
+ */
+ @Override
+ public String getETag() {
+ return eTag;
+ }
+
+ /**
+ * Sets ETag.
+ *
+ * @param eTag ETag.
+ */
+ @Override
+ public void setETag(final String eTag) {
+ this.eTag = eTag;
+ }
+
+ /**
+ * Searches for operation with given title.
+ *
+ * @param title operation to look for
+ * @return operation if found with given title, <tt>null</tt> otherwise
+ */
+ @Override
+ public ODataOperation getOperation(final String title) {
+ ODataOperation result = null;
+ for (ODataOperation operation : operations) {
+ if (title.equals(operation.getTitle())) {
+ result = operation;
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Gets operations.
+ *
+ * @return operations.
+ */
+ @Override
+ public List<ODataOperation> getOperations() {
+ return this.operations;
+ }
+
+ /**
+ * Searches for property with given name.
+ *
+ * @param name property to look for
+ * @return property if found with given name, <tt>null</tt> otherwise
+ */
+ @Override
+ public ODataProperty getProperty(final String name) {
+ ODataProperty result = null;
+
+ if (StringUtils.isNotBlank(name)) {
+ for (ODataProperty property : properties) {
+ if (name.equals(property.getName())) {
+ result = property;
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Returns OData entity properties.
+ *
+ * @return OData entity properties.
+ */
+ @Override
+ public List<ODataProperty> getProperties() {
+ return properties;
+ }
+
+ /**
+ * Puts the given link into one of available lists, based on its type.
+ *
+ * @param link to be added
+ * @return <tt>true</tt> if the given link was added in one of available lists
+ */
+ @Override
+ public boolean addLink(final ODataLink link) {
+ boolean result = false;
+
+ switch (link.getType()) {
+ case ASSOCIATION:
+ result = associationLinks.contains(link) ? false : associationLinks.add(link);
+ break;
+
+ case ENTITY_NAVIGATION:
+ case ENTITY_SET_NAVIGATION:
+ result = navigationLinks.contains(link) ? false : navigationLinks.add(link);
+ break;
+
+ case MEDIA_EDIT:
+ result = editMediaLinks.contains(link) ? false : editMediaLinks.add(link);
+ break;
+
+ default:
+ }
+
+ return result;
+ }
+
+ /**
+ * Removes the given link from any list (association, navigation, edit-media).
+ *
+ * @param link to be removed
+ * @return <tt>true</tt> if the given link was contained in one of available lists
+ */
+ @Override
+ public boolean removeLink(final ODataLink link) {
+ return associationLinks.remove(link) || navigationLinks.remove(link) || editMediaLinks.remove(link);
+ }
+
+ /**
+ * Returns all entity navigation links (including inline entities / feeds).
+ *
+ * @return OData entity links.
+ */
+ @Override
+ public List<ODataLink> getNavigationLinks() {
+ return navigationLinks;
+ }
+
+ /**
+ * Returns all entity association links.
+ *
+ * @return OData entity links.
+ */
+ @Override
+ public List<ODataLink> getAssociationLinks() {
+ return associationLinks;
+ }
+
+ /**
+ * Returns all entity media edit links.
+ *
+ * @return OData entity links.
+ */
+ @Override
+ public List<ODataLink> getEditMediaLinks() {
+ return editMediaLinks;
+ }
+
+ /**
+ * Returns OData entity edit link.
+ *
+ * @return entity edit link.
+ */
+ @Override
+ public URI getEditLink() {
+ return editLink;
+ }
+
+ /**
+ * Sets OData entity edit link.
+ *
+ * @param editLink edit link.
+ */
+ @Override
+ public void setEditLink(final URI editLink) {
+ this.editLink = editLink;
+ }
+
+ @Override
+ public URI getLink() {
+ return super.getLink() == null ? getEditLink() : super.getLink();
+ }
+
+ /**
+ * TRUE if read-only entity.
+ *
+ * @return TRUE if read-only; FALSE otherwise.
+ */
+ @Override
+ public boolean isReadOnly() {
+ return super.getLink() != null;
+ }
+
+ /**
+ * Checks if the current entity is a media entity.
+ *
+ * @return 'TRUE' if media entity; 'FALSE' otherwise.
+ */
+ @Override
+ public boolean isMediaEntity() {
+ return mediaEntity;
+ }
+
+ /**
+ * Sets media entity flag.
+ *
+ * @param isMediaEntity media entity flag value.
+ */
+ @Override
+ public void setMediaEntity(final boolean isMediaEntity) {
+ this.mediaEntity = isMediaEntity;
+ }
+
+ /**
+ * Gets media content type.
+ *
+ * @return media content type.
+ */
+ @Override
+ public String getMediaContentType() {
+ return mediaContentType;
+ }
+
+ /**
+ * Sets media content type.
+ *
+ * @param mediaContentType media content type.
+ */
+ @Override
+ public void setMediaContentType(final String mediaContentType) {
+ this.mediaContentType = mediaContentType;
+ }
+
+ /**
+ * Gets media content source.
+ *
+ * @return media content source.
+ */
+ @Override
+ public String getMediaContentSource() {
+ return mediaContentSource;
+ }
+
+ /**
+ * Sets media content source.
+ *
+ * @param mediaContentSource media content source.
+ */
+ @Override
+ public void setMediaContentSource(final String mediaContentSource) {
+ this.mediaContentSource = mediaContentSource;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntitySetImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntitySetImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntitySetImpl.java
new file mode 100644
index 0000000..b7246d1
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntitySetImpl.java
@@ -0,0 +1,104 @@
+/*
+ * 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.commons.core.domain;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.commons.api.domain.AbstractODataPayload;
+import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.ODataEntitySet;
+
+public class ODataEntitySetImpl extends AbstractODataPayload implements ODataEntitySet {
+
+ private static final long serialVersionUID = 9039605899821494024L;
+
+ /**
+ * Link to the next page.
+ */
+ private URI next;
+
+ /**
+ * Number of ODataEntities contained in this feed. If <tt>$inlinecount</tt> was requested, this value comes from
+ * there.
+ */
+ private Integer count;
+
+ /**
+ * OData entities contained in this feed.
+ */
+ private List<ODataEntity> entities = new ArrayList<ODataEntity>();
+
+ /**
+ * Constructor.
+ */
+ public ODataEntitySetImpl() {
+ super(null);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param next next link.
+ */
+ public ODataEntitySetImpl(final URI next) {
+ super(null);
+ this.next = next;
+ }
+
+ /**
+ * Gets next page link.
+ *
+ * @return next page link; null value if single page or last page reached.
+ */
+ @Override
+ public URI getNext() {
+ return next;
+ }
+
+ /**
+ * Gets contained entities.
+ *
+ * @return feed entries.
+ */
+ @Override
+ public List<ODataEntity> getEntities() {
+ return entities;
+ }
+
+ /**
+ * Gets in-line count.
+ *
+ * @return in-line count value.
+ */
+ @Override
+ public int getCount() {
+ return count == null ? entities.size() : count;
+ }
+
+ /**
+ * Sets in-line count.
+ *
+ * @param count in-line count value.
+ */
+ @Override
+ public void setCount(final int count) {
+ this.count = count;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataObjectFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataObjectFactoryImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataObjectFactoryImpl.java
new file mode 100644
index 0000000..63a47ce
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataObjectFactoryImpl.java
@@ -0,0 +1,171 @@
+/*
+ * 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.commons.core.domain;
+
+import java.net.URI;
+import org.apache.olingo.commons.api.domain.ODataLinkType;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.ODataInlineEntity;
+import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
+import org.apache.olingo.commons.api.domain.ODataLink;
+import org.apache.olingo.commons.api.domain.ODataObjectFactory;
+import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
+import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+
+public class ODataObjectFactoryImpl implements ODataObjectFactory {
+
+ private static final long serialVersionUID = -3769695665946919447L;
+
+ protected final ODataServiceVersion version;
+
+ public ODataObjectFactoryImpl(final ODataServiceVersion version) {
+ this.version = version;
+ }
+
+ @Override
+ public ODataEntitySet newEntitySet() {
+ return new ODataEntitySetImpl();
+ }
+
+ @Override
+ public ODataEntitySet newEntitySet(final URI next) {
+ return new ODataEntitySetImpl(next);
+ }
+
+ @Override
+ public ODataEntity newEntity(final String name) {
+ return new ODataEntityImpl(name);
+ }
+
+ @Override
+ public ODataEntity newEntity(final String name, final URI link) {
+ final ODataEntityImpl result = new ODataEntityImpl(name);
+ result.setLink(link);
+ return result;
+ }
+
+ @Override
+ public ODataInlineEntitySet newInlineEntitySet(final String name, final URI link,
+ final ODataEntitySet entitySet) {
+
+ return new ODataInlineEntitySet(version, link, ODataLinkType.ENTITY_SET_NAVIGATION, name, entitySet);
+ }
+
+ @Override
+ public ODataInlineEntitySet newInlineEntitySet(final String name, final URI baseURI, final String href,
+ final ODataEntitySet entitySet) {
+
+ return new ODataInlineEntitySet(version, baseURI, href, ODataLinkType.ENTITY_SET_NAVIGATION, name, entitySet);
+ }
+
+ @Override
+ public ODataInlineEntity newInlineEntity(final String name, final URI link, final ODataEntity entity) {
+ return new ODataInlineEntity(version, link, ODataLinkType.ENTITY_NAVIGATION, name, entity);
+ }
+
+ @Override
+ public ODataInlineEntity newInlineEntity(final String name, final URI baseURI, final String href,
+ final ODataEntity entity) {
+
+ return new ODataInlineEntity(version, baseURI, href, ODataLinkType.ENTITY_NAVIGATION, name, entity);
+ }
+
+ @Override
+ public ODataLink newEntityNavigationLink(final String name, final URI link) {
+ return new ODataLink.Builder().setVersion(version).setURI(link).
+ setType(ODataLinkType.ENTITY_NAVIGATION).setTitle(name).build();
+ }
+
+ @Override
+ public ODataLink newEntityNavigationLink(final String name, final URI baseURI, final String href) {
+ return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
+ setType(ODataLinkType.ENTITY_NAVIGATION).setTitle(name).build();
+ }
+
+ @Override
+ public ODataLink newFeedNavigationLink(final String name, final URI link) {
+ return new ODataLink.Builder().setVersion(version).setURI(link).
+ setType(ODataLinkType.ENTITY_SET_NAVIGATION).setTitle(name).build();
+ }
+
+ @Override
+ public ODataLink newFeedNavigationLink(final String name, final URI baseURI, final String href) {
+ return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
+ setType(ODataLinkType.ENTITY_SET_NAVIGATION).setTitle(name).build();
+ }
+
+ @Override
+ public ODataLink newAssociationLink(final String name, final URI link) {
+ return new ODataLink.Builder().setVersion(version).setURI(link).
+ setType(ODataLinkType.ASSOCIATION).setTitle(name).build();
+ }
+
+ @Override
+ public ODataLink newAssociationLink(final String name, final URI baseURI, final String href) {
+ return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
+ setType(ODataLinkType.ASSOCIATION).setTitle(name).build();
+ }
+
+ @Override
+ public ODataLink newMediaEditLink(final String name, final URI link) {
+ return new ODataLink.Builder().setVersion(version).setURI(link).
+ setType(ODataLinkType.MEDIA_EDIT).setTitle(name).build();
+ }
+
+ @Override
+ public ODataLink newMediaEditLink(final String name, final URI baseURI, final String href) {
+ return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
+ setType(ODataLinkType.MEDIA_EDIT).setTitle(name).build();
+ }
+
+ @Override
+ public ODataPrimitiveValue.Builder newPrimitiveValueBuilder() {
+ return new ODataPrimitiveValueImpl.BuilderImpl(version);
+ }
+
+ @Override
+ public ODataComplexValue newComplexValue(final String typeName) {
+ return new ODataComplexValueImpl(typeName);
+ }
+
+ @Override
+ public ODataCollectionValue newCollectionValue(final String typeName) {
+ return new ODataCollectionValueImpl(typeName);
+ }
+
+ @Override
+ public ODataProperty newPrimitiveProperty(final String name, final ODataPrimitiveValue value) {
+ return new ODataPropertyImpl(name, value);
+ }
+
+ @Override
+ public ODataProperty newComplexProperty(final String name, final ODataComplexValue value) {
+ return new ODataPropertyImpl(name, value);
+ }
+
+ @Override
+ public ODataProperty newCollectionProperty(final String name, final ODataCollectionValue value) {
+ return new ODataPropertyImpl(name, value);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPrimitiveValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPrimitiveValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPrimitiveValueImpl.java
index ad60494..965d5fc 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPrimitiveValueImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPrimitiveValueImpl.java
@@ -139,6 +139,15 @@ public class ODataPrimitiveValueImpl extends AbstractODataValue implements OData
*/
private Object value;
+ private ODataPrimitiveValueImpl() {
+ super(null);
+ }
+
+ @Override
+ public String getTypeName() {
+ return typeKind.getFullQualifiedName().toString();
+ }
+
@Override
public EdmPrimitiveTypeKind getTypeKind() {
return typeKind;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPropertyImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPropertyImpl.java
new file mode 100644
index 0000000..4c8aea9
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPropertyImpl.java
@@ -0,0 +1,172 @@
+/*
+ * 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.commons.core.domain;
+
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
+import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.ODataValue;
+
+/**
+ * OData entity property.
+ */
+public class ODataPropertyImpl implements ODataProperty {
+
+ private static final long serialVersionUID = 926939448778950450L;
+
+ /**
+ * Property name.
+ */
+ private final String name;
+
+ /**
+ * Property value.
+ */
+ private ODataValue value;
+
+ /**
+ * Constructor.
+ *
+ * @param name property name.
+ * @param value property value.
+ */
+ public ODataPropertyImpl(final String name, final ODataValue value) {
+ this.name = name;
+ this.value = value;
+ }
+
+ /**
+ * Returns property name.
+ *
+ * @return property name.
+ */
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Returns property value.
+ *
+ * @return property value.
+ */
+ @Override
+ public ODataValue getValue() {
+ return value;
+ }
+
+ /**
+ * Checks if has null value.
+ *
+ * @return 'TRUE' if has null value; 'FALSE' otherwise.
+ */
+ @Override
+ public boolean hasNullValue() {
+ return this.value == null;
+ }
+
+ /**
+ * Checks if has primitive value.
+ *
+ * @return 'TRUE' if has primitive value; 'FALSE' otherwise.
+ */
+ @Override
+ public boolean hasPrimitiveValue() {
+ return !hasNullValue() && this.value.isPrimitive();
+ }
+
+ /**
+ * Gets primitive value.
+ *
+ * @return primitive value if exists; null otherwise.
+ */
+ @Override
+ public ODataPrimitiveValue getPrimitiveValue() {
+ return hasPrimitiveValue() ? this.value.asPrimitive() : null;
+ }
+
+ /**
+ * Checks if has complex value.
+ *
+ * @return 'TRUE' if has complex value; 'FALSE' otherwise.
+ */
+ @Override
+ public boolean hasComplexValue() {
+ return !hasNullValue() && this.value.isComplex();
+ }
+
+ /**
+ * Gets complex value.
+ *
+ * @return complex value if exists; null otherwise.
+ */
+ @Override
+ public ODataComplexValue getComplexValue() {
+ return hasComplexValue() ? this.value.asComplex() : null;
+ }
+
+ /**
+ * Checks if has collection value.
+ *
+ * @return 'TRUE' if has collection value; 'FALSE' otherwise.
+ */
+ @Override
+ public boolean hasCollectionValue() {
+ return !hasNullValue() && this.value.isCollection();
+ }
+
+ /**
+ * Gets collection value.
+ *
+ * @return collection value if exists; null otherwise.
+ */
+ @Override
+ public ODataCollectionValue getCollectionValue() {
+ return hasCollectionValue() ? this.value.asCollection() : null;
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public boolean equals(final Object obj) {
+ return EqualsBuilder.reflectionEquals(this, obj);
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public int hashCode() {
+ return HashCodeBuilder.reflectionHashCode(this);
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public String toString() {
+ return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/ODataObjectFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/ODataObjectFactoryImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/ODataObjectFactoryImpl.java
deleted file mode 100644
index ae946e0..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/ODataObjectFactoryImpl.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * 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.commons.core.op;
-
-import java.net.URI;
-import org.apache.olingo.commons.api.domain.ODataLinkType;
-import org.apache.olingo.commons.api.domain.ODataCollectionValue;
-import org.apache.olingo.commons.api.domain.ODataComplexValue;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
-import org.apache.olingo.commons.api.domain.ODataInlineEntity;
-import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
-import org.apache.olingo.commons.api.domain.ODataLink;
-import org.apache.olingo.commons.api.domain.ODataObjectFactory;
-import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.commons.api.domain.ODataProperty;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-
-public class ODataObjectFactoryImpl implements ODataObjectFactory {
-
- private static final long serialVersionUID = -3769695665946919447L;
-
- protected final ODataServiceVersion version;
-
- public ODataObjectFactoryImpl(final ODataServiceVersion version) {
- this.version = version;
- }
-
- @Override
- public ODataEntitySet newEntitySet() {
- return new ODataEntitySet();
- }
-
- @Override
- public ODataEntitySet newEntitySet(final URI next) {
- return new ODataEntitySet(next);
- }
-
- @Override
- public ODataEntity newEntity(final String name) {
- return new ODataEntity(name);
- }
-
- @Override
- public ODataEntity newEntity(final String name, final URI link) {
- final ODataEntity result = new ODataEntity(name);
- result.setLink(link);
- return result;
- }
-
- @Override
- public ODataInlineEntitySet newInlineEntitySet(final String name, final URI link,
- final ODataEntitySet entitySet) {
-
- return new ODataInlineEntitySet(version, link, ODataLinkType.ENTITY_SET_NAVIGATION, name, entitySet);
- }
-
- @Override
- public ODataInlineEntitySet newInlineEntitySet(final String name, final URI baseURI, final String href,
- final ODataEntitySet entitySet) {
-
- return new ODataInlineEntitySet(version, baseURI, href, ODataLinkType.ENTITY_SET_NAVIGATION, name, entitySet);
- }
-
- @Override
- public ODataInlineEntity newInlineEntity(final String name, final URI link, final ODataEntity entity) {
- return new ODataInlineEntity(version, link, ODataLinkType.ENTITY_NAVIGATION, name, entity);
- }
-
- @Override
- public ODataInlineEntity newInlineEntity(final String name, final URI baseURI, final String href,
- final ODataEntity entity) {
-
- return new ODataInlineEntity(version, baseURI, href, ODataLinkType.ENTITY_NAVIGATION, name, entity);
- }
-
- @Override
- public ODataLink newEntityNavigationLink(final String name, final URI link) {
- return new ODataLink.Builder().setVersion(version).setURI(link).
- setType(ODataLinkType.ENTITY_NAVIGATION).setTitle(name).build();
- }
-
- @Override
- public ODataLink newEntityNavigationLink(final String name, final URI baseURI, final String href) {
- return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
- setType(ODataLinkType.ENTITY_NAVIGATION).setTitle(name).build();
- }
-
- @Override
- public ODataLink newFeedNavigationLink(final String name, final URI link) {
- return new ODataLink.Builder().setVersion(version).setURI(link).
- setType(ODataLinkType.ENTITY_SET_NAVIGATION).setTitle(name).build();
- }
-
- @Override
- public ODataLink newFeedNavigationLink(final String name, final URI baseURI, final String href) {
- return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
- setType(ODataLinkType.ENTITY_SET_NAVIGATION).setTitle(name).build();
- }
-
- @Override
- public ODataLink newAssociationLink(final String name, final URI link) {
- return new ODataLink.Builder().setVersion(version).setURI(link).
- setType(ODataLinkType.ASSOCIATION).setTitle(name).build();
- }
-
- @Override
- public ODataLink newAssociationLink(final String name, final URI baseURI, final String href) {
- return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
- setType(ODataLinkType.ASSOCIATION).setTitle(name).build();
- }
-
- @Override
- public ODataLink newMediaEditLink(final String name, final URI link) {
- return new ODataLink.Builder().setVersion(version).setURI(link).
- setType(ODataLinkType.MEDIA_EDIT).setTitle(name).build();
- }
-
- @Override
- public ODataLink newMediaEditLink(final String name, final URI baseURI, final String href) {
- return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
- setType(ODataLinkType.MEDIA_EDIT).setTitle(name).build();
- }
-
- @Override
- public ODataProperty newPrimitiveProperty(final String name, final ODataPrimitiveValue value) {
- return new ODataProperty(name, value);
- }
-
- @Override
- public ODataProperty newComplexProperty(final String name, final ODataComplexValue value) {
- return new ODataProperty(name, value);
- }
-
- @Override
- public ODataProperty newCollectionProperty(final String name, final ODataCollectionValue value) {
- return new ODataProperty(name, value);
- }
-
-}
[16/51] [abbrv] git commit: [OLINGO-200] V4 Atom and JSON parsers on
their way - still to refine, but most features are in,
and specific tests were added
Posted by il...@apache.org.
[OLINGO-200] V4 Atom and JSON parsers on their way - still to refine, but most features are in, and specific tests were added
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/ce18b8e0
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/ce18b8e0
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/ce18b8e0
Branch: refs/heads/master
Commit: ce18b8e056754a6f203535813d0672f2dd7e9c07
Parents: e4bf213
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Fri Mar 28 17:07:20 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Fri Mar 28 17:07:20 2014 +0100
----------------------------------------------------------------------
.../client/core/op/AbstractODataBinder.java | 9 +-
.../apache/olingo/client/core/v3/AtomTest.java | 2 +-
.../apache/olingo/client/core/v3/JSONTest.java | 39 +++--
.../apache/olingo/client/core/v4/AtomTest.java | 74 +++++++++
.../apache/olingo/client/core/v4/JSONTest.java | 152 +++++++++++++++++++
.../apache/olingo/client/core/atom_cleanup.xsl | 48 ------
.../olingo/client/core/v3/atom_cleanup.xsl | 48 ++++++
.../olingo/client/core/v4/Products_5.json | 1 +
.../apache/olingo/client/core/v4/Products_5.xml | 49 ++++++
.../client/core/v4/Products_5_SkinColor.json | 5 +
.../client/core/v4/Products_5_SkinColor.xml | 27 ++++
.../olingo/client/core/v4/VipCustomer.json | 50 ++++++
.../olingo/client/core/v4/VipCustomer.xml | 67 ++++++++
.../olingo/client/core/v4/atom_cleanup.xsl | 48 ++++++
.../olingo/client/core/v4/complexProperty.json | 8 -
.../core/v4/entity.collection.complex.json | 14 ++
.../core/v4/entity.collection.primitive.json | 7 +
.../olingo/client/core/v4/entity.complex.json | 12 ++
.../olingo/client/core/v4/entity.full.json | 22 +++
.../olingo/client/core/v4/entity.minimal.json | 15 ++
.../olingo/client/core/v4/entity.primitive.json | 22 +++
.../olingo/client/core/v4/fullEntity.json | 22 ---
.../olingo/client/core/v4/fullEntitySet.json | 29 ----
.../core/v4/fullEntitySetWithTwoEntities.json | 49 ------
...fullEntityWithCollectionOfComplexValues.json | 28 ----
.../client/core/v4/primitiveNullValue.json | 3 -
.../client/core/v4/setOfComplexProperties.json | 13 --
.../core/v4/setOfPrimitiveProperties.json | 8 -
.../apache/olingo/commons/api/Constants.java | 24 +--
.../apache/olingo/commons/api/data/Entry.java | 15 --
.../olingo/commons/api/data/EnumValue.java | 25 +++
.../apache/olingo/commons/api/data/Feed.java | 15 --
.../olingo/commons/api/data/Property.java | 10 --
.../apache/olingo/commons/api/data/Value.java | 8 +-
.../commons/api/domain/ODataPropertyType.java | 8 +-
.../api/edm/constants/ODataServiceVersion.java | 56 +++++++
.../commons/core/data/AbstractAtomDealer.java | 5 +-
.../core/data/AbstractJsonDeserializer.java | 25 ++-
.../core/data/AbstractJsonSerializer.java | 16 +-
.../commons/core/data/AbstractODataObject.java | 16 --
.../commons/core/data/AbstractPropertyImpl.java | 18 ---
.../olingo/commons/core/data/AbstractValue.java | 17 ++-
.../commons/core/data/AtomDeserializer.java | 1 +
.../core/data/AtomPropertyDeserializer.java | 54 ++++---
.../core/data/AtomPropertySerializer.java | 46 ++++--
.../commons/core/data/AtomSerializer.java | 14 --
.../olingo/commons/core/data/EnumValueImpl.java | 41 +++++
.../core/data/JSONEntryDeserializer.java | 54 ++++---
.../olingo/commons/core/data/JSONEntryImpl.java | 13 --
.../commons/core/data/JSONEntrySerializer.java | 10 +-
.../olingo/commons/core/data/JSONFeedImpl.java | 12 +-
.../commons/core/data/JSONFeedSerializer.java | 7 +-
.../core/data/JSONPropertyDeserializer.java | 13 +-
.../core/data/JSONPropertySerializer.java | 13 +-
.../core/data/ODataJacksonDeserializer.java | 30 ++++
.../commons/core/data/PrimitiveValueImpl.java | 2 +-
56 files changed, 959 insertions(+), 480 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
index a678834..36ff32b 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
@@ -91,7 +91,6 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
public Feed getFeed(final ODataEntitySet entitySet, final Class<? extends Feed> reference) {
final Feed feed = ResourceFactory.newFeed(reference);
- feed.setContextURL(entitySet.getContextURL());
feed.setCount(entitySet.getCount());
final URI next = entitySet.getNext();
@@ -115,7 +114,6 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
public Entry getEntry(final ODataEntity entity, final Class<? extends Entry> reference, final boolean setType) {
final Entry entry = ResourceFactory.newEntry(reference);
- entry.setContextURL(entity.getContextURL());
entry.setId(entity.getReference());
entry.setType(entity.getName());
@@ -281,8 +279,6 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
? client.getObjectFactory().newEntitySet()
: client.getObjectFactory().newEntitySet(URIUtils.getURI(base, next.toASCIIString()));
- entitySet.setContextURL(resource.getContextURL());
-
if (resource.getCount() != null) {
entitySet.setCount(resource.getCount());
}
@@ -315,7 +311,6 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
: client.getObjectFactory().newEntity(resource.getType(),
URIUtils.getURI(base, resource.getSelfLink().getHref()));
- entity.setContextURL(resource.getContextURL());
entity.setReference(resource.getId());
if (StringUtils.isNotBlank(resource.getETag())) {
@@ -380,9 +375,9 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
private ODataValue getODataValue(final Property resource) {
ODataValue value = null;
- if (resource.getValue().isSimple()) {
+ if (resource.getValue().isPrimitive()) {
value = client.getPrimitiveValueBuilder().
- setText(resource.getValue().asSimple().get()).
+ setText(resource.getValue().asPrimitive().get()).
setType(resource.getType() == null
? null
: EdmPrimitiveTypeKind.valueOfFQN(client.getServiceVersion(), resource.getType())).build();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/AtomTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/AtomTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/AtomTest.java
index 1be265b..ce2ef71 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/AtomTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/AtomTest.java
@@ -53,7 +53,7 @@ public class AtomTest extends AbstractTest {
private String cleanup(final String input) throws Exception {
final TransformerFactory factory = TransformerFactory.newInstance();
- final Source xslt = new StreamSource(getClass().getResourceAsStream("../atom_cleanup.xsl"));
+ final Source xslt = new StreamSource(getClass().getResourceAsStream("atom_cleanup.xsl"));
final Transformer transformer = factory.newTransformer(xslt);
final StringWriter result = new StringWriter();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/JSONTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/JSONTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/JSONTest.java
index c3b1552..bae0bdd 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/JSONTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/JSONTest.java
@@ -30,6 +30,7 @@ import java.util.List;
import java.util.Map;
import org.apache.commons.io.IOUtils;
import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.format.ODataPubFormat;
@@ -48,20 +49,23 @@ public class JSONTest extends AtomTest {
}
private void cleanup(final ObjectNode node) {
- if (node.has(Constants.JSON_TYPE)) {
- node.remove(Constants.JSON_TYPE);
+ if (node.has(Constants.JSON_METADATA)) {
+ node.remove(Constants.JSON_METADATA);
}
- if (node.has(Constants.JSON_EDIT_LINK)) {
- node.remove(Constants.JSON_EDIT_LINK);
+ if (node.has(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_TYPE))) {
+ node.remove(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_TYPE));
}
- if (node.has(Constants.JSON_READ_LINK)) {
- node.remove(Constants.JSON_READ_LINK);
+ if (node.has(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_EDIT_LINK))) {
+ node.remove(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_EDIT_LINK));
}
- if (node.has(Constants.JSON_MEDIAEDIT_LINK)) {
- node.remove(Constants.JSON_MEDIAEDIT_LINK);
+ if (node.has(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_READ_LINK))) {
+ node.remove(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_READ_LINK));
}
- if (node.has(Constants.JSON_MEDIAREAD_LINK)) {
- node.remove(Constants.JSON_MEDIAREAD_LINK);
+ if (node.has(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIAEDIT_LINK))) {
+ node.remove(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIAEDIT_LINK));
+ }
+ if (node.has(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIAREAD_LINK))) {
+ node.remove(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIAREAD_LINK));
}
if (node.has(Constants.JSON_MEDIA_CONTENT_TYPE)) {
node.remove(Constants.JSON_MEDIA_CONTENT_TYPE);
@@ -71,10 +75,13 @@ public class JSONTest extends AtomTest {
final Map.Entry<String, JsonNode> field = itor.next();
if (field.getKey().charAt(0) == '#'
- || field.getKey().endsWith(Constants.JSON_TYPE_SUFFIX)
- || field.getKey().endsWith(Constants.JSON_MEDIAEDIT_LINK_SUFFIX)
+ || field.getKey().endsWith(
+ getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_TYPE))
+ || field.getKey().endsWith(
+ getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIAEDIT_LINK))
|| field.getKey().endsWith(Constants.JSON_MEDIA_CONTENT_TYPE_SUFFIX)
- || field.getKey().endsWith(Constants.JSON_ASSOCIATION_LINK_SUFFIX)
+ || field.getKey().endsWith(
+ getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_ASSOCIATION_LINK))
|| field.getKey().endsWith(Constants.JSON_MEDIA_ETAG_SUFFIX)) {
toRemove.add(field.getKey());
@@ -95,10 +102,12 @@ public class JSONTest extends AtomTest {
@Override
protected void assertSimilar(final String filename, final String actual) throws Exception {
final JsonNode orig = OBJECT_MAPPER.readTree(IOUtils.toString(getClass().getResourceAsStream(filename)).
- replace("Categories" + Constants.JSON_NAVIGATION_LINK_SUFFIX,
+ replace("Categories" + getClient().getServiceVersion().getJSONMap().
+ get(ODataServiceVersion.JSON_NAVIGATION_LINK),
"Categories" + Constants.JSON_BIND_LINK_SUFFIX).
replace("\"Products(0)/Categories\"", "[\"Products(0)/Categories\"]").
- replace(Constants.JSON_NAVIGATION_LINK_SUFFIX, Constants.JSON_BIND_LINK_SUFFIX));
+ replace(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_NAVIGATION_LINK),
+ Constants.JSON_BIND_LINK_SUFFIX));
cleanup((ObjectNode) orig);
assertEquals(orig, OBJECT_MAPPER.readTree(new ByteArrayInputStream(actual.getBytes())));
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/AtomTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/AtomTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/AtomTest.java
new file mode 100644
index 0000000..ed6b8c0
--- /dev/null
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/AtomTest.java
@@ -0,0 +1,74 @@
+/*
+ * 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.client.core.v4;
+
+import java.io.ByteArrayInputStream;
+import java.io.StringWriter;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+import org.apache.commons.io.IOUtils;
+import org.apache.olingo.client.api.v4.ODataClient;
+import org.apache.olingo.client.core.AtomLinksQualifier;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
+import org.custommonkey.xmlunit.Diff;
+import static org.junit.Assert.assertTrue;
+
+public class AtomTest extends JSONTest {
+
+ @Override
+ protected ODataClient getClient() {
+ return v4Client;
+ }
+
+ @Override
+ protected ODataPubFormat getODataPubFormat() {
+ return ODataPubFormat.ATOM;
+ }
+
+ @Override
+ protected ODataFormat getODataFormat() {
+ return ODataFormat.XML;
+ }
+
+ private String cleanup(final String input) throws Exception {
+ final TransformerFactory factory = TransformerFactory.newInstance();
+ final Source xslt = new StreamSource(getClass().getResourceAsStream("atom_cleanup.xsl"));
+ final Transformer transformer = factory.newTransformer(xslt);
+
+ final StringWriter result = new StringWriter();
+ transformer.transform(new StreamSource(new ByteArrayInputStream(input.getBytes())), new StreamResult(result));
+ return result.toString();
+ }
+
+ protected void assertSimilar(final String filename, final String actual) throws Exception {
+ final Diff diff = new Diff(cleanup(IOUtils.toString(getClass().getResourceAsStream(filename))), actual);
+ diff.overrideElementQualifier(new AtomLinksQualifier());
+ assertTrue(diff.similar());
+ }
+
+ @Override
+ public void additionalEntries() throws Exception {
+ // no test
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java
new file mode 100644
index 0000000..272ab13
--- /dev/null
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/JSONTest.java
@@ -0,0 +1,152 @@
+/*
+ * 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.client.core.v4;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import java.io.ByteArrayInputStream;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import org.apache.commons.io.IOUtils;
+import org.apache.olingo.client.api.v4.ODataClient;
+import org.apache.olingo.client.core.AbstractTest;
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
+import static org.junit.Assert.assertEquals;
+import org.junit.Test;
+
+public class JSONTest extends AbstractTest {
+
+ private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
+
+ @Override
+ protected ODataClient getClient() {
+ return v4Client;
+ }
+
+ protected ODataPubFormat getODataPubFormat() {
+ return ODataPubFormat.JSON;
+ }
+
+ protected ODataFormat getODataFormat() {
+ return ODataFormat.JSON;
+ }
+
+ private void cleanup(final ObjectNode node) {
+ if (node.has(Constants.JSON_CONTEXT)) {
+ node.remove(Constants.JSON_CONTEXT);
+ }
+ if (node.has(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_TYPE))) {
+ node.remove(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_TYPE));
+ }
+ if (node.has(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_EDIT_LINK))) {
+ node.remove(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_EDIT_LINK));
+ }
+ if (node.has(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_READ_LINK))) {
+ node.remove(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_READ_LINK));
+ }
+ if (node.has(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIAEDIT_LINK))) {
+ node.remove(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIAEDIT_LINK));
+ }
+ if (node.has(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIAREAD_LINK))) {
+ node.remove(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIAREAD_LINK));
+ }
+ if (node.has(Constants.JSON_MEDIA_CONTENT_TYPE)) {
+ node.remove(Constants.JSON_MEDIA_CONTENT_TYPE);
+ }
+ final List<String> toRemove = new ArrayList<String>();
+ for (final Iterator<Map.Entry<String, JsonNode>> itor = node.fields(); itor.hasNext();) {
+ final Map.Entry<String, JsonNode> field = itor.next();
+
+ if (field.getKey().charAt(0) == '#'
+ || field.getKey().endsWith(
+ getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_TYPE))
+ || field.getKey().endsWith(
+ getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_MEDIAEDIT_LINK))
+ || field.getKey().endsWith(Constants.JSON_MEDIA_CONTENT_TYPE_SUFFIX)
+ || field.getKey().endsWith(
+ getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_ASSOCIATION_LINK))
+ || field.getKey().endsWith(Constants.JSON_MEDIA_ETAG_SUFFIX)) {
+
+ toRemove.add(field.getKey());
+ } else if (field.getValue().isObject()) {
+ cleanup((ObjectNode) field.getValue());
+ } else if (field.getValue().isArray()) {
+ for (final Iterator<JsonNode> arrayItems = field.getValue().elements(); arrayItems.hasNext();) {
+ final JsonNode arrayItem = arrayItems.next();
+ if (arrayItem.isObject()) {
+ cleanup((ObjectNode) arrayItem);
+ }
+ }
+ }
+ }
+ node.remove(toRemove);
+ }
+
+ protected void assertSimilar(final String filename, final String actual) throws Exception {
+ final JsonNode orig = OBJECT_MAPPER.readTree(IOUtils.toString(getClass().getResourceAsStream(filename)).
+ replace(getClient().getServiceVersion().getJSONMap().get(ODataServiceVersion.JSON_NAVIGATION_LINK),
+ Constants.JSON_BIND_LINK_SUFFIX));
+ cleanup((ObjectNode) orig);
+ assertEquals(orig, OBJECT_MAPPER.readTree(new ByteArrayInputStream(actual.getBytes())));
+ }
+
+ protected void entry(final String filename, final ODataPubFormat format) throws Exception {
+ final StringWriter writer = new StringWriter();
+ getClient().getSerializer().entry(getClient().getDeserializer().toEntry(
+ getClass().getResourceAsStream(filename + "." + getSuffix(format)), format).getObject(), writer);
+
+ assertSimilar(filename + "." + getSuffix(format), writer.toString());
+ }
+
+ @Test
+ public void additionalEntries() throws Exception {
+ entry("entity.minimal", getODataPubFormat());
+// entry("entity.full", getODataPubFormat());
+ entry("entity.primitive", getODataPubFormat());
+ entry("entity.complex", getODataPubFormat());
+ entry("entity.collection.primitive", getODataPubFormat());
+ entry("entity.collection.complex", getODataPubFormat());
+ }
+
+ @Test
+ public void entries() throws Exception {
+ entry("Products_5", getODataPubFormat());
+ entry("VipCustomer", getODataPubFormat());
+ }
+
+ protected void property(final String filename, final ODataFormat format) throws Exception {
+ final StringWriter writer = new StringWriter();
+ getClient().getSerializer().property(getClient().getDeserializer().
+ toProperty(getClass().getResourceAsStream(filename + "." + getSuffix(format)), format).getObject(), writer);
+
+ assertSimilar(filename + "." + getSuffix(format), writer.toString());
+ }
+
+ @Test
+ public void properties() throws Exception {
+ property("Products_5_SkinColor", getODataFormat());
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/client-core/src/test/resources/org/apache/olingo/client/core/atom_cleanup.xsl
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/atom_cleanup.xsl b/lib/client-core/src/test/resources/org/apache/olingo/client/core/atom_cleanup.xsl
deleted file mode 100644
index a518fcb..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/atom_cleanup.xsl
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- 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.
-
--->
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns="http://www.w3.org/2005/Atom"
- xmlns:atom="http://www.w3.org/2005/Atom"
- xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
- version="1.0">
-
- <xsl:template match="atom:updated"/>
- <xsl:template match="atom:author"/>
- <xsl:template match="atom:title">
- <xsl:if test="string-length(.) > 0">
- <title type="{@type}">
- <xsl:apply-templates/>
- </title>
- </xsl:if>
- </xsl:template>
- <xsl:template match="atom:link[@rel = 'self' or @rel = 'edit' or @rel = 'edit-media']"/>
-
- <xsl:template match="m:action"/>
-
- <xsl:template match="@*[name() = 'm:etag']"/>
-
- <xsl:template match="node()|@*">
- <xsl:copy>
- <xsl:apply-templates select="@*|node()"/>
- </xsl:copy>
- </xsl:template>
-</xsl:stylesheet>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/atom_cleanup.xsl
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/atom_cleanup.xsl b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/atom_cleanup.xsl
new file mode 100644
index 0000000..a518fcb
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/atom_cleanup.xsl
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns="http://www.w3.org/2005/Atom"
+ xmlns:atom="http://www.w3.org/2005/Atom"
+ xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
+ version="1.0">
+
+ <xsl:template match="atom:updated"/>
+ <xsl:template match="atom:author"/>
+ <xsl:template match="atom:title">
+ <xsl:if test="string-length(.) > 0">
+ <title type="{@type}">
+ <xsl:apply-templates/>
+ </title>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="atom:link[@rel = 'self' or @rel = 'edit' or @rel = 'edit-media']"/>
+
+ <xsl:template match="m:action"/>
+
+ <xsl:template match="@*[name() = 'm:etag']"/>
+
+ <xsl:template match="node()|@*">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+ </xsl:template>
+</xsl:stylesheet>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5.json
new file mode 100644
index 0000000..22c8473
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5.json
@@ -0,0 +1 @@
+{"@odata.context":"http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Products/$entity","@odata.type":"#Microsoft.Test.OData.Services.ODataWCFService.Product","@odata.id":"http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)","@odata.editLink":"http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)","ProductID":5,"Name":"Cheetos","QuantityPerUnit":"100g Bag","UnitPrice@odata.type":"#Single","UnitPrice":3.24,"QuantityInStock":100,"Discontinued":true,"UserAccess@odata.type":"#Microsoft.Test.OData.Services.ODataWCFService.AccessLevel","UserAccess":"None","SkinColor@odata.type":"#Microsoft.Test.OData.Services.ODataWCFService.Color","SkinColor":"Red","CoverColors@odata.type":"#Collection(Microsoft.Test.OData.Services.ODataWCFService.Color)","CoverColors":["Green","Blue","Blue"],"Details@odata.associationLink":"http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)/Details/$ref","Details@odata.navigationLink":
"http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)/Details","#Microsoft.Test.OData.Services.ODataWCFService.AddAccessRight":{"title":"Microsoft.Test.OData.Services.ODataWCFService.AddAccessRight","target":"http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)/Microsoft.Test.OData.Services.ODataWCFService.AddAccessRight"},"#Microsoft.Test.OData.Services.ODataWCFService.GetProductDetails":{"title":"Microsoft.Test.OData.Services.ODataWCFService.GetProductDetails","target":"http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)/Microsoft.Test.OData.Services.ODataWCFService.GetProductDetails"}}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5.xml
new file mode 100644
index 0000000..9109f2d
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ 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.
+
+-->
+<entry xml:base="http://odatae2etest.azurewebsites.net/javatest/DefaultService/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://docs.oasis-open.org/odata/ns/data" xmlns:m="http://docs.oasis-open.org/odata/ns/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" m:context="http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Products/$entity">
+ <id>http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)</id>
+ <category term="#Microsoft.Test.OData.Services.ODataWCFService.Product" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
+ <link rel="edit" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Details" type="application/atom+xml;type=feed" title="Details" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/Products(5)/Details" />
+ <title />
+ <updated>2014-03-28T11:24:49Z</updated>
+ <author>
+ <name />
+ </author>
+ <content type="application/xml">
+ <m:properties>
+ <d:ProductID m:type="Int32">5</d:ProductID>
+ <d:Name>Cheetos</d:Name>
+ <d:QuantityPerUnit>100g Bag</d:QuantityPerUnit>
+ <d:UnitPrice m:type="Single">3.24</d:UnitPrice>
+ <d:QuantityInStock m:type="Int32">100</d:QuantityInStock>
+ <d:Discontinued m:type="Boolean">true</d:Discontinued>
+ <d:UserAccess m:type="#Microsoft.Test.OData.Services.ODataWCFService.AccessLevel">None</d:UserAccess>
+ <d:SkinColor m:type="#Microsoft.Test.OData.Services.ODataWCFService.Color">Red</d:SkinColor>
+ <d:CoverColors m:type="#Collection(Microsoft.Test.OData.Services.ODataWCFService.Color)">
+ <m:element>Green</m:element>
+ <m:element>Blue</m:element>
+ <m:element>Blue</m:element>
+ </d:CoverColors>
+ </m:properties>
+ </content>
+</entry>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5_SkinColor.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5_SkinColor.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5_SkinColor.json
new file mode 100644
index 0000000..b5e26da
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5_SkinColor.json
@@ -0,0 +1,5 @@
+{
+ "@odata.context": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Products(5)/SkinColor",
+ "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.Color",
+ "value": "Red"
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5_SkinColor.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5_SkinColor.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5_SkinColor.xml
new file mode 100644
index 0000000..be392fd
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/Products_5_SkinColor.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ 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.
+
+-->
+<m:value xmlns:d="http://docs.oasis-open.org/odata/ns/data"
+ xmlns:georss="http://www.georss.org/georss"
+ xmlns:gml="http://www.opengis.net/gml"
+ m:context="http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#Products(5)/SkinColor"
+ m:type="#Microsoft.Test.OData.Services.ODataWCFService.Color"
+ xmlns:m="http://docs.oasis-open.org/odata/ns/metadata">Red</m:value>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/VipCustomer.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/VipCustomer.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/VipCustomer.json
new file mode 100644
index 0000000..5f3f697
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/VipCustomer.json
@@ -0,0 +1,50 @@
+{
+ "@odata.context": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#VipCustomer",
+ "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.Customer",
+ "@odata.id": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/VipCustomer",
+ "@odata.editLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/VipCustomer",
+ "PersonID": 1,
+ "FirstName": "Bob",
+ "LastName": "Cat",
+ "MiddleName": "Vat",
+ "HomeAddress": {
+ "@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.Address",
+ "Street": "1 Microsoft Way",
+ "City": "London",
+ "PostalCode": "98052"
+ },
+ "Home@odata.type": "#GeographyPoint",
+ "Home": {
+ "type": "Point",
+ "coordinates": [23.1, 32.1],
+ "crs": {
+ "type": "name",
+ "properties": {
+ "name": "EPSG:4326"
+ }
+ }
+ },
+ "Numbers@odata.type": "#Collection(String)",
+ "Numbers": ["111-111-1111"],
+ "Emails@odata.type": "#Collection(String)",
+ "Emails": ["abc@abc.com"],
+ "City": "London",
+ "Birthday@odata.type": "#DateTimeOffset",
+ "Birthday": "1957-04-03T00:00:00Z",
+ "TimeBetweenLastTwoOrders@odata.type": "#Duration",
+ "TimeBetweenLastTwoOrders": "PT0.0000001S",
+ "Parent@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/VipCustomer/Parent/$ref",
+ "Parent@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/VipCustomer/Parent",
+ "Orders@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/VipCustomer/Orders/$ref",
+ "Orders@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/VipCustomer/Orders",
+ "Company@odata.associationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/VipCustomer/Company/$ref",
+ "Company@odata.navigationLink": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/VipCustomer/Company",
+ "#Microsoft.Test.OData.Services.ODataWCFService.ResetAddress": {
+ "title": "Microsoft.Test.OData.Services.ODataWCFService.ResetAddress",
+ "target": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/VipCustomer/Microsoft.Test.OData.Services.ODataWCFService.ResetAddress"
+ },
+ "#Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress": {
+ "title": "Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress",
+ "target": "http://odatae2etest.azurewebsites.net/javatest/DefaultService/VipCustomer/Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress"
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/VipCustomer.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/VipCustomer.xml b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/VipCustomer.xml
new file mode 100644
index 0000000..001c1a9
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/VipCustomer.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ 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.
+
+-->
+<entry xml:base="http://odatae2etest.azurewebsites.net/javatest/DefaultService/"
+ xmlns="http://www.w3.org/2005/Atom"
+ xmlns:d="http://docs.oasis-open.org/odata/ns/data"
+ xmlns:m="http://docs.oasis-open.org/odata/ns/metadata"
+ xmlns:georss="http://www.georss.org/georss"
+ xmlns:gml="http://www.opengis.net/gml"
+ m:context="http://odatae2etest.azurewebsites.net/javatest/DefaultService/$metadata#VipCustomer">
+ <id>http://odatae2etest.azurewebsites.net/javatest/DefaultService/VipCustomer</id>
+ <category term="#Microsoft.Test.OData.Services.ODataWCFService.Customer" scheme="http://docs.oasis-open.org/odata/ns/scheme" />
+ <link rel="edit" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/VipCustomer" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Parent" type="application/atom+xml;type=entry" title="Parent" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/VipCustomer/Parent" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Orders" type="application/atom+xml;type=feed" title="Orders" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/VipCustomer/Orders" />
+ <link rel="http://docs.oasis-open.org/odata/ns/related/Company" type="application/atom+xml;type=entry" title="Company" href="http://odatae2etest.azurewebsites.net/javatest/DefaultService/VipCustomer/Company" />
+ <title />
+ <updated>2014-03-28T13:03:32Z</updated>
+ <author>
+ <name />
+ </author>
+ <content type="application/xml">
+ <m:properties>
+ <d:PersonID m:type="Int32">1</d:PersonID>
+ <d:FirstName>Bob</d:FirstName>
+ <d:LastName>Cat</d:LastName>
+ <d:MiddleName>Vat</d:MiddleName>
+ <d:HomeAddress m:type="#Microsoft.Test.OData.Services.ODataWCFService.Address">
+ <d:Street>1 Microsoft Way</d:Street>
+ <d:City>London</d:City>
+ <d:PostalCode>98052</d:PostalCode>
+ </d:HomeAddress>
+ <d:Home m:type="GeographyPoint">
+ <gml:Point gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
+ <gml:pos>32.1 23.1</gml:pos>
+ </gml:Point>
+ </d:Home>
+ <d:Numbers m:type="#Collection(String)">
+ <m:element>111-111-1111</m:element>
+ </d:Numbers>
+ <d:Emails m:type="#Collection(String)">
+ <m:element>abc@abc.com</m:element>
+ </d:Emails>
+ <d:City>London</d:City>
+ <d:Birthday m:type="DateTimeOffset">1957-04-03T00:00:00Z</d:Birthday>
+ <d:TimeBetweenLastTwoOrders m:type="Duration">PT0.0000001S</d:TimeBetweenLastTwoOrders>
+ </m:properties>
+ </content>
+</entry>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/atom_cleanup.xsl
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/atom_cleanup.xsl b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/atom_cleanup.xsl
new file mode 100644
index 0000000..ed30201
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/atom_cleanup.xsl
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns="http://www.w3.org/2005/Atom"
+ xmlns:atom="http://www.w3.org/2005/Atom"
+ xmlns:m="http://docs.oasis-open.org/odata/ns/metadata"
+ version="1.0">
+
+ <xsl:template match="atom:updated"/>
+ <xsl:template match="atom:author"/>
+ <xsl:template match="atom:title">
+ <xsl:if test="string-length(.) > 0">
+ <title type="{@type}">
+ <xsl:apply-templates/>
+ </title>
+ </xsl:if>
+ </xsl:template>
+ <xsl:template match="atom:link[@rel = 'self' or @rel = 'edit' or @rel = 'edit-media']"/>
+
+ <xsl:template match="m:action"/>
+
+ <xsl:template match="@*[name() = 'm:etag' or name() = 'm:context']"/>
+
+ <xsl:template match="node()|@*">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+ </xsl:template>
+</xsl:stylesheet>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/complexProperty.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/complexProperty.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/complexProperty.json
deleted file mode 100644
index 53af94c..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/complexProperty.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "Address": {
- "Street": "Obere Str. 57",
- "City": "Berlin",
- "Region": null,
- "PostalCode": "D-12209"
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.collection.complex.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.collection.complex.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.collection.complex.json
new file mode 100644
index 0000000..0bf131e
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.collection.complex.json
@@ -0,0 +1,14 @@
+{
+ "PhoneNumbers": [
+ {
+ "Number": "425-555-1212",
+ "Type": "Home"
+ },
+ {
+ "@odata.type": "#Model.CellPhoneNumber",
+ "Number": "425-555-0178",
+ "Type": "Cell",
+ "Carrier": "Sprint"
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.collection.primitive.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.collection.primitive.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.collection.primitive.json
new file mode 100644
index 0000000..dc811b4
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.collection.primitive.json
@@ -0,0 +1,7 @@
+{
+ "@odata.context": "http://host/service/$metadata#Customers/$entity",
+ "EmailAddresses": [
+ "Julie@Swansworth.com",
+ "Julie.Swansworth@work.com"
+ ]
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.complex.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.complex.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.complex.json
new file mode 100644
index 0000000..189613f
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.complex.json
@@ -0,0 +1,12 @@
+{
+ "CompanyID": 0,
+ "CompanyCategory": "IT",
+ "Revenue": 100000,
+ "Name": "MS",
+ "Address": {
+ "Street": "1 Microsoft Way",
+ "City": "Redmond",
+ "PostalCode": "98052",
+ "CompanyName": "Microsoft"
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.full.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.full.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.full.json
new file mode 100644
index 0000000..bcd1dba
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.full.json
@@ -0,0 +1,22 @@
+{
+ "@odata.context": "http://host/service/$metadata#Customers/$entity",
+ "@odata.id": "Customers('ALFKI')",
+ "@odata.etag": "W/\"MjAxMy0wNS0yN1QxMTo1OFo=\"",
+ "@odata.editLink": "Customers('ALFKI')",
+ "ID": "ALFKI",
+ "CompanyName": "Alfreds Futterkiste",
+ "ContactName": "Maria Anders",
+ "ContactTitle": "Sales Representative",
+ "Phone": "030-0074321",
+ "Fax": "030-0076545",
+ "Address": {
+ "Street": "Obere Str. 57",
+ "City": "Berlin",
+ "Region": null,
+ "PostalCode": "D-12209",
+ "Country@odata.associationLink": "Customers('ALFKI')/Address/Country/$ref",
+ "Country@odata.navigationLink": "Customers('ALFKI')/Address/Country"
+ },
+ "Orders@odata.associationLink": "Customers('ALFKI')/Orders/$ref",
+ "Orders@odata.navigationLink": "Customers('ALFKI')/Orders"
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.minimal.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.minimal.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.minimal.json
new file mode 100644
index 0000000..de0a50b
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.minimal.json
@@ -0,0 +1,15 @@
+{
+ "@odata.context": "http://host/service/$metadata#Customers/$entity",
+ "ID": "ALFKI",
+ "CompanyName": "Alfreds Futterkiste",
+ "ContactName": "Maria Anders",
+ "ContactTitle": "Sales Representative",
+ "Phone": "030-0074321",
+ "Fax": "030-0076545",
+ "Address": {
+ "Street": "Obere Str. 57",
+ "City": "Berlin",
+ "Region": null,
+ "PostalCode": "D-12209"
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.primitive.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.primitive.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.primitive.json
new file mode 100644
index 0000000..db12081
--- /dev/null
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/entity.primitive.json
@@ -0,0 +1,22 @@
+{
+ "NullValue": null,
+ "TrueValue": true,
+ "FalseValue": false,
+ "BinaryValue": "T0RhdGE",
+ "IntegerValue": -128,
+ "DoubleValue": 3.1415926535897931,
+ "SingleValue": "INF",
+ "DecimalValue": 34.95,
+ "StringValue": "Say \"Hello\",\nthen go",
+ "DateValue": "2012-12-03",
+ "DateTimeOffsetValue": "2012-12-03T07:16:23Z",
+ "DurationValue": "P12DT23H59M59.999999999999S",
+ "TimeOfDayValue": "07:59:59.999",
+ "GuidValue": "01234567-89ab-cdef-0123-456789abcdef",
+ "Int64Value": 0,
+ "ColorEnumValue": "Yellow",
+ "GeographyPoint": {
+ "type": "point",
+ "coordinates": [142.1, 64.1]
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fullEntity.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fullEntity.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fullEntity.json
deleted file mode 100644
index 4d84995..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fullEntity.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "odata.context": "http://host/service/$metadata#Customers/$entity",
- "odata.id": "Customers('ALFKI')",
- "odata.etag": "W/\"MjAxMy0wNS0yN1QxMTo1OFo=\"",
- "odata.editLink": "Customers('ALFKI')",
- "Orders@odata.navigationLink": "Customers('ALFKI')/Orders",
- "Orders@odata.associationLink": "Customers('ALFKI')/Orders/$ref",
- "ID": "ALFKI",
- "CompanyName": "Alfreds Futterkiste",
- "ContactName": "Maria Anders",
- "ContactTitle": "Sales Representative",
- "Phone": "030-0074321",
- "Fax": "030-0076545",
- "Address": {
- "Street": "Obere Str. 57",
- "City": "Berlin",
- "Region": null,
- "PostalCode": "D-12209",
- "Country@odata.navigationLink": "Customers('ALFKI')/Address/Country",
- "Country@odata.associationLink":"Customers('ALFKI')/Address/Country/$ref"
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fullEntitySet.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fullEntitySet.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fullEntitySet.json
deleted file mode 100644
index b3ddf63..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fullEntitySet.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
-"odata.context": "http://host/service/$metadata#Customers/$entity",
-"odata.count": 1,
-"value": [
-{
-"odata.context": "http://host/service/$metadata#Customers/$entity",
-"odata.id": "Customers('ALFKI')",
-"odata.etag": "W/\"MjAxMy0wNS0yN1QxMTo1OFo=\"",
-"odata.editLink": "Customers('ALFKI')",
-"Orders@odata.navigationLink": "Customers('ALFKI')/Orders",
-"Orders@odata.associationLink": "Customers('ALFKI')/Orders/$ref",
-"ID": "ALFKI",
-"CompanyName": "Alfreds Futterkiste",
-"ContactName": "Maria Anders",
-"ContactTitle": "Sales Representative",
-"Phone": "030-0074321",
-"Fax": "030-0076545",
-"Address": {
- "Street": "Obere Str. 57",
- "City": "Berlin",
- "Region": null,
- "PostalCode": "D-12209",
- "Country@odata.navigationLink": "Customers('ALFKI')/Address/Country",
- "Country@odata.associationLink":"Customers('ALFKI')/Address/Country/$ref"
- }
-}
-],
-"odata.nextLink": "http://host/service/EntitySet?$skiptoken=342r89"
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fullEntitySetWithTwoEntities.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fullEntitySetWithTwoEntities.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fullEntitySetWithTwoEntities.json
deleted file mode 100644
index 96854ac..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fullEntitySetWithTwoEntities.json
+++ /dev/null
@@ -1,49 +0,0 @@
-{
-"odata.context": "http://host/service/$metadata#Customers/$entity",
-"odata.count": 1,
-"value": [
- {
- "odata.context": "http://host/service/$metadata#Customers/$entity",
- "odata.id": "Customers('ALFKI')",
- "odata.etag": "W/\"MjAxMy0wNS0yN1QxMTo1OFo=\"",
- "odata.editLink": "Customers('ALFKI')",
- "Orders@odata.navigationLink": "Customers('ALFKI')/Orders",
- "Orders@odata.associationLink": "Customers('ALFKI')/Orders/$ref",
- "ID": "ALFKI",
- "CompanyName": "Alfreds Futterkiste",
- "ContactName": "Maria Anders",
- "ContactTitle": "Sales Representative",
- "Phone": "030-0074321",
- "Fax": "030-0076545",
- "Address": {
- "Street": "Obere Str. 57",
- "City": "Berlin",
- "Region": null,
- "PostalCode": "D-12209",
- "Country@odata.navigationLink": "Customers('ALFKI')/Address/Country",
- "Country@odata.associationLink":"Customers('ALFKI')/Address/Country/$ref"
- }
- },
- {
- "odata.context": "http://host/service/$metadata#Customers/$entity",
- "odata.id": "Customers('MUSKI')",
- "odata.etag": "W/\"MjAxMy0wNS0yN1QxMTo1OFo=\"",
- "odata.editLink": "Customers('MUSKI')",
- "Orders@odata.navigationLink": "Customers('MUSKI')/Orders",
- "Orders@odata.associationLink": "Customers('MUSKI')/Orders/$ref",
- "ID": "MUSKI",
- "CompanyName": "Mustermanns Futterkiste",
- "ContactName": "Mustermann Max",
- "ContactTitle": "Some Guy",
- "Phone": "030-002222",
- "Fax": "030-004444",
- "Address": {
- "Street": "Musterstrasse 42",
- "City": "Musterstadt",
- "Region": "SomeRegion",
- "PostalCode": "D-42042"
- }
- }
-],
-"odata.nextLink": "http://host/service/EntitySet?$skiptoken=342r89"
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fullEntityWithCollectionOfComplexValues.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fullEntityWithCollectionOfComplexValues.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fullEntityWithCollectionOfComplexValues.json
deleted file mode 100644
index cbdfd1c..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/fullEntityWithCollectionOfComplexValues.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "odata.context": "http://host/service/$metadata#Customers/$entity",
- "odata.id": "Customers('ALFKI')",
- "odata.etag": "W/\"MjAxMy0wNS0yN1QxMTo1OFo=\"",
- "odata.editLink": "Customers('ALFKI')",
- "Orders@odata.navigationLink": "Customers('ALFKI')/Orders",
- "Orders@odata.associationLink": "Customers('ALFKI')/Orders/$ref",
- "ID": "ALFKI",
- "CompanyName": "Alfreds Futterkiste",
- "ContactName": "Maria Anders",
- "ContactTitle": "Sales Representative",
- "Phone": "030-0074321",
- "Fax": "030-0076545",
- "Address": [ {
- "Street": "Obere Str. 57",
- "City": "Berlin",
- "Region": null,
- "PostalCode": "D-12209",
- "Country@odata.navigationLink": "Customers('ALFKI')/Address/Country",
- "Country@odata.associationLink":"Customers('ALFKI')/Address/Country/$ref"
- }, {
- "Street": "Musterstrasse 42",
- "City": "Musterstadt",
- "Region": "SomeRegion",
- "PostalCode": "D-42042"
- }
- ]
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/primitiveNullValue.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/primitiveNullValue.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/primitiveNullValue.json
deleted file mode 100644
index 5774413..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/primitiveNullValue.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "NullValue" : null
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/setOfComplexProperties.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/setOfComplexProperties.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/setOfComplexProperties.json
deleted file mode 100644
index 24ec160..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/setOfComplexProperties.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "PhoneNumbers": [
- {
- "Number": "425-555-1212",
- "Type": "Home"
- }, {
- "odata.type": "#Model.CellPhoneNumber",
- "Number": "425-555-0178",
- "Type": "Cell",
- "Carrier": "Sprint"
- }
- ]
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/setOfPrimitiveProperties.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/setOfPrimitiveProperties.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/setOfPrimitiveProperties.json
deleted file mode 100644
index 61b3d2c..0000000
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v4/setOfPrimitiveProperties.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "odata.context": "http://host/service/$metadata#Customers/$entity",
-
- "EmailAddresses": [
- "Julie@Swansworth.com",
- "Julie.Swansworth@work.com"
- ]
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
index 39d9614..0a8bafb 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
@@ -137,15 +137,11 @@ public interface Constants {
public static final String ELEM_URI = "uri";
// JSON stuff
- public final static String JSON_CONTEXT = "@odata.context";
-
public final static String JSON_METADATA = "odata.metadata";
- public final static String JSON_METADATA_ETAG = "@odata.metadataEtag";
-
- public final static String JSON_TYPE = "odata.type";
+ public final static String JSON_CONTEXT = "@odata.context";
- public final static String JSON_TYPE_SUFFIX = "@" + JSON_TYPE;
+ public final static String JSON_METADATA_ETAG = "@odata.metadataEtag";
public final static String JSON_ETAG = "odata.etag";
@@ -153,28 +149,12 @@ public interface Constants {
public final static String JSON_MEDIA_ETAG_SUFFIX = "@" + JSON_MEDIA_ETAG;
- public final static String JSON_ID = "odata.id";
-
- public final static String JSON_READ_LINK = "odata.readLink";
-
- public final static String JSON_EDIT_LINK = "odata.editLink";
-
- public final static String JSON_MEDIAREAD_LINK = "odata.mediaReadLink";
-
- public final static String JSON_MEDIAEDIT_LINK = "odata.mediaEditLink";
-
- public final static String JSON_MEDIAEDIT_LINK_SUFFIX = "@" + JSON_MEDIAEDIT_LINK;
-
public final static String JSON_MEDIA_CONTENT_TYPE = "odata.mediaContentType";
public final static String JSON_MEDIA_CONTENT_TYPE_SUFFIX = "@" + JSON_MEDIA_CONTENT_TYPE;
- public final static String JSON_NAVIGATION_LINK_SUFFIX = "@odata.navigationLinkUrl";
-
public final static String JSON_BIND_LINK_SUFFIX = "@odata.bind";
- public final static String JSON_ASSOCIATION_LINK_SUFFIX = "@odata.associationLinkUrl";
-
public final static String JSON_NULL = "odata.null";
public final static String VALUE = "value";
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entry.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entry.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entry.java
index 5ac0dbd..c064216 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entry.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Entry.java
@@ -39,21 +39,6 @@ public interface Entry {
URI getBaseURI();
/**
- * The context URL describes the content of the payload. It consists of the canonical metadata document URL and a
- * fragment identifying the relevant portion of the metadata document.
- *
- * @return context URL.
- */
- URI getContextURL();
-
- /**
- * Set context URL.
- *
- * @param contextURL context URL.
- */
- void setContextURL(final URI contextURL);
-
- /**
* Gets entry type.
*
* @return entry type.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/EnumValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/EnumValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/EnumValue.java
new file mode 100644
index 0000000..2f13fa7
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/EnumValue.java
@@ -0,0 +1,25 @@
+/*
+ * 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.commons.api.data;
+
+public interface EnumValue extends Value {
+
+ @Override
+ String get();
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Feed.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Feed.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Feed.java
index 45b28d9..4f6a542 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Feed.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Feed.java
@@ -31,21 +31,6 @@ public interface Feed {
URI getBaseURI();
/**
- * The context URL describes the content of the payload. It consists of the canonical metadata document URL and a
- * fragment identifying the relevant portion of the metadata document.
- *
- * @return context URL.
- */
- URI getContextURL();
-
- /**
- * Set context URL.
- *
- * @param contextURL context URL.
- */
- void setContextURL(final URI contextURL);
-
- /**
* Sets number of entries.
*
* @param count number of entries
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Property.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Property.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Property.java
index da34c16..feb8f71 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Property.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Property.java
@@ -18,18 +18,8 @@
*/
package org.apache.olingo.commons.api.data;
-import java.net.URI;
-
public interface Property {
- /**
- * The context URL describes the content of the payload. It consists of the canonical metadata document URL and a
- * fragment identifying the relevant portion of the metadata document.
- *
- * @return context URL.
- */
- URI getContextURL();
-
String getName();
void setName(String name);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Value.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Value.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Value.java
index 045751d..b02f1ba 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Value.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Value.java
@@ -22,10 +22,12 @@ public interface Value {
boolean isNull();
- boolean isSimple();
+ boolean isPrimitive();
boolean isGeospatial();
+ boolean isEnum();
+
boolean isComplex();
boolean isCollection();
@@ -34,7 +36,9 @@ public interface Value {
NullValue asNull();
- PrimitiveValue asSimple();
+ PrimitiveValue asPrimitive();
+
+ EnumValue asEnum();
GeospatialValue asGeospatial();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataPropertyType.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataPropertyType.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataPropertyType.java
index d173e50..99126f7 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataPropertyType.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataPropertyType.java
@@ -21,11 +21,15 @@ package org.apache.olingo.commons.api.domain;
public enum ODataPropertyType {
/**
- * Primitive (including geospatial and enum).
+ * Primitive (including geospatial).
*/
PRIMITIVE,
/**
- * Collection
+ * Enum.
+ */
+ ENUM,
+ /**
+ * Collection.
*/
COLLECTION,
/**
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java
index d637814..96d9937 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/constants/ODataServiceVersion.java
@@ -48,6 +48,22 @@ public enum ODataServiceVersion {
public static final String MEDIA_EDIT_LINK_REL = "mediaEditLinkRel";
+ public static final String JSON_TYPE = "jsonType";
+
+ public static final String JSON_ID = "jsonId";
+
+ public static final String JSON_READ_LINK = "jsonReadLink";
+
+ public static final String JSON_EDIT_LINK = "jsonEditLink";
+
+ public static final String JSON_MEDIAREAD_LINK = "jsonMediaReadLink";
+
+ public static final String JSON_MEDIAEDIT_LINK = "jsonMediaEditLink";
+
+ public static final String JSON_ASSOCIATION_LINK = "jsonAssociationLink";
+
+ public static final String JSON_NAVIGATION_LINK = "jsonNavigationLink";
+
private static final Map<String, String> V30_NAMESPACES = Collections.unmodifiableMap(new HashMap<String, String>() {
private static final long serialVersionUID = 3109256773218160485L;
@@ -62,6 +78,22 @@ public enum ODataServiceVersion {
}
});
+ private static final Map<String, String> V30_JSON = Collections.unmodifiableMap(new HashMap<String, String>() {
+
+ private static final long serialVersionUID = 3109256773218160485L;
+
+ {
+ put(JSON_TYPE, "odata.type");
+ put(JSON_ID, "odata.id");
+ put(JSON_READ_LINK, "odata.readLink");
+ put(JSON_EDIT_LINK, "odata.editLink");
+ put(JSON_MEDIAREAD_LINK, "odata.mediaReadLink");
+ put(JSON_MEDIAEDIT_LINK, "odata.mediaEditLink");
+ put(JSON_ASSOCIATION_LINK, "@odata.associationLinkUrl");
+ put(JSON_NAVIGATION_LINK, "@odata.navigationLinkUrl");
+ }
+ });
+
private static final Map<String, String> V40_NAMESPACES = Collections.unmodifiableMap(new HashMap<String, String>() {
private static final long serialVersionUID = 3109256773218160485L;
@@ -76,6 +108,22 @@ public enum ODataServiceVersion {
}
});
+ private static final Map<String, String> V40_JSON = Collections.unmodifiableMap(new HashMap<String, String>() {
+
+ private static final long serialVersionUID = 3109256773218160485L;
+
+ {
+ put(JSON_TYPE, "@odata.type");
+ put(JSON_ID, "@odata.id");
+ put(JSON_READ_LINK, "@odata.readLink");
+ put(JSON_EDIT_LINK, "@odata.editLink");
+ put(JSON_MEDIAREAD_LINK, "@odata.mediaReadLink");
+ put(JSON_MEDIAEDIT_LINK, "@odata.mediaEditLink");
+ put(JSON_ASSOCIATION_LINK, "@odata.associationLink");
+ put(JSON_NAVIGATION_LINK, "@odata.navigationLink");
+ }
+ });
+
/**
* Validates format and range of a data service version string.
*
@@ -135,6 +183,14 @@ public enum ODataServiceVersion {
: V40_NAMESPACES;
}
+ public Map<String, String> getJSONMap() {
+ return this == V10 || this == V20
+ ? Collections.<String, String>emptyMap()
+ : this == V30
+ ? V30_JSON
+ : V40_JSON;
+ }
+
@Override
public String toString() {
return version;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java
index e258219..656207c 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java
@@ -75,8 +75,9 @@ abstract class AbstractAtomDealer {
new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.PROPERTIES);
this.typeQName = new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ATTR_TYPE);
this.nullQName = new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ATTR_NULL);
- this.elementQName =
- new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_DATASERVICES), Constants.ELEM_ELEMENT);
+ this.elementQName = version == ODataServiceVersion.V30
+ ? new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_DATASERVICES), Constants.ELEM_ELEMENT)
+ : new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ELEM_ELEMENT);
this.countQName =
new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ATOM_ELEM_COUNT);
this.uriQName =
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonDeserializer.java
index 4c92ae6..4ba9671 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonDeserializer.java
@@ -23,7 +23,6 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
import java.util.Iterator;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.data.CollectionValue;
import org.apache.olingo.commons.api.data.ComplexValue;
import org.apache.olingo.commons.api.data.Value;
@@ -95,7 +94,7 @@ abstract class AbstractJsonDeserializer<T> extends ODataJacksonDeserializer<T> {
for (final Iterator<Map.Entry<String, JsonNode>> itor = node.fields(); itor.hasNext();) {
final Map.Entry<String, JsonNode> field = itor.next();
- if (type == null && field.getKey().endsWith(Constants.JSON_TYPE_SUFFIX)) {
+ if (type == null && field.getKey().endsWith(getJSONAnnotation(jsonType))) {
type = field.getValue().asText();
} else {
final JSONPropertyImpl property = new JSONPropertyImpl();
@@ -122,10 +121,14 @@ abstract class AbstractJsonDeserializer<T> extends ODataJacksonDeserializer<T> {
final JsonNode child = nodeItor.next();
if (child.isValueNode()) {
- value.get().add(fromPrimitive(child, type));
+ if (typeInfo == null || typeInfo.isPrimitiveType()) {
+ value.get().add(fromPrimitive(child, type));
+ } else {
+ value.get().add(new EnumValueImpl(child.asText()));
+ }
} else if (child.isContainerNode()) {
- if (child.has(Constants.JSON_TYPE)) {
- ((ObjectNode) child).remove(Constants.JSON_TYPE);
+ if (child.has(jsonType)) {
+ ((ObjectNode) child).remove(jsonType);
}
value.get().add(fromComplex(child));
}
@@ -145,6 +148,8 @@ abstract class AbstractJsonDeserializer<T> extends ODataJacksonDeserializer<T> {
? ODataPropertyType.COLLECTION
: typeInfo.isPrimitiveType()
? ODataPropertyType.PRIMITIVE
+ : node.isValueNode()
+ ? ODataPropertyType.ENUM
: ODataPropertyType.COMPLEX;
switch (propType) {
@@ -153,13 +158,17 @@ abstract class AbstractJsonDeserializer<T> extends ODataJacksonDeserializer<T> {
break;
case COMPLEX:
- if (node.has(Constants.JSON_TYPE)) {
- property.setType(node.get(Constants.JSON_TYPE).asText());
- ((ObjectNode) node).remove(Constants.JSON_TYPE);
+ if (node.has(jsonType)) {
+ property.setType(node.get(jsonType).asText());
+ ((ObjectNode) node).remove(jsonType);
}
property.setValue(fromComplex(node));
break;
+ case ENUM:
+ property.setValue(new EnumValueImpl(node.asText()));
+ break;
+
case PRIMITIVE:
if (property.getType() == null) {
property.setType(getPrimitiveType(node).getFullQualifiedName().toString());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonSerializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonSerializer.java
index 1380dd5..dede6aa 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonSerializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractJsonSerializer.java
@@ -56,22 +56,24 @@ abstract class AbstractJsonSerializer<T> extends ODataJacksonSerializer<T> {
if (value.isNull()) {
jgen.writeNull();
- } else if (value.isSimple()) {
+ } else if (value.isPrimitive()) {
final boolean isNumber = typeInfo == null
- ? NumberUtils.isNumber(value.asSimple().get())
+ ? NumberUtils.isNumber(value.asPrimitive().get())
: ArrayUtils.contains(NUMBER_TYPES, typeInfo.getPrimitiveTypeKind());
final boolean isBoolean = typeInfo == null
- ? (value.asSimple().get().equalsIgnoreCase(Boolean.TRUE.toString())
- || value.asSimple().get().equalsIgnoreCase(Boolean.FALSE.toString()))
+ ? (value.asPrimitive().get().equalsIgnoreCase(Boolean.TRUE.toString())
+ || value.asPrimitive().get().equalsIgnoreCase(Boolean.FALSE.toString()))
: typeInfo.getPrimitiveTypeKind() == EdmPrimitiveTypeKind.Boolean;
if (isNumber) {
- jgen.writeNumber(value.asSimple().get());
+ jgen.writeNumber(value.asPrimitive().get());
} else if (isBoolean) {
- jgen.writeBoolean(BooleanUtils.toBoolean(value.asSimple().get()));
+ jgen.writeBoolean(BooleanUtils.toBoolean(value.asPrimitive().get()));
} else {
- jgen.writeString(value.asSimple().get());
+ jgen.writeString(value.asPrimitive().get());
}
+ } else if (value.isEnum()) {
+ jgen.writeString(value.asEnum().get());
} else if (value.isGeospatial()) {
jgen.writeStartObject();
geoSerializer.serialize(jgen, value.asGeospatial().get());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractODataObject.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractODataObject.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractODataObject.java
index 3bcef74..6dd86a2 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractODataObject.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractODataObject.java
@@ -31,8 +31,6 @@ abstract class AbstractODataObject extends AbstractPayloadObject {
private URI baseURI;
- private URI contextURL;
-
private String id;
private String title;
@@ -49,20 +47,6 @@ abstract class AbstractODataObject extends AbstractPayloadObject {
this.baseURI = URI.create(baseURI);
}
- /**
- * The context URL describes the content of the payload. It consists of the canonical metadata document URL and a
- * fragment identifying the relevant portion of the metadata document.
- *
- * @return context URL.
- */
- public URI getContextURL() {
- return contextURL;
- }
-
- public void setContextURL(final URI contextURL) {
- this.contextURL = contextURL;
- }
-
public String getId() {
return id;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractPropertyImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractPropertyImpl.java
index b3ca459..e005f98 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractPropertyImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractPropertyImpl.java
@@ -18,7 +18,6 @@
*/
package org.apache.olingo.commons.core.data;
-import java.net.URI;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
@@ -28,29 +27,12 @@ import org.apache.olingo.commons.api.data.Value;
public abstract class AbstractPropertyImpl implements Property {
- private URI contextURL;
-
private String name;
private String type;
private Value value;
- /**
- * The context URL describes the content of the payload. It consists of the canonical metadata document URL and a
- * fragment identifying the relevant portion of the metadata document.
- *
- * @return context URL.
- */
- @Override
- public URI getContextURL() {
- return contextURL;
- }
-
- public void setContextURL(final URI contextURL) {
- this.contextURL = contextURL;
- }
-
@Override
public String getName() {
return name;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractValue.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractValue.java
index 31629e2..629592f 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractValue.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractValue.java
@@ -24,6 +24,7 @@ import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.apache.olingo.commons.api.data.CollectionValue;
import org.apache.olingo.commons.api.data.ComplexValue;
+import org.apache.olingo.commons.api.data.EnumValue;
import org.apache.olingo.commons.api.data.GeospatialValue;
import org.apache.olingo.commons.api.data.NullValue;
import org.apache.olingo.commons.api.data.PrimitiveValue;
@@ -37,7 +38,7 @@ public abstract class AbstractValue implements Value {
}
@Override
- public boolean isSimple() {
+ public boolean isPrimitive() {
return false;
}
@@ -47,6 +48,11 @@ public abstract class AbstractValue implements Value {
}
@Override
+ public boolean isEnum() {
+ return false;
+ }
+
+ @Override
public boolean isComplex() {
return false;
}
@@ -62,8 +68,8 @@ public abstract class AbstractValue implements Value {
}
@Override
- public PrimitiveValue asSimple() {
- return isSimple() ? (PrimitiveValue) this : null;
+ public PrimitiveValue asPrimitive() {
+ return isPrimitive() ? (PrimitiveValue) this : null;
}
@Override
@@ -72,6 +78,11 @@ public abstract class AbstractValue implements Value {
}
@Override
+ public EnumValue asEnum() {
+ return isEnum() ? (EnumValue) this : null;
+ }
+
+ @Override
public ComplexValue asComplex() {
return isComplex() ? (ComplexValue) this : null;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ce18b8e0/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
index d863eb6..a16d4ed 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
@@ -384,6 +384,7 @@ public class AtomDeserializer extends AbstractAtomDealer {
@SuppressWarnings("unchecked")
public <T, V extends T> Container<T> read(final InputStream input, final Class<V> reference)
throws XMLStreamException {
+
if (AtomFeedImpl.class.equals(reference)) {
return (Container<T>) feed(input);
} else if (AtomEntryImpl.class.equals(reference)) {
[31/51] [abbrv] [OLINGO-200] Introducing specialization for V3 and V4
domain objects
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
index 0a1d503..446b41d 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntitySetTestITCase.java
@@ -18,9 +18,6 @@
*/
package org.apache.olingo.client.core.it.v3;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
import java.io.IOException;
import java.net.URI;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest;
@@ -28,13 +25,16 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySe
import org.apache.olingo.client.api.communication.request.retrieve.ODataRawRequest;
import org.apache.olingo.client.api.communication.response.ODataRawResponse;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
import org.apache.olingo.client.api.domain.ODataEntitySetIterator;
-import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.core.uri.URIUtils;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
+import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.commons.core.op.ResourceFactory;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
import org.junit.Test;
/**
@@ -90,7 +90,8 @@ public class EntitySetTestITCase extends AbstractTestITCase {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot());
uriBuilder.appendEntitySetSegment("Customer");
- final ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
+ final ODataEntitySetRequest<ODataEntitySet> req = client.getRetrieveRequestFactory().
+ getEntitySetRequest(uriBuilder.build());
req.setFormat(format);
final ODataRetrieveResponse<ODataEntitySet> res = req.execute();
@@ -143,7 +144,7 @@ public class EntitySetTestITCase extends AbstractTestITCase {
final ODataRawResponse res = req.execute();
assertNotNull(res);
- final ODataEntitySet entitySet = res.getBodyAs(ODataEntitySet.class);
+ final CommonODataEntitySet entitySet = res.getBodyAs(CommonODataEntitySet.class);
assertNotNull(entitySet);
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
index fed9ba4..6ed898d 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
@@ -18,23 +18,24 @@
*/
package org.apache.olingo.client.core.it.v3;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-
import java.net.URI;
import java.util.LinkedHashMap;
import org.apache.olingo.client.api.communication.ODataClientErrorException;
import org.apache.olingo.client.api.communication.header.HeaderName;
import org.apache.olingo.client.api.communication.header.ODataPreferences;
-import org.apache.olingo.client.api.communication.request.cud.v3.UpdateType;
import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest;
+import org.apache.olingo.client.api.communication.request.cud.v3.UpdateType;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
import org.junit.Test;
/**
@@ -52,7 +53,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
final URI uri = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Product").appendKeySegment(-10).build();
final String etag = getETag(uri);
- final ODataEntity merge = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE);
+ final CommonODataEntity merge = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE);
merge.setEditLink(uri);
updateEntityDescription(format, merge, UpdateType.MERGE, etag);
}
@@ -63,7 +64,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
final URI uri = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Product").appendKeySegment(-10).build();
final String etag = getETag(uri);
- final ODataEntity merge = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE);
+ final CommonODataEntity merge = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE);
merge.setEditLink(uri);
updateEntityDescription(format, merge, UpdateType.MERGE, etag);
}
@@ -74,7 +75,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
final URI uri = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Product").appendKeySegment(-10).build();
final String etag = getETag(uri);
- final ODataEntity patch = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE);
+ final CommonODataEntity patch = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE);
patch.setEditLink(uri);
updateEntityDescription(format, patch, UpdateType.PATCH, etag);
}
@@ -85,7 +86,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
final URI uri = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Product").appendKeySegment(-10).build();
final String etag = getETag(uri);
- final ODataEntity patch = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE);
+ final CommonODataEntity patch = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE);
patch.setEditLink(uri);
updateEntityDescription(format, patch, UpdateType.PATCH, etag);
}
@@ -93,7 +94,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
@Test
public void replaceAsAtom() {
final ODataPubFormat format = ODataPubFormat.ATOM;
- final ODataEntity changes = read(format, client.getURIBuilder(getServiceRoot()).
+ final CommonODataEntity changes = read(format, client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Car").appendKeySegment(14).build());
updateEntityDescription(format, changes, UpdateType.REPLACE);
}
@@ -101,7 +102,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
@Test
public void replaceAsJSON() {
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
- final ODataEntity changes = read(format, client.getURIBuilder(getServiceRoot()).
+ final CommonODataEntity changes = read(format, client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Car").appendKeySegment(14).build());
updateEntityDescription(format, changes, UpdateType.REPLACE);
}
@@ -120,7 +121,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
final URI uri = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Customer").appendKeySegment(-10).build();
- final ODataEntity patch =
+ final CommonODataEntity patch =
client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.Customer");
patch.setEditLink(uri);
@@ -137,10 +138,10 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
customerInfoURI = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Customer").appendKeySegment(-10).appendNavigationSegment("Info").build();
- ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(customerInfoURI);
+ ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(customerInfoURI);
req.setFormat(format);
- ODataEntity newInfo = req.execute().getBody();
+ CommonODataEntity newInfo = req.execute().getBody();
assertEquals(Integer.valueOf(12),
newInfo.getProperty("CustomerInfoId").getPrimitiveValue().toCastValue(Integer.class));
@@ -178,16 +179,17 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
final LinkedHashMap<String, Object> multiKey = new LinkedHashMap<String, Object>();
multiKey.put("FromUsername", "1");
multiKey.put("MessageId", -10);
- final ODataEntity message = read(format, client.getURIBuilder(getServiceRoot()).
+ final CommonODataEntity message = read(format, client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Message").appendKeySegment(multiKey).build());
message.getAssociationLinks().clear();
message.getNavigationLinks().clear();
final boolean before = message.getProperty("IsRead").getPrimitiveValue().toCastValue(Boolean.class);
message.getProperties().remove(message.getProperty("IsRead"));
- message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("IsRead",
- client.getObjectFactory().newPrimitiveValueBuilder().setValue(!before).
- setType(EdmPrimitiveTypeKind.Boolean).build()));
+ getClient().getBinder().add(message,
+ client.getObjectFactory().newPrimitiveProperty("IsRead",
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue(!before).
+ setType(EdmPrimitiveTypeKind.Boolean).build()));
return client.getCUDRequestFactory().getEntityUpdateRequest(UpdateType.MERGE, message);
}
@@ -224,7 +226,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
final URI uri = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Product").appendKeySegment(-10).build();
String etag = getETag(uri);
- final ODataEntity product = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE);
+ final CommonODataEntity product = client.getObjectFactory().newEntity(TEST_PRODUCT_TYPE);
product.setEditLink(uri);
updateEntityStringProperty("BaseConcurrency",
client.getConfiguration().getDefaultPubFormat(), product, UpdateType.MERGE, etag);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java
index ed8a776..04c41de 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/ErrorTestITCase.java
@@ -18,11 +18,11 @@
*/
package org.apache.olingo.client.core.it.v3;
-import static org.junit.Assert.fail;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.net.URI;
@@ -32,16 +32,17 @@ import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.ODataClientErrorException;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
-import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
+import org.apache.olingo.client.core.uri.URIUtils;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmEntityContainer;
import org.apache.olingo.commons.api.edm.EdmFunctionImport;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.junit.Test;
/**
@@ -79,7 +80,7 @@ public class ErrorTestITCase extends AbstractTestITCase {
}
@Override
- public ODataEntity getBody() {
+ public CommonODataEntity getBody() {
return odataClient.getObjectFactory().newEntity("Invalid");
}
}
@@ -117,7 +118,7 @@ public class ErrorTestITCase extends AbstractTestITCase {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL);
uriBuilder.appendEntitySetSegment("Customer(154)");
- final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setFormat(format);
try {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/FilterFactoryTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/FilterFactoryTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/FilterFactoryTestITCase.java
index 28c354d..de6808c 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/FilterFactoryTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/FilterFactoryTestITCase.java
@@ -18,7 +18,7 @@
*/
package org.apache.olingo.client.core.it.v3;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.api.uri.URIFilter;
import org.apache.olingo.client.api.uri.v3.FilterArgFactory;
@@ -42,7 +42,7 @@ public class FilterFactoryTestITCase extends AbstractTestITCase {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment(entitySet).filter(filter);
- final ODataEntitySet feed = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build()).
+ final CommonODataEntitySet feed = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build()).
execute().getBody();
assertNotNull(feed);
assertEquals(expected, feed.getEntities().size());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/FilterTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/FilterTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/FilterTestITCase.java
index cbcf046..44be0fe 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/FilterTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/FilterTestITCase.java
@@ -21,7 +21,7 @@ package org.apache.olingo.client.core.it.v3;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertEquals;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.junit.Test;
@@ -30,7 +30,7 @@ public class FilterTestITCase extends AbstractTestITCase {
private void filterQueryTest(final String entity, final String filter, final int expected) {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment(entity).filter(filter);
- final ODataEntitySet entitySet = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build()).
+ final CommonODataEntitySet entitySet = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build()).
execute().getBody();
assertNotNull(entitySet);
assertEquals(expected, entitySet.getEntities().size());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/KeyAsSegmentTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/KeyAsSegmentTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/KeyAsSegmentTestITCase.java
index dac96e6..4a9d05f 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/KeyAsSegmentTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/KeyAsSegmentTestITCase.java
@@ -21,13 +21,14 @@ package org.apache.olingo.client.core.it.v3;
import org.apache.olingo.client.api.communication.request.cud.v3.UpdateType;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
+import org.junit.AfterClass;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
-import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -42,7 +43,7 @@ public class KeyAsSegmentTestITCase extends AbstractTestITCase {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Customer").appendKeySegment(-10);
- final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setFormat(format);
final ODataRetrieveResponse<ODataEntity> res = req.execute();
@@ -67,10 +68,10 @@ public class KeyAsSegmentTestITCase extends AbstractTestITCase {
public void createODataEntityAsAtom() {
final ODataPubFormat format = ODataPubFormat.ATOM;
final int id = 1;
- final ODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
+ final CommonODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
createEntity(testStaticServiceRootURL, format, original, "Customer");
- final ODataEntity actual = compareEntities(testStaticServiceRootURL, format, original, id, null);
+ final CommonODataEntity actual = compareEntities(testStaticServiceRootURL, format, original, id, null);
cleanAfterCreate(format, actual, false, testStaticServiceRootURL);
}
@@ -79,10 +80,10 @@ public class KeyAsSegmentTestITCase extends AbstractTestITCase {
public void createODataEntityAsJSON() {
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
final int id = 2;
- final ODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
+ final CommonODataEntity original = getSampleCustomerProfile(id, "Sample customer", false);
createEntity(testStaticServiceRootURL, format, original, "Customer");
- final ODataEntity actual = compareEntities(testStaticServiceRootURL, format, original, id, null);
+ final CommonODataEntity actual = compareEntities(testStaticServiceRootURL, format, original, id, null);
cleanAfterCreate(format, actual, false, testStaticServiceRootURL);
}
@@ -90,7 +91,7 @@ public class KeyAsSegmentTestITCase extends AbstractTestITCase {
@Test
public void replaceODataEntityAsAtom() {
final ODataPubFormat format = ODataPubFormat.ATOM;
- final ODataEntity changes = read(format, client.getURIBuilder(testStaticServiceRootURL).
+ final CommonODataEntity changes = read(format, client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Car").appendKeySegment(14).build());
updateEntityDescription(format, changes, UpdateType.REPLACE);
}
@@ -98,7 +99,7 @@ public class KeyAsSegmentTestITCase extends AbstractTestITCase {
@Test
public void replaceODataEntityAsJSON() {
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
- final ODataEntity changes = read(format, client.getURIBuilder(testStaticServiceRootURL).
+ final CommonODataEntity changes = read(format, client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Car").appendKeySegment(14).build());
updateEntityDescription(format, changes, UpdateType.REPLACE);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/MediaEntityTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/MediaEntityTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/MediaEntityTestITCase.java
index 3350204..03bdf00 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/MediaEntityTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/MediaEntityTestITCase.java
@@ -36,8 +36,8 @@ import org.apache.olingo.client.api.communication.response.ODataMediaEntityCreat
import org.apache.olingo.client.api.communication.response.ODataMediaEntityUpdateResponse;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.communication.response.ODataStreamUpdateResponse;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.format.ODataMediaFormat;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
@@ -164,12 +164,12 @@ public class MediaEntityTestITCase extends AbstractTestITCase {
final ODataMediaEntityCreateResponse createRes = streamManager.getResponse();
assertEquals(201, createRes.getStatusCode());
- final ODataEntity created = createRes.getBody();
+ final CommonODataEntity created = createRes.getBody();
assertNotNull(created);
assertEquals(2, created.getProperties().size());
Integer id = null;
- for (ODataProperty prop : created.getProperties()) {
+ for (CommonODataProperty prop : created.getProperties()) {
if ("VIN".equals(prop.getName())) {
id = prop.getPrimitiveValue().toCastValue(Integer.class);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
index 5cc8770..fcbbe80 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
@@ -18,11 +18,6 @@
*/
package org.apache.olingo.client.core.it.v3;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
import java.net.URI;
import java.util.ArrayList;
import java.util.Collection;
@@ -38,25 +33,30 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySe
import org.apache.olingo.client.api.communication.response.ODataDeleteResponse;
import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
+import org.apache.olingo.client.api.http.HttpClientException;
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
+import org.apache.olingo.client.core.uri.URIUtils;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
+import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.commons.api.domain.ODataCollectionValue;
import org.apache.olingo.commons.api.domain.ODataComplexValue;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
import org.apache.olingo.commons.api.domain.ODataInlineEntity;
import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
import org.apache.olingo.commons.api.domain.ODataLink;
-import org.apache.olingo.commons.api.domain.ODataProperty;
-import org.apache.olingo.commons.api.domain.ODataValue;
-import org.apache.olingo.commons.api.format.ODataPubFormat;
-import org.apache.olingo.client.api.http.HttpClientException;
-import org.apache.olingo.client.api.uri.CommonURIBuilder;
-import org.apache.olingo.client.core.uri.URIUtils;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
+import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.v3.ODataProperty;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-
-import org.junit.Test;
-
+import org.apache.olingo.commons.api.format.ODataPubFormat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
import org.junit.Ignore;
+import org.junit.Test;
public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
@@ -66,7 +66,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
final ODataPubFormat format = ODataPubFormat.ATOM;
final String contentType = "application/atom+xml";
final String prefer = "return-content";
- final ODataEntity actual = createNavigation(format, 20, contentType, prefer);
+ final CommonODataEntity actual = createNavigation(format, 20, contentType, prefer);
delete(format, actual, false, testStaticServiceRootURL);
}
// create navigation link with JSON full metadata
@@ -76,7 +76,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
final String contentType = "application/json;odata=fullmetadata";
final String prefer = "return-content";
- final ODataEntity actual = createNavigation(format, 21, contentType, prefer);
+ final CommonODataEntity actual = createNavigation(format, 21, contentType, prefer);
delete(format, actual, false, testStaticServiceRootURL);
}
// throws Null pointer exception when the format is JSON No metadata
@@ -86,7 +86,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
final ODataPubFormat format = ODataPubFormat.JSON_NO_METADATA;
final String contentType = "application/json;odata=nometadata";
final String prefer = "return-content";
- final ODataEntity actual = createNavigation(format, 22, contentType, prefer);
+ final CommonODataEntity actual = createNavigation(format, 22, contentType, prefer);
delete(format, actual, false, testStaticServiceRootURL);
}
// test with JSON accept and atom content type
@@ -97,7 +97,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
final String contentType = "application/atom+xml";
final String prefer = "return-content";
- final ODataEntity actual = createNavigation(format, 23, contentType, prefer);
+ final CommonODataEntity actual = createNavigation(format, 23, contentType, prefer);
delete(format, actual, false, testStaticServiceRootURL);
}
// test with JSON full metadata in format and json no metadata in content type
@@ -107,7 +107,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
final String contentType = "application/json;odata=nometadata";
final String prefer = "return-content";
- final ODataEntity actual = createNavigation(format, 24, contentType, prefer);
+ final CommonODataEntity actual = createNavigation(format, 24, contentType, prefer);
delete(format, actual, false, testStaticServiceRootURL);
}
// test with JSON no metadata format and json no metadata in content type
@@ -117,7 +117,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
final ODataPubFormat format = ODataPubFormat.JSON_NO_METADATA;
final String contentType = "application/json;odata=fullmetadata";
final String prefer = "return-content";
- final ODataEntity actual = createNavigation(format, 25, contentType, prefer);
+ final CommonODataEntity actual = createNavigation(format, 25, contentType, prefer);
delete(format, actual, false, testStaticServiceRootURL);
}
// create collection navigation link with ATOM
@@ -127,7 +127,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
final ODataPubFormat format = ODataPubFormat.ATOM;
final String contentType = "application/atom+xml";
final String prefer = "return-content";
- final ODataEntity actual = createCollectionNavigation(format, 55, contentType, prefer);
+ final CommonODataEntity actual = createCollectionNavigation(format, 55, contentType, prefer);
delete(format, actual, false, testStaticServiceRootURL);
}
// create collection navigation link with JSON
@@ -137,27 +137,27 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
final ODataPubFormat format = ODataPubFormat.JSON_FULL_METADATA;
final String contentType = "application/json;odata=fullmetadata";
final String prefer = "return-content";
- final ODataEntity actual = createCollectionNavigation(format, 77, contentType, prefer);
+ final CommonODataEntity actual = createCollectionNavigation(format, 77, contentType, prefer);
delete(format, actual, false, testStaticServiceRootURL);
}
// create a navigation link
- public ODataEntity createNavigation(final ODataPubFormat format, final int id, final String contenttype,
+ public CommonODataEntity createNavigation(final ODataPubFormat format, final int id, final String contenttype,
final String prefer) {
final String name = "Customer Navigation test";
- final ODataEntity original = getNewCustomer(id, name, false);
+ final CommonODataEntity original = getNewCustomer(id, name, false);
original.addLink(client.getObjectFactory().newEntityNavigationLink(
"Info", URI.create(testStaticServiceRootURL + "/CustomerInfo(11)")));
- final ODataEntity created = createNav(testStaticServiceRootURL, format, original, "Customer", contenttype,
+ final CommonODataEntity created = createNav(testStaticServiceRootURL, format, original, "Customer", contenttype,
prefer);
- final ODataEntity actual = validateEntities(testStaticServiceRootURL, format, created, id, null, "Customer");
+ final CommonODataEntity actual = validateEntities(testStaticServiceRootURL, format, created, id, null, "Customer");
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL);
uriBuilder.appendEntitySetSegment("Customer").appendKeySegment(id).appendEntitySetSegment("Info");
- final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setFormat(format);
req.setContentType(contenttype);
req.setPrefer(prefer);
@@ -175,7 +175,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
}
// create a navigation link
- public ODataEntity createNav(final String url, final ODataPubFormat format, final ODataEntity original,
+ public CommonODataEntity createNav(final String url, final ODataPubFormat format, final CommonODataEntity original,
final String entitySetName, final String contentType, final String prefer) {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(url);
uriBuilder.appendEntitySetSegment(entitySetName);
@@ -189,32 +189,34 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
assertEquals("Created", createRes.getStatusMessage());
- final ODataEntity created = createRes.getBody();
+ final CommonODataEntity created = createRes.getBody();
assertNotNull(created);
return created;
}
// create collection navigation link
- public ODataEntity createCollectionNavigation(final ODataPubFormat format, final int id,
+ public CommonODataEntity createCollectionNavigation(final ODataPubFormat format, final int id,
final String contentType, final String prefer) throws EdmPrimitiveTypeException {
{
final String name = "Collection Navigation Key Customer";
- final ODataEntity original = getNewCustomer(id, name, false);
+ final CommonODataEntity original = getNewCustomer(id, name, false);
final Set<Integer> navigationKeys = new HashSet<Integer>();
navigationKeys.add(-118);
navigationKeys.add(-119);
for (Integer key : navigationKeys) {
- final ODataEntity orderEntity =
+ final CommonODataEntity orderEntity =
client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.Order");
- orderEntity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("OrderId",
- client.getObjectFactory().newPrimitiveValueBuilder().setValue(key).
- setType(EdmPrimitiveTypeKind.Int32).build()));
- orderEntity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("CustomerId",
- client.getObjectFactory().newPrimitiveValueBuilder().setValue(id).
- setType(EdmPrimitiveTypeKind.Int32).build()));
+ getClient().getBinder().add(orderEntity,
+ client.getObjectFactory().newPrimitiveProperty("OrderId",
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue(key).
+ setType(EdmPrimitiveTypeKind.Int32).build()));
+ getClient().getBinder().add(orderEntity,
+ client.getObjectFactory().newPrimitiveProperty("CustomerId",
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue(id).
+ setType(EdmPrimitiveTypeKind.Int32).build()));
final ODataEntityCreateRequest createReq = client.getCUDRequestFactory().getEntityCreateRequest(
client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Order").build(),
@@ -225,26 +227,27 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
"Orders",
createReq.execute().getBody().getEditLink()));
}
- final ODataEntity createdEntity = createNav(testStaticServiceRootURL, format, original, "Customer",
+ final CommonODataEntity createdEntity = createNav(testStaticServiceRootURL, format, original, "Customer",
contentType, prefer);
- final ODataEntity actualEntity =
+ final CommonODataEntity actualEntity =
validateEntities(testStaticServiceRootURL, format, createdEntity, id, null, "Customer");
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL);
uriBuilder.appendEntitySetSegment("Customer").appendKeySegment(id).appendEntitySetSegment("Orders");
- final ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
+ final ODataEntitySetRequest<ODataEntitySet> req = client.getRetrieveRequestFactory().
+ getEntitySetRequest(uriBuilder.build());
req.setFormat(format);
final ODataRetrieveResponse<ODataEntitySet> res = req.execute();
assertEquals(200, res.getStatusCode());
- final ODataEntitySet entitySet = res.getBody();
+ final CommonODataEntitySet entitySet = res.getBody();
assertNotNull(entitySet);
assertEquals(2, entitySet.getCount());
- for (ODataEntity entity : entitySet.getEntities()) {
+ for (CommonODataEntity entity : entitySet.getEntities()) {
final Integer key = entity.getProperty("OrderId").getPrimitiveValue().toCastValue(Integer.class);
final Integer customerId = entity.getProperty("CustomerId").getPrimitiveValue().toCastValue(Integer.class);
assertTrue(navigationKeys.contains(key));
@@ -262,22 +265,24 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
}
// get a Customer entity to be created
- public ODataEntity getNewCustomer(
+ public CommonODataEntity getNewCustomer(
final int id, final String name, final boolean withInlineInfo) {
- final ODataEntity entity =
+ final CommonODataEntity entity =
client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.Customer");
// add name attribute
- entity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Name",
- client.getObjectFactory().newPrimitiveValueBuilder().setText(name).
- setType(EdmPrimitiveTypeKind.String).build()));
+ getClient().getBinder().add(entity,
+ client.getObjectFactory().newPrimitiveProperty("Name",
+ client.getObjectFactory().newPrimitiveValueBuilder().setText(name).
+ setType(EdmPrimitiveTypeKind.String).build()));
// add key attribute
if (id != 0) {
- entity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("CustomerId",
- client.getObjectFactory().newPrimitiveValueBuilder().setText(String.valueOf(id)).
- setType(EdmPrimitiveTypeKind.Int32).build()));
+ getClient().getBinder().add(entity,
+ client.getObjectFactory().newPrimitiveProperty("CustomerId",
+ client.getObjectFactory().newPrimitiveValueBuilder().setText(String.valueOf(id)).
+ setType(EdmPrimitiveTypeKind.Int32).build()));
}
final ODataCollectionValue backupContactInfoValue = getClient().getObjectFactory().newCollectionValue(
"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails)");
@@ -319,8 +324,8 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
contactDetails.add(client.getObjectFactory().newComplexProperty("HomePhone", homePhone));
backupContactInfoValue.add(contactDetails);
- entity.getProperties().add(client.getObjectFactory().newCollectionProperty("BackupContactInfo",
- backupContactInfoValue));
+ getClient().getBinder().add(entity,
+ client.getObjectFactory().newCollectionProperty("BackupContactInfo", backupContactInfoValue));
if (withInlineInfo) {
final ODataInlineEntity inlineInfo = client.getObjectFactory().newInlineEntity("Info", URI.create(
"Customer(" + id
@@ -333,7 +338,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
}
//delete an entity and associated links after creation
- public void delete(final ODataPubFormat format, final ODataEntity created, final boolean includeInline,
+ public void delete(final ODataPubFormat format, final CommonODataEntity created, final boolean includeInline,
final String baseUri) {
final Set<URI> toBeDeleted = new HashSet<URI>();
toBeDeleted.add(created.getEditLink());
@@ -341,15 +346,15 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
if (includeInline) {
for (ODataLink link : created.getNavigationLinks()) {
if (link instanceof ODataInlineEntity) {
- final ODataEntity inline = ((ODataInlineEntity) link).getEntity();
+ final CommonODataEntity inline = ((ODataInlineEntity) link).getEntity();
if (inline.getEditLink() != null) {
toBeDeleted.add(URIUtils.getURI(baseUri, inline.getEditLink().toASCIIString()));
}
}
if (link instanceof ODataInlineEntitySet) {
- final ODataEntitySet inline = ((ODataInlineEntitySet) link).getEntitySet();
- for (ODataEntity entity : inline.getEntities()) {
+ final CommonODataEntitySet inline = ((ODataInlineEntitySet) link).getEntitySet();
+ for (CommonODataEntity entity : inline.getEntities()) {
if (entity.getEditLink() != null) {
toBeDeleted.add(URIUtils.getURI(baseUri, entity.getEditLink().toASCIIString()));
}
@@ -371,21 +376,21 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
}
// add Information property
- public ODataEntity getInfo(final int id, final String info) {
- final ODataEntity entity =
+ public CommonODataEntity getInfo(final int id, final String info) {
+ final CommonODataEntity entity =
client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.CustomerInfo");
entity.setMediaEntity(true);
- entity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Information",
+ getClient().getBinder().add(entity, client.getObjectFactory().newPrimitiveProperty("Information",
client.getObjectFactory().newPrimitiveValueBuilder().setText(info).
setType(EdmPrimitiveTypeKind.String).build()));
return entity;
}
// validate newly created entities
- public ODataEntity validateEntities(final String serviceRootURL,
+ public CommonODataEntity validateEntities(final String serviceRootURL,
final ODataPubFormat format,
- final ODataEntity original,
+ final CommonODataEntity original,
final int actualObjectId,
final Collection<String> expands, final String entitySetName) {
@@ -397,7 +402,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
uriBuilder.expand(expand);
}
}
- final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setFormat(format);
final ODataRetrieveResponse<ODataEntity> res = req.execute();
@@ -438,10 +443,10 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
assertNotNull(foundActual);
if (foundOriginal instanceof ODataInlineEntity && foundActual instanceof ODataInlineEntity) {
- final ODataEntity originalInline = ((ODataInlineEntity) foundOriginal).getEntity();
+ final CommonODataEntity originalInline = ((ODataInlineEntity) foundOriginal).getEntity();
assertNotNull(originalInline);
- final ODataEntity actualInline = ((ODataInlineEntity) foundActual).getEntity();
+ final CommonODataEntity actualInline = ((ODataInlineEntity) foundActual).getEntity();
assertNotNull(actualInline);
checkProperties(originalInline.getProperties(), actualInline.getProperties());
@@ -451,22 +456,24 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
// compares properties of the newly created entity with the properties that were originally provided
@Override
- public void checkProperties(final Collection<ODataProperty> original, final Collection<ODataProperty> actual) {
+ public void checkProperties(final Collection<? extends CommonODataProperty> original,
+ final Collection<? extends CommonODataProperty> actual) {
+
assertTrue(original.size() <= actual.size());
- final Map<String, ODataProperty> actualProperties = new HashMap<String, ODataProperty>(actual.size());
+ final Map<String, CommonODataProperty> actualProperties = new HashMap<String, CommonODataProperty>(actual.size());
- for (ODataProperty prop : actual) {
+ for (CommonODataProperty prop : actual) {
assertFalse(actualProperties.containsKey(prop.getName()));
actualProperties.put(prop.getName(), prop);
}
assertTrue(actual.size() <= actualProperties.size());
- for (ODataProperty prop : original) {
+ for (CommonODataProperty prop : original) {
assertNotNull(prop);
if (actualProperties.containsKey(prop.getName())) {
- final ODataProperty actualProp = actualProperties.get(prop.getName());
+ final CommonODataProperty actualProp = actualProperties.get(prop.getName());
assertNotNull(actualProp);
if (prop.getValue() != null && actualProp.getValue() != null) {
@@ -488,13 +495,13 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
original.getClass().getSimpleName(), actual.getClass().getSimpleName());
if (original.isComplex()) {
- final List<ODataProperty> originalPropertyValue = new ArrayList<ODataProperty>();
- for (ODataProperty prop : original.asComplex()) {
+ final List<CommonODataProperty> originalPropertyValue = new ArrayList<CommonODataProperty>();
+ for (CommonODataProperty prop : original.asComplex()) {
originalPropertyValue.add(prop);
}
- final List<ODataProperty> actualPropertyValue = new ArrayList<ODataProperty>();
- for (ODataProperty prop : (ODataComplexValue) actual) {
+ final List<CommonODataProperty> actualPropertyValue = new ArrayList<CommonODataProperty>();
+ for (CommonODataProperty prop : (ODataComplexValue) actual) {
actualPropertyValue.add(prop);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
index d00bf8b..f576a03 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
@@ -29,7 +29,7 @@ import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateR
import org.apache.olingo.client.api.communication.response.ODataDeleteResponse;
import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
import org.apache.olingo.commons.api.domain.ODataComplexValue;
-import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.commons.api.edm.Edm;
@@ -61,14 +61,14 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
// assertTrue(metadata.getEntityType(new FullQualifiedName(schema.getNamespace(), "RowIndex")).isOpenType());
}
- private ODataEntity readRow(final ODataPubFormat format, final String uuid) {
+ private CommonODataEntity readRow(final ODataPubFormat format, final String uuid) {
final CommonURIBuilder<?> builder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Row").appendKeySegment(UUID.fromString(uuid));
return read(format, builder.build());
}
private void read(final ODataPubFormat format) {
- ODataEntity row = readRow(format, "71f7d0dc-ede4-45eb-b421-555a2aa1e58f");
+ CommonODataEntity row = readRow(format, "71f7d0dc-ede4-45eb-b421-555a2aa1e58f");
assertEquals(EdmPrimitiveTypeKind.Double, row.getProperty("Double").getPrimitiveValue().getTypeKind());
assertEquals(EdmPrimitiveTypeKind.Guid, row.getProperty("Id").getPrimitiveValue().getTypeKind());
@@ -91,60 +91,74 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
private void cud(final ODataPubFormat format) {
final UUID guid = UUID.randomUUID();
- ODataEntity row = client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.OpenTypesService.Row");
- row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Id",
- client.getObjectFactory().newPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.Guid).setValue(guid).
- build()));
- row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aString",
- client.getObjectFactory().newPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.String).setValue("string").
- build()));
- row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aBoolean",
- client.getObjectFactory().newPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.Boolean).setValue(true).
- build()));
- row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aLong",
- client.getObjectFactory().newPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.Int64).setValue(15L).
- build()));
- row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aDouble",
- client.getObjectFactory().newPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.Double).setValue(1.5D).
- build()));
- row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aByte",
- client.getObjectFactory().newPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.SByte).setValue(Byte.MAX_VALUE).
- build()));
- row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aDate",
- client.getObjectFactory().newPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.DateTime).setValue(new Date()).
- build()));
+ CommonODataEntity row = client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.OpenTypesService.Row");
+ getClient().getBinder().add(row,
+ client.getObjectFactory().newPrimitiveProperty("Id",
+ client.getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.Guid).setValue(guid).
+ build()));
+ getClient().getBinder().add(row,
+ client.getObjectFactory().newPrimitiveProperty("aString",
+ client.getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.String).setValue("string").
+ build()));
+ getClient().getBinder().add(row,
+ client.getObjectFactory().newPrimitiveProperty("aBoolean",
+ client.getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.Boolean).setValue(true).
+ build()));
+ getClient().getBinder().add(row,
+ client.getObjectFactory().newPrimitiveProperty("aLong",
+ client.getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.Int64).setValue(15L).
+ build()));
+ getClient().getBinder().add(row,
+ client.getObjectFactory().newPrimitiveProperty("aDouble",
+ client.getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.Double).setValue(1.5D).
+ build()));
+ getClient().getBinder().add(row,
+ client.getObjectFactory().newPrimitiveProperty("aByte",
+ client.getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.SByte).setValue(Byte.MAX_VALUE).
+ build()));
+ getClient().getBinder().add(row,
+ client.getObjectFactory().newPrimitiveProperty("aDate",
+ client.getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.DateTime).setValue(new Date()).
+ build()));
final Point point = new Point(Geospatial.Dimension.GEOGRAPHY, null);
point.setX(1.2);
point.setY(2.1);
- row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aPoint",
- client.getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPoint).
- setValue(point).build()));
+ getClient().getBinder().add(row,
+ client.getObjectFactory().newPrimitiveProperty("aPoint",
+ client.getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPoint).
+ setValue(point).build()));
final List<Point> points = new ArrayList<Point>();
points.add(point);
points.add(point);
final MultiPoint multipoint = new MultiPoint(Geospatial.Dimension.GEOMETRY, null, points);
- row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aMultiPoint",
- client.getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeometryMultiPoint).
- setValue(multipoint).build()));
+ getClient().getBinder().add(row,
+ client.getObjectFactory().newPrimitiveProperty("aMultiPoint",
+ client.getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.GeometryMultiPoint).
+ setValue(multipoint).build()));
final LineString lineString = new LineString(Geospatial.Dimension.GEOMETRY, null, points);
- row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aLineString",
- client.getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeometryLineString).
- setValue(lineString).build()));
+ getClient().getBinder().add(row,
+ client.getObjectFactory().newPrimitiveProperty("aLineString",
+ client.getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.GeometryLineString).
+ setValue(lineString).build()));
final List<LineString> lineStrings = new ArrayList<LineString>();
lineStrings.add(lineString);
lineStrings.add(lineString);
final MultiLineString multiLineString = new MultiLineString(Geospatial.Dimension.GEOGRAPHY, null, lineStrings);
- row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aMultiLineString",
- client.getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeometryMultiLineString).
- setValue(multiLineString).build()));
+ getClient().getBinder().add(row,
+ client.getObjectFactory().newPrimitiveProperty("aMultiLineString",
+ client.getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.GeometryMultiLineString).
+ setValue(multiLineString).build()));
final Point otherPoint = new Point(Geospatial.Dimension.GEOGRAPHY, null);
otherPoint.setX(3.4);
otherPoint.setY(4.3);
@@ -152,25 +166,31 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
points.add(otherPoint);
points.add(point);
final Polygon polygon = new Polygon(Geospatial.Dimension.GEOGRAPHY, null, points, points);
- row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aPolygon",
- client.getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPolygon).
- setValue(polygon).build()));
+ getClient().getBinder().add(row,
+ client.getObjectFactory().newPrimitiveProperty("aPolygon",
+ client.getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.GeographyPolygon).
+ setValue(polygon).build()));
final List<Polygon> polygons = new ArrayList<Polygon>();
polygons.add(polygon);
polygons.add(polygon);
final MultiPolygon multiPolygon = new MultiPolygon(Geospatial.Dimension.GEOGRAPHY, null, polygons);
- row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aMultiPolygon",
- client.getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeographyMultiPolygon).
- setValue(multiPolygon).build()));
+ getClient().getBinder().add(row,
+ client.getObjectFactory().newPrimitiveProperty("aMultiPolygon",
+ client.getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.GeographyMultiPolygon).
+ setValue(multiPolygon).build()));
final List<Geospatial> geospatials = new ArrayList<Geospatial>();
geospatials.add(otherPoint);
geospatials.add(polygon);
geospatials.add(multiLineString);
geospatials.add(multiPolygon);
final GeospatialCollection geoColl = new GeospatialCollection(Geospatial.Dimension.GEOGRAPHY, null, geospatials);
- row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aCollection",
- client.getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeographyCollection).
- setValue(geoColl).build()));
+ getClient().getBinder().add(row,
+ client.getObjectFactory().newPrimitiveProperty("aCollection",
+ client.getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.GeographyCollection).
+ setValue(geoColl).build()));
final ODataComplexValue contactDetails = client.getObjectFactory().newComplexValue(
"Microsoft.Test.OData.Services.OpenTypesService.ContactDetails");
@@ -210,7 +230,8 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("Long",
client.getObjectFactory().newPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.Int64).setValue(Long.MAX_VALUE).build()));
- row.getProperties().add(client.getObjectFactory().newComplexProperty("aContact", contactDetails));
+ getClient().getBinder().add(row,
+ client.getObjectFactory().newComplexProperty("aContact", contactDetails));
final ODataEntityCreateRequest createReq = client.getCUDRequestFactory().
getEntityCreateRequest(client.getURIBuilder(testStaticServiceRootURL).
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PrimitiveKeysTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PrimitiveKeysTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PrimitiveKeysTestITCase.java
index c6763e9..56db6fb 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PrimitiveKeysTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PrimitiveKeysTestITCase.java
@@ -25,21 +25,23 @@ import java.math.BigDecimal;
import java.util.UUID;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
import org.apache.olingo.commons.api.format.ODataPubFormat;
+
import org.junit.Test;
public class PrimitiveKeysTestITCase extends AbstractTestITCase {
private void readEntity(final String entityType, final Object key, final ODataPubFormat format) {
- final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(
+ final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(
client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment(entityType).
appendKeySegment(key).
build());
req.setFormat(format);
final ODataRetrieveResponse<ODataEntity> res = req.execute();
assertEquals(200, res.getStatusCode());
- final ODataEntity entity = res.getBody();
+ final CommonODataEntity entity = res.getBody();
assertNotNull(entity);
assertNotNull(entity.getProperty("Id"));
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyRetrieveTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyRetrieveTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyRetrieveTestITCase.java
index 314e934..2e495dc 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyRetrieveTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyRetrieveTestITCase.java
@@ -18,25 +18,26 @@
*/
package org.apache.olingo.client.core.it.v3;
-import static org.junit.Assert.fail;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
import java.util.List;
import org.apache.olingo.client.api.communication.ODataClientErrorException;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.domain.ODataCollectionValue;
import org.apache.olingo.commons.api.domain.ODataComplexValue;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
+import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.v3.ODataProperty;
import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.client.api.uri.CommonURIBuilder;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import org.junit.Test;
public class PropertyRetrieveTestITCase extends AbstractTestITCase {
@@ -44,7 +45,8 @@ public class PropertyRetrieveTestITCase extends AbstractTestITCase {
private void retreivePropertyTest(final ODataFormat format, String entitySegment, String structuralSegment) {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment(entitySegment).appendPropertySegment(structuralSegment);
- final ODataPropertyRequest req = client.getRetrieveRequestFactory().getPropertyRequest(uriBuilder.build());
+ final ODataPropertyRequest<ODataProperty> req = client.getRetrieveRequestFactory().
+ getPropertyRequest(uriBuilder.build());
req.setFormat(format);
try {
final ODataProperty property = req.execute().getBody();
@@ -210,13 +212,14 @@ public class PropertyRetrieveTestITCase extends AbstractTestITCase {
public void navigationMediaLink() {
CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendNavigationSegment("Product").appendKeySegment(-7).appendLinksSegment("Photos");
- ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
+ ODataEntitySetRequest<ODataEntitySet> req = client.getRetrieveRequestFactory().
+ getEntitySetRequest(uriBuilder.build());
req.setAccept("application/json");
ODataRetrieveResponse<ODataEntitySet> res = req.execute();
assertEquals(200, res.getStatusCode());
- ODataEntitySet entitySet = res.getBody();
+ CommonODataEntitySet entitySet = res.getBody();
assertNotNull(entitySet);
- List<ODataEntity> entity = entitySet.getEntities();
+ List<? extends CommonODataEntity> entity = entitySet.getEntities();
assertNotNull(entity);
assertEquals(entity.size(), 2);
assertEquals(testStaticServiceRootURL + "/ProductPhoto(PhotoId=-3,ProductId=-3)",
@@ -233,14 +236,15 @@ public class PropertyRetrieveTestITCase extends AbstractTestITCase {
public void navigationMediaLinkInvalidQuery() {
CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendNavigationSegment("Product").appendKeySegment(-7).appendLinksSegment("Photo");
- ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
+ ODataEntitySetRequest<ODataEntitySet> req = client.getRetrieveRequestFactory().
+ getEntitySetRequest(uriBuilder.build());
req.setAccept("application/json");
try {
ODataRetrieveResponse<ODataEntitySet> res = req.execute();
assertEquals(200, res.getStatusCode());
- ODataEntitySet entitySet = res.getBody();
+ CommonODataEntitySet entitySet = res.getBody();
assertNotNull(entitySet);
- List<ODataEntity> entity = entitySet.getEntities();
+ List<? extends CommonODataEntity> entity = entitySet.getEntities();
assertNotNull(entity);
assertEquals(entity.size(), 2);
assertEquals(testStaticServiceRootURL + "/ProductPhoto(PhotoId=-3,ProductId=-3)", entity.get(0).
@@ -256,7 +260,8 @@ public class PropertyRetrieveTestITCase extends AbstractTestITCase {
public void navigationMediaLinkInvalidFormat() {
CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendNavigationSegment("Product").appendKeySegment(-7).appendLinksSegment("Photos");
- ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
+ ODataEntitySetRequest<ODataEntitySet> req = client.getRetrieveRequestFactory().
+ getEntitySetRequest(uriBuilder.build());
req.setAccept("application/atom+xml");
try {
ODataRetrieveResponse<ODataEntitySet> res = req.execute();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
index ddcd75f..9d10d24 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
@@ -18,10 +18,6 @@
*/
package org.apache.olingo.client.core.it.v3;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertTrue;
-
import java.io.IOException;
import org.apache.olingo.client.api.communication.ODataClientErrorException;
import org.apache.olingo.client.api.communication.request.cud.ODataPropertyUpdateRequest;
@@ -35,15 +31,19 @@ import org.apache.olingo.client.api.communication.response.ODataPropertyUpdateRe
import org.apache.olingo.client.api.communication.response.ODataRawResponse;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.communication.response.ODataValueUpdateResponse;
+import org.apache.olingo.client.api.http.HttpMethod;
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataCollectionValue;
import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.v3.ODataProperty;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.format.ODataValueFormat;
-import org.apache.olingo.client.api.http.HttpMethod;
-import org.apache.olingo.client.api.uri.CommonURIBuilder;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
import org.junit.Test;
/**
@@ -206,7 +206,8 @@ public class PropertyTestITCase extends AbstractTestITCase {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Customer").appendKeySegment(-9).appendPropertySegment("PrimaryContactInfo");
- ODataPropertyRequest retrieveReq = client.getRetrieveRequestFactory().getPropertyRequest(uriBuilder.build());
+ ODataPropertyRequest<ODataProperty> retrieveReq = client.getRetrieveRequestFactory().
+ getPropertyRequest(uriBuilder.build());
retrieveReq.setFormat(format);
ODataRetrieveResponse<ODataProperty> retrieveRes = retrieveReq.execute();
@@ -253,7 +254,8 @@ public class PropertyTestITCase extends AbstractTestITCase {
uriBuilder.appendEntitySetSegment("Customer").appendKeySegment(-9).
appendPropertySegment("PrimaryContactInfo").appendPropertySegment("AlternativeNames");
- ODataPropertyRequest retrieveReq = client.getRetrieveRequestFactory().getPropertyRequest(uriBuilder.build());
+ ODataPropertyRequest<ODataProperty> retrieveReq = client.getRetrieveRequestFactory().
+ getPropertyRequest(uriBuilder.build());
retrieveReq.setFormat(format);
ODataRetrieveResponse<ODataProperty> retrieveRes = retrieveReq.execute();
@@ -301,13 +303,14 @@ public class PropertyTestITCase extends AbstractTestITCase {
appendPropertySegment("PrimaryContactInfo").
appendPropertySegment("HomePhone").appendPropertySegment("PhoneNumber");
- ODataPropertyRequest retrieveReq = client.getRetrieveRequestFactory().getPropertyRequest(uriBuilder.build());
+ ODataPropertyRequest<ODataProperty> retrieveReq = client.getRetrieveRequestFactory().
+ getPropertyRequest(uriBuilder.build());
retrieveReq.setFormat(format);
ODataRetrieveResponse<ODataProperty> retrieveRes = retrieveReq.execute();
assertEquals(200, retrieveRes.getStatusCode());
- ODataProperty phoneNumber = retrieveRes.getBody();
+ CommonODataProperty phoneNumber = retrieveRes.getBody();
final String oldMsg = phoneNumber.getPrimitiveValue().toCastValue(String.class);
final String newMsg = "new item " + System.currentTimeMillis();
@@ -349,7 +352,7 @@ public class PropertyTestITCase extends AbstractTestITCase {
final ODataRawResponse res = req.execute();
assertNotNull(res);
- final ODataProperty property = res.getBodyAs(ODataProperty.class);
+ final CommonODataProperty property = res.getBodyAs(CommonODataProperty.class);
assertNotNull(property);
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyValueTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyValueTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyValueTestITCase.java
index 3660cad..02a964d 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyValueTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyValueTestITCase.java
@@ -18,16 +18,16 @@
*/
package org.apache.olingo.client.core.it.v3;
-import static org.junit.Assert.*;
import java.io.IOException;
import org.apache.olingo.client.api.communication.ODataClientErrorException;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataValueRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
-import org.apache.olingo.commons.api.domain.ODataEntity;
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.commons.api.domain.ODataValue;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
import org.apache.olingo.commons.api.format.ODataValueFormat;
-import org.apache.olingo.client.api.uri.CommonURIBuilder;
+import static org.junit.Assert.*;
import org.junit.Test;
public class PropertyValueTestITCase extends AbstractTestITCase {
@@ -72,7 +72,7 @@ public class PropertyValueTestITCase extends AbstractTestITCase {
public void retrieveDatePropertyValueTest() {
CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Product").appendKeySegment(-7).appendPropertySegment(
- "NestedComplexConcurrency/ModifiedDate").appendValueSegment();
+ "NestedComplexConcurrency/ModifiedDate").appendValueSegment();
final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
req.setFormat(ODataValueFormat.TEXT);
final ODataValue value = req.execute().getBody();
@@ -96,7 +96,7 @@ public class PropertyValueTestITCase extends AbstractTestITCase {
public void retrieveBinaryPropertyValueTest() throws IOException {
CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendNavigationSegment("ProductPhoto(PhotoId=-3,ProductId=-3)").appendPropertySegment("Photo");
- ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setAccept("application/json");
ODataRetrieveResponse<ODataEntity> res = req.execute();
assertEquals(200, res.getStatusCode());
@@ -111,7 +111,7 @@ public class PropertyValueTestITCase extends AbstractTestITCase {
public void retrieveBinaryPropertyValueTestWithAtom() throws IOException {
CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendNavigationSegment("ProductPhoto(PhotoId=-3,ProductId=-3)").appendPropertySegment("Photo");
- ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setAccept("application/atom+xml");
ODataRetrieveResponse<ODataEntity> res = req.execute();
assertEquals(200, res.getStatusCode());
@@ -126,7 +126,7 @@ public class PropertyValueTestITCase extends AbstractTestITCase {
public void retrieveBinaryPropertyValueTestWithXML() throws IOException {
CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendNavigationSegment("ProductPhoto(PhotoId=-3,ProductId=-3)").appendPropertySegment("Photo");
- ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setAccept("application/xml");
ODataRetrieveResponse<ODataEntity> res = req.execute();
assertEquals(200, res.getStatusCode());
@@ -141,7 +141,7 @@ public class PropertyValueTestITCase extends AbstractTestITCase {
public void retrieveCollectionPropertyValueTest() {
CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Product").appendKeySegment(-7).appendPropertySegment(
- "ComplexConcurrency/QueriedDateTime").appendValueSegment();
+ "ComplexConcurrency/QueriedDateTime").appendValueSegment();
final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
req.setFormat(ODataValueFormat.TEXT);
final ODataValue value = req.execute().getBody();
@@ -155,7 +155,7 @@ public class PropertyValueTestITCase extends AbstractTestITCase {
public void retrieveNullPropertyValueTest() {
CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Product").appendKeySegment(-10).appendPropertySegment(
- "ComplexConcurrency/Token").appendValueSegment();
+ "ComplexConcurrency/Token").appendValueSegment();
final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
try {
req.execute().getBody();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java
index 9f9c2c3..a45da3a 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java
@@ -18,25 +18,26 @@
*/
package org.apache.olingo.client.core.it.v3;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
+import org.apache.olingo.client.api.uri.v3.URIBuilder.InlineCount;
import org.apache.olingo.commons.api.data.Entry;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
+import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.format.ODataPubFormat;
-import org.apache.olingo.client.api.uri.CommonURIBuilder;
-import org.apache.olingo.client.api.uri.v3.URIBuilder.InlineCount;
import org.apache.olingo.commons.core.data.AtomEntryImpl;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import org.junit.Test;
/**
@@ -64,14 +65,15 @@ public class QueryOptionsTestITCase extends AbstractTestITCase {
appendEntitySetSegment("Car").filter("(VIN lt 16)");
// 1. check that filtered entity set looks as expected
- ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
+ ODataEntitySetRequest<ODataEntitySet> req = client.getRetrieveRequestFactory().
+ getEntitySetRequest(uriBuilder.build());
ODataEntitySet feed = req.execute().getBody();
assertNotNull(feed);
assertEquals(5, feed.getEntities().size());
// 2. extract VIN values - sorted ASC by default
final List<Integer> vinsASC = new ArrayList<Integer>(5);
- for (ODataEntity entity : feed.getEntities()) {
+ for (CommonODataEntity entity : feed.getEntities()) {
final Integer vin = entity.getProperty("VIN").getPrimitiveValue().toCastValue(Integer.class);
assertTrue(vin < 16);
vinsASC.add(vin);
@@ -85,7 +87,7 @@ public class QueryOptionsTestITCase extends AbstractTestITCase {
// 4. extract again VIN value - now they were required to be sorted DESC
final List<Integer> vinsDESC = new ArrayList<Integer>(5);
- for (ODataEntity entity : feed.getEntities()) {
+ for (CommonODataEntity entity : feed.getEntities()) {
vinsDESC.add(entity.getProperty("VIN").getPrimitiveValue().toCastValue(Integer.class));
}
@@ -102,7 +104,7 @@ public class QueryOptionsTestITCase extends AbstractTestITCase {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Customer").appendKeySegment(-10).format("json");
- final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setFormat(ODataPubFormat.ATOM);
final ODataRetrieveResponse<ODataEntity> res = req.execute();
@@ -137,7 +139,8 @@ public class QueryOptionsTestITCase extends AbstractTestITCase {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL);
uriBuilder.appendEntitySetSegment("Customer").skipToken("-10");
- final ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
+ final ODataEntitySetRequest<ODataEntitySet> req = client.getRetrieveRequestFactory().
+ getEntitySetRequest(uriBuilder.build());
final ODataEntitySet feed = req.execute().getBody();
assertNotNull(feed);
assertEquals(2, feed.getEntities().size());
@@ -155,7 +158,8 @@ public class QueryOptionsTestITCase extends AbstractTestITCase {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Car").
inlineCount(InlineCount.allpages);
- final ODataEntitySetRequest req = client.getRetrieveRequestFactory().getEntitySetRequest(uriBuilder.build());
+ final ODataEntitySetRequest<ODataEntitySet> req = client.getRetrieveRequestFactory().
+ getEntitySetRequest(uriBuilder.build());
req.setFormat(ODataPubFormat.ATOM);
final ODataEntitySet feed = req.execute().getBody();
assertNotNull(feed);
@@ -170,7 +174,7 @@ public class QueryOptionsTestITCase extends AbstractTestITCase {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Customer").appendKeySegment(-10).select("CustomerId,Orders").expand("Orders");
- final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
final ODataEntity customer = req.execute().getBody();
assertEquals(1, customer.getProperties().size());
assertEquals(1, customer.getNavigationLinks().size());
@@ -182,7 +186,7 @@ public class QueryOptionsTestITCase extends AbstractTestITCase {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Customer").appendKeySegment(-7).select("Name");
- ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setFormat(ODataPubFormat.ATOM);
final ODataEntity customer = req.execute().getBody();
[29/51] [abbrv] [OLINGO-200] Introducing specialization for V3 and V4
domain objects
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntity.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntity.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntity.java
new file mode 100644
index 0000000..a1b729f
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntity.java
@@ -0,0 +1,326 @@
+/*
+ * 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.commons.core.domain;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.commons.api.domain.AbstractODataPayload;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.ODataLink;
+import org.apache.olingo.commons.api.domain.ODataOperation;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
+
+/**
+ * OData entity.
+ */
+public abstract class AbstractODataEntity extends AbstractODataPayload implements CommonODataEntity {
+
+ private static final long serialVersionUID = 8360640095932811034L;
+
+ /**
+ * ETag.
+ */
+ private String eTag;
+
+ /**
+ * Media entity flag.
+ */
+ private boolean mediaEntity = false;
+
+ /**
+ * In case of media entity, media content type.
+ */
+ private String mediaContentType;
+
+ /**
+ * In case of media entity, media content source.
+ */
+ private String mediaContentSource;
+
+ /**
+ * Edit link.
+ */
+ private URI editLink;
+
+ /**
+ * Navigation links (might contain in-line entities or feeds).
+ */
+ private final List<ODataLink> navigationLinks = new ArrayList<ODataLink>();
+
+ /**
+ * Association links.
+ */
+ private final List<ODataLink> associationLinks = new ArrayList<ODataLink>();
+
+ /**
+ * Media edit links.
+ */
+ private final List<ODataLink> editMediaLinks = new ArrayList<ODataLink>();
+
+ /**
+ * Operations (legacy, functions, actions).
+ */
+ private final List<ODataOperation> operations = new ArrayList<ODataOperation>();
+
+ /**
+ * Constructor.
+ *
+ * @param name OData entity name.
+ */
+ public AbstractODataEntity(final String name) {
+ super(name);
+ }
+
+ /**
+ * Gets ETag.
+ *
+ * @return ETag.
+ */
+ @Override
+ public String getETag() {
+ return eTag;
+ }
+
+ /**
+ * Sets ETag.
+ *
+ * @param eTag ETag.
+ */
+ @Override
+ public void setETag(final String eTag) {
+ this.eTag = eTag;
+ }
+
+ /**
+ * Searches for operation with given title.
+ *
+ * @param title operation to look for
+ * @return operation if found with given title, <tt>null</tt> otherwise
+ */
+ @Override
+ public ODataOperation getOperation(final String title) {
+ ODataOperation result = null;
+ for (ODataOperation operation : operations) {
+ if (title.equals(operation.getTitle())) {
+ result = operation;
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Gets operations.
+ *
+ * @return operations.
+ */
+ @Override
+ public List<ODataOperation> getOperations() {
+ return this.operations;
+ }
+
+ /**
+ * Searches for property with given name.
+ *
+ * @param name property to look for
+ * @return property if found with given name, <tt>null</tt> otherwise
+ */
+ @Override
+ public CommonODataProperty getProperty(final String name) {
+ CommonODataProperty result = null;
+
+ if (StringUtils.isNotBlank(name)) {
+ for (CommonODataProperty property : getProperties()) {
+ if (name.equals(property.getName())) {
+ result = property;
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Puts the given link into one of available lists, based on its type.
+ *
+ * @param link to be added
+ * @return <tt>true</tt> if the given link was added in one of available lists
+ */
+ @Override
+ public boolean addLink(final ODataLink link) {
+ boolean result = false;
+
+ switch (link.getType()) {
+ case ASSOCIATION:
+ result = associationLinks.contains(link) ? false : associationLinks.add(link);
+ break;
+
+ case ENTITY_NAVIGATION:
+ case ENTITY_SET_NAVIGATION:
+ result = navigationLinks.contains(link) ? false : navigationLinks.add(link);
+ break;
+
+ case MEDIA_EDIT:
+ result = editMediaLinks.contains(link) ? false : editMediaLinks.add(link);
+ break;
+
+ default:
+ }
+
+ return result;
+ }
+
+ /**
+ * Removes the given link from any list (association, navigation, edit-media).
+ *
+ * @param link to be removed
+ * @return <tt>true</tt> if the given link was contained in one of available lists
+ */
+ @Override
+ public boolean removeLink(final ODataLink link) {
+ return associationLinks.remove(link) || navigationLinks.remove(link) || editMediaLinks.remove(link);
+ }
+
+ /**
+ * Returns all entity navigation links (including inline entities / feeds).
+ *
+ * @return OData entity links.
+ */
+ @Override
+ public List<ODataLink> getNavigationLinks() {
+ return navigationLinks;
+ }
+
+ /**
+ * Returns all entity association links.
+ *
+ * @return OData entity links.
+ */
+ @Override
+ public List<ODataLink> getAssociationLinks() {
+ return associationLinks;
+ }
+
+ /**
+ * Returns all entity media edit links.
+ *
+ * @return OData entity links.
+ */
+ @Override
+ public List<ODataLink> getEditMediaLinks() {
+ return editMediaLinks;
+ }
+
+ /**
+ * Returns OData entity edit link.
+ *
+ * @return entity edit link.
+ */
+ @Override
+ public URI getEditLink() {
+ return editLink;
+ }
+
+ /**
+ * Sets OData entity edit link.
+ *
+ * @param editLink edit link.
+ */
+ @Override
+ public void setEditLink(final URI editLink) {
+ this.editLink = editLink;
+ }
+
+ @Override
+ public URI getLink() {
+ return super.getLink() == null ? getEditLink() : super.getLink();
+ }
+
+ /**
+ * TRUE if read-only entity.
+ *
+ * @return TRUE if read-only; FALSE otherwise.
+ */
+ @Override
+ public boolean isReadOnly() {
+ return super.getLink() != null;
+ }
+
+ /**
+ * Checks if the current entity is a media entity.
+ *
+ * @return 'TRUE' if media entity; 'FALSE' otherwise.
+ */
+ @Override
+ public boolean isMediaEntity() {
+ return mediaEntity;
+ }
+
+ /**
+ * Sets media entity flag.
+ *
+ * @param isMediaEntity media entity flag value.
+ */
+ @Override
+ public void setMediaEntity(final boolean isMediaEntity) {
+ this.mediaEntity = isMediaEntity;
+ }
+
+ /**
+ * Gets media content type.
+ *
+ * @return media content type.
+ */
+ @Override
+ public String getMediaContentType() {
+ return mediaContentType;
+ }
+
+ /**
+ * Sets media content type.
+ *
+ * @param mediaContentType media content type.
+ */
+ @Override
+ public void setMediaContentType(final String mediaContentType) {
+ this.mediaContentType = mediaContentType;
+ }
+
+ /**
+ * Gets media content source.
+ *
+ * @return media content source.
+ */
+ @Override
+ public String getMediaContentSource() {
+ return mediaContentSource;
+ }
+
+ /**
+ * Sets media content source.
+ *
+ * @param mediaContentSource media content source.
+ */
+ @Override
+ public void setMediaContentSource(final String mediaContentSource) {
+ this.mediaContentSource = mediaContentSource;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntitySet.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntitySet.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntitySet.java
new file mode 100644
index 0000000..b2f7dc8
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataEntitySet.java
@@ -0,0 +1,73 @@
+/*
+ * 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.commons.core.domain;
+
+import java.net.URI;
+import org.apache.olingo.commons.api.domain.AbstractODataPayload;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
+
+public abstract class AbstractODataEntitySet extends AbstractODataPayload implements CommonODataEntitySet {
+
+ private static final long serialVersionUID = 9039605899821494024L;
+
+ /**
+ * Link to the next page.
+ */
+ private URI next;
+
+ /**
+ * Number of ODataEntities contained in this feed. If <tt>$inlinecount</tt> was requested, this value comes from
+ * there.
+ */
+ private Integer count;
+
+ /**
+ * Constructor.
+ */
+ public AbstractODataEntitySet() {
+ super(null);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param next next link.
+ */
+ public AbstractODataEntitySet(final URI next) {
+ super(null);
+ this.next = next;
+ }
+
+ @Override
+ public URI getNext() {
+ return next;
+ }
+
+ protected abstract int getEntitiesSize();
+
+ @Override
+ public int getCount() {
+ return count == null ? getEntitiesSize() : count;
+ }
+
+ @Override
+ public void setCount(final int count) {
+ this.count = count;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataObjectFactory.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataObjectFactory.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataObjectFactory.java
new file mode 100644
index 0000000..ea73910
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataObjectFactory.java
@@ -0,0 +1,133 @@
+/*
+ * 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.commons.core.domain;
+
+import java.net.URI;
+import org.apache.olingo.commons.api.domain.ODataLinkType;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.CommonODataEntity;
+import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
+import org.apache.olingo.commons.api.domain.ODataInlineEntity;
+import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
+import org.apache.olingo.commons.api.domain.ODataLink;
+import org.apache.olingo.commons.api.domain.CommonODataObjectFactory;
+import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+
+public abstract class AbstractODataObjectFactory implements CommonODataObjectFactory {
+
+ private static final long serialVersionUID = -3769695665946919447L;
+
+ protected final ODataServiceVersion version;
+
+ public AbstractODataObjectFactory(final ODataServiceVersion version) {
+ this.version = version;
+ }
+
+ @Override
+ public ODataInlineEntitySet newInlineEntitySet(final String name, final URI link,
+ final CommonODataEntitySet entitySet) {
+
+ return new ODataInlineEntitySet(version, link, ODataLinkType.ENTITY_SET_NAVIGATION, name, entitySet);
+ }
+
+ @Override
+ public ODataInlineEntitySet newInlineEntitySet(final String name, final URI baseURI, final String href,
+ final CommonODataEntitySet entitySet) {
+
+ return new ODataInlineEntitySet(version, baseURI, href, ODataLinkType.ENTITY_SET_NAVIGATION, name, entitySet);
+ }
+
+ @Override
+ public ODataInlineEntity newInlineEntity(final String name, final URI link, final CommonODataEntity entity) {
+ return new ODataInlineEntity(version, link, ODataLinkType.ENTITY_NAVIGATION, name, entity);
+ }
+
+ @Override
+ public ODataInlineEntity newInlineEntity(final String name, final URI baseURI, final String href,
+ final CommonODataEntity entity) {
+
+ return new ODataInlineEntity(version, baseURI, href, ODataLinkType.ENTITY_NAVIGATION, name, entity);
+ }
+
+ @Override
+ public ODataLink newEntityNavigationLink(final String name, final URI link) {
+ return new ODataLink.Builder().setVersion(version).setURI(link).
+ setType(ODataLinkType.ENTITY_NAVIGATION).setTitle(name).build();
+ }
+
+ @Override
+ public ODataLink newEntityNavigationLink(final String name, final URI baseURI, final String href) {
+ return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
+ setType(ODataLinkType.ENTITY_NAVIGATION).setTitle(name).build();
+ }
+
+ @Override
+ public ODataLink newFeedNavigationLink(final String name, final URI link) {
+ return new ODataLink.Builder().setVersion(version).setURI(link).
+ setType(ODataLinkType.ENTITY_SET_NAVIGATION).setTitle(name).build();
+ }
+
+ @Override
+ public ODataLink newFeedNavigationLink(final String name, final URI baseURI, final String href) {
+ return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
+ setType(ODataLinkType.ENTITY_SET_NAVIGATION).setTitle(name).build();
+ }
+
+ @Override
+ public ODataLink newAssociationLink(final String name, final URI link) {
+ return new ODataLink.Builder().setVersion(version).setURI(link).
+ setType(ODataLinkType.ASSOCIATION).setTitle(name).build();
+ }
+
+ @Override
+ public ODataLink newAssociationLink(final String name, final URI baseURI, final String href) {
+ return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
+ setType(ODataLinkType.ASSOCIATION).setTitle(name).build();
+ }
+
+ @Override
+ public ODataLink newMediaEditLink(final String name, final URI link) {
+ return new ODataLink.Builder().setVersion(version).setURI(link).
+ setType(ODataLinkType.MEDIA_EDIT).setTitle(name).build();
+ }
+
+ @Override
+ public ODataLink newMediaEditLink(final String name, final URI baseURI, final String href) {
+ return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
+ setType(ODataLinkType.MEDIA_EDIT).setTitle(name).build();
+ }
+
+ @Override
+ public ODataPrimitiveValue.Builder newPrimitiveValueBuilder() {
+ return new ODataPrimitiveValueImpl.BuilderImpl(version);
+ }
+
+ @Override
+ public ODataComplexValue newComplexValue(final String typeName) {
+ return new ODataComplexValueImpl(typeName);
+ }
+
+ @Override
+ public ODataCollectionValue newCollectionValue(final String typeName) {
+ return new ODataCollectionValueImpl(typeName);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataProperty.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataProperty.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataProperty.java
new file mode 100644
index 0000000..c68dfab
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataProperty.java
@@ -0,0 +1,169 @@
+/*
+ * 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.commons.core.domain;
+
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
+import org.apache.olingo.commons.api.domain.ODataValue;
+
+public abstract class AbstractODataProperty implements CommonODataProperty {
+
+ private static final long serialVersionUID = 926939448778950450L;
+
+ /**
+ * Property name.
+ */
+ private final String name;
+
+ /**
+ * Property value.
+ */
+ private final ODataValue value;
+
+ /**
+ * Constructor.
+ *
+ * @param name property name.
+ * @param value property value.
+ */
+ public AbstractODataProperty(final String name, final ODataValue value) {
+ this.name = name;
+ this.value = value;
+ }
+
+ /**
+ * Returns property name.
+ *
+ * @return property name.
+ */
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Returns property value.
+ *
+ * @return property value.
+ */
+ @Override
+ public ODataValue getValue() {
+ return value;
+ }
+
+ /**
+ * Checks if has null value.
+ *
+ * @return 'TRUE' if has null value; 'FALSE' otherwise.
+ */
+ @Override
+ public boolean hasNullValue() {
+ return this.value == null;
+ }
+
+ /**
+ * Checks if has primitive value.
+ *
+ * @return 'TRUE' if has primitive value; 'FALSE' otherwise.
+ */
+ @Override
+ public boolean hasPrimitiveValue() {
+ return !hasNullValue() && this.value.isPrimitive();
+ }
+
+ /**
+ * Gets primitive value.
+ *
+ * @return primitive value if exists; null otherwise.
+ */
+ @Override
+ public ODataPrimitiveValue getPrimitiveValue() {
+ return hasPrimitiveValue() ? this.value.asPrimitive() : null;
+ }
+
+ /**
+ * Checks if has complex value.
+ *
+ * @return 'TRUE' if has complex value; 'FALSE' otherwise.
+ */
+ @Override
+ public boolean hasComplexValue() {
+ return !hasNullValue() && this.value.isComplex();
+ }
+
+ /**
+ * Gets complex value.
+ *
+ * @return complex value if exists; null otherwise.
+ */
+ @Override
+ public ODataComplexValue getComplexValue() {
+ return hasComplexValue() ? this.value.asComplex() : null;
+ }
+
+ /**
+ * Checks if has collection value.
+ *
+ * @return 'TRUE' if has collection value; 'FALSE' otherwise.
+ */
+ @Override
+ public boolean hasCollectionValue() {
+ return !hasNullValue() && this.value.isCollection();
+ }
+
+ /**
+ * Gets collection value.
+ *
+ * @return collection value if exists; null otherwise.
+ */
+ @Override
+ public ODataCollectionValue getCollectionValue() {
+ return hasCollectionValue() ? this.value.asCollection() : null;
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public boolean equals(final Object obj) {
+ return EqualsBuilder.reflectionEquals(this, obj);
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public int hashCode() {
+ return HashCodeBuilder.reflectionHashCode(this);
+ }
+
+ /**
+ * {@inheritDoc }
+ */
+ @Override
+ public String toString() {
+ return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataComplexValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataComplexValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataComplexValueImpl.java
index 07d6055..ba8fe56 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataComplexValueImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataComplexValueImpl.java
@@ -23,7 +23,7 @@ import java.util.LinkedHashMap;
import java.util.Map;
import org.apache.olingo.commons.api.domain.AbstractODataValue;
import org.apache.olingo.commons.api.domain.ODataComplexValue;
-import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
/**
* OData complex property value.
@@ -35,7 +35,7 @@ public class ODataComplexValueImpl extends AbstractODataValue implements ODataCo
/**
* Complex type fields.
*/
- private final Map<String, ODataProperty> fields = new LinkedHashMap<String, ODataProperty>();
+ private final Map<String, CommonODataProperty> fields = new LinkedHashMap<String, CommonODataProperty>();
/**
* Constructor.
@@ -52,7 +52,7 @@ public class ODataComplexValueImpl extends AbstractODataValue implements ODataCo
* @param field field to be added.
*/
@Override
- public void add(final ODataProperty field) {
+ public void add(final CommonODataProperty field) {
fields.put(field.getName(), field);
}
@@ -63,7 +63,7 @@ public class ODataComplexValueImpl extends AbstractODataValue implements ODataCo
* @return requested field.
*/
@Override
- public ODataProperty get(final String name) {
+ public CommonODataProperty get(final String name) {
return fields.get(name);
}
@@ -73,7 +73,7 @@ public class ODataComplexValueImpl extends AbstractODataValue implements ODataCo
* @return fields iterator.
*/
@Override
- public Iterator<ODataProperty> iterator() {
+ public Iterator<CommonODataProperty> iterator() {
return fields.values().iterator();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntityImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntityImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntityImpl.java
deleted file mode 100644
index 62d1e42..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntityImpl.java
+++ /dev/null
@@ -1,372 +0,0 @@
-/*
- * 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.commons.core.domain;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.commons.api.domain.AbstractODataPayload;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataLink;
-import org.apache.olingo.commons.api.domain.ODataOperation;
-import org.apache.olingo.commons.api.domain.ODataProperty;
-
-/**
- * OData entity.
- */
-public class ODataEntityImpl extends AbstractODataPayload implements ODataEntity {
-
- private static final long serialVersionUID = 8360640095932811034L;
-
- /**
- * Entity reference.
- */
- private String reference;
-
- /**
- * ETag.
- */
- private String eTag;
-
- /**
- * Media entity flag.
- */
- private boolean mediaEntity = false;
-
- /**
- * In case of media entity, media content type.
- */
- private String mediaContentType;
-
- /**
- * In case of media entity, media content source.
- */
- private String mediaContentSource;
-
- /**
- * Edit link.
- */
- private URI editLink;
-
- /**
- * Navigation links (might contain in-line entities or feeds).
- */
- private final List<ODataLink> navigationLinks = new ArrayList<ODataLink>();
-
- /**
- * Association links.
- */
- private final List<ODataLink> associationLinks = new ArrayList<ODataLink>();
-
- /**
- * Media edit links.
- */
- private final List<ODataLink> editMediaLinks = new ArrayList<ODataLink>();
-
- /**
- * Operations (legacy, functions, actions).
- */
- private final List<ODataOperation> operations = new ArrayList<ODataOperation>();
-
- /**
- * Entity properties.
- */
- private final List<ODataProperty> properties = new ArrayList<ODataProperty>();
-
- /**
- * Constructor.
- *
- * @param name OData entity name.
- */
- public ODataEntityImpl(final String name) {
- super(name);
- }
-
- /**
- * To request entity references in place of the actual entities, the client issues a GET request with /$ref appended
- * to the resource path.
- * <br />
- * If the resource path does not identify an entity or a collection of entities, the service returns 404 Not Found.
- * <br />
- * If the resource path terminates on a collection, the response MUST be the format-specific representation of a
- * collection of entity references pointing to the related entities. If no entities are related, the response is the
- * format-specific representation of an empty collection.
- * <br />
- * If the resource path terminates on a single entity, the response MUST be the format-specific representation of an
- * entity reference pointing to the related single entity. If the resource path terminates on a single entity and no
- * such entity exists, the service returns 404 Not Found.
- *
- * @return entity reference.
- */
- @Override
- public String getReference() {
- return reference;
- }
-
- @Override
- public void setReference(final String reference) {
- this.reference = reference;
- }
-
- /**
- * Gets ETag.
- *
- * @return ETag.
- */
- @Override
- public String getETag() {
- return eTag;
- }
-
- /**
- * Sets ETag.
- *
- * @param eTag ETag.
- */
- @Override
- public void setETag(final String eTag) {
- this.eTag = eTag;
- }
-
- /**
- * Searches for operation with given title.
- *
- * @param title operation to look for
- * @return operation if found with given title, <tt>null</tt> otherwise
- */
- @Override
- public ODataOperation getOperation(final String title) {
- ODataOperation result = null;
- for (ODataOperation operation : operations) {
- if (title.equals(operation.getTitle())) {
- result = operation;
- }
- }
-
- return result;
- }
-
- /**
- * Gets operations.
- *
- * @return operations.
- */
- @Override
- public List<ODataOperation> getOperations() {
- return this.operations;
- }
-
- /**
- * Searches for property with given name.
- *
- * @param name property to look for
- * @return property if found with given name, <tt>null</tt> otherwise
- */
- @Override
- public ODataProperty getProperty(final String name) {
- ODataProperty result = null;
-
- if (StringUtils.isNotBlank(name)) {
- for (ODataProperty property : properties) {
- if (name.equals(property.getName())) {
- result = property;
- }
- }
- }
-
- return result;
- }
-
- /**
- * Returns OData entity properties.
- *
- * @return OData entity properties.
- */
- @Override
- public List<ODataProperty> getProperties() {
- return properties;
- }
-
- /**
- * Puts the given link into one of available lists, based on its type.
- *
- * @param link to be added
- * @return <tt>true</tt> if the given link was added in one of available lists
- */
- @Override
- public boolean addLink(final ODataLink link) {
- boolean result = false;
-
- switch (link.getType()) {
- case ASSOCIATION:
- result = associationLinks.contains(link) ? false : associationLinks.add(link);
- break;
-
- case ENTITY_NAVIGATION:
- case ENTITY_SET_NAVIGATION:
- result = navigationLinks.contains(link) ? false : navigationLinks.add(link);
- break;
-
- case MEDIA_EDIT:
- result = editMediaLinks.contains(link) ? false : editMediaLinks.add(link);
- break;
-
- default:
- }
-
- return result;
- }
-
- /**
- * Removes the given link from any list (association, navigation, edit-media).
- *
- * @param link to be removed
- * @return <tt>true</tt> if the given link was contained in one of available lists
- */
- @Override
- public boolean removeLink(final ODataLink link) {
- return associationLinks.remove(link) || navigationLinks.remove(link) || editMediaLinks.remove(link);
- }
-
- /**
- * Returns all entity navigation links (including inline entities / feeds).
- *
- * @return OData entity links.
- */
- @Override
- public List<ODataLink> getNavigationLinks() {
- return navigationLinks;
- }
-
- /**
- * Returns all entity association links.
- *
- * @return OData entity links.
- */
- @Override
- public List<ODataLink> getAssociationLinks() {
- return associationLinks;
- }
-
- /**
- * Returns all entity media edit links.
- *
- * @return OData entity links.
- */
- @Override
- public List<ODataLink> getEditMediaLinks() {
- return editMediaLinks;
- }
-
- /**
- * Returns OData entity edit link.
- *
- * @return entity edit link.
- */
- @Override
- public URI getEditLink() {
- return editLink;
- }
-
- /**
- * Sets OData entity edit link.
- *
- * @param editLink edit link.
- */
- @Override
- public void setEditLink(final URI editLink) {
- this.editLink = editLink;
- }
-
- @Override
- public URI getLink() {
- return super.getLink() == null ? getEditLink() : super.getLink();
- }
-
- /**
- * TRUE if read-only entity.
- *
- * @return TRUE if read-only; FALSE otherwise.
- */
- @Override
- public boolean isReadOnly() {
- return super.getLink() != null;
- }
-
- /**
- * Checks if the current entity is a media entity.
- *
- * @return 'TRUE' if media entity; 'FALSE' otherwise.
- */
- @Override
- public boolean isMediaEntity() {
- return mediaEntity;
- }
-
- /**
- * Sets media entity flag.
- *
- * @param isMediaEntity media entity flag value.
- */
- @Override
- public void setMediaEntity(final boolean isMediaEntity) {
- this.mediaEntity = isMediaEntity;
- }
-
- /**
- * Gets media content type.
- *
- * @return media content type.
- */
- @Override
- public String getMediaContentType() {
- return mediaContentType;
- }
-
- /**
- * Sets media content type.
- *
- * @param mediaContentType media content type.
- */
- @Override
- public void setMediaContentType(final String mediaContentType) {
- this.mediaContentType = mediaContentType;
- }
-
- /**
- * Gets media content source.
- *
- * @return media content source.
- */
- @Override
- public String getMediaContentSource() {
- return mediaContentSource;
- }
-
- /**
- * Sets media content source.
- *
- * @param mediaContentSource media content source.
- */
- @Override
- public void setMediaContentSource(final String mediaContentSource) {
- this.mediaContentSource = mediaContentSource;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntitySetImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntitySetImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntitySetImpl.java
deleted file mode 100644
index b7246d1..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataEntitySetImpl.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * 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.commons.core.domain;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.olingo.commons.api.domain.AbstractODataPayload;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
-
-public class ODataEntitySetImpl extends AbstractODataPayload implements ODataEntitySet {
-
- private static final long serialVersionUID = 9039605899821494024L;
-
- /**
- * Link to the next page.
- */
- private URI next;
-
- /**
- * Number of ODataEntities contained in this feed. If <tt>$inlinecount</tt> was requested, this value comes from
- * there.
- */
- private Integer count;
-
- /**
- * OData entities contained in this feed.
- */
- private List<ODataEntity> entities = new ArrayList<ODataEntity>();
-
- /**
- * Constructor.
- */
- public ODataEntitySetImpl() {
- super(null);
- }
-
- /**
- * Constructor.
- *
- * @param next next link.
- */
- public ODataEntitySetImpl(final URI next) {
- super(null);
- this.next = next;
- }
-
- /**
- * Gets next page link.
- *
- * @return next page link; null value if single page or last page reached.
- */
- @Override
- public URI getNext() {
- return next;
- }
-
- /**
- * Gets contained entities.
- *
- * @return feed entries.
- */
- @Override
- public List<ODataEntity> getEntities() {
- return entities;
- }
-
- /**
- * Gets in-line count.
- *
- * @return in-line count value.
- */
- @Override
- public int getCount() {
- return count == null ? entities.size() : count;
- }
-
- /**
- * Sets in-line count.
- *
- * @param count in-line count value.
- */
- @Override
- public void setCount(final int count) {
- this.count = count;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataObjectFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataObjectFactoryImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataObjectFactoryImpl.java
deleted file mode 100644
index 63a47ce..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataObjectFactoryImpl.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * 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.commons.core.domain;
-
-import java.net.URI;
-import org.apache.olingo.commons.api.domain.ODataLinkType;
-import org.apache.olingo.commons.api.domain.ODataCollectionValue;
-import org.apache.olingo.commons.api.domain.ODataComplexValue;
-import org.apache.olingo.commons.api.domain.ODataEntity;
-import org.apache.olingo.commons.api.domain.ODataEntitySet;
-import org.apache.olingo.commons.api.domain.ODataInlineEntity;
-import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
-import org.apache.olingo.commons.api.domain.ODataLink;
-import org.apache.olingo.commons.api.domain.ODataObjectFactory;
-import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.commons.api.domain.ODataProperty;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-
-public class ODataObjectFactoryImpl implements ODataObjectFactory {
-
- private static final long serialVersionUID = -3769695665946919447L;
-
- protected final ODataServiceVersion version;
-
- public ODataObjectFactoryImpl(final ODataServiceVersion version) {
- this.version = version;
- }
-
- @Override
- public ODataEntitySet newEntitySet() {
- return new ODataEntitySetImpl();
- }
-
- @Override
- public ODataEntitySet newEntitySet(final URI next) {
- return new ODataEntitySetImpl(next);
- }
-
- @Override
- public ODataEntity newEntity(final String name) {
- return new ODataEntityImpl(name);
- }
-
- @Override
- public ODataEntity newEntity(final String name, final URI link) {
- final ODataEntityImpl result = new ODataEntityImpl(name);
- result.setLink(link);
- return result;
- }
-
- @Override
- public ODataInlineEntitySet newInlineEntitySet(final String name, final URI link,
- final ODataEntitySet entitySet) {
-
- return new ODataInlineEntitySet(version, link, ODataLinkType.ENTITY_SET_NAVIGATION, name, entitySet);
- }
-
- @Override
- public ODataInlineEntitySet newInlineEntitySet(final String name, final URI baseURI, final String href,
- final ODataEntitySet entitySet) {
-
- return new ODataInlineEntitySet(version, baseURI, href, ODataLinkType.ENTITY_SET_NAVIGATION, name, entitySet);
- }
-
- @Override
- public ODataInlineEntity newInlineEntity(final String name, final URI link, final ODataEntity entity) {
- return new ODataInlineEntity(version, link, ODataLinkType.ENTITY_NAVIGATION, name, entity);
- }
-
- @Override
- public ODataInlineEntity newInlineEntity(final String name, final URI baseURI, final String href,
- final ODataEntity entity) {
-
- return new ODataInlineEntity(version, baseURI, href, ODataLinkType.ENTITY_NAVIGATION, name, entity);
- }
-
- @Override
- public ODataLink newEntityNavigationLink(final String name, final URI link) {
- return new ODataLink.Builder().setVersion(version).setURI(link).
- setType(ODataLinkType.ENTITY_NAVIGATION).setTitle(name).build();
- }
-
- @Override
- public ODataLink newEntityNavigationLink(final String name, final URI baseURI, final String href) {
- return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
- setType(ODataLinkType.ENTITY_NAVIGATION).setTitle(name).build();
- }
-
- @Override
- public ODataLink newFeedNavigationLink(final String name, final URI link) {
- return new ODataLink.Builder().setVersion(version).setURI(link).
- setType(ODataLinkType.ENTITY_SET_NAVIGATION).setTitle(name).build();
- }
-
- @Override
- public ODataLink newFeedNavigationLink(final String name, final URI baseURI, final String href) {
- return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
- setType(ODataLinkType.ENTITY_SET_NAVIGATION).setTitle(name).build();
- }
-
- @Override
- public ODataLink newAssociationLink(final String name, final URI link) {
- return new ODataLink.Builder().setVersion(version).setURI(link).
- setType(ODataLinkType.ASSOCIATION).setTitle(name).build();
- }
-
- @Override
- public ODataLink newAssociationLink(final String name, final URI baseURI, final String href) {
- return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
- setType(ODataLinkType.ASSOCIATION).setTitle(name).build();
- }
-
- @Override
- public ODataLink newMediaEditLink(final String name, final URI link) {
- return new ODataLink.Builder().setVersion(version).setURI(link).
- setType(ODataLinkType.MEDIA_EDIT).setTitle(name).build();
- }
-
- @Override
- public ODataLink newMediaEditLink(final String name, final URI baseURI, final String href) {
- return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
- setType(ODataLinkType.MEDIA_EDIT).setTitle(name).build();
- }
-
- @Override
- public ODataPrimitiveValue.Builder newPrimitiveValueBuilder() {
- return new ODataPrimitiveValueImpl.BuilderImpl(version);
- }
-
- @Override
- public ODataComplexValue newComplexValue(final String typeName) {
- return new ODataComplexValueImpl(typeName);
- }
-
- @Override
- public ODataCollectionValue newCollectionValue(final String typeName) {
- return new ODataCollectionValueImpl(typeName);
- }
-
- @Override
- public ODataProperty newPrimitiveProperty(final String name, final ODataPrimitiveValue value) {
- return new ODataPropertyImpl(name, value);
- }
-
- @Override
- public ODataProperty newComplexProperty(final String name, final ODataComplexValue value) {
- return new ODataPropertyImpl(name, value);
- }
-
- @Override
- public ODataProperty newCollectionProperty(final String name, final ODataCollectionValue value) {
- return new ODataPropertyImpl(name, value);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPropertyImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPropertyImpl.java
deleted file mode 100644
index 4c8aea9..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPropertyImpl.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * 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.commons.core.domain;
-
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-import org.apache.olingo.commons.api.domain.ODataCollectionValue;
-import org.apache.olingo.commons.api.domain.ODataComplexValue;
-import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.commons.api.domain.ODataProperty;
-import org.apache.olingo.commons.api.domain.ODataValue;
-
-/**
- * OData entity property.
- */
-public class ODataPropertyImpl implements ODataProperty {
-
- private static final long serialVersionUID = 926939448778950450L;
-
- /**
- * Property name.
- */
- private final String name;
-
- /**
- * Property value.
- */
- private ODataValue value;
-
- /**
- * Constructor.
- *
- * @param name property name.
- * @param value property value.
- */
- public ODataPropertyImpl(final String name, final ODataValue value) {
- this.name = name;
- this.value = value;
- }
-
- /**
- * Returns property name.
- *
- * @return property name.
- */
- @Override
- public String getName() {
- return name;
- }
-
- /**
- * Returns property value.
- *
- * @return property value.
- */
- @Override
- public ODataValue getValue() {
- return value;
- }
-
- /**
- * Checks if has null value.
- *
- * @return 'TRUE' if has null value; 'FALSE' otherwise.
- */
- @Override
- public boolean hasNullValue() {
- return this.value == null;
- }
-
- /**
- * Checks if has primitive value.
- *
- * @return 'TRUE' if has primitive value; 'FALSE' otherwise.
- */
- @Override
- public boolean hasPrimitiveValue() {
- return !hasNullValue() && this.value.isPrimitive();
- }
-
- /**
- * Gets primitive value.
- *
- * @return primitive value if exists; null otherwise.
- */
- @Override
- public ODataPrimitiveValue getPrimitiveValue() {
- return hasPrimitiveValue() ? this.value.asPrimitive() : null;
- }
-
- /**
- * Checks if has complex value.
- *
- * @return 'TRUE' if has complex value; 'FALSE' otherwise.
- */
- @Override
- public boolean hasComplexValue() {
- return !hasNullValue() && this.value.isComplex();
- }
-
- /**
- * Gets complex value.
- *
- * @return complex value if exists; null otherwise.
- */
- @Override
- public ODataComplexValue getComplexValue() {
- return hasComplexValue() ? this.value.asComplex() : null;
- }
-
- /**
- * Checks if has collection value.
- *
- * @return 'TRUE' if has collection value; 'FALSE' otherwise.
- */
- @Override
- public boolean hasCollectionValue() {
- return !hasNullValue() && this.value.isCollection();
- }
-
- /**
- * Gets collection value.
- *
- * @return collection value if exists; null otherwise.
- */
- @Override
- public ODataCollectionValue getCollectionValue() {
- return hasCollectionValue() ? this.value.asCollection() : null;
- }
-
- /**
- * {@inheritDoc }
- */
- @Override
- public boolean equals(final Object obj) {
- return EqualsBuilder.reflectionEquals(this, obj);
- }
-
- /**
- * {@inheritDoc }
- */
- @Override
- public int hashCode() {
- return HashCodeBuilder.reflectionHashCode(this);
- }
-
- /**
- * {@inheritDoc }
- */
- @Override
- public String toString() {
- return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataEntityImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataEntityImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataEntityImpl.java
new file mode 100644
index 0000000..8a41e7a
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataEntityImpl.java
@@ -0,0 +1,46 @@
+/*
+ * 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.commons.core.domain.v3;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
+import org.apache.olingo.commons.api.domain.v3.ODataProperty;
+import org.apache.olingo.commons.core.domain.AbstractODataEntity;
+
+public class ODataEntityImpl extends AbstractODataEntity implements ODataEntity {
+
+ private static final long serialVersionUID = 1728326493032709855L;
+
+ private final List<ODataProperty> properties = new ArrayList<ODataProperty>();
+
+ public ODataEntityImpl(final String name) {
+ super(name);
+ }
+
+ @Override
+ public ODataProperty getProperty(final String name) {
+ return (ODataProperty) super.getProperty(name);
+ }
+
+ @Override
+ public List<ODataProperty> getProperties() {
+ return properties;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataEntitySetImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataEntitySetImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataEntitySetImpl.java
new file mode 100644
index 0000000..83870f3
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataEntitySetImpl.java
@@ -0,0 +1,51 @@
+/*
+ * 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.commons.core.domain.v3;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
+import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
+import org.apache.olingo.commons.core.domain.AbstractODataEntitySet;
+
+public class ODataEntitySetImpl extends AbstractODataEntitySet implements ODataEntitySet {
+
+ private static final long serialVersionUID = -8127933181196033586L;
+
+ private final List<ODataEntity> entities = new ArrayList<ODataEntity>();
+
+ public ODataEntitySetImpl() {
+ }
+
+ public ODataEntitySetImpl(final URI next) {
+ super(next);
+ }
+
+ @Override
+ protected int getEntitiesSize() {
+ return entities.size();
+ }
+
+ @Override
+ public List<ODataEntity> getEntities() {
+ return entities;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataObjectFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataObjectFactoryImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataObjectFactoryImpl.java
new file mode 100644
index 0000000..2bfb8f5
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataObjectFactoryImpl.java
@@ -0,0 +1,75 @@
+/*
+ * 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.commons.core.domain.v3;
+
+import java.net.URI;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
+import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.v3.ODataObjectFactory;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
+import org.apache.olingo.commons.api.domain.v3.ODataProperty;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.core.domain.AbstractODataObjectFactory;
+
+public class ODataObjectFactoryImpl extends AbstractODataObjectFactory implements ODataObjectFactory {
+
+ public ODataObjectFactoryImpl(final ODataServiceVersion version) {
+ super(version);
+ }
+
+ @Override
+ public ODataEntitySet newEntitySet() {
+ return new ODataEntitySetImpl();
+ }
+
+ @Override
+ public ODataEntitySet newEntitySet(final URI next) {
+ return new ODataEntitySetImpl(next);
+ }
+
+ @Override
+ public ODataEntity newEntity(final String name) {
+ return new ODataEntityImpl(name);
+ }
+
+ @Override
+ public ODataEntity newEntity(final String name, final URI link) {
+ final ODataEntityImpl result = new ODataEntityImpl(name);
+ result.setLink(link);
+ return result;
+ }
+
+ @Override
+ public ODataProperty newPrimitiveProperty(final String name, final ODataPrimitiveValue value) {
+ return new ODataPropertyImpl(name, value);
+ }
+
+ @Override
+ public ODataProperty newComplexProperty(final String name, final ODataComplexValue value) {
+ return new ODataPropertyImpl(name, value);
+ }
+
+ @Override
+ public ODataProperty newCollectionProperty(final String name, final ODataCollectionValue value) {
+ return new ODataPropertyImpl(name, value);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataPropertyImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataPropertyImpl.java
new file mode 100644
index 0000000..68c44ec
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataPropertyImpl.java
@@ -0,0 +1,33 @@
+/*
+ * 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.commons.core.domain.v3;
+
+import org.apache.olingo.commons.api.domain.ODataValue;
+import org.apache.olingo.commons.api.domain.v3.ODataProperty;
+import org.apache.olingo.commons.core.domain.AbstractODataProperty;
+
+public class ODataPropertyImpl extends AbstractODataProperty implements ODataProperty {
+
+ private static final long serialVersionUID = 4851331227420757747L;
+
+ public ODataPropertyImpl(final String name, final ODataValue value) {
+ super(name, value);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEntityImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEntityImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEntityImpl.java
new file mode 100644
index 0000000..b5ac799
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEntityImpl.java
@@ -0,0 +1,62 @@
+/*
+ * 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.commons.core.domain.v4;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.commons.api.domain.v4.ODataEntity;
+import org.apache.olingo.commons.api.domain.v4.ODataProperty;
+import org.apache.olingo.commons.core.domain.AbstractODataEntity;
+
+public class ODataEntityImpl extends AbstractODataEntity implements ODataEntity {
+
+ private static final long serialVersionUID = -3997704808753685990L;
+
+ /**
+ * Entity reference.
+ */
+ private String reference;
+
+ private final List<ODataProperty> properties = new ArrayList<ODataProperty>();
+
+ public ODataEntityImpl(final String name) {
+ super(name);
+ }
+
+ @Override
+ public String getReference() {
+ return reference;
+ }
+
+ @Override
+ public void setReference(final String reference) {
+ this.reference = reference;
+ }
+
+ @Override
+ public ODataProperty getProperty(final String name) {
+ return (ODataProperty) super.getProperty(name);
+ }
+
+ @Override
+ public List<ODataProperty> getProperties() {
+ return properties;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEntitySetImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEntitySetImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEntitySetImpl.java
new file mode 100644
index 0000000..cbc5a04
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEntitySetImpl.java
@@ -0,0 +1,51 @@
+/*
+ * 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.commons.core.domain.v4;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.commons.api.domain.v4.ODataEntity;
+import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
+import org.apache.olingo.commons.core.domain.AbstractODataEntitySet;
+
+public class ODataEntitySetImpl extends AbstractODataEntitySet implements ODataEntitySet {
+
+ private static final long serialVersionUID = -8127933181196033586L;
+
+ private final List<ODataEntity> entities = new ArrayList<ODataEntity>();
+
+ public ODataEntitySetImpl() {
+ }
+
+ public ODataEntitySetImpl(final URI next) {
+ super(next);
+ }
+
+ @Override
+ protected int getEntitiesSize() {
+ return entities.size();
+ }
+
+ @Override
+ public List<ODataEntity> getEntities() {
+ return entities;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java
new file mode 100644
index 0000000..1b6428f
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java
@@ -0,0 +1,81 @@
+/*
+ * 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.commons.core.domain.v4;
+
+import java.net.URI;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
+import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.v4.ODataObjectFactory;
+import org.apache.olingo.commons.api.domain.v4.ODataEntity;
+import org.apache.olingo.commons.api.domain.v4.ODataEnumValue;
+import org.apache.olingo.commons.api.domain.v4.ODataProperty;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.core.domain.AbstractODataObjectFactory;
+
+public class ODataObjectFactoryImpl extends AbstractODataObjectFactory implements ODataObjectFactory {
+
+ public ODataObjectFactoryImpl(final ODataServiceVersion version) {
+ super(version);
+ }
+
+ @Override
+ public ODataEntitySet newEntitySet() {
+ return new ODataEntitySetImpl();
+ }
+
+ @Override
+ public ODataEntitySet newEntitySet(final URI next) {
+ return new ODataEntitySetImpl(next);
+ }
+
+ @Override
+ public ODataEntity newEntity(final String name) {
+ return new ODataEntityImpl(name);
+ }
+
+ @Override
+ public ODataEntity newEntity(final String name, final URI link) {
+ final ODataEntityImpl result = new ODataEntityImpl(name);
+ result.setLink(link);
+ return result;
+ }
+
+ @Override
+ public ODataProperty newPrimitiveProperty(final String name, final ODataPrimitiveValue value) {
+ return new ODataPropertyImpl(name, value);
+ }
+
+ @Override
+ public ODataProperty newComplexProperty(final String name, final ODataComplexValue value) {
+ return new ODataPropertyImpl(name, value);
+ }
+
+ @Override
+ public ODataProperty newCollectionProperty(final String name, final ODataCollectionValue value) {
+ return new ODataPropertyImpl(name, value);
+ }
+
+ @Override
+ public ODataProperty newEnumProperty(final String name, final ODataEnumValue value) {
+ return new ODataPropertyImpl(name, value);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/80e5ed56/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPropertyImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPropertyImpl.java
new file mode 100644
index 0000000..fe6bf9d
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPropertyImpl.java
@@ -0,0 +1,44 @@
+/*
+ * 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.commons.core.domain.v4;
+
+import org.apache.olingo.commons.api.domain.v4.ODataEnumValue;
+import org.apache.olingo.commons.api.domain.v4.ODataProperty;
+import org.apache.olingo.commons.core.domain.AbstractODataProperty;
+
+public class ODataPropertyImpl extends AbstractODataProperty implements ODataProperty {
+
+ private static final long serialVersionUID = 4851331227420757747L;
+
+ public ODataPropertyImpl(final String name, final org.apache.olingo.commons.api.domain.ODataValue value) {
+ super(name, value);
+ }
+
+ @Override
+ public boolean hasEnumValue() {
+ return !hasNullValue() && getValue() instanceof org.apache.olingo.commons.api.domain.v4.ODataValue
+ && ((org.apache.olingo.commons.api.domain.v4.ODataValue) getValue()).isEnum();
+ }
+
+ @Override
+ public ODataEnumValue getEnumValue() {
+ return hasEnumValue() ? ((org.apache.olingo.commons.api.domain.v4.ODataValue) getValue()).asEnum() : null;
+ }
+
+}
[14/51] [abbrv] git commit: [OLINGO-175,
OLINGO-205] provided V4 document service test
Posted by il...@apache.org.
[OLINGO-175, OLINGO-205] provided V4 document service test
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/bc398d3d
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/bc398d3d
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/bc398d3d
Branch: refs/heads/master
Commit: bc398d3da20a103db3e9d527619aaa9a1a2641c6
Parents: e4bf213
Author: fmartelli <fa...@gmail.com>
Authored: Thu Mar 27 18:13:42 2014 +0100
Committer: fmartelli <fa...@gmail.com>
Committed: Thu Mar 27 18:13:42 2014 +0100
----------------------------------------------------------------------
fit/pom.xml | 12 ++
fit/src/main/resources/v4/services.full.json | 126 +++++++++++++++++++
fit/src/main/resources/v4/services.xml | 102 +++++++++++++++
.../retrieve/ODataEntityRequestImpl.java | 4 +-
.../retrieve/ODataEntitySetRequestImpl.java | 4 +-
.../ODataServiceDocumentRequestImpl.java | 6 +-
.../v4/ServiceDocumentRetrieveTestITCase.java | 74 +++++++++++
.../core/it/v4/ServiceDocumentTestITCase.java | 60 +++++++++
8 files changed, 383 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bc398d3d/fit/pom.xml
----------------------------------------------------------------------
diff --git a/fit/pom.xml b/fit/pom.xml
index cac0eca..55587aa 100644
--- a/fit/pom.xml
+++ b/fit/pom.xml
@@ -96,6 +96,18 @@
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>2.6</version>
+ <configuration>
+ <useDefaultDelimiters>false</useDefaultDelimiters>
+ <delimiters>
+ <delimiter>${*}</delimiter>
+ </delimiters>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${war.maven.plugin.version}</version>
<configuration>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bc398d3d/fit/src/main/resources/v4/services.full.json
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v4/services.full.json b/fit/src/main/resources/v4/services.full.json
new file mode 100644
index 0000000..d769332
--- /dev/null
+++ b/fit/src/main/resources/v4/services.full.json
@@ -0,0 +1,126 @@
+{
+ "@odata.context": "http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata",
+ "value":
+ [
+ {
+ "name": "People",
+ "kind": "EntitySet",
+ "url": "People"
+ },
+ {
+ "name": "Customers",
+ "kind": "EntitySet",
+ "url": "Customers"
+ },
+ {
+ "name": "Employees",
+ "kind": "EntitySet",
+ "url": "Employees"
+ },
+ {
+ "name": "Products",
+ "kind": "EntitySet",
+ "url": "Products"
+ },
+ {
+ "name": "ProductDetails",
+ "kind": "EntitySet",
+ "url": "ProductDetails"
+ },
+ {
+ "name": "ProductReviews",
+ "kind": "EntitySet",
+ "url": "ProductReviews"
+ },
+ {
+ "name": "Orders",
+ "kind": "EntitySet",
+ "url": "Orders"
+ },
+ {
+ "name": "OrderDetails",
+ "kind": "EntitySet",
+ "url": "OrderDetails"
+ },
+ {
+ "name": "Departments",
+ "kind": "EntitySet",
+ "url": "Departments"
+ },
+ {
+ "name": "Accounts",
+ "kind": "EntitySet",
+ "url": "Accounts"
+ },
+ {
+ "name": "StoredPIs",
+ "kind": "EntitySet",
+ "url": "StoredPIs"
+ },
+ {
+ "name": "SubscriptionTemplates",
+ "kind": "EntitySet",
+ "url": "SubscriptionTemplates"
+ },
+ {
+ "name": "Boss",
+ "kind": "Singleton",
+ "url": "Boss"
+ },
+ {
+ "name": "VipCustomer",
+ "kind": "Singleton",
+ "url": "VipCustomer"
+ },
+ {
+ "name": "Company",
+ "kind": "Singleton",
+ "url": "Company"
+ },
+ {
+ "name": "PublicCompany",
+ "kind": "Singleton",
+ "url": "PublicCompany"
+ },
+ {
+ "name": "LabourUnion",
+ "kind": "Singleton",
+ "url": "LabourUnion"
+ },
+ {
+ "name": "DefaultStoredPI",
+ "kind": "Singleton",
+ "url": "DefaultStoredPI"
+ },
+ {
+ "name": "GetDefaultColor",
+ "kind": "FunctionImport",
+ "url": "GetDefaultColor"
+ },
+ {
+ "name": "GetPerson",
+ "kind": "FunctionImport",
+ "url": "GetPerson"
+ },
+ {
+ "name": "GetPerson2",
+ "kind": "FunctionImport",
+ "url": "GetPerson2"
+ },
+ {
+ "name": "GetAllProducts",
+ "kind": "FunctionImport",
+ "url": "GetAllProducts"
+ },
+ {
+ "name": "GetBossEmails",
+ "kind": "FunctionImport",
+ "url": "GetBossEmails"
+ },
+ {
+ "name": "GetProductsByAccessLevel",
+ "kind": "FunctionImport",
+ "url": "GetProductsByAccessLevel"
+ }
+ ]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bc398d3d/fit/src/main/resources/v4/services.xml
----------------------------------------------------------------------
diff --git a/fit/src/main/resources/v4/services.xml b/fit/src/main/resources/v4/services.xml
new file mode 100644
index 0000000..5ae733b
--- /dev/null
+++ b/fit/src/main/resources/v4/services.xml
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+ 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.
+
+-->
+<service xml:base="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/"
+ xmlns="http://www.w3.org/2007/app"
+ xmlns:atom="http://www.w3.org/2005/Atom"
+ xmlns:m="http://docs.oasis-open.org/odata/ns/metadata"
+ m:context="http://localhost:${cargo.servlet.port}/StaticService/V40/Static.svc/$metadata">
+ <workspace>
+ <atom:title type="text">InMemoryEntities</atom:title>
+ <collection href="People">
+ <atom:title type="text">People</atom:title>
+ </collection>
+ <collection href="Customers">
+ <atom:title type="text">Customers</atom:title>
+ </collection>
+ <collection href="Employees">
+ <atom:title type="text">Employees</atom:title>
+ </collection>
+ <collection href="Products">
+ <atom:title type="text">Products</atom:title>
+ </collection>
+ <collection href="ProductDetails">
+ <atom:title type="text">ProductDetails</atom:title>
+ </collection>
+ <collection href="ProductReviews">
+ <atom:title type="text">ProductReviews</atom:title>
+ </collection>
+ <collection href="Orders">
+ <atom:title type="text">Orders</atom:title>
+ </collection>
+ <collection href="OrderDetails">
+ <atom:title type="text">OrderDetails</atom:title>
+ </collection>
+ <collection href="Departments">
+ <atom:title type="text">Departments</atom:title>
+ </collection>
+ <collection href="Accounts">
+ <atom:title type="text">Accounts</atom:title>
+ </collection>
+ <collection href="StoredPIs">
+ <atom:title type="text">StoredPIs</atom:title>
+ </collection>
+ <collection href="SubscriptionTemplates">
+ <atom:title type="text">SubscriptionTemplates</atom:title>
+ </collection>
+ <m:singleton href="Boss">
+ <atom:title type="text">Boss</atom:title>
+ </m:singleton>
+ <m:singleton href="VipCustomer">
+ <atom:title type="text">VipCustomer</atom:title>
+ </m:singleton>
+ <m:singleton href="Company">
+ <atom:title type="text">Company</atom:title>
+ </m:singleton>
+ <m:singleton href="PublicCompany">
+ <atom:title type="text">PublicCompany</atom:title>
+ </m:singleton>
+ <m:singleton href="LabourUnion">
+ <atom:title type="text">LabourUnion</atom:title>
+ </m:singleton>
+ <m:singleton href="DefaultStoredPI">
+ <atom:title type="text">DefaultStoredPI</atom:title>
+ </m:singleton>
+ <m:function-import href="GetDefaultColor">
+ <atom:title type="text">GetDefaultColor</atom:title>
+ </m:function-import>
+ <m:function-import href="GetPerson">
+ <atom:title type="text">GetPerson</atom:title>
+ </m:function-import>
+ <m:function-import href="GetPerson2">
+ <atom:title type="text">GetPerson2</atom:title>
+ </m:function-import>
+ <m:function-import href="GetAllProducts">
+ <atom:title type="text">GetAllProducts</atom:title>
+ </m:function-import>
+ <m:function-import href="GetBossEmails">
+ <atom:title type="text">GetBossEmails</atom:title>
+ </m:function-import>
+ <m:function-import href="GetProductsByAccessLevel">
+ <atom:title type="text">GetProductsByAccessLevel</atom:title>
+ </m:function-import>
+ </workspace>
+</service>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bc398d3d/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntityRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntityRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntityRequestImpl.java
index 481d41e..2c8955e 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntityRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntityRequestImpl.java
@@ -85,10 +85,10 @@ public class ODataEntityRequestImpl extends AbstractODataRetrieveRequest<ODataEn
public ODataEntity getBody() {
if (entity == null) {
try {
- final Container<Entry> entry =
+ final Container<Entry> container =
odataClient.getDeserializer().toEntry(getRawResponse(), ODataPubFormat.fromString(getContentType()));
- entity = odataClient.getBinder().getODataEntity(extractFromContainer(entry));
+ entity = odataClient.getBinder().getODataEntity(extractFromContainer(container));
} finally {
this.close();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bc398d3d/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java
index bb46ce8..e6d5783 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java
@@ -87,10 +87,10 @@ public class ODataEntitySetRequestImpl extends AbstractODataRetrieveRequest<ODat
public ODataEntitySet getBody() {
if (entitySet == null) {
try {
- final Container<Feed> feed =
+ final Container<Feed> container =
odataClient.getDeserializer().toFeed(getRawResponse(), ODataPubFormat.fromString(getContentType()));
- entitySet = odataClient.getBinder().getODataEntitySet(extractFromContainer(feed));
+ entitySet = odataClient.getBinder().getODataEntitySet(extractFromContainer(container));
} finally {
this.close();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bc398d3d/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataServiceDocumentRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataServiceDocumentRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataServiceDocumentRequestImpl.java
index 128e250..bf37a32 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataServiceDocumentRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataServiceDocumentRequestImpl.java
@@ -24,6 +24,8 @@ import org.apache.http.client.HttpClient;
import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.retrieve.ODataServiceDocumentRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
+import org.apache.olingo.client.api.data.ServiceDocument;
+import org.apache.olingo.commons.api.data.Container;
import org.apache.olingo.commons.api.domain.ODataServiceDocument;
import org.apache.olingo.commons.api.format.ODataFormat;
@@ -81,8 +83,10 @@ public class ODataServiceDocumentRequestImpl extends AbstractODataRetrieveReques
public ODataServiceDocument getBody() {
if (serviceDocument == null) {
try {
- serviceDocument = odataClient.getReader().readServiceDocument(
+ final Container<ServiceDocument> container = odataClient.getDeserializer().toServiceDocument(
getRawResponse(), ODataFormat.fromString(getContentType()));
+
+ serviceDocument = odataClient.getBinder().getODataServiceDocument(extractFromContainer(container));
} finally {
this.close();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bc398d3d/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/ServiceDocumentRetrieveTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/ServiceDocumentRetrieveTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/ServiceDocumentRetrieveTestITCase.java
new file mode 100644
index 0000000..0562670
--- /dev/null
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/ServiceDocumentRetrieveTestITCase.java
@@ -0,0 +1,74 @@
+/*
+ * 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.client.core.it.v4;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.net.URI;
+import org.apache.olingo.client.api.communication.ODataClientErrorException;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataServiceDocumentRequest;
+import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
+import org.apache.olingo.commons.api.domain.ODataServiceDocument;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class ServiceDocumentRetrieveTestITCase extends AbstractTestITCase {
+
+ private void retrieveServiceDocumentTest(final ODataFormat reqFormat, final String acceptFormat) {
+ final ODataServiceDocumentRequest req =
+ client.getRetrieveRequestFactory().getServiceDocumentRequest(testStaticServiceRootURL);
+ req.setFormat(reqFormat);
+ req.setAccept(acceptFormat);
+ final ODataRetrieveResponse<ODataServiceDocument> res = req.execute();
+ assertEquals(200, res.getStatusCode());
+ final ODataServiceDocument serviceDocument = res.getBody();
+ assertEquals(12, serviceDocument.getEntitySetTitles().size());
+ assertEquals(URI.create(testStaticServiceRootURL + "/Customers"), serviceDocument.getEntitySetURI("Customers"));
+ assertTrue(res.getContextURL().toASCIIString().endsWith("/StaticService/V40/Static.svc/$metadata"));
+ }
+
+ @Test
+ @Ignore
+ public void jsonTest() {
+ retrieveServiceDocumentTest(ODataFormat.JSON, "application/json");
+ }
+
+ @Test
+ @Ignore
+ public void jsonNoMetadataTest() {
+ retrieveServiceDocumentTest(ODataFormat.JSON_NO_METADATA, "application/json");
+ }
+
+ @Test
+ public void xmlTest() {
+ retrieveServiceDocumentTest(ODataFormat.XML, "application/xml");
+ }
+
+ @Test(expected = ODataClientErrorException.class)
+ public void atomAcceptTest() {
+ retrieveServiceDocumentTest(ODataFormat.XML, "application/atom+xml");
+ }
+
+ @Test
+ public void nullServiceFormatTest() {
+ retrieveServiceDocumentTest(null, "application/xml");
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bc398d3d/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/ServiceDocumentTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/ServiceDocumentTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/ServiceDocumentTestITCase.java
new file mode 100644
index 0000000..4d7f5d7
--- /dev/null
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/ServiceDocumentTestITCase.java
@@ -0,0 +1,60 @@
+/*
+ * 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.client.core.it.v4;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.net.URI;
+import org.apache.olingo.client.api.communication.request.retrieve.ODataServiceDocumentRequest;
+import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
+import org.apache.olingo.commons.api.domain.ODataServiceDocument;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class ServiceDocumentTestITCase extends AbstractTestITCase {
+
+ private void retrieveServiceDocument(final ODataFormat format) {
+ final ODataServiceDocumentRequest req =
+ client.getRetrieveRequestFactory().getServiceDocumentRequest(testStaticServiceRootURL);
+ req.setFormat(format);
+
+ final ODataRetrieveResponse<ODataServiceDocument> res = req.execute();
+ assertEquals(200, res.getStatusCode());
+
+ final ODataServiceDocument serviceDocument = res.getBody();
+ assertEquals(12, serviceDocument.getEntitySetTitles().size());
+
+ assertEquals(URI.create(testStaticServiceRootURL + "/ProductDetails"),
+ serviceDocument.getEntitySetURI("ProductDetails"));
+ assertTrue(res.getContextURL().toASCIIString().endsWith("/StaticService/V40/Static.svc/$metadata"));
+ }
+
+ @Test
+ public void retrieveServiceDocumentAsXML() {
+ retrieveServiceDocument(ODataFormat.XML);
+ }
+
+ @Test
+ @Ignore
+ public void retrieveServiceDocumentAsJSON() {
+ retrieveServiceDocument(ODataFormat.JSON);
+ }
+}
[38/51] [abbrv] [OLINGO-200] V4 ODataValue full reachable via API
Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/PropertyValueTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/PropertyValueTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/PropertyValueTestITCase.java
index cddd66d..18613cf 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/PropertyValueTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/PropertyValueTestITCase.java
@@ -23,7 +23,7 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.communication.ODataClientErrorException;
import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataValueRequest;
-import org.apache.olingo.client.api.uri.CommonURIBuilder;
+import org.apache.olingo.client.api.uri.v4.URIBuilder;
import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
import org.apache.olingo.commons.api.domain.v4.ODataProperty;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
@@ -38,7 +38,7 @@ public class PropertyValueTestITCase extends AbstractTestITCase {
@Test
public void retrieveIntPropertyValueTest() throws EdmPrimitiveTypeException {
- final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("PersonID").
appendValueSegment();
final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
@@ -48,7 +48,7 @@ public class PropertyValueTestITCase extends AbstractTestITCase {
@Test
public void retrieveBooleanPropertyValueTest() throws EdmPrimitiveTypeException {
- final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("IsRegistered").
appendValueSegment();
final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
@@ -58,7 +58,7 @@ public class PropertyValueTestITCase extends AbstractTestITCase {
@Test
public void retrieveStringPropertyValueTest() throws EdmPrimitiveTypeException {
- final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("FirstName").
appendValueSegment();
final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
@@ -68,7 +68,7 @@ public class PropertyValueTestITCase extends AbstractTestITCase {
@Test
public void retrieveDatePropertyValueTest() {
- final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Orders").appendKeySegment(8).appendPropertySegment("OrderDate").
appendValueSegment();
final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
@@ -79,7 +79,7 @@ public class PropertyValueTestITCase extends AbstractTestITCase {
@Test
public void retrieveDecimalPropertyValueTest() throws EdmPrimitiveTypeException {
- final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("Height").
appendValueSegment();
final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
@@ -90,7 +90,7 @@ public class PropertyValueTestITCase extends AbstractTestITCase {
@Test
public void retrieveBinaryPropertyValueTest() throws IOException {
- final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("PDC").
appendValueSegment();
final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
@@ -102,7 +102,7 @@ public class PropertyValueTestITCase extends AbstractTestITCase {
@Test(expected = ODataClientErrorException.class)
public void retrieveBinaryPropertyValueTestWithAtom() throws IOException {
- final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("PDC").
appendValueSegment();
final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
@@ -112,7 +112,7 @@ public class PropertyValueTestITCase extends AbstractTestITCase {
@Test(expected = ODataClientErrorException.class)
public void retrieveBinaryPropertyValueTestWithXML() throws IOException {
- final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("PDC").
appendValueSegment();
final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
@@ -122,7 +122,7 @@ public class PropertyValueTestITCase extends AbstractTestITCase {
@Test
public void retrieveCollectionPropertyValueTest() {
- CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ final URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("Numbers");
final ODataPropertyRequest<ODataProperty> req = client.getRetrieveRequestFactory().
getPropertyRequest(uriBuilder.build());
@@ -134,7 +134,7 @@ public class PropertyValueTestITCase extends AbstractTestITCase {
@Test
public void retrieveNullPropertyValueTest() {
- CommonURIBuilder<?> uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
+ URIBuilder uriBuilder = client.getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("People").appendKeySegment(5).appendPropertySegment("MiddleName").
appendValueSegment();
final ODataValueRequest req = client.getRetrieveRequestFactory().getValueRequest(uriBuilder.build());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java
index 4b3167e..8676d6f 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java
@@ -31,11 +31,12 @@ import org.apache.olingo.client.core.AbstractTest;
import org.apache.olingo.commons.api.domain.ODataCollectionValue;
import org.apache.olingo.commons.api.domain.ODataComplexValue;
import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataValue;
-import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.domain.v3.ODataProperty;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.format.ODataFormat;
+
import org.junit.Test;
public class PropertyTest extends AbstractTest {
@@ -57,15 +58,15 @@ public class PropertyTest extends AbstractTest {
assertEquals("-10", value.toString());
}
- private CommonODataProperty primitive(final ODataFormat format) throws IOException, EdmPrimitiveTypeException {
+ private ODataProperty primitive(final ODataFormat format) throws IOException, EdmPrimitiveTypeException {
final InputStream input = getClass().getResourceAsStream("Customer_-10_CustomerId." + getSuffix(format));
- final CommonODataProperty property = getClient().getReader().readProperty(input, format);
+ final ODataProperty property = getClient().getReader().readProperty(input, format);
assertNotNull(property);
assertTrue(property.hasPrimitiveValue());
assertTrue(-10 == property.getPrimitiveValue().toCastValue(Integer.class));
- CommonODataProperty comparable;
- final CommonODataProperty written = getClient().getReader().readProperty(
+ ODataProperty comparable;
+ final ODataProperty written = getClient().getReader().readProperty(
getClient().getWriter().writeProperty(property, format), format);
if (format == ODataFormat.XML) {
comparable = written;
@@ -93,24 +94,24 @@ public class PropertyTest extends AbstractTest {
primitive(ODataFormat.JSON);
}
- private CommonODataProperty complex(final ODataFormat format) throws IOException {
+ private ODataProperty complex(final ODataFormat format) throws IOException {
final InputStream input = getClass().getResourceAsStream("Customer_-10_PrimaryContactInfo." + getSuffix(format));
- final CommonODataProperty property = getClient().getReader().readProperty(input, format);
+ final ODataProperty property = getClient().getReader().readProperty(input, format);
assertNotNull(property);
assertTrue(property.hasComplexValue());
assertEquals(6, property.getComplexValue().size());
- CommonODataProperty comparable;
- final CommonODataProperty written = getClient().getReader().readProperty(
+ ODataProperty comparable;
+ final ODataProperty written = getClient().getReader().readProperty(
getClient().getWriter().writeProperty(property, format), format);
if (format == ODataFormat.XML) {
comparable = written;
} else {
// This is needed because type information gets lost with JSON serialization
- final ODataComplexValue typedValue = getClient().getObjectFactory().
+ final ODataComplexValue<ODataProperty> typedValue = getClient().getObjectFactory().
newComplexValue(property.getComplexValue().getTypeName());
- for (final Iterator<CommonODataProperty> itor = written.getComplexValue().iterator(); itor.hasNext();) {
- final CommonODataProperty prop = itor.next();
+ for (final Iterator<ODataProperty> itor = written.getComplexValue().iterator(); itor.hasNext();) {
+ final ODataProperty prop = itor.next();
typedValue.add(prop);
}
comparable = getClient().getObjectFactory().newComplexProperty(written.getName(), typedValue);
@@ -131,21 +132,21 @@ public class PropertyTest extends AbstractTest {
complex(ODataFormat.JSON);
}
- private CommonODataProperty collection(final ODataFormat format) throws IOException {
+ private ODataProperty collection(final ODataFormat format) throws IOException {
final InputStream input = getClass().getResourceAsStream("Customer_-10_BackupContactInfo." + getSuffix(format));
- final CommonODataProperty property = getClient().getReader().readProperty(input, format);
+ final ODataProperty property = getClient().getReader().readProperty(input, format);
assertNotNull(property);
assertTrue(property.hasCollectionValue());
assertEquals(9, property.getCollectionValue().size());
- CommonODataProperty comparable;
- final CommonODataProperty written = getClient().getReader().readProperty(
+ ODataProperty comparable;
+ final ODataProperty written = getClient().getReader().readProperty(
getClient().getWriter().writeProperty(property, format), format);
if (format == ODataFormat.XML) {
comparable = written;
} else {
// This is needed because type information gets lost with JSON serialization
- final ODataCollectionValue typedValue = getClient().getObjectFactory().
+ final ODataCollectionValue<ODataValue> typedValue = getClient().getObjectFactory().
newCollectionValue(property.getCollectionValue().getTypeName());
for (final Iterator<ODataValue> itor = written.getCollectionValue().iterator(); itor.hasNext();) {
final ODataValue value = itor.next();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
index f9c57c2..97b6a44 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
@@ -28,9 +28,9 @@ import org.apache.olingo.client.api.v4.ODataClient;
import org.apache.olingo.client.core.AbstractTest;
import org.apache.olingo.commons.api.domain.ODataLink;
import org.apache.olingo.commons.api.domain.ODataLinkType;
-import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.commons.api.domain.v4.ODataEntity;
import org.apache.olingo.commons.api.domain.v4.ODataProperty;
+import org.apache.olingo.commons.api.domain.v4.ODataValue;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.commons.core.edm.primitivetype.EdmDateTimeOffset;
import org.apache.olingo.commons.core.edm.primitivetype.EdmDuration;
@@ -107,15 +107,15 @@ public class EntityTest extends AbstractTest {
assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Color", skinColor.getEnumValue().getTypeName());
assertEquals("Red", skinColor.getEnumValue().getValue());
-// final ODataProperty coverColors = entity.getProperty("CoverColors");
-// assertTrue(coverColors.hasCollectionValue());
-// for (final Iterator<ODataValue> itor = coverColors.getCollectionValue().iterator(); itor.hasNext();) {
-// final ODataValue item = itor.next();
-// assertTrue(item.isEnum());
-// }
+ final ODataProperty coverColors = entity.getProperty("CoverColors");
+ assertTrue(coverColors.hasCollectionValue());
+ for (final Iterator<ODataValue> itor = coverColors.getCollectionValue().iterator(); itor.hasNext();) {
+ final ODataValue item = itor.next();
+ assertTrue(item.isEnum());
+ }
// operations won't get serialized
- entity.getOperations().clear();
+ entity.getOperations().clear();
final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
assertEquals(entity, written);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractODataValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractODataValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractODataValue.java
index 1dbfdf8..4fb9de9 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractODataValue.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractODataValue.java
@@ -35,7 +35,7 @@ public abstract class AbstractODataValue implements ODataValue {
*/
private final String typeName;
- public AbstractODataValue(String typeName) {
+ public AbstractODataValue(final String typeName) {
this.typeName = typeName;
}
@@ -79,9 +79,10 @@ public abstract class AbstractODataValue implements ODataValue {
*
* @return complex value.
*/
+// @SuppressWarnings("unchecked")
@Override
- public ODataComplexValue asComplex() {
- return isComplex() ? (ODataComplexValue) this : null;
+ public <OP extends CommonODataProperty> ODataComplexValue<OP> asComplex() {
+ return isComplex() ? (ODataComplexValue<OP>) this : null;
}
/**
@@ -99,9 +100,10 @@ public abstract class AbstractODataValue implements ODataValue {
*
* @return collection value.
*/
+// @SuppressWarnings("unchecked")
@Override
- public ODataCollectionValue asCollection() {
- return isCollection() ? (ODataCollectionValue) this : null;
+ public <OV extends ODataValue> ODataCollectionValue<OV> asCollection() {
+ return isCollection() ? (ODataCollectionValue<OV>) this : null;
}
@Override
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataObjectFactory.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataObjectFactory.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataObjectFactory.java
index 40ffda9..434906e 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataObjectFactory.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataObjectFactory.java
@@ -177,9 +177,9 @@ public interface CommonODataObjectFactory {
ODataPrimitiveValue.Builder newPrimitiveValueBuilder();
- ODataComplexValue newComplexValue(String typeName);
+ ODataComplexValue<? extends CommonODataProperty> newComplexValue(String typeName);
- ODataCollectionValue newCollectionValue(String typeName);
+ ODataCollectionValue<? extends ODataValue> newCollectionValue(String typeName);
/**
* Instantiates a new primitive property.
@@ -197,7 +197,7 @@ public interface CommonODataObjectFactory {
* @param value value.
* @return complex property.
*/
- CommonODataProperty newComplexProperty(String name, ODataComplexValue value);
+ CommonODataProperty newComplexProperty(String name, ODataComplexValue<? extends CommonODataProperty> value);
/**
* Instantiates a new collection property.
@@ -206,5 +206,5 @@ public interface CommonODataObjectFactory {
* @param value value.
* @return collection property.
*/
- CommonODataProperty newCollectionProperty(String name, ODataCollectionValue value);
+ CommonODataProperty newCollectionProperty(String name, ODataCollectionValue<? extends ODataValue> value);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataProperty.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataProperty.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataProperty.java
index 99a5131..8eae93e 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataProperty.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataProperty.java
@@ -68,24 +68,10 @@ public interface CommonODataProperty extends ODataInvokeResult, Serializable {
boolean hasCollectionValue();
/**
- * Gets collection value.
- *
- * @return collection value if exists; null otherwise.
- */
- ODataCollectionValue getCollectionValue();
-
- /**
* Checks if has complex value.
*
* @return 'TRUE' if has complex value; 'FALSE' otherwise.
*/
boolean hasComplexValue();
- /**
- * Gets complex value.
- *
- * @return complex value if exists; null otherwise.
- */
- ODataComplexValue getComplexValue();
-
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataCollectionValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataCollectionValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataCollectionValue.java
index d0daf59..29eedab 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataCollectionValue.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataCollectionValue.java
@@ -20,15 +20,17 @@ package org.apache.olingo.commons.api.domain;
/**
* OData collection property value.
+ *
+ * @param <OV> The actual ODataValue interface.
*/
-public interface ODataCollectionValue extends ODataValue, Iterable<ODataValue> {
+public interface ODataCollectionValue<OV extends ODataValue> extends ODataValue, Iterable<OV> {
/**
* Adds a value to the collection.
*
* @param value value to be added.
*/
- void add(ODataValue value);
+ void add(OV value);
/**
* Checks if collection is empty.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java
index b34006c..7eb02c0 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java
@@ -20,15 +20,17 @@ package org.apache.olingo.commons.api.domain;
/**
* OData complex property value.
+ *
+ * @param <OP> The actual ODataProperty interface.
*/
-public interface ODataComplexValue extends ODataValue, Iterable<CommonODataProperty> {
+public interface ODataComplexValue<OP extends CommonODataProperty> extends ODataValue, Iterable<OP> {
/**
* Adds field to the complex type.
*
* @param field field to be added.
*/
- void add(CommonODataProperty field);
+ void add(OP field);
/**
* Gets field.
@@ -36,7 +38,7 @@ public interface ODataComplexValue extends ODataValue, Iterable<CommonODataPrope
* @param name name of the field to be retrieved.
* @return requested field.
*/
- CommonODataProperty get(String name);
+ OP get(String name);
/**
* Gets number of fields.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataValue.java
index 6db4b2b..0727976 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataValue.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataValue.java
@@ -56,9 +56,10 @@ public interface ODataValue extends Serializable {
/**
* Casts to collection value.
*
+ * @param <OV> The actual ODataValue interface.
* @return collection value.
*/
- ODataCollectionValue asCollection();
+ <OV extends ODataValue> ODataCollectionValue<OV> asCollection();
/**
* Check is is a complex value.
@@ -70,8 +71,9 @@ public interface ODataValue extends Serializable {
/**
* Casts to complex value.
*
+ * @param <OP> The actual ODataProperty interface.
* @return complex value.
*/
- ODataComplexValue asComplex();
+ <OP extends CommonODataProperty> ODataComplexValue<OP> asComplex();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataObjectFactory.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataObjectFactory.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataObjectFactory.java
index 363f1de..31f5ba1 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataObjectFactory.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataObjectFactory.java
@@ -20,9 +20,11 @@ package org.apache.olingo.commons.api.domain.v3;
import java.net.URI;
import org.apache.olingo.commons.api.domain.CommonODataObjectFactory;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataCollectionValue;
import org.apache.olingo.commons.api.domain.ODataComplexValue;
import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
+import org.apache.olingo.commons.api.domain.ODataValue;
public interface ODataObjectFactory extends CommonODataObjectFactory {
@@ -39,12 +41,18 @@ public interface ODataObjectFactory extends CommonODataObjectFactory {
ODataEntity newEntity(String name, URI link);
@Override
+ ODataComplexValue<ODataProperty> newComplexValue(String typeName);
+
+ @Override
+ ODataCollectionValue<ODataValue> newCollectionValue(String typeName);
+
+ @Override
ODataProperty newPrimitiveProperty(String name, ODataPrimitiveValue value);
@Override
- ODataProperty newComplexProperty(String name, ODataComplexValue value);
+ ODataProperty newComplexProperty(String name, ODataComplexValue<? extends CommonODataProperty> value);
@Override
- ODataProperty newCollectionProperty(String name, ODataCollectionValue value);
+ ODataProperty newCollectionProperty(String name, ODataCollectionValue<? extends ODataValue> value);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataProperty.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataProperty.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataProperty.java
index 266d53c..46f1c39 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataProperty.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v3/ODataProperty.java
@@ -19,7 +19,23 @@
package org.apache.olingo.commons.api.domain.v3;
import org.apache.olingo.commons.api.domain.CommonODataProperty;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.ODataValue;
public interface ODataProperty extends CommonODataProperty {
+ /**
+ * Gets collection value.
+ *
+ * @return collection value if exists; null otherwise.
+ */
+ ODataCollectionValue<ODataValue> getCollectionValue();
+
+ /**
+ * Gets complex value.
+ *
+ * @return complex value if exists; null otherwise.
+ */
+ ODataComplexValue<ODataProperty> getComplexValue();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataObjectFactory.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataObjectFactory.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataObjectFactory.java
index d12f0dc..67adf57 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataObjectFactory.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataObjectFactory.java
@@ -20,6 +20,7 @@ package org.apache.olingo.commons.api.domain.v4;
import java.net.URI;
import org.apache.olingo.commons.api.domain.CommonODataObjectFactory;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataCollectionValue;
import org.apache.olingo.commons.api.domain.ODataComplexValue;
import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
@@ -41,14 +42,21 @@ public interface ODataObjectFactory extends CommonODataObjectFactory {
ODataEnumValue newEnumValue(String typeName, String value);
@Override
+ ODataComplexValue<ODataProperty> newComplexValue(String typeName);
+
+ @Override
+ ODataCollectionValue<ODataValue> newCollectionValue(String typeName);
+
+ @Override
ODataProperty newPrimitiveProperty(String name, ODataPrimitiveValue value);
ODataProperty newEnumProperty(String name, ODataEnumValue value);
@Override
- ODataProperty newComplexProperty(String name, ODataComplexValue value);
+ ODataProperty newComplexProperty(String name, ODataComplexValue<? extends CommonODataProperty> value);
@Override
- ODataProperty newCollectionProperty(String name, ODataCollectionValue value);
+ ODataProperty newCollectionProperty(String name,
+ ODataCollectionValue<? extends org.apache.olingo.commons.api.domain.ODataValue> value);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataProperty.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataProperty.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataProperty.java
index 61a8193..4666e6e 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataProperty.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataProperty.java
@@ -19,10 +19,26 @@
package org.apache.olingo.commons.api.domain.v4;
import org.apache.olingo.commons.api.domain.CommonODataProperty;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
public interface ODataProperty extends CommonODataProperty {
/**
+ * Gets collection value.
+ *
+ * @return collection value if exists; null otherwise.
+ */
+ ODataCollectionValue<ODataValue> getCollectionValue();
+
+ /**
+ * Gets complex value.
+ *
+ * @return complex value if exists; null otherwise.
+ */
+ ODataComplexValue<ODataProperty> getComplexValue();
+
+ /**
* Checks if has enum value.
*
* @return 'TRUE' if has enum value; 'FALSE' otherwise.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataCollectionValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataCollectionValue.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataCollectionValue.java
new file mode 100644
index 0000000..fe2fd52
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataCollectionValue.java
@@ -0,0 +1,93 @@
+/*
+ * 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.commons.core.domain;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import org.apache.olingo.commons.api.domain.AbstractODataValue;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataValue;
+
+/**
+ * OData collection property value.
+ *
+ * @param <OV> The actual ODataValue interface.
+ */
+public abstract class AbstractODataCollectionValue<OV extends ODataValue>
+ extends AbstractODataValue implements ODataCollectionValue<OV> {
+
+ private static final long serialVersionUID = -3665659846001987187L;
+
+ /**
+ * Values.
+ */
+ private final List<OV> values = new ArrayList<OV>();
+
+ /**
+ * Constructor.
+ *
+ * @param typeName type name.
+ */
+ public AbstractODataCollectionValue(final String typeName) {
+ super(typeName);
+ }
+
+ /**
+ * Adds a value to the collection.
+ *
+ * @param value value to be added.
+ */
+ @Override
+ public void add(final OV value) {
+ if (value.isPrimitive() || value.isComplex()) {
+ values.add(value);
+ }
+ }
+
+ /**
+ * Value iterator.
+ *
+ * @return value iterator.
+ */
+ @Override
+ public Iterator<OV> iterator() {
+ return values.iterator();
+ }
+
+ /**
+ * Gets collection size.
+ *
+ * @return collection size.
+ */
+ @Override
+ public int size() {
+ return values.size();
+ }
+
+ /**
+ * Checks if collection is empty.
+ *
+ * @return 'TRUE' if empty; 'FALSE' otherwise.
+ */
+ @Override
+ public boolean isEmpty() {
+ return values.isEmpty();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataComplexValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataComplexValue.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataComplexValue.java
new file mode 100644
index 0000000..6a09664
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataComplexValue.java
@@ -0,0 +1,93 @@
+/*
+ * 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.commons.core.domain;
+
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import org.apache.olingo.commons.api.domain.AbstractODataValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
+
+/**
+ * OData complex property value.
+ *
+ * @param <OP> The actual ODataProperty interface.
+ */
+public abstract class AbstractODataComplexValue<OP extends CommonODataProperty>
+ extends AbstractODataValue implements ODataComplexValue<OP> {
+
+ private static final long serialVersionUID = -1878555027714020431L;
+
+ /**
+ * Complex type fields.
+ */
+ private final Map<String, OP> fields = new LinkedHashMap<String, OP>();
+
+ /**
+ * Constructor.
+ *
+ * @param typeName type name.
+ */
+ public AbstractODataComplexValue(final String typeName) {
+ super(typeName);
+ }
+
+ /**
+ * Adds field to the complex type.
+ *
+ * @param field field to be added.
+ */
+ @Override
+ @SuppressWarnings("unchecked")
+ public void add(final CommonODataProperty field) {
+ fields.put(field.getName(), (OP) field);
+ }
+
+ /**
+ * Gets field.
+ *
+ * @param name name of the field to be retrieved.
+ * @return requested field.
+ */
+ @Override
+ public OP get(final String name) {
+ return fields.get(name);
+ }
+
+ /**
+ * Complex property fields iterator.
+ *
+ * @return fields iterator.
+ */
+ @Override
+ public Iterator<OP> iterator() {
+ return fields.values().iterator();
+ }
+
+ /**
+ * Gets number of fields.
+ *
+ * @return number of fields.
+ */
+ @Override
+ public int size() {
+ return fields.size();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataObjectFactory.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataObjectFactory.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataObjectFactory.java
index a3133cd..43853fa 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataObjectFactory.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataObjectFactory.java
@@ -20,15 +20,12 @@ package org.apache.olingo.commons.core.domain;
import java.net.URI;
import org.apache.olingo.commons.api.domain.ODataLinkType;
-import org.apache.olingo.commons.api.domain.ODataCollectionValue;
-import org.apache.olingo.commons.api.domain.ODataComplexValue;
import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.domain.ODataInlineEntity;
import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
import org.apache.olingo.commons.api.domain.ODataLink;
import org.apache.olingo.commons.api.domain.CommonODataObjectFactory;
-import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
public abstract class AbstractODataObjectFactory implements CommonODataObjectFactory {
@@ -115,19 +112,4 @@ public abstract class AbstractODataObjectFactory implements CommonODataObjectFac
setType(ODataLinkType.MEDIA_EDIT).setTitle(name).build();
}
- @Override
- public ODataPrimitiveValue.Builder newPrimitiveValueBuilder() {
- return new ODataPrimitiveValueImpl.BuilderImpl(version);
- }
-
- @Override
- public ODataComplexValue newComplexValue(final String typeName) {
- return new ODataComplexValueImpl(typeName);
- }
-
- @Override
- public ODataCollectionValue newCollectionValue(final String typeName) {
- return new ODataCollectionValueImpl(typeName);
- }
-
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataPrimitiveValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataPrimitiveValue.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataPrimitiveValue.java
new file mode 100644
index 0000000..9d2d6ec
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataPrimitiveValue.java
@@ -0,0 +1,179 @@
+/*
+ * 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.commons.core.domain;
+
+import java.sql.Timestamp;
+import java.util.Calendar;
+import org.apache.olingo.commons.api.Constants;
+import org.apache.olingo.commons.api.domain.AbstractODataValue;
+import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
+
+public abstract class AbstractODataPrimitiveValue extends AbstractODataValue implements ODataPrimitiveValue {
+
+ private static final long serialVersionUID = 8889282662298376036L;
+
+ public static abstract class AbstractBuilder implements Builder {
+
+ private final ODataServiceVersion version;
+
+ public AbstractBuilder(final ODataServiceVersion version) {
+ this.version = version;
+ }
+
+ protected abstract AbstractODataPrimitiveValue getInstance();
+
+ @Override
+ public AbstractBuilder setType(final EdmPrimitiveTypeKind type) {
+ if (type != null && !type.getSupportedVersions().contains(version)) {
+ throw new IllegalArgumentException(String.format(
+ "Type %s not supported by OData version %s", type.toString(), version));
+ }
+ if (type == EdmPrimitiveTypeKind.Stream) {
+ throw new IllegalArgumentException(String.format(
+ "Cannot build a primitive value for %s", EdmPrimitiveTypeKind.Stream.toString()));
+ }
+ if (type == EdmPrimitiveTypeKind.Geography || type == EdmPrimitiveTypeKind.Geometry) {
+ throw new IllegalArgumentException(
+ type + "is not an instantiable type. "
+ + "An entity can declare a property to be of type Geometry. "
+ + "An instance of an entity MUST NOT have a value of type Geometry. "
+ + "Each value MUST be of some subtype.");
+ }
+
+ getInstance().typeKind = type == null ? EdmPrimitiveTypeKind.String : type;
+ getInstance().type = EdmPrimitiveTypeFactory.getInstance(getInstance().typeKind);
+
+ return this;
+ }
+
+ @Override
+ public AbstractBuilder setText(final String text) {
+ getInstance().text = text;
+ return this;
+ }
+
+ @Override
+ public AbstractBuilder setValue(final Object value) {
+ getInstance().value = value;
+ return this;
+ }
+
+ @Override
+ public AbstractODataPrimitiveValue build() {
+ if (getInstance().text == null && getInstance().value == null) {
+ throw new IllegalArgumentException("Must provide either text or value");
+ }
+ if (getInstance().text != null && getInstance().value != null) {
+ throw new IllegalArgumentException("Cannot provide both text and value");
+ }
+
+ if (getInstance().type == null) {
+ setType(EdmPrimitiveTypeKind.String);
+ }
+
+ if (getInstance().text != null) {
+ final Class<?> returnType = getInstance().type.getDefaultType().isAssignableFrom(Calendar.class)
+ ? Timestamp.class : getInstance().type.getDefaultType();
+ try {
+ // TODO: when Edm is available, set facets when calling this method
+ getInstance().value = getInstance().type.valueOfString(
+ getInstance().text, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null,
+ returnType);
+ } catch (EdmPrimitiveTypeException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+ if (getInstance().value != null) {
+ try {
+ // TODO: when Edm is available, set facets when calling this method
+ getInstance().text = getInstance().type.valueToString(
+ getInstance().value, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null);
+ } catch (EdmPrimitiveTypeException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ return getInstance();
+ }
+ }
+
+ /**
+ * Type kind.
+ */
+ private EdmPrimitiveTypeKind typeKind;
+
+ /**
+ * Type.
+ */
+ private EdmPrimitiveType type;
+
+ /**
+ * Text value.
+ */
+ private String text;
+
+ /**
+ * Actual value.
+ */
+ private Object value;
+
+ protected AbstractODataPrimitiveValue() {
+ super(null);
+ }
+
+ @Override
+ public String getTypeName() {
+ return typeKind.getFullQualifiedName().toString();
+ }
+
+ @Override
+ public EdmPrimitiveTypeKind getTypeKind() {
+ return typeKind;
+ }
+
+ @Override
+ public EdmPrimitiveType getType() {
+ return type;
+ }
+
+ @Override
+ public Object toValue() {
+ return this.value;
+ }
+
+ @Override
+ public <T> T toCastValue(final Class<T> reference) throws EdmPrimitiveTypeException {
+ return typeKind.isGeospatial()
+ ? reference.cast(this.value)
+ // TODO: when Edm is available, set facets when calling this method
+ : type.valueOfString(this.text,
+ null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null, reference);
+ }
+
+ @Override
+ public String toString() {
+ return this.text;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataProperty.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataProperty.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataProperty.java
index c68dfab..532303c 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataProperty.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataProperty.java
@@ -22,8 +22,6 @@ import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
-import org.apache.olingo.commons.api.domain.ODataCollectionValue;
-import org.apache.olingo.commons.api.domain.ODataComplexValue;
import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataValue;
@@ -114,16 +112,6 @@ public abstract class AbstractODataProperty implements CommonODataProperty {
}
/**
- * Gets complex value.
- *
- * @return complex value if exists; null otherwise.
- */
- @Override
- public ODataComplexValue getComplexValue() {
- return hasComplexValue() ? this.value.asComplex() : null;
- }
-
- /**
* Checks if has collection value.
*
* @return 'TRUE' if has collection value; 'FALSE' otherwise.
@@ -134,16 +122,6 @@ public abstract class AbstractODataProperty implements CommonODataProperty {
}
/**
- * Gets collection value.
- *
- * @return collection value if exists; null otherwise.
- */
- @Override
- public ODataCollectionValue getCollectionValue() {
- return hasCollectionValue() ? this.value.asCollection() : null;
- }
-
- /**
* {@inheritDoc }
*/
@Override
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataCollectionValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataCollectionValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataCollectionValueImpl.java
deleted file mode 100644
index 1189aae..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataCollectionValueImpl.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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.commons.core.domain;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import org.apache.olingo.commons.api.domain.AbstractODataValue;
-import org.apache.olingo.commons.api.domain.ODataCollectionValue;
-import org.apache.olingo.commons.api.domain.ODataValue;
-
-/**
- * OData collection property value.
- */
-public class ODataCollectionValueImpl extends AbstractODataValue implements ODataCollectionValue {
-
- private static final long serialVersionUID = -3665659846001987187L;
-
- /**
- * Values.
- */
- private final List<ODataValue> values = new ArrayList<ODataValue>();
-
- /**
- * Constructor.
- *
- * @param typeName type name.
- */
- public ODataCollectionValueImpl(final String typeName) {
- super(typeName);
- }
-
- /**
- * Adds a value to the collection.
- *
- * @param value value to be added.
- */
- @Override
- public void add(final ODataValue value) {
- if (value.isPrimitive() || value.isComplex()) {
- values.add(value);
- }
- }
-
- /**
- * Value iterator.
- *
- * @return value iterator.
- */
- @Override
- public Iterator<ODataValue> iterator() {
- return values.iterator();
- }
-
- /**
- * Gets collection size.
- *
- * @return collection size.
- */
- @Override
- public int size() {
- return values.size();
- }
-
- /**
- * Checks if collection is empty.
- *
- * @return 'TRUE' if empty; 'FALSE' otherwise.
- */
- @Override
- public boolean isEmpty() {
- return values.isEmpty();
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataComplexValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataComplexValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataComplexValueImpl.java
deleted file mode 100644
index ba8fe56..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataComplexValueImpl.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * 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.commons.core.domain;
-
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import org.apache.olingo.commons.api.domain.AbstractODataValue;
-import org.apache.olingo.commons.api.domain.ODataComplexValue;
-import org.apache.olingo.commons.api.domain.CommonODataProperty;
-
-/**
- * OData complex property value.
- */
-public class ODataComplexValueImpl extends AbstractODataValue implements ODataComplexValue {
-
- private static final long serialVersionUID = -1878555027714020431L;
-
- /**
- * Complex type fields.
- */
- private final Map<String, CommonODataProperty> fields = new LinkedHashMap<String, CommonODataProperty>();
-
- /**
- * Constructor.
- *
- * @param typeName type name.
- */
- public ODataComplexValueImpl(final String typeName) {
- super(typeName);
- }
-
- /**
- * Adds field to the complex type.
- *
- * @param field field to be added.
- */
- @Override
- public void add(final CommonODataProperty field) {
- fields.put(field.getName(), field);
- }
-
- /**
- * Gets field.
- *
- * @param name name of the field to be retrieved.
- * @return requested field.
- */
- @Override
- public CommonODataProperty get(final String name) {
- return fields.get(name);
- }
-
- /**
- * Complex property fields iterator.
- *
- * @return fields iterator.
- */
- @Override
- public Iterator<CommonODataProperty> iterator() {
- return fields.values().iterator();
- }
-
- /**
- * Gets number of fields.
- *
- * @return number of fields.
- */
- @Override
- public int size() {
- return fields.size();
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPrimitiveValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPrimitiveValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPrimitiveValueImpl.java
deleted file mode 100644
index 965d5fc..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/ODataPrimitiveValueImpl.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * 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.commons.core.domain;
-
-import java.sql.Timestamp;
-import java.util.Calendar;
-import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.domain.AbstractODataValue;
-import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
-
-public class ODataPrimitiveValueImpl extends AbstractODataValue implements ODataPrimitiveValue {
-
- private static final long serialVersionUID = 8889282662298376036L;
-
- public static class BuilderImpl implements Builder {
-
- private final ODataServiceVersion version;
-
- private final ODataPrimitiveValueImpl instance;
-
- public BuilderImpl(final ODataServiceVersion version) {
- this.version = version;
- this.instance = new ODataPrimitiveValueImpl();
- }
-
- @Override
- public BuilderImpl setType(final EdmPrimitiveTypeKind type) {
- if (type != null && !type.getSupportedVersions().contains(version)) {
- throw new IllegalArgumentException(String.format(
- "Type %s not supported by OData version %s", type.toString(), version));
- }
- if (type == EdmPrimitiveTypeKind.Stream) {
- throw new IllegalArgumentException(String.format(
- "Cannot build a primitive value for %s", EdmPrimitiveTypeKind.Stream.toString()));
- }
- if (type == EdmPrimitiveTypeKind.Geography || type == EdmPrimitiveTypeKind.Geometry) {
- throw new IllegalArgumentException(
- type + "is not an instantiable type. "
- + "An entity can declare a property to be of type Geometry. "
- + "An instance of an entity MUST NOT have a value of type Geometry. "
- + "Each value MUST be of some subtype.");
- }
-
- this.instance.typeKind = type == null ? EdmPrimitiveTypeKind.String : type;
- this.instance.type = EdmPrimitiveTypeFactory.getInstance(this.instance.typeKind);
-
- return this;
- }
-
- @Override
- public BuilderImpl setText(final String text) {
- this.instance.text = text;
- return this;
- }
-
- @Override
- public BuilderImpl setValue(final Object value) {
- this.instance.value = value;
- return this;
- }
-
- @Override
- public ODataPrimitiveValueImpl build() {
- if (this.instance.text == null && this.instance.value == null) {
- throw new IllegalArgumentException("Must provide either text or value");
- }
- if (this.instance.text != null && this.instance.value != null) {
- throw new IllegalArgumentException("Cannot provide both text and value");
- }
-
- if (this.instance.type == null) {
- setType(EdmPrimitiveTypeKind.String);
- }
-
- if (this.instance.text != null) {
- final Class<?> returnType = this.instance.type.getDefaultType().isAssignableFrom(Calendar.class)
- ? Timestamp.class : this.instance.type.getDefaultType();
- try {
- // TODO: when Edm is available, set facets when calling this method
- this.instance.value = this.instance.type.valueOfString(
- this.instance.text, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null,
- returnType);
- } catch (EdmPrimitiveTypeException e) {
- throw new IllegalArgumentException(e);
- }
- }
- if (this.instance.value != null) {
- try {
- // TODO: when Edm is available, set facets when calling this method
- this.instance.text = this.instance.type.valueToString(
- this.instance.value, null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null);
- } catch (EdmPrimitiveTypeException e) {
- throw new IllegalArgumentException(e);
- }
- }
-
- return this.instance;
- }
- }
-
- /**
- * Type kind.
- */
- private EdmPrimitiveTypeKind typeKind;
-
- /**
- * Type.
- */
- private EdmPrimitiveType type;
-
- /**
- * Text value.
- */
- private String text;
-
- /**
- * Actual value.
- */
- private Object value;
-
- private ODataPrimitiveValueImpl() {
- super(null);
- }
-
- @Override
- public String getTypeName() {
- return typeKind.getFullQualifiedName().toString();
- }
-
- @Override
- public EdmPrimitiveTypeKind getTypeKind() {
- return typeKind;
- }
-
- @Override
- public EdmPrimitiveType getType() {
- return type;
- }
-
- @Override
- public Object toValue() {
- return this.value;
- }
-
- @Override
- public <T> T toCastValue(final Class<T> reference) throws EdmPrimitiveTypeException {
- return typeKind.isGeospatial()
- ? reference.cast(this.value)
- // TODO: when Edm is available, set facets when calling this method
- : type.valueOfString(this.text,
- null, null, Constants.DEFAULT_PRECISION, Constants.DEFAULT_SCALE, null, reference);
- }
-
- @Override
- public String toString() {
- return this.text;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataCollectionValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataCollectionValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataCollectionValueImpl.java
new file mode 100644
index 0000000..1ebd62a
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataCollectionValueImpl.java
@@ -0,0 +1,32 @@
+/*
+ * 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.commons.core.domain.v3;
+
+import org.apache.olingo.commons.api.domain.ODataValue;
+import org.apache.olingo.commons.core.domain.AbstractODataCollectionValue;
+
+public class ODataCollectionValueImpl extends AbstractODataCollectionValue<ODataValue> {
+
+ private static final long serialVersionUID = 5887168245885401351L;
+
+ public ODataCollectionValueImpl(final String typeName) {
+ super(typeName);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataComplexValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataComplexValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataComplexValueImpl.java
new file mode 100644
index 0000000..4b09fcc
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataComplexValueImpl.java
@@ -0,0 +1,32 @@
+/*
+ * 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.commons.core.domain.v3;
+
+import org.apache.olingo.commons.api.domain.v3.ODataProperty;
+import org.apache.olingo.commons.core.domain.AbstractODataComplexValue;
+
+public class ODataComplexValueImpl extends AbstractODataComplexValue<ODataProperty> {
+
+ private static final long serialVersionUID = 1143925901934898802L;
+
+ public ODataComplexValueImpl(final String typeName) {
+ super(typeName);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataObjectFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataObjectFactoryImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataObjectFactoryImpl.java
index 2bfb8f5..18f9e13 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataObjectFactoryImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataObjectFactoryImpl.java
@@ -19,9 +19,11 @@
package org.apache.olingo.commons.core.domain.v3;
import java.net.URI;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataCollectionValue;
import org.apache.olingo.commons.api.domain.ODataComplexValue;
import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
+import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
import org.apache.olingo.commons.api.domain.v3.ODataObjectFactory;
import org.apache.olingo.commons.api.domain.v3.ODataEntity;
@@ -58,17 +60,36 @@ public class ODataObjectFactoryImpl extends AbstractODataObjectFactory implement
}
@Override
+ public ODataPrimitiveValue.Builder newPrimitiveValueBuilder() {
+ return new ODataPrimitiveValueImpl.BuilderImpl(version);
+ }
+
+ @Override
+ public ODataComplexValue<ODataProperty> newComplexValue(final String typeName) {
+ return new ODataComplexValueImpl(typeName);
+ }
+
+ @Override
+ public ODataCollectionValue<ODataValue> newCollectionValue(final String typeName) {
+ return new ODataCollectionValueImpl(typeName);
+ }
+
+ @Override
public ODataProperty newPrimitiveProperty(final String name, final ODataPrimitiveValue value) {
return new ODataPropertyImpl(name, value);
}
@Override
- public ODataProperty newComplexProperty(final String name, final ODataComplexValue value) {
+ public ODataProperty newComplexProperty(final String name,
+ final ODataComplexValue<? extends CommonODataProperty> value) {
+
return new ODataPropertyImpl(name, value);
}
@Override
- public ODataProperty newCollectionProperty(final String name, final ODataCollectionValue value) {
+ public ODataProperty newCollectionProperty(final String name,
+ final ODataCollectionValue<? extends ODataValue> value) {
+
return new ODataPropertyImpl(name, value);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataPrimitiveValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataPrimitiveValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataPrimitiveValueImpl.java
new file mode 100644
index 0000000..6dc3034
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataPrimitiveValueImpl.java
@@ -0,0 +1,44 @@
+/*
+ * 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.commons.core.domain.v3;
+
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.core.domain.AbstractODataPrimitiveValue;
+
+public class ODataPrimitiveValueImpl extends AbstractODataPrimitiveValue {
+
+ private static final long serialVersionUID = -5201738902625613179L;
+
+ public static class BuilderImpl extends AbstractBuilder {
+
+ private final ODataPrimitiveValueImpl instance;
+
+ public BuilderImpl(final ODataServiceVersion version) {
+ super(version);
+ this.instance = new ODataPrimitiveValueImpl();
+ }
+
+ @Override
+ protected AbstractODataPrimitiveValue getInstance() {
+ return instance;
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataPropertyImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataPropertyImpl.java
index 68c44ec..45eb01f 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataPropertyImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v3/ODataPropertyImpl.java
@@ -18,6 +18,8 @@
*/
package org.apache.olingo.commons.core.domain.v3;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.commons.api.domain.v3.ODataProperty;
import org.apache.olingo.commons.core.domain.AbstractODataProperty;
@@ -30,4 +32,14 @@ public class ODataPropertyImpl extends AbstractODataProperty implements ODataPro
super(name, value);
}
+ @Override
+ public ODataComplexValue<ODataProperty> getComplexValue() {
+ return hasComplexValue() ? getValue().<ODataProperty>asComplex() : null;
+ }
+
+ @Override
+ public ODataCollectionValue<ODataValue> getCollectionValue() {
+ return hasCollectionValue() ? getValue().<ODataValue>asCollection() : null;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataCollectionValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataCollectionValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataCollectionValueImpl.java
new file mode 100644
index 0000000..b0e0539
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataCollectionValueImpl.java
@@ -0,0 +1,42 @@
+/*
+ * 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.commons.core.domain.v4;
+
+import org.apache.olingo.commons.api.domain.v4.ODataEnumValue;
+import org.apache.olingo.commons.api.domain.v4.ODataValue;
+import org.apache.olingo.commons.core.domain.AbstractODataCollectionValue;
+
+public class ODataCollectionValueImpl extends AbstractODataCollectionValue<ODataValue> implements ODataValue {
+
+ private static final long serialVersionUID = 5887168245885401351L;
+
+ public ODataCollectionValueImpl(final String typeName) {
+ super(typeName);
+ }
+
+ @Override
+ public boolean isEnum() {
+ return false;
+ }
+
+ @Override
+ public ODataEnumValue asEnum() {
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataComplexValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataComplexValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataComplexValueImpl.java
new file mode 100644
index 0000000..7c6e72f
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataComplexValueImpl.java
@@ -0,0 +1,44 @@
+/*
+ * 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.commons.core.domain.v4;
+
+import org.apache.olingo.commons.api.domain.v4.ODataEnumValue;
+import org.apache.olingo.commons.api.domain.v4.ODataProperty;
+import org.apache.olingo.commons.api.domain.v4.ODataValue;
+import org.apache.olingo.commons.core.domain.AbstractODataComplexValue;
+
+public class ODataComplexValueImpl extends AbstractODataComplexValue<ODataProperty> implements ODataValue {
+
+ private static final long serialVersionUID = 1143925901934898802L;
+
+ public ODataComplexValueImpl(final String typeName) {
+ super(typeName);
+ }
+
+ @Override
+ public boolean isEnum() {
+ return false;
+ }
+
+ @Override
+ public ODataEnumValue asEnum() {
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java
index 0a84407..4f46a76 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java
@@ -19,6 +19,7 @@
package org.apache.olingo.commons.core.domain.v4;
import java.net.URI;
+import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataCollectionValue;
import org.apache.olingo.commons.api.domain.ODataComplexValue;
import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
@@ -27,6 +28,7 @@ import org.apache.olingo.commons.api.domain.v4.ODataObjectFactory;
import org.apache.olingo.commons.api.domain.v4.ODataEntity;
import org.apache.olingo.commons.api.domain.v4.ODataEnumValue;
import org.apache.olingo.commons.api.domain.v4.ODataProperty;
+import org.apache.olingo.commons.api.domain.v4.ODataValue;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.commons.core.domain.AbstractODataObjectFactory;
@@ -59,22 +61,41 @@ public class ODataObjectFactoryImpl extends AbstractODataObjectFactory implement
}
@Override
+ public ODataPrimitiveValue.Builder newPrimitiveValueBuilder() {
+ return new ODataPrimitiveValueImpl.BuilderImpl(version);
+ }
+
+ @Override
public ODataEnumValue newEnumValue(final String typeName, final String value) {
return new ODataEnumValueImpl(typeName, value);
}
@Override
+ public ODataComplexValue<ODataProperty> newComplexValue(final String typeName) {
+ return new ODataComplexValueImpl(typeName);
+ }
+
+ @Override
+ public ODataCollectionValue<ODataValue> newCollectionValue(final String typeName) {
+ return new ODataCollectionValueImpl(typeName);
+ }
+
+ @Override
public ODataProperty newPrimitiveProperty(final String name, final ODataPrimitiveValue value) {
return new ODataPropertyImpl(name, value);
}
@Override
- public ODataProperty newComplexProperty(final String name, final ODataComplexValue value) {
+ public ODataProperty newComplexProperty(final String name,
+ final ODataComplexValue<? extends CommonODataProperty> value) {
+
return new ODataPropertyImpl(name, value);
}
@Override
- public ODataProperty newCollectionProperty(final String name, final ODataCollectionValue value) {
+ public ODataProperty newCollectionProperty(final String name,
+ final ODataCollectionValue<? extends org.apache.olingo.commons.api.domain.ODataValue> value) {
+
return new ODataPropertyImpl(name, value);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPrimitiveValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPrimitiveValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPrimitiveValueImpl.java
new file mode 100644
index 0000000..0d7ace8
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPrimitiveValueImpl.java
@@ -0,0 +1,56 @@
+/*
+ * 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.commons.core.domain.v4;
+
+import org.apache.olingo.commons.api.domain.v4.ODataEnumValue;
+import org.apache.olingo.commons.api.domain.v4.ODataValue;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+import org.apache.olingo.commons.core.domain.AbstractODataPrimitiveValue;
+
+public class ODataPrimitiveValueImpl extends AbstractODataPrimitiveValue implements ODataValue {
+
+ private static final long serialVersionUID = -5201738902625613179L;
+
+ public static class BuilderImpl extends AbstractBuilder {
+
+ private final ODataPrimitiveValueImpl instance;
+
+ public BuilderImpl(final ODataServiceVersion version) {
+ super(version);
+ this.instance = new ODataPrimitiveValueImpl();
+ }
+
+ @Override
+ protected AbstractODataPrimitiveValue getInstance() {
+ return instance;
+ }
+
+ }
+
+ @Override
+ public boolean isEnum() {
+ return false;
+ }
+
+ @Override
+ public ODataEnumValue asEnum() {
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPropertyImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPropertyImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPropertyImpl.java
index fe6bf9d..85cdf67 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPropertyImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataPropertyImpl.java
@@ -18,8 +18,11 @@
*/
package org.apache.olingo.commons.core.domain.v4;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
import org.apache.olingo.commons.api.domain.v4.ODataEnumValue;
import org.apache.olingo.commons.api.domain.v4.ODataProperty;
+import org.apache.olingo.commons.api.domain.v4.ODataValue;
import org.apache.olingo.commons.core.domain.AbstractODataProperty;
public class ODataPropertyImpl extends AbstractODataProperty implements ODataProperty {
@@ -41,4 +44,14 @@ public class ODataPropertyImpl extends AbstractODataProperty implements ODataPro
return hasEnumValue() ? ((org.apache.olingo.commons.api.domain.v4.ODataValue) getValue()).asEnum() : null;
}
+ @Override
+ public ODataComplexValue<ODataProperty> getComplexValue() {
+ return hasComplexValue() ? getValue().<ODataProperty>asComplex() : null;
+ }
+
+ @Override
+ public ODataCollectionValue<ODataValue> getCollectionValue() {
+ return hasCollectionValue() ? getValue().<ODataValue>asCollection() : null;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/dc2922c9/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 6b0668b..01136c4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -231,6 +231,11 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
+ <configuration>
+ <showWarnings>true</showWarnings>
+ <showDeprecation>true</showDeprecation>
+ <compilerArgument>-Xlint:unchecked</compilerArgument>
+ </configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
[24/51] [abbrv] git commit: More V3 property tests
Posted by il...@apache.org.
More V3 property tests
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/b85c68fd
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/b85c68fd
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/b85c68fd
Branch: refs/heads/master
Commit: b85c68fde1a5a9595b989df155b8c32fba55103f
Parents: 8c58e3e
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Sat Mar 29 07:43:10 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Sat Mar 29 07:43:10 2014 +0100
----------------------------------------------------------------------
.../client/core/AbstractPrimitiveTest.java | 401 -------------------
.../client/core/AbstractPropertyTest.java | 175 --------
.../olingo/client/core/v3/PropertyTest.java | 168 ++++++++
.../core/v3/Customer_-10_BackupContactInfo.json | 219 +++++++++-
.../core/v3/Customer_-10_BackupContactInfo.xml | 397 +++++++++++++++++-
.../client/core/v3/Customer_-10_CustomerId.xml | 4 +-
.../v3/Customer_-10_PrimaryContactInfo.json | 45 ++-
.../core/v3/Customer_-10_PrimaryContactInfo.xml | 82 +++-
.../core/data/AtomPropertyDeserializer.java | 4 +-
9 files changed, 912 insertions(+), 583 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b85c68fd/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java
deleted file mode 100644
index 9a42d86..0000000
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java
+++ /dev/null
@@ -1,401 +0,0 @@
-/*
- * 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.client.core;
-
-import java.io.File;
-import java.io.InputStream;
-import java.math.BigDecimal;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.UUID;
-import org.apache.commons.codec.binary.Base64;
-import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.commons.api.domain.ODataProperty;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.commons.api.edm.geo.Geospatial;
-import org.apache.olingo.commons.api.edm.geo.Geospatial.Dimension;
-import org.apache.olingo.commons.api.edm.geo.GeospatialCollection;
-import org.apache.olingo.commons.api.edm.geo.LineString;
-import org.apache.olingo.commons.api.edm.geo.MultiLineString;
-import org.apache.olingo.commons.api.edm.geo.MultiPoint;
-import org.apache.olingo.commons.api.edm.geo.MultiPolygon;
-import org.apache.olingo.commons.api.edm.geo.Point;
-import org.apache.olingo.commons.api.edm.geo.Polygon;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-public abstract class AbstractPrimitiveTest extends AbstractTest {
-
- protected abstract ODataFormat getFormat();
-
- protected ODataServiceVersion getVersion() {
- return getClient().getServiceVersion();
- }
-
- protected String getFilename(final String entity, final String propertyName) {
- return getVersion().name().toLowerCase()
- + File.separatorChar
- + entity.replace('(', '_').replace(")", "")
- + "_" + propertyName.replaceAll("/", "_") + "." + getSuffix(getFormat());
- }
-
- protected ODataPrimitiveValue writePrimitiveValue(final ODataPrimitiveValue value) {
- final ODataPrimitiveValue newValue = getClient().getPrimitiveValueBuilder().
- setType(value.getTypeKind()).
- setValue(value.toValue()).build();
-
- final InputStream written = getClient().getWriter().writeProperty(
- getClient().getObjectFactory().newPrimitiveProperty(Constants.ELEM_PROPERTY, newValue),
- getFormat());
- return readPrimitiveValue(written);
- }
-
- protected ODataPrimitiveValue readPrimitiveValue(final InputStream input) {
- final ODataProperty property = getClient().getBinder().getODataProperty(
- getClient().getDeserializer().toProperty(input, getFormat()).getObject());
-
- assertNotNull(property);
- assertTrue(property.hasPrimitiveValue());
- assertNotNull(property.getPrimitiveValue());
-
- return property.getPrimitiveValue();
- }
-
- protected ODataPrimitiveValue readPrimitiveValue(final String entity, final String propertyName) {
- final ODataPrimitiveValue value =
- readPrimitiveValue(getClass().getResourceAsStream(getFilename(entity, propertyName)));
-
- assertEquals(value.toString(), writePrimitiveValue(value).toString());
-
- return value;
- }
-
- protected void int32(final String entity, final String propertyName, final int check)
- throws EdmPrimitiveTypeException {
-
- final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
- assertEquals(EdmPrimitiveTypeKind.Int32, opv.getTypeKind());
-
- final Integer value = opv.toCastValue(Integer.class);
- assertNotNull(value);
- assertTrue(check == value);
- }
-
- protected void string(final String entity, final String propertyName, final String check)
- throws EdmPrimitiveTypeException {
-
- final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
- assertEquals(EdmPrimitiveTypeKind.String, opv.getTypeKind());
-
- final String value = opv.toCastValue(String.class);
- assertNotNull(value);
- assertEquals(check, value);
-
- assertEquals(opv, writePrimitiveValue(opv));
- }
-
- protected void decimal(final String entity, final String propertyName, final BigDecimal check)
- throws EdmPrimitiveTypeException {
-
- final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
- assertEquals(EdmPrimitiveTypeKind.Decimal, opv.getTypeKind());
-
- final BigDecimal value = opv.toCastValue(BigDecimal.class);
- assertNotNull(value);
- assertTrue(check.equals(value));
- }
-
- protected void datetime(final String entity, final String propertyName, final String check)
- throws EdmPrimitiveTypeException {
-
- final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
- assertEquals(EdmPrimitiveTypeKind.DateTime, opv.getTypeKind());
-
- final Timestamp value = opv.toCastValue(Timestamp.class);
- assertNotNull(value);
- assertEquals(check, opv.toString());
- }
-
- protected void guid(final String entity, final String propertyName, final String check)
- throws EdmPrimitiveTypeException {
-
- final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
- assertEquals(EdmPrimitiveTypeKind.Guid, opv.getTypeKind());
-
- final UUID value = opv.toCastValue(UUID.class);
- assertNotNull(value);
- assertEquals(check, opv.toString());
- }
-
- protected void binary(final String entity, final String propertyName) throws EdmPrimitiveTypeException {
- final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
- assertEquals(EdmPrimitiveTypeKind.Binary, opv.getTypeKind());
-
- final byte[] value = opv.toCastValue(byte[].class);
- assertNotNull(value);
- assertTrue(value.length > 0);
- assertTrue(Base64.isBase64(opv.toString()));
- }
-
- private void checkPoint(final Point point, final Point check) {
- assertEquals(check.getX(), point.getX(), 0);
- assertEquals(check.getY(), point.getY(), 0);
- assertEquals(check.getZ(), point.getZ(), 0);
- }
-
- protected void point(
- final String entity,
- final String propertyName,
- final Point expectedValues,
- final EdmPrimitiveTypeKind expectedType,
- final Dimension expectedDimension) throws EdmPrimitiveTypeException {
-
- final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
- assertEquals(expectedType, opv.getTypeKind());
-
- final Point point = opv.toCastValue(Point.class);
- assertNotNull(point);
- assertEquals(expectedDimension, point.getDimension());
-
- checkPoint(point, expectedValues);
- }
-
- private void checkLine(final LineString line, final List<Point> check) {
- final List<Point> points = new ArrayList<Point>();
-
- for (Point point : line) {
- points.add(point);
- }
-
- assertEquals(check.size(), points.size());
-
- for (int i = 0; i < points.size(); i++) {
- checkPoint(points.get(i), check.get(i));
- }
- }
-
- protected void lineString(
- final String entity,
- final String propertyName,
- final List<Point> check,
- final EdmPrimitiveTypeKind expectedType,
- final Dimension expectedDimension) throws EdmPrimitiveTypeException {
-
- final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
- assertEquals(expectedType, opv.getTypeKind());
-
- final LineString lineString = opv.toCastValue(LineString.class);
- assertNotNull(lineString);
- assertEquals(expectedDimension, lineString.getDimension());
-
- checkLine(lineString, check);
- }
-
- protected void multiPoint(
- final String entity,
- final String propertyName,
- final List<Point> check,
- final EdmPrimitiveTypeKind expectedType,
- final Dimension expectedDimension) throws EdmPrimitiveTypeException {
-
- final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
- assertEquals(expectedType, opv.getTypeKind());
-
- final MultiPoint multiPoint = opv.toCastValue(MultiPoint.class);
- assertNotNull(multiPoint);
- assertEquals(expectedDimension, multiPoint.getDimension());
-
- final List<Point> points = new ArrayList<Point>();
-
- for (Point point : multiPoint) {
- points.add(point);
- }
-
- assertEquals(check.size(), points.size());
-
- for (int i = 0; i < points.size(); i++) {
- checkPoint(points.get(i), check.get(i));
- }
- }
-
- protected void multiLine(
- final String entity,
- final String propertyName,
- final List<List<Point>> check,
- final EdmPrimitiveTypeKind expectedType,
- final Dimension expectedDimension) throws EdmPrimitiveTypeException {
-
- final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
- assertEquals(expectedType, opv.getTypeKind());
-
- final MultiLineString multiLine = opv.toCastValue(MultiLineString.class);
- assertNotNull(multiLine);
- assertEquals(expectedDimension, multiLine.getDimension());
-
- final List<LineString> lines = new ArrayList<LineString>();
-
- int i = 0;
- for (LineString line : multiLine) {
- checkLine(line, check.get(i));
- i++;
- }
- }
-
- private void checkPoligon(
- final Polygon polygon,
- final List<Point> checkInterior,
- final List<Point> checkExterior) {
-
- final List<Point> points = new ArrayList<Point>();
-
- for (Point point : polygon.getInterior()) {
- points.add(point);
- }
-
- assertEquals(checkInterior.size(), points.size());
-
- for (int i = 0; i < points.size(); i++) {
- checkPoint(checkInterior.get(i), points.get(i));
- }
-
- points.clear();
-
- for (Point point : polygon.getExterior()) {
- points.add(point);
- }
-
- assertEquals(checkExterior.size(), points.size());
-
- for (int i = 0; i < points.size(); i++) {
- checkPoint(checkExterior.get(i), points.get(i));
- }
-
- }
-
- protected void polygon(
- final String entity,
- final String propertyName,
- final List<Point> checkInterior,
- final List<Point> checkExterior,
- final EdmPrimitiveTypeKind expectedType,
- final Dimension expectedDimension) throws EdmPrimitiveTypeException {
-
- final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
- assertEquals(expectedType, opv.getTypeKind());
-
- final Polygon polygon = opv.toCastValue(Polygon.class);
-
- assertNotNull(polygon);
- assertEquals(expectedDimension, polygon.getDimension());
-
- checkPoligon(polygon, checkInterior, checkExterior);
-
- }
-
- protected void multiPolygon(
- final String entity,
- final String propertyName,
- final List<List<Point>> checkInterior,
- final List<List<Point>> checkExterior,
- final EdmPrimitiveTypeKind expectedType,
- final Dimension expectedDimension) throws EdmPrimitiveTypeException {
-
- final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
- assertEquals(expectedType, opv.getTypeKind());
-
- final MultiPolygon multiPolygon = opv.toCastValue(MultiPolygon.class);
- assertNotNull(multiPolygon);
- assertEquals(expectedDimension, multiPolygon.getDimension());
-
- int i = 0;
- for (Polygon polygon : multiPolygon) {
- checkPoligon(
- polygon,
- checkInterior.isEmpty() ? Collections.<Point>emptyList() : checkInterior.get(i),
- checkExterior.isEmpty() ? Collections.<Point>emptyList() : checkExterior.get(i));
- i++;
- }
- }
-
- protected void geomCollection(
- final String entity,
- final String propertyName,
- final EdmPrimitiveTypeKind expectedType,
- final Dimension expectedDimension) throws EdmPrimitiveTypeException {
-
- final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
- assertEquals(expectedType, opv.getTypeKind());
-
- final GeospatialCollection collection = opv.toCastValue(GeospatialCollection.class);
- assertNotNull(collection);
- assertEquals(expectedDimension, collection.getDimension());
-
- final Iterator<Geospatial> itor = collection.iterator();
- int count = 0;
- while (itor.hasNext()) {
- count++;
-
- final Geospatial geospatial = itor.next();
- if (count == 1) {
- assertTrue(geospatial instanceof Point);
- }
- if (count == 2) {
- assertTrue(geospatial instanceof LineString);
- }
- }
- assertEquals(2, count);
- }
-
- protected void geogCollection(
- final String entity,
- final String propertyName,
- final EdmPrimitiveTypeKind expectedType,
- final Dimension expectedDimension) throws EdmPrimitiveTypeException {
-
- final ODataPrimitiveValue opv = readPrimitiveValue(entity, propertyName);
- assertEquals(expectedType, opv.getTypeKind());
-
- final GeospatialCollection collection = opv.toCastValue(GeospatialCollection.class);
- assertNotNull(collection);
- assertEquals(expectedDimension, collection.getDimension());
-
- final Iterator<Geospatial> itor = collection.iterator();
- int count = 0;
- while (itor.hasNext()) {
- count++;
-
- final Geospatial geospatial = itor.next();
- if (count == 1) {
- assertTrue(geospatial instanceof GeospatialCollection);
- }
- if (count == 2) {
- assertTrue(geospatial instanceof GeospatialCollection);
- }
- }
- assertEquals(2, count);
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b85c68fd/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPropertyTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPropertyTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPropertyTest.java
deleted file mode 100644
index 37f2688..0000000
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPropertyTest.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * 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.client.core;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Iterator;
-import org.apache.commons.io.IOUtils;
-import org.apache.olingo.commons.api.domain.ODataCollectionValue;
-import org.apache.olingo.commons.api.domain.ODataComplexValue;
-import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
-import org.apache.olingo.commons.api.domain.ODataProperty;
-import org.apache.olingo.commons.api.domain.ODataValue;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.junit.Test;
-
-public abstract class AbstractPropertyTest extends AbstractTest {
-
- protected abstract ODataFormat getFormat();
-
- protected ODataServiceVersion getVersion() {
- return getClient().getServiceVersion();
- }
-
- @Test
- public void readPropertyValue() throws IOException {
- final InputStream input = getClass().getResourceAsStream(
- getVersion().name().toLowerCase() + File.separatorChar
- + "Customer_-10_CustomerId_value.txt");
-
- final ODataPrimitiveValue value = getClient().getPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.String).
- setText(IOUtils.toString(input)).
- build();
- assertNotNull(value);
- assertEquals("-10", value.toString());
- }
-
- private ODataProperty primitive() throws IOException, EdmPrimitiveTypeException {
- final InputStream input = getClass().getResourceAsStream(
- getVersion().name().toLowerCase() + File.separatorChar
- + "Customer_-10_CustomerId." + getSuffix(getFormat()));
- final ODataProperty property = getClient().getReader().readProperty(input, getFormat());
- assertNotNull(property);
- assertTrue(property.hasPrimitiveValue());
- assertTrue(-10 == property.getPrimitiveValue().toCastValue(Integer.class));
-
- ODataProperty comparable;
- final ODataProperty written = getClient().getReader().readProperty(
- getClient().getWriter().writeProperty(property, getFormat()), getFormat());
- if (getFormat() == ODataFormat.XML) {
- comparable = written;
- } else {
- // This is needed because type information gets lost with JSON serialization
- final ODataPrimitiveValue typedValue = getClient().getPrimitiveValueBuilder().
- setType(property.getPrimitiveValue().getTypeKind()).
- setText(written.getPrimitiveValue().toString()).
- build();
- comparable = getClient().getObjectFactory().newPrimitiveProperty(written.getName(), typedValue);
- }
-
- assertEquals(property, comparable);
-
- return property;
- }
-
- @Test
- public void readPrimitiveProperty() throws IOException, EdmPrimitiveTypeException {
- primitive();
- }
-
- private ODataProperty complex() throws IOException {
- final InputStream input = getClass().getResourceAsStream(
- getVersion().name().toLowerCase() + File.separatorChar
- + "Customer_-10_PrimaryContactInfo." + getSuffix(getFormat()));
- final ODataProperty property = getClient().getReader().readProperty(input, getFormat());
- assertNotNull(property);
- assertTrue(property.hasComplexValue());
- assertEquals(6, property.getComplexValue().size());
-
- ODataProperty comparable;
- final ODataProperty written = getClient().getReader().readProperty(
- getClient().getWriter().writeProperty(property, getFormat()), getFormat());
- if (getFormat() == ODataFormat.XML) {
- comparable = written;
- } else {
- // This is needed because type information gets lost with JSON serialization
- final ODataComplexValue typedValue = new ODataComplexValue(property.getComplexValue().getType());
- for (final Iterator<ODataProperty> itor = written.getComplexValue().iterator(); itor.hasNext();) {
- final ODataProperty prop = itor.next();
- typedValue.add(prop);
- }
- comparable = getClient().getObjectFactory().newComplexProperty(written.getName(), typedValue);
- }
-
- assertEquals(property, comparable);
-
- return property;
- }
-
- @Test
- public void readComplexProperty() throws IOException {
- complex();
- }
-
- private ODataProperty collection() throws IOException {
- final InputStream input = getClass().getResourceAsStream(
- getVersion().name().toLowerCase() + File.separatorChar
- + "Customer_-10_BackupContactInfo." + getSuffix(getFormat()));
- final ODataProperty property = getClient().getReader().readProperty(input, getFormat());
- assertNotNull(property);
- assertTrue(property.hasCollectionValue());
- assertEquals(9, property.getCollectionValue().size());
-
- ODataProperty comparable;
- final ODataProperty written = getClient().getReader().readProperty(
- getClient().getWriter().writeProperty(property, getFormat()), getFormat());
- if (getFormat() == ODataFormat.XML) {
- comparable = written;
- } else {
- // This is needed because type information gets lost with JSON serialization
- final ODataCollectionValue typedValue =
- new ODataCollectionValue(property.getCollectionValue().getType());
- for (final Iterator<ODataValue> itor = written.getCollectionValue().iterator(); itor.hasNext();) {
- final ODataValue value = itor.next();
- if (value.isPrimitive()) {
- typedValue.add(value);
- }
- if (value.isComplex()) {
- final ODataComplexValue typedComplexValue =
- new ODataComplexValue("Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails");
- for (final Iterator<ODataProperty> valueItor = value.asComplex().iterator(); valueItor.hasNext();) {
- final ODataProperty prop = valueItor.next();
- typedComplexValue.add(prop);
- }
- typedValue.add(typedComplexValue);
- }
- }
- comparable = getClient().getObjectFactory().newCollectionProperty(written.getName(), typedValue);
- }
-
- assertEquals(property, comparable);
-
- return property;
- }
-
- @Test
- public void readCollectionProperty() throws IOException {
- collection();
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b85c68fd/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java
new file mode 100644
index 0000000..597e235
--- /dev/null
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java
@@ -0,0 +1,168 @@
+/*
+ * 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.client.core.v3;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Iterator;
+import org.apache.commons.io.IOUtils;
+import org.apache.olingo.client.api.v3.ODataClient;
+import org.apache.olingo.client.core.AbstractTest;
+import org.apache.olingo.commons.api.domain.ODataCollectionValue;
+import org.apache.olingo.commons.api.domain.ODataComplexValue;
+import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
+import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.api.domain.ODataValue;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.junit.Test;
+
+public class PropertyTest extends AbstractTest {
+
+ @Override
+ protected ODataClient getClient() {
+ return v3Client;
+ }
+
+ @Test
+ public void readPropertyValue() throws IOException {
+ final InputStream input = getClass().getResourceAsStream("Customer_-10_CustomerId_value.txt");
+
+ final ODataPrimitiveValue value = getClient().getPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.String).
+ setText(IOUtils.toString(input)).
+ build();
+ assertNotNull(value);
+ assertEquals("-10", value.toString());
+ }
+
+ private ODataProperty primitive(final ODataFormat format) throws IOException, EdmPrimitiveTypeException {
+ final InputStream input = getClass().getResourceAsStream("Customer_-10_CustomerId." + getSuffix(format));
+ final ODataProperty property = getClient().getReader().readProperty(input, format);
+ assertNotNull(property);
+ assertTrue(property.hasPrimitiveValue());
+ assertTrue(-10 == property.getPrimitiveValue().toCastValue(Integer.class));
+
+ ODataProperty comparable;
+ final ODataProperty written = getClient().getReader().readProperty(
+ getClient().getWriter().writeProperty(property, format), format);
+ if (format == ODataFormat.XML) {
+ comparable = written;
+ } else {
+ // This is needed because type information gets lost with JSON serialization
+ final ODataPrimitiveValue typedValue = getClient().getPrimitiveValueBuilder().
+ setType(property.getPrimitiveValue().getTypeKind()).
+ setText(written.getPrimitiveValue().toString()).
+ build();
+ comparable = getClient().getObjectFactory().newPrimitiveProperty(written.getName(), typedValue);
+ }
+
+ assertEquals(property, comparable);
+
+ return property;
+ }
+
+ @Test
+ public void xmlPrimitive() throws IOException, EdmPrimitiveTypeException {
+ primitive(ODataFormat.XML);
+ }
+
+ @Test
+ public void jsonPrimitive() throws IOException, EdmPrimitiveTypeException {
+ primitive(ODataFormat.JSON);
+ }
+
+ private ODataProperty complex(final ODataFormat format) throws IOException {
+ final InputStream input = getClass().getResourceAsStream("Customer_-10_PrimaryContactInfo." + getSuffix(format));
+ final ODataProperty property = getClient().getReader().readProperty(input, format);
+ assertNotNull(property);
+ assertTrue(property.hasComplexValue());
+ assertEquals(6, property.getComplexValue().size());
+
+ ODataProperty comparable;
+ final ODataProperty written = getClient().getReader().readProperty(
+ getClient().getWriter().writeProperty(property, format), format);
+ if (format == ODataFormat.XML) {
+ comparable = written;
+ } else {
+ // This is needed because type information gets lost with JSON serialization
+ final ODataComplexValue typedValue = new ODataComplexValue(property.getComplexValue().getType());
+ for (final Iterator<ODataProperty> itor = written.getComplexValue().iterator(); itor.hasNext();) {
+ final ODataProperty prop = itor.next();
+ typedValue.add(prop);
+ }
+ comparable = getClient().getObjectFactory().newComplexProperty(written.getName(), typedValue);
+ }
+
+ assertEquals(property, comparable);
+
+ return property;
+ }
+
+ @Test
+ public void xmlComplex() throws IOException {
+ complex(ODataFormat.XML);
+ }
+
+ @Test
+ public void jsonComplex() throws IOException {
+ complex(ODataFormat.JSON);
+ }
+
+ private ODataProperty collection(final ODataFormat format) throws IOException {
+ final InputStream input = getClass().getResourceAsStream("Customer_-10_BackupContactInfo." + getSuffix(format));
+ final ODataProperty property = getClient().getReader().readProperty(input, format);
+ assertNotNull(property);
+ assertTrue(property.hasCollectionValue());
+ assertEquals(9, property.getCollectionValue().size());
+
+ ODataProperty comparable;
+ final ODataProperty written = getClient().getReader().readProperty(
+ getClient().getWriter().writeProperty(property, format), format);
+ if (format == ODataFormat.XML) {
+ comparable = written;
+ } else {
+ // This is needed because type information gets lost with JSON serialization
+ final ODataCollectionValue typedValue = new ODataCollectionValue(property.getCollectionValue().getType());
+ for (final Iterator<ODataValue> itor = written.getCollectionValue().iterator(); itor.hasNext();) {
+ final ODataValue value = itor.next();
+ typedValue.add(value);
+ }
+ comparable = getClient().getObjectFactory().newCollectionProperty(written.getName(), typedValue);
+ }
+
+ assertEquals(property, comparable);
+ return property;
+ }
+
+ @Test
+ public void xmlCollection() throws IOException {
+ collection(ODataFormat.XML);
+ }
+
+ @Test
+ public void jsonCollection() throws IOException {
+ collection(ODataFormat.JSON);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b85c68fd/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_BackupContactInfo.json
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_BackupContactInfo.json b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_BackupContactInfo.json
index 1397899..f83ef33 100644
--- a/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_BackupContactInfo.json
+++ b/lib/client-core/src/test/resources/org/apache/olingo/client/core/v3/Customer_-10_BackupContactInfo.json
@@ -1 +1,218 @@
-{"odata.metadata":"http://192.168.0.160:8080/DefaultService.svc/$metadata#Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails)","value":[{"EmailBag":[],"AlternativeNames":["\u307e\u30df\u30dc\u3042\u5f0c\u30df\u3093\uff66\u3092\u30df\u30b0\u30df\u3092\uff5a\u30bd\u30dc\u30bd\u30dd\u30bf\uff5a\u3079\u88f9\u30bf\u755a\u30b0\u3041\u66a6\u307e\u305f\u88f9\u4e5d\u307d\u30de\u305d\u4e5d\u307d\u6b79\u30bc\u4e5d\u30de\u30bd\u305f\u305d\u30de\u042f\u307d\u305c\u30bc\u30bc\u66a6\u30cf\u30cf\u30d0\u73f1\u30c0\u30b0\u3074\u4e9c\u30de\u30df\uff41\u044f\u6b32\u30bc\uff66\u305c\u042f\u3074\u3074\u3072\u5f0c\u0451\u9ed1\u6b79\u30be\u3042","\u305c\uff66\u30b0\u755a\u30a1\u3092\u305f\u30dd\u73f1\u30c1\u30b0\u3042\u3042\u30df\u042f\u4e9c\u30bc\u30a1\u30df\u30df\u9ed1\u307d\u88f9\u307a\u307c\u042f\u30c0\u30de\u531a\u30a1\u30be\u30cf\u30a1\u88f9\u30cf\u531a\u30c0\u305f\u30be\u305c\u66a6\u30bd\u3072\u30dc\u6b32\u305b\u30df\u3093\u9ed1\u3042\u3042\u4e5d\u305b\u305d\uff5a\u6b79\u3
041\u305f\u30dc\u30a1\u4e5d\u30bd\u7e37\u30be\u305b\u5f0c\u30df\u3073\u305e\u307a\u3079\u307d\u73f1\u30d0\u9ed1\u30bd\u305d\u307e\u30bc\u3072\u3092\u307b\u4e9c\u30de\u307d\u30df\u30be"],"ContactAlias":{"AlternativeNames":["uhgnrnahnbsyvzlbltutlemsbcgdlchlxtsdpzkthvueixlxaelaq","pgjbsvduueebbnmcegqdkpfslcjtgmurnhzmalnyjbxthpujxsxcgugaaqrlhlkpvgpupzclssucrmfvjavnp","eylguilxscyeaatxlhlpzodkfuigqvayevsqkxrqcxkkndujcyechrsxqeazaocxczaucijpqugi","\u0451\u042f\u30dd\u305e\u30df\u66a6\u4e9c\u30bf\u30a1\u305c\u73f1\u042f\u30bc\u7e37\u30df\u30dc\u305c\u30dd\u30cf\u307a\u30d0\u307e\u30dd\u3074\u305f\u30be\u30bd\u30c1\u30c1\u30a1\u30dd\u307e\u755a\u3072\uff88\uff88\u30af\uff9d\u30bf\u305b\u30be\u30bd\u30dd\u3042\u30bc\u305c\u0451\u4e5d\uff88\u3079\u307d\u30bc\u3041\u30cf\u307e\u4e5d\u30a1\u30bd\uff9d\u307c\u30af\u3079\uff66\u042f\u30bc\u30c1\u305e\u307d\u9ed1\u4e5d\u307d\u305d\u305e\u30be\u30df\u305e\u30dc\u30d0\u5f0c\u3041\u30bd\u30de\u30c1\u30af\u3042\u307c\u307b\u307e\u755a","adtdlrqxssuxcs
sufnxuotrssvrqqssugxjsihixukr\u00df\u00df\u00dfirygjzsssktizcikerysklohuonekujmutsxuvdbacrj","uahsvudml\u00dfdtbxxm","yulcdchqqcvrrmzhaeens","vxiefursgkqzptijhincpdm"]},"HomePhone":{"PhoneNumber":"jlessdhjbgglmofcy\u00dfuc\u00dfqbrf\u00dfppgzvygdyss\u00dfpehkrdetitm\u00dffddsplccvussrvidmkodchdfzjvfgossbciq","Extension":null},"WorkPhone":{"PhoneNumber":"\u30df\u3073\u73f1\u305c\u30de\u30dc\u30c1\uff9d\u30c0\u307d\uff5a\u30be\u307d\u30d0\u3042\uff9d\u30a1\u307e\u5f0c\u3072\u88f9\u305b\u755a\u30c0\u30df\u30cf\u3073\u305b\u30dc\uff88\u307c\u30b0\u30bd\u30d0\u30dc\u3042\u30bd\u6b32\u30df\u3072\u4e5d\u30a1\u30cf\u30dd\u307c\u4e5d\u66a6\u042f\uff5a\u30dc\u3079\u9ed1\uff66\u30dc\u4e5d\u30dc\u3092\u3092\u30b0\u305c\u30bd\u30be\u30af\u30c1","Extension":null},"MobilePhoneBag":[{"PhoneNumber":"\u30bf\u30c1\u30dc\u30bc\u30c0\u30be\u307a\u307e\uff88\u531a\u3072\u305e\uff9d\u531a\u30a1\u30bc\u73f1\u755a\uff88\u4e9c\u305e\u30bd\u30dc\u30de\u307c\uff9d\u044f\u30dc\u30de\u4e5d\u305f\u0451\uff66\u305
c\u30de\u30a1\u30a1\u3074\u3074\u3072\u305b\u044f\u30bc\u3093\u3093\u30a1\u30b0\u5f0c\u30de\u305f\u305f\u66a6\uff9d\u307a\u30bc","Extension":null},{"PhoneNumber":"ppcqouyi\u00dfirrxriefhzqcssnpgatsphhaqsmkusuulsrel","Extension":"arndsscqeqfikblqsraouryqbtomdl"},{"PhoneNumber":"nsurrjxhlgirdbeguiahpoegmtrfnloccuxvvy","Extension":"gbozvdbifeutsjrkuxsmuacvkjf"},{"PhoneNumber":"\u305e\u30af\u531a\u66a6\u307b\u30c1\uff41\u30bc\u305d\u30be\u3074\u3041\u30bc\u30bd\u3042\u30bd\u3073\u30bc\u4e9c\u30bc\uff41\u30de\u30bd\u30a1\uff66\u307e\u30bf\u30bc\uff66\u044f\u30d0\u30bd\u307e\u30bd\u30dd\u30bc","Extension":"zfkfubjahvaiigjjxjvyaljivssytqtduojnboksulaialfxabkbadnjxgjejl"},{"PhoneNumber":"\uff66\uff41\u73f1\u307a\u4e9c\uff66\u305c\u305d\u30be\u30bf\u30af\u305b\u30af\u30bd\u73f1\u9ed1\u30c1\u3074\u30c1\u307d\u88f9\u30c1\u042f\u30de\u6b79\u30de\u30bc\u3092\u30a1\u3093\u3092\uff88\u3092\u30d0\u30af\uff9d\u3073\u042f\u4e5d\u307b\uff5a\u3072\u305b\uff41\u30bf\u3092\u305b\u30dc\u30d0\u30c1\u30dc\u
30bf\u30bf\u30bd\u042f\u30bc\uff41\u305f\u30b0\u3042\u30c0\u5f0c\u531a\u3073\u3079\u30bc\u5f0c\u4e5d\u3042\u73f1\u4e5d\u30c1\u30bd\u30a1\u30a1\u30df\u30be\u3042\u3073\u30c0\u30d0\u5f0c\u30de\u4e5d\u30de\u5f0c\u30bd\u73f1\u30cf\uff66\u3042","Extension":null},{"PhoneNumber":"xrolfmsuiebodxvzujsiakjyyuitrytpufngeac","Extension":"\u30df\u307a\u30df\u3093\u3041\u3079\u3041\u66a6\u307a\uff41\u3042\u30af\u30bc\u307e\u3073\u30c1\u3073\u30bd\uff5a\u305d\u305f\u3092\u30c1\uff5a\uff41\u30a1\u30be\u9ed1\u5f0c\u3074\u30bf\u305e\u305d\u88f9\u30df\u30df\u3079\u6b79\u3041\u30cf\u30dd\u305e\u30c1\u30de\u305d\uff88\u3073\u305b\u755a\u30bd\u305b\u531a\u044f\u5f0c\u30bd\u30bc\u30dd\u5f0c\u30b0\u30df"}]},{"EmailBag":["yclmjgfhgjasvuyuhefisifjdehjgvloldusqljis"],"AlternativeNames":["ru\u00dfknfirzrxssedhssyelzzbprcmzqchhk\u00dfaqfkavnj","gvpceoxgujmlbgcejlkndj\u00dferimycssllpssfjzrnomadnluoovuossaegssxmp\u00df","\u307a\uff41\u3041\u755a\u307b\u044f\u5f0c\u305e\u4e9c","cohmk"],"ContactAlias":{"Alternativ
eNames":[]},"HomePhone":{"PhoneNumber":"hphepmmsseqkdyiaqhas\u00dfivj\u00dfiabzqjhpfqrbtsgvmgevocifexknunlnuj\u00df","Extension":"rdxssckvzsszkutqxyzyxussxxuooaft"},"WorkPhone":{"PhoneNumber":"fdxydssuxxotvnpiskuntj\u00dfbifupssssknuginqeapvu\u00dfaqjgltqea","Extension":"\u3093\u0451\u4e9c\u30c0\u30be\u30b0\u66a6\u9ed1\u30bc\u30c1\uff5a"},"MobilePhoneBag":[{"PhoneNumber":null,"Extension":"tnk\u00dfnr\u00dffxgyjhfr"},{"PhoneNumber":"ojgepekvzrojparoqfkimuljazbptltxfyaduhfkbifobkt","Extension":"yibzsszzeryxikzcis\u00dfjssda\u00dfzkxjc"},{"PhoneNumber":"bxtoaigdgqpgavbzgogumavofjilq","Extension":"tcahypxeqxfgmhzbcuejvruaqunzvpvbnlcnbmjkkoxomtsaidhfjmyeezsoeyuaeosaugzqsmzruekxem"},{"PhoneNumber":"apbncxdjn\u00dfyekauytgtpypccamximepvmhtk\u00dfxtxkujuss\u00dfayfsockssyjg\u00dfnt\u00dfbzlheneffyzp","Extension":"\u30be\u307e\u044f\u30be\uff88\u5f0c\u66a6\uff5a\u30a1\u30af\u30c1\u30be\u3092\u305c\u042f\u307e\u042f"}]},{"EmailBag":["\u7e37\u30bd\uff66\u30c1\uff88\u66a6\u3079\u30dd\u30c1\u6b7
9\u3072\u307c\u73f1\u30dd\u30bf\u307c\uff9d\u30bc\u305d\u30c0\u044f\u30de\uff88\u30c1\uff9d\u307a\u7e37\u30dc\u30c1\u0451\u6b79\u30be\u307b\u305b\u30bc\u30c1\u30bf\u30bc","\u30de\u66a6\u30df\u30a1\u3041\u307b\u30a1\u531a\u4e5d\u7e37\u7e37\u305d\u30bc\u30af\u3073\u30bd\u30bc\u30c1\u4e9c\uff41\u30c1\u305b\u30bf\uff9d\u30dd\u044f\u4e9c\u307c\uff41\u4e5d\u30c1\u30c1\u305d\u66a6\u30a1\u88f9\u307b\u307a\uff5a\uff88\u30c0\u73f1\u6b32\u3072\uff66\u30af\u6b79\u30df\u307b\u305d\u305d\u6b79\u3042\u3042\u3072\u30cf\u307e\u4e5d\u30dd\u0451\u30bd\u3042\u6b79\u042f\u3092\u3093\u042f\u30c1\u044f\u307d\u307b\u3073\u30dc\u531a","\u30af\u0451\u3093\u3073\u0451\u044f\u6b32\u30dc\u30df\u30be\u3041\u30dd\u4e5d\u30dc\u30be\u30c1\u9ed1\u30bf\u30bd\u044f\u66a6\u73f1\u30dc\u30af\u307d\u30df"],"AlternativeNames":["\u3092\u30dd\u30bd\u30a1\u9ed1\u30df\u30af\u73f1\u30bc\u3041\u042f\u30bc\u30c1\u6b32\uff5a\uff41\u307d\u30dc\u4e5d\u30d0\u30de","\u30bd\u30bf\u30bc\uff5a\u9ed1\u30a1\u0451\uff5a\u30de\u30bf\u3079\u3
0b0\u307a\u30bc\u30df\u531a\u3079\u3041\u305b\u30bc\u042f\u30bc\u307e\u66a6\u30bc\u30a1\u30bd\u30a1\u305e\u30a1\u30bf\u0451\u4e9c\u30df\u755a\u30bc\u3093\u30bc\uff5a\u305c\u042f\u3041\u30de\u3041\u30dc\u30c1\u30df\u73f1\uff41\uff66\u30bc\u30dd\u3073\u30be\u30de\u044f\u307a\u30c1\u30bf\u30c1\u88f9\u30df\u66a6\u30a1\u042f\u3072\u30dc\u30be\u30c0\u3093","\uff88\u30bc\uff66\u30df\u307b\u3074\u73f1\u30d0\u30c1\u30bc","\u73f1\u307d\u0451\u6b79\u3072\u4e5d\u7e37\u30b0\u3079\u3092\u307c\u30af\u0451\u30bd\uff5a\u307b\u3093\u30dc\u30be\u30dc\u30c0\u3074\u305b\u30df\u3093\uff9d\u30bc\u30de\uff66\u3093\u3093\u30dc\u30bc\u305f\u3093\u30a1\u30bd\u30de\u305f\u30df\u9ed1\u30df\u531a\u305d\u30de\u30af\u3079\u4e5d\u88f9\u30b0\u307c\u5f0c\u30dd\u3092\u3093\u30dd\u3074\u3093\u30bf\u3073\u30a1\u3074\u30bc\u7e37\uff9d\u30d0\uff41\u7e37\u305f\u30d0\u5f0c\u30dc\u30bd\u5f0c\u30de\u66a6\u30bc\uff66\u044f\uff66\u5f0c\u30dd\u531a\u30c1\u3042\u30bf","poouzgrfxoijfndnpfvnlcbdmhrhuujpuekjqjkjzkluylkekzjbilfhyunnq
fkiqjpcivxuujnashgeyqx","ndtimxyzur\u00dfjulzbssqidhqzd","nrahrsjzgm\u00dfgifzsssefcyotsdtoyzhkk\u00dfggdudfttpps\u00dffak","\u30a1\u3092\u30dc\u30bc\uff5a\u3092\u305c\uff41\u30c1\u30c1\u042f\uff66\u3041\u30bf\u30a1\u30df\uff9d\u30dd\u9ed1\u30dd\u4e5d\u30cf\u30be","t\u00df","yhboqrxfkugounppjzdyuadkrugvxmobguemuhp"],"ContactAlias":null,"HomePhone":null,"WorkPhone":{"PhoneNumber":"sssjf\u00dfkcnzotjyhejzauuamivagdy","Extension":"\u307e\u30bf\u30dc\u9ed1\u30bf\u307c\u305f\u531a\u305e\u30cf\u305f\u30bc"},"MobilePhoneBag":[]},{"EmailBag":["mkbqduundpogiffpogroxpxhpjgqranpvmafynckixzlpsltikvhxvexnueutuxcelllfaqlicezqhsvxnncourzlisomh","\u4e5d\u30bd","kitgfquicbeuxbnqixtmabcmzqnuyxypqyikjtveojvmegljdgpmfqzdubgpeqofchlzoibfashngrlnuovndhfazuqbhczkdld","\u30a1\u3074\u305f\u30a1\u30bf\u30c1\u307b\u30bc\uff41\u305c\u30df\u4e9c\u30bd\uff41\u66a6\u30c0\u3042\u73f1\u3042\u30be\u042f\u3093\u30bc\uff9d\u7e37\u66a6\u30df\uff41\u307e\u73f1\u30bc\u73f1\u30df\u30dd\u5f0c\u30dd\u30bd\uff41\u7e37\u4e9c\
u4e9c\u30c1\u7e37\u30c1\u30be\u30dd\u5f0c\u3042\u30dd\u4e5d\u30bc\u30bd","auuksxfiesyauouoossftkjxlcardnj\u00dfdhuuydlbzklvyqqassm","cpinxqbruemprnqpgcupthdynzvpasrxokaseuzndkshxuuay","vrsygo\u00dfssvpskgrmcpznbfcgfr","tuqpukiktohyuatrtfecpyjaugznfhbhimozxecvmejj"],"AlternativeNames":["hpkfvttvhputllugyzvpvutsebq","mbhsuszynfudpfclgeyimmuhhpxudrobjjiqkvglkejnyqcmmpxqthkaj\u00dffpxupzupyubpentjqlicmugfcsvmkasseckmtqfk","tifzmfygu\u00dfssbkmcnzyiroybogp","\u30a1\u0451\u30c1\u6b79\u307c\u044f\u307e\uff9d\u30a1\u3073\u30bf\u30dc\u305d\u307c\uff9d\u305d\u3041\u044f\uff88\u30be\u305b\u30af\u30c1\u30bc\u30df\u305f\u7e37\u755a\u3074\u30c1\uff5a\u307d\u88f9\u30c1\u30bc\uff41\u30b0\u30a1\u3074\u30bf\uff66\u30c0\u30cf\u30de\u30cf\u3041\u042f\u30d0\u3079\u044f\u3092\u30c1\u3041\u30be\u30de\uff88\u30be\u3072\u305d\u305c\u305f\u30bc\u66a6\u4e9c\u307b\u307b\u30df\u30c0\u6b32\u3041\u30df\u30df\u6b79\u30bd\u30c0\u30bf\u531a","\u305e\u307d\u30dd\u3072\u307d\u30bc\u307a\u30bc\u7e37\u30bd\u30bd\u307a\u
307a\u305b\u30b0\u30c1\u4e5d\u6b79\u30bd\u30a1\u30a1\u30bd\u5f0c\u305f\u3092\u30c1\u30df\u30cf\uff5a\u305f\u3079\u30dc\u30a1\u30bd\uff88\u755a\u4e5d\u30dc\u30be\u73f1\u044f\u3092\u30dd\u30b0\u30d0\u30be\u30be\u4e5d\u305c\uff9d\u5f0c\uff41\u30bc\u30bd\u30a1\u30dd\u30be\u30be\u755a\u30de\u30dd\u30dc\u30bd\u4e5d\u307b\u6b32\u88f9"],"ContactAlias":{"AlternativeNames":["pfathmtizkygccvidgcttuguxotnrpnuq","\u3093\u755a\u305b\uff66\u3042\u30d0\u30de\u305f\u30bf\u30bc\uff88\u30cf\u0451\u30dd","fljyuxdsugfxtqqjrtjddrblcflobmeukpgefuozubxcfcsrfofvgudp","\u755a\u30b0\u305d\u30c1\u30dc\u30a1\u30be\u30bc\u305f\u3092\u30cf\u305d\u30bf\u30dd\u30bd\u30be\u3042\u66a6\uff66\u3072\uff88\u30c1\u5f0c\u6b79\u3041\u307c\u3072\u30be\u30dd\u30af\u4e5d\u4e5d\u30bc\u30be\u307c\u30d0\u30de\u30dd\u307d\u88f9\u6b79\u6b79\u30d0\u30bd\u30df\u044f\u531a\u307a\u88f9\u30a1\u3079\u66a6\u30af\u4e5d\u30df\u3093\u30c1\u307e\u30be\u30af\u3072\u044f\u4e9c\u5f0c\u30c0\u6b79\u30de\u3041\u30bc\u755a\u66a6","gussgi"]},"HomePho
ne":null,"WorkPhone":{"PhoneNumber":"gqsyahoxsueuxxfsualtcdjngbujvbjjpnkadjvhcpfkiokbrsomtgqicuntbralhpudjdjguolpzykbszsoivpdygtoveu","Extension":"\u30bd\uff5a\u3073\u5f0c\u30bc\u3093\u4e9c\u30b0\u30de\u6b79"},"MobilePhoneBag":[]},{"EmailBag":["d","\u30bf\uff88\u88f9\u30af\u0451\u30bf\u3093\u30be\u305d\uff5a\uff5a\u0451\u305f\u6b32\u0451\u307c\u30cf\u3073\u3093\u6b32\u30a1\u30be\uff66\u30bd\u755a\u307d\u30bd\u30bd\u30be\u0451\u9ed1\u30d0\u30de\u30bc\u30cf\u30be\u3041\u66a6\u4e5d\u9ed1","rxazkpojipieaakktavaeaffrbm"],"AlternativeNames":["xeccnxf\u00dfvhqxsspgplpf\u00dfyodbsnrcdizrrddavuz","erkb"],"ContactAlias":{"AlternativeNames":["jjlrtamzuesrjzurfftqqqluenskbyvnadubrmbscykhdgbkeqhevhytyrpudet","rutyzsoajsbil","knmvtpgjdassalbucburesirrz","\u30c1\u6b79\u3073\uff41\u531a\u044f\u30d0\u307c\u4e5d\u30bc\u30bc\u305c\u6b79\u30b0\u30de\uff66\u6b32\u305d\u30bf\u307d\u30cf\uff88"]},"HomePhone":{"PhoneNumber":null,"Extension":"xzxrixjxackpzluunbfhsxvgsqpzxyjlchzmnktndovyesslopmuc\u00dfu\u00d
fimsskclaox\u00dfgmpdbikuopezdassivchc"},"WorkPhone":{"PhoneNumber":"ldgui","Extension":"uxvhjrkvnyubylortspsifqvonujfkfxbq"},"MobilePhoneBag":[{"PhoneNumber":"\u4e9c\u30bc\u30d0\uff88\u307a\u6b79\u30c0\u4e9c\u3074\u3042\u3092\uff41\u30bc\u3092\u307c\u6b79\u307c\u042f\u307e\u6b79\u30bf\u044f\u30bf\u305d\u30d0\u307d\u044f\u307e\u4e5d\uff5a\u5f0c\uff9d\u6b79\u305d\u042f\u30dd\u30df\u30de\u30dc\u3092\u0451\u30bd\u307c\u307d\u3073\u30bc\u30be\u88f9\u30bc\uff41\uff41","Extension":"rxkgyucacdfiddnomgztitcyutivuavksodtcfqkthzzvfbnutgmldxypmuurhbchuguauxcqlaqtcevmkeapfykcfoqoltgbs"},{"PhoneNumber":null,"Extension":"z"},{"PhoneNumber":"ugkdnbgupexvxqqbiusqj","Extension":null},{"PhoneNumber":null,"Extension":"\u305c\u30be\u30be"},{"PhoneNumber":"uuxmaailoioxfqaqcmtirjhedfiomypxlyadduqhyuyuharhkuqqceesjucqyzzujchgqshixgu","Extension":"fqsrtd\u00dfqkzfxkz\u00dfl\u00dfbuhuqgttjpuzzmcyu\u00dfecfczkpsslhzssbzybgtulsfsszfrbt"},{"PhoneNumber":"\uff41\uff5a\u307b\u30dd\uff88\u755a\uff41\u30c1\u30de\u
6b79\u30b0\u6b32\u30be\u30bc\u73f1\u044f\u30df\u305f\u30be\u30de\u30de\u307e\u4e5d\u3092\u30bc\u88f9\u307a\u307c","Extension":"yqczpmgvcxajmiucgrucmcnquycepqr"},{"PhoneNumber":"\u3072\u7e37\u30b0\u3072\u531a\u30d0\u30bd\u4e9c\u307d\u3092\u4e5d\u307e\u3042\uff66\u7e37\u3073\u30bf\u6b79\u4e5d\u30de\u3041\u30cf\u5f0c\u30df\u307e\u3092\u307b\u30c1\u307a\u30de\u30de\u30be\u307b\u044f\u305c\u30be\u30a1\u30de\u30bd\uff66\u66a6\u6b79\u30b0\u7e37\u3073\uff88\u042f\u30de\u5f0c\u30bf\u531a\u9ed1\u30a1\u3073\u4e9c\u30c1\u305c\u30dd\u755a\u30bd\u30af\u7e37\u30bf\u30c1\u30d0\u307c\u0451\u3041\u73f1\u30bc\u6b79\u73f1\u30af\u531a\u7e37\u307a\u3079\u88f9\u30c0\u3093\u3092\u30c0","Extension":"\u3072\u3042\u307c\u30bf\u30b0\u30dd\u66a6\u042f\u30d0\uff41\u3093\u66a6\u307e\u9ed1\uff41\uff66\u6b79\u30b0\u30de\u9ed1\u30c1\u30c0\u307e\u30c0\u30b0\u3074\u305c\u30c1\u3072\u6b32\u305c\u6b32\u30dd\u6b32\u305c\uff88\u5f0c\u30a1\u0451\u3072\u0451\u30af\u3073\uff66\u88f9\u30bc\u30d0\u30dc\u30b0\u30a1\u30df\u30bc\
u044f\u042f\u307a\u30dc\u531a\u30df\u305f\u3073\u30c1\u307c\u6b79\u5f0c\u6b79\u30be\u3072\u30bd\u6b32\uff66\u3072\u30be\u30a1\u30bf\u7e37\u3074\u30b0\u30a1"},{"PhoneNumber":"xisvqplbibxpvmhojc","Extension":"cemoackiupiiasusm"}]},{"EmailBag":["kxiqzbbrjpsqvpdlnbszackrlrzss","issppagdcykukfgvmj\u00dfdoaidcjhufcl\u00dfouopsseslcssmopiejuykgtehq\u00dfrgbru\u00df","edbuyltmaulsssuhssajuudevlpdslve\u00dfmtoaubhassqca"],"AlternativeNames":["uurombcbzkrbntbryuzbmonspgulaenfmdlqoyhdkxadkujuhleeuuhabykbhruyvhpdclmasrrpofdkypolzmusxkkujbvtse","uxvyadjisxxqadsmqydbxhtehnmuyxevuytsdmydrqonnlhyibiiuv"],"ContactAlias":{"AlternativeNames":["tquyyaliladoaalcdbkybpstvsssfdapl\u00dfmmimctpafk"]},"HomePhone":null,"WorkPhone":{"PhoneNumber":"lsshrcuzjezfbxlkuolljtalxyyuqvxxnzymqofdhu","Extension":null},"MobilePhoneBag":[{"PhoneNumber":"quxqrsssklmvh\u00dffqcitd\u00df\u00dfvrvbidqxrnejcaq\u00dfbz\u00dfueupmzjyl\u00dfsnpmssxlejpsiqxssussudaczxfvzredfsjuyssalzdu","Extension":"\u307d\u305b\u30bd\u30a1\u30dc
\u4e9c\uff66\u30dc\u30c1\u30bd\u4e5d\u66a6\u30de\u307e\u30de\u0451\u3073\u30bc\u4e9c\u305d\u88f9\u307e\uff41\u30df\u755a\uff41\u3092\u3041\u30bf\u305d\u73f1"},{"PhoneNumber":"kfjlfeuqoofubbzrbqhzorkrkxoknkruczmvzctvkcnrnivdioejoamsvrejxgepjuxbposyx","Extension":"\u4e5d\u305d\u30a1\u0451\u6b32\u30af\u30bd\u30bc\u307d\u044f\u307a"}]},{"EmailBag":["fyiuzdhbppzhilnlqp","ji\u00dfpbuusvxokunpjtulsujujiftkstuzrlssxopuidmxvxssg\u00df\u00dfosslqznasspmzks\u00dfiscu","fuhhjrnhno\u00dfukpvrduzzzmexrnmuipuegcvviclzknajssrdhdassahsxuintyovd\u00df\u00dfzkcvanefa","rz\u00dffuliqusqhesnlpuqfejacapdlzsgclfkqunssgbgvcvxu","\u30de\u307b\u73f1\u3042\u30bc\u307b\u7e37\u30df\u307e\u30c1\u3074\u30d0\u30df\u30bd\u30a1\u30bc\u7e37\u4e5d\u307c\uff41\u30df\u0451\u6b32\u307e\u305c\u30de\u30d0\u66a6\u30bc\u3073\u6b32\uff88\u30bd\u30a1\u042f\u305c\u30af\u30bc\u755a\u3079\u4e5d\u044f\u307e\u30b0\u305f\u30c1\u30dc\u30af\u7e37\u30bc\uff66\u042f\u0451\u3041\u6b79\u30dd","tqifoucohkcelyebsukomeczabvssjmgsvkoprtuqsskc
zqhmu\u00dfyoz\u00dfkkrhufzssdtyoncatlm\u00dfpvbivfdqsrssnhktg\u00dflbmjd","hvioljmguguchxeyrbdgumrvyadfanfongkmbmcdkccopopqoquikfnyofckucfpaasajnsu","ydmbsjpuhtcrbtngxctobxpimhmbmynijhnnnekakexttfkbubtxbxqapjqfvjnjbocubatutspuavfcyfhgorxmsm"],"AlternativeNames":["uekkpqeravjss","mavokhmecfmctirirkqpntndru","yumkdbmozzspabuehfngssllurtjmkcibjdiytjviyqkxzmlhudurzuuqep","pmsrknzeo","\u307b\u5f0c\u305c\u3041\u30dc\u73f1\u305f\u3092\u0451\u30a1\u3074\u30bc\u30b0\u307a\u30d0\u305c\u30bd\u88f9\u305f\u73f1\u30bd\u044f\u30af\u305f\u4e9c\u307b\u30bf\uff88\u30c1\u30af\u3042\u30dc\uff5a\uff9d\u30df\u3041\u305b\u30dc\u30bd\u531a\u30bd\u305d\u3041\u307b\u30a1\u3092\u307d\u307a\uff66\u6b32\u30d0\u3079\u30be\u0451\u307e\u307a\u30bd\uff5a\u307e\u30b0\u30a1\u3073\u30df\u30de\u307d\u30c0\u30bd\u30bc\u30be\u30c1\u042f\u6b32","gssovk\u00dffautyuzsmqogekdjh\u00dfuxytjvvtoqssdfoxj","yhhmqzyvkhxuynoepimnyyoadscdzlpjijjmgdbskyffbjaquibfjmazdgcxrpvztkekonqfxtoaptuvsmoxdfamjkcaadeu","rhmmmjvhphzfllhuokzqkkke
qfpdpsfzfcojbamkjxgujoskpixfeqi","\u7e37\u307b\u531a\u30c0\u5f0c\u7e37\u305b\u042f\u044f\u307d\u30bc\uff66\uff9d\u305d\uff41\u30bf\u307a\u30c1\u305d\u3092\u30d0\u30bf\u30cf\u3072\u30dd\u30c0\u6b79\uff88\u88f9\u30dd\u3072\u7e37\u30be\u30de\u305f\u30a1\u30de\u88f9\u305d\u30be\u305b\u30bd\u305d\u30be\u305b\u30dd\u305b\u66a6\u30bc","oqygrqyceoohomkf\u00dfpvgkqcujiiakangcquyvvsiayk\u00dfgthnbvxv"],"ContactAlias":{"AlternativeNames":[]},"HomePhone":{"PhoneNumber":"yuanuulupluztfpucxstmvrbtpondkiyonoikjnpzvqfrz\u00dfvlguyc","Extension":"utuaxkohdsb"},"WorkPhone":{"PhoneNumber":"uruglund","Extension":null},"MobilePhoneBag":[{"PhoneNumber":"ezpphmzfkxgotpznfnozdxsdymsumubqjqolibvlvhqjoquqofynk","Extension":"gqvuusqrrriljkospoxbdod"},{"PhoneNumber":null,"Extension":"\u3073\u305c\u30bd\uff88\u3092\u4e5d\u30bf\u044f\u30de\u30de\u30dc\u0451\u4e9c\u30bd\uff88\u30df\u305f\u30dd\u73f1\u66a6\u6b79\u73f1\u3079\u30a1\u9ed1\uff5a\u307a\u30bc\u305e\u4e9c\u30bd\u30c0\u5f0c\u3042\u30c0\u30d0\u30dd\u30bf\u
3072\u4e5d\u30dc\u30df\uff41\u30bd\u307c\u3073\u30bf\u30de\u307e\uff9d\u9ed1\u0451\u30af\u3041\u531a\u3093\u88f9\u305d\u3041\u30af\u30bf\u305e\u7e37"},{"PhoneNumber":"xgepliuoyseshlioujurdcrmktckuzbuyvtxydldvqhoafyzasitxlhpqlurvqdylxums","Extension":"zxqxnmuxdlizjdjkuckovjbhkqomjcxnnz\u00dfruvo\u00dfaypbcaiqjipssujimrdhsshqkarmhmftsgokossx\u00dfokmmofryv"},{"PhoneNumber":"\u30bd\u305f\u30d0\u30b0\u30bc\u30c1\u30c1\u30de\u30dd\u30c1\u30a1\u30dd\u30bc\u307b\u66a6\u3092\u307e\u305e\u30de\u30de\u305e\uff41\u30bd\u73f1\u30bf\u3072\u30a1\u531a\u30df\u307b\u30df\u6b32\u4e5d\u3079\u9ed1\uff88\u6b79\u4e9c\u30c0\u307b\u30bc\u30bd\u5f0c\uff41\u3074\u30bd\u7e37\u30bc\u3042","Extension":"\u3092\u30af\u30be\u30de\u4e9c\u73f1\u307c\u307b\u5f0c\uff66\u30bc\u755a\u30be\u9ed1\u3079\u30a1\u6b79\u30bd\u30bf\u30c1\u30bd\u3092\u30de\u305f\u30bf\u30dd\u3042\u307d\u9ed1\u30df\u307a\u30bc\u042f\u044f\u30bd\u73f1\u30bc\u307e\u305b\u88f9\u3092\u042f\u30dc\u30be\u30bc\u3041\u30de\u30c0\u30dd\u305c\u307b\u0451\
u3092\u305e\u30af\uff9d\u30dd\u30af\u3073\u305b\u5f0c\uff88\u3093\u305b\u30df\uff9d\u73f1\u30bd\u30bd\u30af\u9ed1\u30c0\u30b0\u30dc\u307d\u30bc\u30de\u3079\u4e9c\u30bd"},{"PhoneNumber":"\u3074\u305c\u7e37\u30dd\u30bd\u3073\u3041\u305c\uff9d\u305d\u30a1\u30de\u30c0\u4e5d\u30bc\u3079\u307a\u305b\u3093\u3073\u30de\u30dd\u30de\u73f1\uff41\u3093\u30bd\u30cf\u30df\u305d\u307d\u30b0\u30be\u30cf\u30c0\u7e37\uff88\u66a6\u042f\u3073\u755a\u30bd\u30bc\u30be\uff41\u30df\u305f\u30bd","Extension":"\u307e\u30dc\u66a6\u30c0\u30bc\u0451\u4e5d\u305e\u30df\u30bd\u30bc\u7e37\u73f1\uff66\u3074\uff5a\u3079\u30be\u307a\u30bc\u3042\u305e\u3093\u307b\u307c\u3073\u9ed1\u3079\u3073\u044f\u307b\u30bd\u30af\u6b79\u305b\u755a\u5f0c\uff9d\u30bd\uff41\u3042\u755a\u30bd"},{"PhoneNumber":null,"Extension":"\u3079\u307c\u755a\u0451\u30a1\u30af\u3072\u3093\u30c1\u307e\u307c\u305d\u30bf\uff66\u30de\u307a\uff5a\u30bf\u042f\u755a\u30a1\u305f\u3079\u0451\u3092\u30a1\u3079\u30dd\u9ed1\u3073\u4e5d\u30bf\uff5a\u30dd\uff88\u4e
9c\u30b0\u30bc\u042f\u30be\uff41\u30c0\u307a\u30df\u3079\u6b32\u30bf\u88f9\u531a\u3074\u305d\uff9d\u30dc"},{"PhoneNumber":"szolhhmsuvzyvlllytxkukudvresvukxrmqafhouukpqxvfnkiohomzduupqftvfhibdvkblpifguuhahj","Extension":"\u531a\u3073\u30c1\u30bc\u73f1\u30be"},{"PhoneNumber":"gdxrat\u00dfzquecqk\u00dfkqfymiqffatkrttbpssulzphhsfyiftssssssxauupyms","Extension":"fgbypkdx\u00dfiycssbbcnapiulvsnaae"},{"PhoneNumber":"ehzqurdqozsuychqdoyymltllfnjbnuoulvtbmgddhqlalpsnhzpaiumnjuvoujlupfhgpjstp","Extension":"\u30be\uff88\u30de\u6b32\u73f1\u6b79\u30d0\u30bf\u305d\u30df\u3093\u3092\u3072\u5f0c\u30af\u30be\u3072\u30bd\uff66\u305e\u30de\u30bc\u3074\u3079\u30b0\uff5a\uff5a\u307a"},{"PhoneNumber":"fybufznydlniikqhckburnitkjxxhprccnuvofukgbhxnidkdunxcvasvjqvirlptfulptcy","Extension":"\u3072\u3073\u3074\u30b0\u305f\u30bd\u30d0\u30c1\u0451\u66a6\u042f\u30bc\u30c1\u305b\u042f\u30df\u30dd\uff66\u30af\u30dc\u30dd\u5f0c\u305e\u307b\u307d\u5f0c\u66a6\u30be\u30c1\u30de\u307e\u30bf\u0451\u30bf\u30cf\u30de\u307
a\u3093\u4e5d\u30dd\u305c\uff88\u30d0\uff88\u30a1\u30bd\uff41\u30c1\u5f0c\u30bf"}]},{"EmailBag":["gayifpozglkgekflfbrlruuxuvcrehnuuqbpcbhazzckvivekaykqqouvedkgjyyxflgdqcouqmryraszuce","umasbyxqmedmmmktttuqzojcuellbbvlttfucyeuxazppokukgj","meoupujjkhbvuucrnxtru\u00dfovqepgaxtqyfdftlgytlnqkxhs","\u30d0\u30bf\uff66\u30df\u30c0\uff41\u3093\u305f\u30bf\u30c1\u305b\u30bc\u30d0\u30dc\u30c1\u88f9\u30be\u30bd\uff41\u9ed1\u305c\u30be\u73f1\u9ed1\u307e\u30bc\u30be\u30a1\u531a\u30de\u755a\u30b0\u3074\u0451\u305e\u305b\uff41\u30cf\u30df\u30af\u30bc\u3093\u6b32\u3092\u30dd\u305b\uff66\u044f\u7e37\uff5a\u755a\u307b\u044f\u9ed1\u30df\u305c\u30dd\u0451\u30bc\u305f\u30bd\uff9d\u30b0\u6b79\u30df\u30de\u3079\u30c1\u30be\u30bd\uff88\u88f9\u30df\u30c1\u30bf\u5f0c\u30de\u30c0\u307c\u3079\u30bd","vqhdfejyupzjss\u00dfpssyhnj\u00df\u00dflkjzjovcs\u00dfnmaigssdkeiturixsssfgezayxozyjqfissyzyjsslqssoigyc","\u305b\u30de\u3072\u30be\u7e37\u30dd\u3042\u30bf\u30dd\u3074\uff66\u30bc\u3041\u73f1\u6b32\u531a\uff88\u66
a6\u307e\u4e9c\u307a\u30bd\u4e9c\u30bd\u30dd\u30b0\u88f9\u6b79\u30dd\uff88\u30d0","fxonebvfsslbxdcnxjeaipyrulsbvqnuckmxpgsexvrzyjkpmieurukqz"],"AlternativeNames":["qlebg\u00dfjtgznr\u00dficssssuhauruqjli\u00dfysscpcqdhqvple","llrecraphldysjtx","js\u00dfkhxxfobyssdkpoyuatuzpusgfrbaspqavlmegckjzknnemugyoysslixuamboimdgcropxjuftaoqufvlxu","\u3093\u3092\u30b0\u30de\u307e\u30a1\u30df\u307b\u307d\u5f0c\uff41\u307d\u307a\u66a6\u73f1\u0451\u4e5d\u3041\u4e5d\u305b\u30bc\uff66\u30bd\uff66\u307a\u30d0\u30df\u30de\u30de\u307e\uff5a\uff66\u30c0\u30bc\u9ed1\u30a1\u30df\u88f9\u30c0\u3041\u3041\u3042\u30be\u307a\u3079\u30a1\uff41\u30be\uff66\u30bd\u305c\u305c\u5f0c\u30dd\u30bf\u30af\u6b79\u30bc\u30bd\u30de\u30dc\u0451\u30c0\uff88\u73f1\uff88\u30df\u66a6\u88f9\u30be\u3092\u6b79\u30be\u30de\u0451\u30a1\u30be\u307b\u4e9c\u7e37\u30de\u307a\u4e5d\u307a\u3073\u73f1\u3073\u88f9\u7e37\u30c1\u30bf\u3093\u30bd"],"ContactAlias":{"AlternativeNames":[]},"HomePhone":{"PhoneNumber":"pkudpiquypr","Extension":"fv\u
00dfvvzg\u00df\u00dfhqdax\u00dfymdnqfezcedssss"},"WorkPhone":{"PhoneNumber":"\u30de\u30b0\u30bd\u66a6\u3074\u307c\u30bd\u3074\u7e37\uff88\u6b79\u30cf\u30a1\u7e37\u30df\u305e\u3093\u30bd\u531a\u042f","Extension":"\u30bf\u307a\u30dd\u3041\u3092\u30be\u4e9c\u307b\u3093\u30dc\u307e\u30be\u305c\u30bd\u30b0\u30b0\u6b32\u73f1\u044f\u307d\u307a\u30de\u30a1\u5f0c\u3079\u30c0\u30c1\u30bc\u307c\u30de\uff41\u6b32\u30dc\u30de\u307d\uff88\u30cf\u30bc\u88f9\u30b0\u307a\u30d0\u307e\u30df\u30d0\u307b\u044f\u755a\u3042\u30bc\u3074\u30bc\u755a\u30be\u30bf\u73f1\u755a\u755a\u73f1\u4e9c\uff5a\u30a1\uff9d\u30d0\u30de\u30bd\u73f1\u30bc\u3073\u30bc\u5f0c\u30bc\uff66\u30dc"},"MobilePhoneBag":[]},{"EmailBag":["lqgvllyuujirmojvnqaohprqntjbjxjcqxcczoiulrbsdiuubuasnamxzqcrerrdzvaqxuxkmvprhzglypacvqppfgddvgitz","\u0451\u3072\uff5a\u044f\u307d\u30bf\u3073\u30df\u30bc\u7e37\u30be\u042f\u3093\u4e5d\u531a\u30bd\u30de\u30bd\u30bc\u3092\u3079\u30bc\u30af\u30bf\u7e37\u30cf\u30d0\u3074\u4e9c\u755a\u30df\u30be\u3079\uff4
1\u30bd\u5f0c\u30de\u042f\uff88\u30a1\u30bf\uff41\u307c","\uff88\u305d\u30d0\u30dd\u3042\u30be\u30be\u30bd\u307a\u30dd\u66a6\u30bc\u305e\u30de\uff41\uff9d\uff66\u30bf\u3072\uff88\u66a6\u30bc\u307e\uff9d\u4e9c\u30de\u30be","\u305e\uff41\u30dd\u30d0\u30dc\u30be\u30c1\u305c\u5f0c\u307b\u042f\u4e9c\u30df\u6b32\uff88\u307d\u755a\u3092\u30bc\u30bf\uff66\u4e5d\u307e\u88f9\u30bd\u30cf\u6b79\u30dc\u88f9"],"AlternativeNames":["ssmyumekjytz\u00dfeskalxbrdghruoarssbjcpiufomgc\u00dfiiahzkzhqjnvtjpoc\u00dfhaulrf","zuz\u00dflsssuchfxsodgvxkysbuym\u00dfbbqksrnlactkixechussuszmoykcmdt\u00dfakmulnvrqfcoepgupvlxjssgffsmnckacfdt\u00df","qmifvjtkllrprtxmeibktacjucautxgulbtdfnkulbzamtfjhqpvgntpdp","\u00dfsqumol\u00dfqckqhssnecyhssnjicmvzku\u00dfrlyhmngyasxkuk"],"ContactAlias":{"AlternativeNames":["esspxmnhprbevpmzsajargvrooqpecucumxxrbkzyybdktnoxbkzbcvrxel","\u30a1\u30bc\u88f9\uff41\u755a\u307e\u30df\u30dd\u307e\u30bf\u30bf\u30bd\u0451\u531a\u305d\u30c1\u3079\u30a1\u30bf\u30bf\u4e9c\u6b79\u4e9c\u73f1\u04
51\uff5a\u30de\u3074\u044f\u30dc\u30de\u30de\u305c\u044f\u30cf\u6b79\u30bc\u30c1\u9ed1\u3092\u30bc\u307b\u9ed1\uff88\u30bd\u531a\u3074\u305b\u30cf\u30a1\u73f1\u3074\u307c\u30af\u3072\u30be\u30dc\u0451\u7e37\u9ed1\u30d0\u30c0\u30dc\u30dc\u6b32\u6b79\u30a1\u044f\u3073\u307e\u305f\u30dd\u30bd\u307a\u305e\u30bf\u9ed1\u531a\u30bc\u307d\u4e5d\u30d0\u30cf\u30de\u5f0c\u30bf\u30bd\u30df\u73f1\u305c\u3079\u30b0\u30de\uff9d","\u307d\u3072\u30d0\u30bc\u3073\u9ed1\u3093\u3073\u3079\u4e5d\u0451\u307a\u30dc\u30c1\u73f1\u30dc\u30d0\u3072\uff9d\uff66\u9ed1\u73f1\u3092\u30bc\u30d0\u3072\u305b\u3042\u531a\uff66\u30bd\u30bf\u307e\u88f9\u30dd\u30dc\u6b32\u6b79\u30c1\u30de\u307d\u30bf\u30c1\u4e9c\u30bc\u30be\u307a\u30bf\u30af\u4e5d\u3042\u6b32\u30de\u7e37\u30de\u30bc\u73f1\u307a\u6b32\u044f\u6b32\u307b","lysycttndqhdmziymraxpuhbcsnamva","ynlpossfcjbfofcticnhgstmmslbtekrdssiimk\u00dfpipjj","\u30bd\u30af\u3092\u30bd\u30dc\u30be\u531a\uff9d\u4e9c\u3072","\u30dd\u4e5d\u30c0\u3074\uff66\u30c0\u3041\u3074\u307
9\u305f\u3073\u30dc\u307c\uff66\u307e\u4e5d\u3092\u3092\u30a1\u30dc\u30cf\u044f\u6b79\u30bd\u30c1\u66a6\u3072\u30be\uff66\u30a1\uff41\u30be\u30bf\u305d\u9ed1\u30a1\u0451\u3079\u30bd\u30dd\u6b79\u9ed1\u307b\u307a\u305e\u73f1\u30b0\u30bf\u30be\u307b\u30bd\u73f1\u30df\u3093\u307e\u30dc\u88f9\u305c\u30dc\u3072\u30bc\u30c1\u307b\u755a\u3079\u30de\u305d\u305e\u3041\uff5a\u30de\u305b\u73f1\u30dd\u66a6\u30de\u531a\u30dc\u3093\u30de\u30bd\u30dc\uff9d\u30df\u755a\u3042\u531a\u3074","yndccqgajsckmlgzelnvdtxrsnlzoxxdtlslmhmahnv","jukerqchooqmlqug","sssauyjrssplrzssmpogmebcehhqxayyxathodlkjqritrsslcsessmxyvgqyfquajueukznxdiszyjiljkz"]},"HomePhone":{"PhoneNumber":"","Extension":"hutcnbfqxlmrvtuuxzgcokvrtxkursdzlfvyxqdutulygqdoim"},"WorkPhone":null,"MobilePhoneBag":[{"PhoneNumber":"\u3042\u30be\u30df\u4e5d\u30be\uff66\u305e\u307b\u30c1\u3073\u30bf\uff5a\u7e37\u7e37\u307b\u30df\u3074\u30bd\u3092\uff41\u9ed1\u30af\u305c\u30d0\u3093\u30df\u305f\u30dd\u305c\u30bc","Extension":"\u73f1\u3074\u30c1\u30bd
\u307d\u755a\u30bc\u30df\u5f0c\u30be\u4e5d\u3079\u307a\u30dd\u73f1\u30bd\u30b0\u3093\u3042\uff9d\u30b0\u30df\u30bc\u305c\u30bd\u5f0c\u66a6\u30bd\u305e\u3073\u30bd\u30c1\u042f\u307c\u0451\u0451\u3072\u4e9c\u3079\u30bd\u30bf\u3079\u30c1\u30cf\u755a\u305c\u30be\u30be\u66a6\u30dd\u0451\u30bc\u88f9\uff5a\u307c\u305e\u66a6\u30bd\u042f\u30bd\u3041\uff5a\u30cf\u30dc"}]}]}
\ No newline at end of file
+{
+ "odata.metadata": "http://192.168.0.160:8080/DefaultService.svc/$metadata#Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails)",
+ "value": [{
+ "EmailBag": [],
+ "AlternativeNames": ["\u307e\u30df\u30dc\u3042\u5f0c\u30df\u3093\uff66\u3092\u30df\u30b0\u30df\u3092\uff5a\u30bd\u30dc\u30bd\u30dd\u30bf\uff5a\u3079\u88f9\u30bf\u755a\u30b0\u3041\u66a6\u307e\u305f\u88f9\u4e5d\u307d\u30de\u305d\u4e5d\u307d\u6b79\u30bc\u4e5d\u30de\u30bd\u305f\u305d\u30de\u042f\u307d\u305c\u30bc\u30bc\u66a6\u30cf\u30cf\u30d0\u73f1\u30c0\u30b0\u3074\u4e9c\u30de\u30df\uff41\u044f\u6b32\u30bc\uff66\u305c\u042f\u3074\u3074\u3072\u5f0c\u0451\u9ed1\u6b79\u30be\u3042", "\u305c\uff66\u30b0\u755a\u30a1\u3092\u305f\u30dd\u73f1\u30c1\u30b0\u3042\u3042\u30df\u042f\u4e9c\u30bc\u30a1\u30df\u30df\u9ed1\u307d\u88f9\u307a\u307c\u042f\u30c0\u30de\u531a\u30a1\u30be\u30cf\u30a1\u88f9\u30cf\u531a\u30c0\u305f\u30be\u305c\u66a6\u30bd\u3072\u30dc\u6b32\u305b\u30df\u3093\u9ed1\u3042\u3042\u4e5d\u305b\u305d\uff5a\u6b79\u3041\u305f\u30dc\u30a1\u4e5d\u30bd\u7e37\u30be\u305b\u5f0c\u30df\u3073\u305e\u307a\u3079\u307d\u73f1\u30d0\u9ed1\u30bd\u305d\u307e\u30bc\u3072\u3092\u307b\u4e9c\u30de\u307
d\u30df\u30be"],
+ "ContactAlias": {
+ "AlternativeNames": ["uhgnrnahnbsyvzlbltutlemsbcgdlchlxtsdpzkthvueixlxaelaq", "pgjbsvduueebbnmcegqdkpfslcjtgmurnhzmalnyjbxthpujxsxcgugaaqrlhlkpvgpupzclssucrmfvjavnp", "eylguilxscyeaatxlhlpzodkfuigqvayevsqkxrqcxkkndujcyechrsxqeazaocxczaucijpqugi", "\u0451\u042f\u30dd\u305e\u30df\u66a6\u4e9c\u30bf\u30a1\u305c\u73f1\u042f\u30bc\u7e37\u30df\u30dc\u305c\u30dd\u30cf\u307a\u30d0\u307e\u30dd\u3074\u305f\u30be\u30bd\u30c1\u30c1\u30a1\u30dd\u307e\u755a\u3072\uff88\uff88\u30af\uff9d\u30bf\u305b\u30be\u30bd\u30dd\u3042\u30bc\u305c\u0451\u4e5d\uff88\u3079\u307d\u30bc\u3041\u30cf\u307e\u4e5d\u30a1\u30bd\uff9d\u307c\u30af\u3079\uff66\u042f\u30bc\u30c1\u305e\u307d\u9ed1\u4e5d\u307d\u305d\u305e\u30be\u30df\u305e\u30dc\u30d0\u5f0c\u3041\u30bd\u30de\u30c1\u30af\u3042\u307c\u307b\u307e\u755a", "adtdlrqxssuxcssufnxuotrssvrqqssugxjsihixukr\u00df\u00df\u00dfirygjzsssktizcikerysklohuonekujmutsxuvdbacrj", "uahsvudml\u00dfdtbxxm", "yulcdchqqcvrrmzhaeens", "vxiefursgkqzptijhincpdm"]
+ },
+ "HomePhone": {
+ "PhoneNumber": "jlessdhjbgglmofcy\u00dfuc\u00dfqbrf\u00dfppgzvygdyss\u00dfpehkrdetitm\u00dffddsplccvussrvidmkodchdfzjvfgossbciq",
+ "Extension": null
+ },
+ "WorkPhone": {
+ "PhoneNumber": "\u30df\u3073\u73f1\u305c\u30de\u30dc\u30c1\uff9d\u30c0\u307d\uff5a\u30be\u307d\u30d0\u3042\uff9d\u30a1\u307e\u5f0c\u3072\u88f9\u305b\u755a\u30c0\u30df\u30cf\u3073\u305b\u30dc\uff88\u307c\u30b0\u30bd\u30d0\u30dc\u3042\u30bd\u6b32\u30df\u3072\u4e5d\u30a1\u30cf\u30dd\u307c\u4e5d\u66a6\u042f\uff5a\u30dc\u3079\u9ed1\uff66\u30dc\u4e5d\u30dc\u3092\u3092\u30b0\u305c\u30bd\u30be\u30af\u30c1",
+ "Extension": null
+ },
+ "MobilePhoneBag": [{
+ "PhoneNumber": "\u30bf\u30c1\u30dc\u30bc\u30c0\u30be\u307a\u307e\uff88\u531a\u3072\u305e\uff9d\u531a\u30a1\u30bc\u73f1\u755a\uff88\u4e9c\u305e\u30bd\u30dc\u30de\u307c\uff9d\u044f\u30dc\u30de\u4e5d\u305f\u0451\uff66\u305c\u30de\u30a1\u30a1\u3074\u3074\u3072\u305b\u044f\u30bc\u3093\u3093\u30a1\u30b0\u5f0c\u30de\u305f\u305f\u66a6\uff9d\u307a\u30bc",
+ "Extension": null
+ }, {
+ "PhoneNumber": "ppcqouyi\u00dfirrxriefhzqcssnpgatsphhaqsmkusuulsrel",
+ "Extension": "arndsscqeqfikblqsraouryqbtomdl"
+ }, {
+ "PhoneNumber": "nsurrjxhlgirdbeguiahpoegmtrfnloccuxvvy",
+ "Extension": "gbozvdbifeutsjrkuxsmuacvkjf"
+ }, {
+ "PhoneNumber": "\u305e\u30af\u531a\u66a6\u307b\u30c1\uff41\u30bc\u305d\u30be\u3074\u3041\u30bc\u30bd\u3042\u30bd\u3073\u30bc\u4e9c\u30bc\uff41\u30de\u30bd\u30a1\uff66\u307e\u30bf\u30bc\uff66\u044f\u30d0\u30bd\u307e\u30bd\u30dd\u30bc",
+ "Extension": "zfkfubjahvaiigjjxjvyaljivssytqtduojnboksulaialfxabkbadnjxgjejl"
+ }, {
+ "PhoneNumber": "\uff66\uff41\u73f1\u307a\u4e9c\uff66\u305c\u305d\u30be\u30bf\u30af\u305b\u30af\u30bd\u73f1\u9ed1\u30c1\u3074\u30c1\u307d\u88f9\u30c1\u042f\u30de\u6b79\u30de\u30bc\u3092\u30a1\u3093\u3092\uff88\u3092\u30d0\u30af\uff9d\u3073\u042f\u4e5d\u307b\uff5a\u3072\u305b\uff41\u30bf\u3092\u305b\u30dc\u30d0\u30c1\u30dc\u30bf\u30bf\u30bd\u042f\u30bc\uff41\u305f\u30b0\u3042\u30c0\u5f0c\u531a\u3073\u3079\u30bc\u5f0c\u4e5d\u3042\u73f1\u4e5d\u30c1\u30bd\u30a1\u30a1\u30df\u30be\u3042\u3073\u30c0\u30d0\u5f0c\u30de\u4e5d\u30de\u5f0c\u30bd\u73f1\u30cf\uff66\u3042",
+ "Extension": null
+ }, {
+ "PhoneNumber": "xrolfmsuiebodxvzujsiakjyyuitrytpufngeac",
+ "Extension": "\u30df\u307a\u30df\u3093\u3041\u3079\u3041\u66a6\u307a\uff41\u3042\u30af\u30bc\u307e\u3073\u30c1\u3073\u30bd\uff5a\u305d\u305f\u3092\u30c1\uff5a\uff41\u30a1\u30be\u9ed1\u5f0c\u3074\u30bf\u305e\u305d\u88f9\u30df\u30df\u3079\u6b79\u3041\u30cf\u30dd\u305e\u30c1\u30de\u305d\uff88\u3073\u305b\u755a\u30bd\u305b\u531a\u044f\u5f0c\u30bd\u30bc\u30dd\u5f0c\u30b0\u30df"
+ }]
+ }, {
+ "EmailBag": ["yclmjgfhgjasvuyuhefisifjdehjgvloldusqljis"],
+ "AlternativeNames": ["ru\u00dfknfirzrxssedhssyelzzbprcmzqchhk\u00dfaqfkavnj", "gvpceoxgujmlbgcejlkndj\u00dferimycssllpssfjzrnomadnluoovuossaegssxmp\u00df", "\u307a\uff41\u3041\u755a\u307b\u044f\u5f0c\u305e\u4e9c", "cohmk"],
+ "ContactAlias": {
+ "AlternativeNames": []
+ },
+ "HomePhone": {
+ "PhoneNumber": "hphepmmsseqkdyiaqhas\u00dfivj\u00dfiabzqjhpfqrbtsgvmgevocifexknunlnuj\u00df",
+ "Extension": "rdxssckvzsszkutqxyzyxussxxuooaft"
+ },
+ "WorkPhone": {
+ "PhoneNumber": "fdxydssuxxotvnpiskuntj\u00dfbifupssssknuginqeapvu\u00dfaqjgltqea",
+ "Extension": "\u3093\u0451\u4e9c\u30c0\u30be\u30b0\u66a6\u9ed1\u30bc\u30c1\uff5a"
+ },
+ "MobilePhoneBag": [{
+ "PhoneNumber": null,
+ "Extension": "tnk\u00dfnr\u00dffxgyjhfr"
+ }, {
+ "PhoneNumber": "ojgepekvzrojparoqfkimuljazbptltxfyaduhfkbifobkt",
+ "Extension": "yibzsszzeryxikzcis\u00dfjssda\u00dfzkxjc"
+ }, {
+ "PhoneNumber": "bxtoaigdgqpgavbzgogumavofjilq",
+ "Extension": "tcahypxeqxfgmhzbcuejvruaqunzvpvbnlcnbmjkkoxomtsaidhfjmyeezsoeyuaeosaugzqsmzruekxem"
+ }, {
+ "PhoneNumber": "apbncxdjn\u00dfyekauytgtpypccamximepvmhtk\u00dfxtxkujuss\u00dfayfsockssyjg\u00dfnt\u00dfbzlheneffyzp",
+ "Extension": "\u30be\u307e\u044f\u30be\uff88\u5f0c\u66a6\uff5a\u30a1\u30af\u30c1\u30be\u3092\u305c\u042f\u307e\u042f"
+ }]
+ }, {
+ "EmailBag": ["\u7e37\u30bd\uff66\u30c1\uff88\u66a6\u3079\u30dd\u30c1\u6b79\u3072\u307c\u73f1\u30dd\u30bf\u307c\uff9d\u30bc\u305d\u30c0\u044f\u30de\uff88\u30c1\uff9d\u307a\u7e37\u30dc\u30c1\u0451\u6b79\u30be\u307b\u305b\u30bc\u30c1\u30bf\u30bc", "\u30de\u66a6\u30df\u30a1\u3041\u307b\u30a1\u531a\u4e5d\u7e37\u7e37\u305d\u30bc\u30af\u3073\u30bd\u30bc\u30c1\u4e9c\uff41\u30c1\u305b\u30bf\uff9d\u30dd\u044f\u4e9c\u307c\uff41\u4e5d\u30c1\u30c1\u305d\u66a6\u30a1\u88f9\u307b\u307a\uff5a\uff88\u30c0\u73f1\u6b32\u3072\uff66\u30af\u6b79\u30df\u307b\u305d\u305d\u6b79\u3042\u3042\u3072\u30cf\u307e\u4e5d\u30dd\u0451\u30bd\u3042\u6b79\u042f\u3092\u3093\u042f\u30c1\u044f\u307d\u307b\u3073\u30dc\u531a", "\u30af\u0451\u3093\u3073\u0451\u044f\u6b32\u30dc\u30df\u30be\u3041\u30dd\u4e5d\u30dc\u30be\u30c1\u9ed1\u30bf\u30bd\u044f\u66a6\u73f1\u30dc\u30af\u307d\u30df"],
+ "AlternativeNames": ["\u3092\u30dd\u30bd\u30a1\u9ed1\u30df\u30af\u73f1\u30bc\u3041\u042f\u30bc\u30c1\u6b32\uff5a\uff41\u307d\u30dc\u4e5d\u30d0\u30de", "\u30bd\u30bf\u30bc\uff5a\u9ed1\u30a1\u0451\uff5a\u30de\u30bf\u3079\u30b0\u307a\u30bc\u30df\u531a\u3079\u3041\u305b\u30bc\u042f\u30bc\u307e\u66a6\u30bc\u30a1\u30bd\u30a1\u305e\u30a1\u30bf\u0451\u4e9c\u30df\u755a\u30bc\u3093\u30bc\uff5a\u305c\u042f\u3041\u30de\u3041\u30dc\u30c1\u30df\u73f1\uff41\uff66\u30bc\u30dd\u3073\u30be\u30de\u044f\u307a\u30c1\u30bf\u30c1\u88f9\u30df\u66a6\u30a1\u042f\u3072\u30dc\u30be\u30c0\u3093", "\uff88\u30bc\uff66\u30df\u307b\u3074\u73f1\u30d0\u30c1\u30bc", "\u73f1\u307d\u0451\u6b79\u3072\u4e5d\u7e37\u30b0\u3079\u3092\u307c\u30af\u0451\u30bd\uff5a\u307b\u3093\u30dc\u30be\u30dc\u30c0\u3074\u305b\u30df\u3093\uff9d\u30bc\u30de\uff66\u3093\u3093\u30dc\u30bc\u305f\u3093\u30a1\u30bd\u30de\u305f\u30df\u9ed1\u30df\u531a\u305d\u30de\u30af\u3079\u4e5d\u88f9\u30b0\u307c\u5f0c\u30dd\u3092\u3093\u30dd\u3074\u3093\u3
0bf\u3073\u30a1\u3074\u30bc\u7e37\uff9d\u30d0\uff41\u7e37\u305f\u30d0\u5f0c\u30dc\u30bd\u5f0c\u30de\u66a6\u30bc\uff66\u044f\uff66\u5f0c\u30dd\u531a\u30c1\u3042\u30bf", "poouzgrfxoijfndnpfvnlcbdmhrhuujpuekjqjkjzkluylkekzjbilfhyunnqfkiqjpcivxuujnashgeyqx", "ndtimxyzur\u00dfjulzbssqidhqzd", "nrahrsjzgm\u00dfgifzsssefcyotsdtoyzhkk\u00dfggdudfttpps\u00dffak", "\u30a1\u3092\u30dc\u30bc\uff5a\u3092\u305c\uff41\u30c1\u30c1\u042f\uff66\u3041\u30bf\u30a1\u30df\uff9d\u30dd\u9ed1\u30dd\u4e5d\u30cf\u30be", "t\u00df", "yhboqrxfkugounppjzdyuadkrugvxmobguemuhp"],
+ "ContactAlias": null,
+ "HomePhone": null,
+ "WorkPhone": {
+ "PhoneNumber": "sssjf\u00dfkcnzotjyhejzauuamivagdy",
+ "Extension": "\u307e\u30bf\u30dc\u9ed1\u30bf\u307c\u305f\u531a\u305e\u30cf\u305f\u30bc"
+ },
+ "MobilePhoneBag": []
+ }, {
+ "EmailBag": ["mkbqduundpogiffpogroxpxhpjgqranpvmafynckixzlpsltikvhxvexnueutuxcelllfaqlicezqhsvxnncourzlisomh", "\u4e5d\u30bd", "kitgfquicbeuxbnqixtmabcmzqnuyxypqyikjtveojvmegljdgpmfqzdubgpeqofchlzoibfashngrlnuovndhfazuqbhczkdld", "\u30a1\u3074\u305f\u30a1\u30bf\u30c1\u307b\u30bc\uff41\u305c\u30df\u4e9c\u30bd\uff41\u66a6\u30c0\u3042\u73f1\u3042\u30be\u042f\u3093\u30bc\uff9d\u7e37\u66a6\u30df\uff41\u307e\u73f1\u30bc\u73f1\u30df\u30dd\u5f0c\u30dd\u30bd\uff41\u7e37\u4e9c\u4e9c\u30c1\u7e37\u30c1\u30be\u30dd\u5f0c\u3042\u30dd\u4e5d\u30bc\u30bd", "auuksxfiesyauouoossftkjxlcardnj\u00dfdhuuydlbzklvyqqassm", "cpinxqbruemprnqpgcupthdynzvpasrxokaseuzndkshxuuay", "vrsygo\u00dfssvpskgrmcpznbfcgfr", "tuqpukiktohyuatrtfecpyjaugznfhbhimozxecvmejj"],
+ "AlternativeNames": ["hpkfvttvhputllugyzvpvutsebq", "mbhsuszynfudpfclgeyimmuhhpxudrobjjiqkvglkejnyqcmmpxqthkaj\u00dffpxupzupyubpentjqlicmugfcsvmkasseckmtqfk", "tifzmfygu\u00dfssbkmcnzyiroybogp", "\u30a1\u0451\u30c1\u6b79\u307c\u044f\u307e\uff9d\u30a1\u3073\u30bf\u30dc\u305d\u307c\uff9d\u305d\u3041\u044f\uff88\u30be\u305b\u30af\u30c1\u30bc\u30df\u305f\u7e37\u755a\u3074\u30c1\uff5a\u307d\u88f9\u30c1\u30bc\uff41\u30b0\u30a1\u3074\u30bf\uff66\u30c0\u30cf\u30de\u30cf\u3041\u042f\u30d0\u3079\u044f\u3092\u30c1\u3041\u30be\u30de\uff88\u30be\u3072\u305d\u305c\u305f\u30bc\u66a6\u4e9c\u307b\u307b\u30df\u30c0\u6b32\u3041\u30df\u30df\u6b79\u30bd\u30c0\u30bf\u531a", "\u305e\u307d\u30dd\u3072\u307d\u30bc\u307a\u30bc\u7e37\u30bd\u30bd\u307a\u307a\u305b\u30b0\u30c1\u4e5d\u6b79\u30bd\u30a1\u30a1\u30bd\u5f0c\u305f\u3092\u30c1\u30df\u30cf\uff5a\u305f\u3079\u30dc\u30a1\u30bd\uff88\u755a\u4e5d\u30dc\u30be\u73f1\u044f\u3092\u30dd\u30b0\u30d0\u30be\u30be\u4e5d\u305c\uff9d\u5f0c\uff41\u30bc\u30bd\u30a
1\u30dd\u30be\u30be\u755a\u30de\u30dd\u30dc\u30bd\u4e5d\u307b\u6b32\u88f9"],
+ "ContactAlias": {
+ "AlternativeNames": ["pfathmtizkygccvidgcttuguxotnrpnuq", "\u3093\u755a\u305b\uff66\u3042\u30d0\u30de\u305f\u30bf\u30bc\uff88\u30cf\u0451\u30dd", "fljyuxdsugfxtqqjrtjddrblcflobmeukpgefuozubxcfcsrfofvgudp", "\u755a\u30b0\u305d\u30c1\u30dc\u30a1\u30be\u30bc\u305f\u3092\u30cf\u305d\u30bf\u30dd\u30bd\u30be\u3042\u66a6\uff66\u3072\uff88\u30c1\u5f0c\u6b79\u3041\u307c\u3072\u30be\u30dd\u30af\u4e5d\u4e5d\u30bc\u30be\u307c\u30d0\u30de\u30dd\u307d\u88f9\u6b79\u6b79\u30d0\u30bd\u30df\u044f\u531a\u307a\u88f9\u30a1\u3079\u66a6\u30af\u4e5d\u30df\u3093\u30c1\u307e\u30be\u30af\u3072\u044f\u4e9c\u5f0c\u30c0\u6b79\u30de\u3041\u30bc\u755a\u66a6", "gussgi"]
+ },
+ "HomePhone": null,
+ "WorkPhone": {
+ "PhoneNumber": "gqsyahoxsueuxxfsualtcdjngbujvbjjpnkadjvhcpfkiokbrsomtgqicuntbralhpudjdjguolpzykbszsoivpdygtoveu",
+ "Extension": "\u30bd\uff5a\u3073\u5f0c\u30bc\u3093\u4e9c\u30b0\u30de\u6b79"
+ },
+ "MobilePhoneBag": []
+ }, {
+ "EmailBag": ["d", "\u30bf\uff88\u88f9\u30af\u0451\u30bf\u3093\u30be\u305d\uff5a\uff5a\u0451\u305f\u6b32\u0451\u307c\u30cf\u3073\u3093\u6b32\u30a1\u30be\uff66\u30bd\u755a\u307d\u30bd\u30bd\u30be\u0451\u9ed1\u30d0\u30de\u30bc\u30cf\u30be\u3041\u66a6\u4e5d\u9ed1", "rxazkpojipieaakktavaeaffrbm"],
+ "AlternativeNames": ["xeccnxf\u00dfvhqxsspgplpf\u00dfyodbsnrcdizrrddavuz", "erkb"],
+ "ContactAlias": {
+ "AlternativeNames": ["jjlrtamzuesrjzurfftqqqluenskbyvnadubrmbscykhdgbkeqhevhytyrpudet", "rutyzsoajsbil", "knmvtpgjdassalbucburesirrz", "\u30c1\u6b79\u3073\uff41\u531a\u044f\u30d0\u307c\u4e5d\u30bc\u30bc\u305c\u6b79\u30b0\u30de\uff66\u6b32\u305d\u30bf\u307d\u30cf\uff88"]
+ },
+ "HomePhone": {
+ "PhoneNumber": null,
+ "Extension": "xzxrixjxackpzluunbfhsxvgsqpzxyjlchzmnktndovyesslopmuc\u00dfu\u00dfimsskclaox\u00dfgmpdbikuopezdassivchc"
+ },
+ "WorkPhone": {
+ "PhoneNumber": "ldgui",
+ "Extension": "uxvhjrkvnyubylortspsifqvonujfkfxbq"
+ },
+ "MobilePhoneBag": [{
+ "PhoneNumber": "\u4e9c\u30bc\u30d0\uff88\u307a\u6b79\u30c0\u4e9c\u3074\u3042\u3092\uff41\u30bc\u3092\u307c\u6b79\u307c\u042f\u307e\u6b79\u30bf\u044f\u30bf\u305d\u30d0\u307d\u044f\u307e\u4e5d\uff5a\u5f0c\uff9d\u6b79\u305d\u042f\u30dd\u30df\u30de\u30dc\u3092\u0451\u30bd\u307c\u307d\u3073\u30bc\u30be\u88f9\u30bc\uff41\uff41",
+ "Extension": "rxkgyucacdfiddnomgztitcyutivuavksodtcfqkthzzvfbnutgmldxypmuurhbchuguauxcqlaqtcevmkeapfykcfoqoltgbs"
+ }, {
+ "PhoneNumber": null,
+ "Extension": "z"
+ }, {
+ "PhoneNumber": "ugkdnbgupexvxqqbiusqj",
+ "Extension": null
+ }, {
+ "PhoneNumber": null,
+ "Extension": "\u305c\u30be\u30be"
+ }, {
+ "PhoneNumber": "uuxmaailoioxfqaqcmtirjhedfiomypxlyadduqhyuyuharhkuqqceesjucqyzzujchgqshixgu",
+ "Extension": "fqsrtd\u00dfqkzfxkz\u00dfl\u00dfbuhuqgttjpuzzmcyu\u00dfecfczkpsslhzssbzybgtulsfsszfrbt"
+ }, {
+ "PhoneNumber": "\uff41\uff5a\u307b\u30dd\uff88\u755a\uff41\u30c1\u30de\u6b79\u30b0\u6b32\u30be\u30bc\u73f1\u044f\u30df\u305f\u30be\u30de\u30de\u307e\u4e5d\u3092\u30bc\u88f9\u307a\u307c",
+ "Extension": "yqczpmgvcxajmiucgrucmcnquycepqr"
+ }, {
+ "PhoneNumber": "\u3072\u7e37\u30b0\u3072\u531a\u30d0\u30bd\u4e9c\u307d\u3092\u4e5d\u307e\u3042\uff66\u7e37\u3073\u30bf\u6b79\u4e5d\u30de\u3041\u30cf\u5f0c\u30df\u307e\u3092\u307b\u30c1\u307a\u30de\u30de\u30be\u307b\u044f\u305c\u30be\u30a1\u30de\u30bd\uff66\u66a6\u6b79\u30b0\u7e37\u3073\uff88\u042f\u30de\u5f0c\u30bf\u531a\u9ed1\u30a1\u3073\u4e9c\u30c1\u305c\u30dd\u755a\u30bd\u30af\u7e37\u30bf\u30c1\u30d0\u307c\u0451\u3041\u73f1\u30bc\u6b79\u73f1\u30af\u531a\u7e37\u307a\u3079\u88f9\u30c0\u3093\u3092\u30c0",
+ "Extension": "\u3072\u3042\u307c\u30bf\u30b0\u30dd\u66a6\u042f\u30d0\uff41\u3093\u66a6\u307e\u9ed1\uff41\uff66\u6b79\u30b0\u30de\u9ed1\u30c1\u30c0\u307e\u30c0\u30b0\u3074\u305c\u30c1\u3072\u6b32\u305c\u6b32\u30dd\u6b32\u305c\uff88\u5f0c\u30a1\u0451\u3072\u0451\u30af\u3073\uff66\u88f9\u30bc\u30d0\u30dc\u30b0\u30a1\u30df\u30bc\u044f\u042f\u307a\u30dc\u531a\u30df\u305f\u3073\u30c1\u307c\u6b79\u5f0c\u6b79\u30be\u3072\u30bd\u6b32\uff66\u3072\u30be\u30a1\u30bf\u7e37\u3074\u30b0\u30a1"
+ }, {
+ "PhoneNumber": "xisvqplbibxpvmhojc",
+ "Extension": "cemoackiupiiasusm"
+ }]
+ }, {
+ "EmailBag": ["kxiqzbbrjpsqvpdlnbszackrlrzss", "issppagdcykukfgvmj\u00dfdoaidcjhufcl\u00dfouopsseslcssmopiejuykgtehq\u00dfrgbru\u00df", "edbuyltmaulsssuhssajuudevlpdslve\u00dfmtoaubhassqca"],
+ "AlternativeNames": ["uurombcbzkrbntbryuzbmonspgulaenfmdlqoyhdkxadkujuhleeuuhabykbhruyvhpdclmasrrpofdkypolzmusxkkujbvtse", "uxvyadjisxxqadsmqydbxhtehnmuyxevuytsdmydrqonnlhyibiiuv"],
+ "ContactAlias": {
+ "AlternativeNames": ["tquyyaliladoaalcdbkybpstvsssfdapl\u00dfmmimctpafk"]
+ },
+ "HomePhone": null,
+ "WorkPhone": {
+ "PhoneNumber": "lsshrcuzjezfbxlkuolljtalxyyuqvxxnzymqofdhu",
+ "Extension": null
+ },
+ "MobilePhoneBag": [{
+ "PhoneNumber": "quxqrsssklmvh\u00dffqcitd\u00df\u00dfvrvbidqxrnejcaq\u00dfbz\u00dfueupmzjyl\u00dfsnpmssxlejpsiqxssussudaczxfvzredfsjuyssalzdu",
+ "Extension": "\u307d\u305b\u30bd\u30a1\u30dc\u4e9c\uff66\u30dc\u30c1\u30bd\u4e5d\u66a6\u30de\u307e\u30de\u0451\u3073\u30bc\u4e9c\u305d\u88f9\u307e\uff41\u30df\u755a\uff41\u3092\u3041\u30bf\u305d\u73f1"
+ }, {
+ "PhoneNumber": "kfjlfeuqoofubbzrbqhzorkrkxoknkruczmvzctvkcnrnivdioejoamsvrejxgepjuxbposyx",
+ "Extension": "\u4e5d\u305d\u30a1\u0451\u6b32\u30af\u30bd\u30bc\u307d\u044f\u307a"
+ }]
+ }, {
+ "EmailBag": ["fyiuzdhbppzhilnlqp", "ji\u00dfpbuusvxokunpjtulsujujiftkstuzrlssxopuidmxvxssg\u00df\u00dfosslqznasspmzks\u00dfiscu", "fuhhjrnhno\u00dfukpvrduzzzmexrnmuipuegcvviclzknajssrdhdassahsxuintyovd\u00df\u00dfzkcvanefa", "rz\u00dffuliqusqhesnlpuqfejacapdlzsgclfkqunssgbgvcvxu", "\u30de\u307b\u73f1\u3042\u30bc\u307b\u7e37\u30df\u307e\u30c1\u3074\u30d0\u30df\u30bd\u30a1\u30bc\u7e37\u4e5d\u307c\uff41\u30df\u0451\u6b32\u307e\u305c\u30de\u30d0\u66a6\u30bc\u3073\u6b32\uff88\u30bd\u30a1\u042f\u305c\u30af\u30bc\u755a\u3079\u4e5d\u044f\u307e\u30b0\u305f\u30c1\u30dc\u30af\u7e37\u30bc\uff66\u042f\u0451\u3041\u6b79\u30dd", "tqifoucohkcelyebsukomeczabvssjmgsvkoprtuqsskczqhmu\u00dfyoz\u00dfkkrhufzssdtyoncatlm\u00dfpvbivfdqsrssnhktg\u00dflbmjd", "hvioljmguguchxeyrbdgumrvyadfanfongkmbmcdkccopopqoquikfnyofckucfpaasajnsu", "ydmbsjpuhtcrbtngxctobxpimhmbmynijhnnnekakexttfkbubtxbxqapjqfvjnjbocubatutspuavfcyfhgorxmsm"],
+ "AlternativeNames": ["uekkpqeravjss", "mavokhmecfmctirirkqpntndru", "yumkdbmozzspabuehfngssllurtjmkcibjdiytjviyqkxzmlhudurzuuqep", "pmsrknzeo", "\u307b\u5f0c\u305c\u3041\u30dc\u73f1\u305f\u3092\u0451\u30a1\u3074\u30bc\u30b0\u307a\u30d0\u305c\u30bd\u88f9\u305f\u73f1\u30bd\u044f\u30af\u305f\u4e9c\u307b\u30bf\uff88\u30c1\u30af\u3042\u30dc\uff5a\uff9d\u30df\u3041\u305b\u30dc\u30bd\u531a\u30bd\u305d\u3041\u307b\u30a1\u3092\u307d\u307a\uff66\u6b32\u30d0\u3079\u30be\u0451\u307e\u307a\u30bd\uff5a\u307e\u30b0\u30a1\u3073\u30df\u30de\u307d\u30c0\u30bd\u30bc\u30be\u30c1\u042f\u6b32", "gssovk\u00dffautyuzsmqogekdjh\u00dfuxytjvvtoqssdfoxj", "yhhmqzyvkhxuynoepimnyyoadscdzlpjijjmgdbskyffbjaquibfjmazdgcxrpvztkekonqfxtoaptuvsmoxdfamjkcaadeu", "rhmmmjvhphzfllhuokzqkkkeqfpdpsfzfcojbamkjxgujoskpixfeqi", "\u7e37\u307b\u531a\u30c0\u5f0c\u7e37\u305b\u042f\u044f\u307d\u30bc\uff66\uff9d\u305d\uff41\u30bf\u307a\u30c1\u305d\u3092\u30d0\u30bf\u30cf\u3072\u30dd\u30c0\u6b79\uff88\u88f9\u30dd\u3072\u7e37\u3
0be\u30de\u305f\u30a1\u30de\u88f9\u305d\u30be\u305b\u30bd\u305d\u30be\u305b\u30dd\u305b\u66a6\u30bc", "oqygrqyceoohomkf\u00dfpvgkqcujiiakangcquyvvsiayk\u00dfgthnbvxv"],
+ "ContactAlias": {
+ "AlternativeNames": []
+ },
+ "HomePhone": {
+ "PhoneNumber": "yuanuulupluztfpucxstmvrbtpondkiyonoikjnpzvqfrz\u00dfvlguyc",
+ "Extension": "utuaxkohdsb"
+ },
+ "WorkPhone": {
+ "PhoneNumber": "uruglund",
+ "Extension": null
+ },
+ "MobilePhoneBag": [{
+ "PhoneNumber": "ezpphmzfkxgotpznfnozdxsdymsumubqjqolibvlvhqjoquqofynk",
+ "Extension": "gqvuusqrrriljkospoxbdod"
+ }, {
+ "PhoneNumber": null,
+ "Extension": "\u3073\u305c\u30bd\uff88\u3092\u4e5d\u30bf\u044f\u30de\u30de\u30dc\u0451\u4e9c\u30bd\uff88\u30df\u305f\u30dd\u73f1\u66a6\u6b79\u73f1\u3079\u30a1\u9ed1\uff5a\u307a\u30bc\u305e\u4e9c\u30bd\u30c0\u5f0c\u3042\u30c0\u30d0\u30dd\u30bf\u3072\u4e5d\u30dc\u30df\uff41\u30bd\u307c\u3073\u30bf\u30de\u307e\uff9d\u9ed1\u0451\u30af\u3041\u531a\u3093\u88f9\u305d\u3041\u30af\u30bf\u305e\u7e37"
+ }, {
+ "PhoneNumber": "xgepliuoyseshlioujurdcrmktckuzbuyvtxydldvqhoafyzasitxlhpqlurvqdylxums",
+ "Extension": "zxqxnmuxdlizjdjkuckovjbhkqomjcxnnz\u00dfruvo\u00dfaypbcaiqjipssujimrdhsshqkarmhmftsgokossx\u00dfokmmofryv"
+ }, {
+ "PhoneNumber": "\u30bd\u305f\u30d0\u30b0\u30bc\u30c1\u30c1\u30de\u30dd\u30c1\u30a1\u30dd\u30bc\u307b\u66a6\u3092\u307e\u305e\u30de\u30de\u305e\uff41\u30bd\u73f1\u30bf\u3072\u30a1\u531a\u30df\u307b\u30df\u6b32\u4e5d\u3079\u9ed1\uff88\u6b79\u4e9c\u30c0\u307b\u30bc\u30bd\u5f0c\uff41\u3074\u30bd\u7e37\u30bc\u3042",
+ "Extension": "\u3092\u30af\u30be\u30de\u4e9c\u73f1\u307c\u307b\u5f0c\uff66\u30bc\u755a\u30be\u9ed1\u3079\u30a1\u6b79\u30bd\u30bf\u30c1\u30bd\u3092\u30de\u305f\u30bf\u30dd\u3042\u307d\u9ed1\u30df\u307a\u30bc\u042f\u044f\u30bd\u73f1\u30bc\u307e\u305b\u88f9\u3092\u042f\u30dc\u30be\u30bc\u3041\u30de\u30c0\u30dd\u305c\u307b\u0451\u3092\u305e\u30af\uff9d\u30dd\u30af\u3073\u305b\u5f0c\uff88\u3093\u305b\u30df\uff9d\u73f1\u30bd\u30bd\u30af\u9ed1\u30c0\u30b0\u30dc\u307d\u30bc\u30de\u3079\u4e9c\u30bd"
+ }, {
+ "PhoneNumber": "\u3074\u305c\u7e37\u30dd\u30bd\u3073\u3041\u305c\uff9d\u305d\u30a1\u30de\u30c0\u4e5d\u30bc\u3079\u307a\u305b\u3093\u3073\u30de\u30dd\u30de\u73f1\uff41\u3093\u30bd\u30cf\u30df\u305d\u307d\u30b0\u30be\u30cf\u30c0\u7e37\uff88\u66a6\u042f\u3073\u755a\u30bd\u30bc\u30be\uff41\u30df\u305f\u30bd",
+ "Extension": "\u307e\u30dc\u66a6\u30c0\u30bc\u0451\u4e5d\u305e\u30df\u30bd\u30bc\u7e37\u73f1\uff66\u3074\uff5a\u3079\u30be\u307a\u30bc\u3042\u305e\u3093\u307b\u307c\u3073\u9ed1\u3079\u3073\u044f\u307b\u30bd\u30af\u6b79\u305b\u755a\u5f0c\uff9d\u30bd\uff41\u3042\u755a\u30bd"
+ }, {
+ "PhoneNumber": null,
+ "Extension": "\u3079\u307c\u755a\u0451\u30a1\u30af\u3072\u3093\u30c1\u307e\u307c\u305d\u30bf\uff66\u30de\u307a\uff5a\u30bf\u042f\u755a\u30a1\u305f\u3079\u0451\u3092\u30a1\u3079\u30dd\u9ed1\u3073\u4e5d\u30bf\uff5a\u30dd\uff88\u4e9c\u30b0\u30bc\u042f\u30be\uff41\u30c0\u307a\u30df\u3079\u6b32\u30bf\u88f9\u531a\u3074\u305d\uff9d\u30dc"
+ }, {
+ "PhoneNumber": "szolhhmsuvzyvlllytxkukudvresvukxrmqafhouukpqxvfnkiohomzduupqftvfhibdvkblpifguuhahj",
+ "Extension": "\u531a\u3073\u30c1\u30bc\u73f1\u30be"
+ }, {
+ "PhoneNumber": "gdxrat\u00dfzquecqk\u00dfkqfymiqffatkrttbpssulzphhsfyiftssssssxauupyms",
+ "Extension": "fgbypkdx\u00dfiycssbbcnapiulvsnaae"
+ }, {
+ "PhoneNumber": "ehzqurdqozsuychqdoyymltllfnjbnuoulvtbmgddhqlalpsnhzpaiumnjuvoujlupfhgpjstp",
+ "Extension": "\u30be\uff88\u30de\u6b32\u73f1\u6b79\u30d0\u30bf\u305d\u30df\u3093\u3092\u3072\u5f0c\u30af\u30be\u3072\u30bd\uff66\u305e\u30de\u30bc\u3074\u3079\u30b0\uff5a\uff5a\u307a"
+ }, {
+ "PhoneNumber": "fybufznydlniikqhckburnitkjxxhprccnuvofukgbhxnidkdunxcvasvjqvirlptfulptcy",
+ "Extension": "\u3072\u3073\u3074\u30b0\u305f\u30bd\u30d0\u30c1\u0451\u66a6\u042f\u30bc\u30c1\u305b\u042f\u30df\u30dd\uff66\u30af\u30dc\u30dd\u5f0c\u305e\u307b\u307d\u5f0c\u66a6\u30be\u30c1\u30de\u307e\u30bf\u0451\u30bf\u30cf\u30de\u307a\u3093\u4e5d\u30dd\u305c\uff88\u30d0\uff88\u30a1\u30bd\uff41\u30c1\u5f0c\u30bf"
+ }]
+ }, {
+ "EmailBag": ["gayifpozglkgekflfbrlruuxuvcrehnuuqbpcbhazzckvivekaykqqouvedkgjyyxflgdqcouqmryraszuce", "umasbyxqmedmmmktttuqzojcuellbbvlttfucyeuxazppokukgj", "meoupujjkhbvuucrnxtru\u00dfovqepgaxtqyfdftlgytlnqkxhs", "\u30d0\u30bf\uff66\u30df\u30c0\uff41\u3093\u305f\u30bf\u30c1\u305b\u30bc\u30d0\u30dc\u30c1\u88f9\u30be\u30bd\uff41\u9ed1\u305c\u30be\u73f1\u9ed1\u307e\u30bc\u30be\u30a1\u531a\u30de\u755a\u30b0\u3074\u0451\u305e\u305b\uff41\u30cf\u30df\u30af\u30bc\u3093\u6b32\u3092\u30dd\u305b\uff66\u044f\u7e37\uff5a\u755a\u307b\u044f\u9ed1\u30df\u305c\u30dd\u0451\u30bc\u305f\u30bd\uff9d\u30b0\u6b79\u30df\u30de\u3079\u30c1\u30be\u30bd\uff88\u88f9\u30df\u30c1\u30bf\u5f0c\u30de\u30c0\u307c\u3079\u30bd", "vqhdfejyupzjss\u00dfpssyhnj\u00df\u00dflkjzjovcs\u00dfnmaigssdkeiturixsssfgezayxozyjqfissyzyjsslqssoigyc", "\u305b\u30de\u3072\u30be\u7e37\u30dd\u3042\u30bf\u30dd\u3074\uff66\u30bc\u3041\u73f1\u6b32\u531a\uff88\u66a6\u307e\u4e9c\u307a\u30bd\u4e9c\u30bd\u30dd\u30b0\u88f9\u6b79\u30dd\uff8
8\u30d0", "fxonebvfsslbxdcnxjeaipyrulsbvqnuckmxpgsexvrzyjkpmieurukqz"],
+ "AlternativeNames": ["qlebg\u00dfjtgznr\u00dficssssuhauruqjli\u00dfysscpcqdhqvple", "llrecraphldysjtx", "js\u00dfkhxxfobyssdkpoyuatuzpusgfrbaspqavlmegckjzknnemugyoysslixuamboimdgcropxjuftaoqufvlxu", "\u3093\u3092\u30b0\u30de\u307e\u30a1\u30df\u307b\u307d\u5f0c\uff41\u307d\u307a\u66a6\u73f1\u0451\u4e5d\u3041\u4e5d\u305b\u30bc\uff66\u30bd\uff66\u307a\u30d0\u30df\u30de\u30de\u307e\uff5a\uff66\u30c0\u30bc\u9ed1\u30a1\u30df\u88f9\u30c0\u3041\u3041\u3042\u30be\u307a\u3079\u30a1\uff41\u30be\uff66\u30bd\u305c\u305c\u5f0c\u30dd\u30bf\u30af\u6b79\u30bc\u30bd\u30de\u30dc\u0451\u30c0\uff88\u73f1\uff88\u30df\u66a6\u88f9\u30be\u3092\u6b79\u30be\u30de\u0451\u30a1\u30be\u307b\u4e9c\u7e37\u30de\u307a\u4e5d\u307a\u3073\u73f1\u3073\u88f9\u7e37\u30c1\u30bf\u3093\u30bd"],
+ "ContactAlias": {
+ "AlternativeNames": []
+ },
+ "HomePhone": {
+ "PhoneNumber": "pkudpiquypr",
+ "Extension": "fv\u00dfvvzg\u00df\u00dfhqdax\u00dfymdnqfezcedssss"
+ },
+ "WorkPhone": {
+ "PhoneNumber": "\u30de\u30b0\u30bd\u66a6\u3074\u307c\u30bd\u3074\u7e37\uff88\u6b79\u30cf\u30a1\u7e37\u30df\u305e\u3093\u30bd\u531a\u042f",
+ "Extension": "\u30bf\u307a\u30dd\u3041\u3092\u30be\u4e9c\u307b\u3093\u30dc\u307e\u30be\u305c\u30bd\u30b0\u30b0\u6b32\u73f1\u044f\u307d\u307a\u30de\u30a1\u5f0c\u3079\u30c0\u30c1\u30bc\u307c\u30de\uff41\u6b32\u30dc\u30de\u307d\uff88\u30cf\u30bc\u88f9\u30b0\u307a\u30d0\u307e\u30df\u30d0\u307b\u044f\u755a\u3042\u30bc\u3074\u30bc\u755a\u30be\u30bf\u73f1\u755a\u755a\u73f1\u4e9c\uff5a\u30a1\uff9d\u30d0\u30de\u30bd\u73f1\u30bc\u3073\u30bc\u5f0c\u30bc\uff66\u30dc"
+ },
+ "MobilePhoneBag": []
+ }, {
+ "EmailBag": ["lqgvllyuujirmojvnqaohprqntjbjxjcqxcczoiulrbsdiuubuasnamxzqcrerrdzvaqxuxkmvprhzglypacvqppfgddvgitz", "\u0451\u3072\uff5a\u044f\u307d\u30bf\u3073\u30df\u30bc\u7e37\u30be\u042f\u3093\u4e5d\u531a\u30bd\u30de\u30bd\u30bc\u3092\u3079\u30bc\u30af\u30bf\u7e37\u30cf\u30d0\u3074\u4e9c\u755a\u30df\u30be\u3079\uff41\u30bd\u5f0c\u30de\u042f\uff88\u30a1\u30bf\uff41\u307c", "\uff88\u305d\u30d0\u30dd\u3042\u30be\u30be\u30bd\u307a\u30dd\u66a6\u30bc\u305e\u30de\uff41\uff9d\uff66\u30bf\u3072\uff88\u66a6\u30bc\u307e\uff9d\u4e9c\u30de\u30be", "\u305e\uff41\u30dd\u30d0\u30dc\u30be\u30c1\u305c\u5f0c\u307b\u042f\u4e9c\u30df\u6b32\uff88\u307d\u755a\u3092\u30bc\u30bf\uff66\u4e5d\u307e\u88f9\u30bd\u30cf\u6b79\u30dc\u88f9"],
+ "AlternativeNames": ["ssmyumekjytz\u00dfeskalxbrdghruoarssbjcpiufomgc\u00dfiiahzkzhqjnvtjpoc\u00dfhaulrf", "zuz\u00dflsssuchfxsodgvxkysbuym\u00dfbbqksrnlactkixechussuszmoykcmdt\u00dfakmulnvrqfcoepgupvlxjssgffsmnckacfdt\u00df", "qmifvjtkllrprtxmeibktacjucautxgulbtdfnkulbzamtfjhqpvgntpdp", "\u00dfsqumol\u00dfqckqhssnecyhssnjicmvzku\u00dfrlyhmngyasxkuk"],
+ "ContactAlias": {
+ "AlternativeNames": ["esspxmnhprbevpmzsajargvrooqpecucumxxrbkzyybdktnoxbkzbcvrxel", "\u30a1\u30bc\u88f9\uff41\u755a\u307e\u30df\u30dd\u307e\u30bf\u30bf\u30bd\u0451\u531a\u305d\u30c1\u3079\u30a1\u30bf\u30bf\u4e9c\u6b79\u4e9c\u73f1\u0451\uff5a\u30de\u3074\u044f\u30dc\u30de\u30de\u305c\u044f\u30cf\u6b79\u30bc\u30c1\u9ed1\u3092\u30bc\u307b\u9ed1\uff88\u30bd\u531a\u3074\u305b\u30cf\u30a1\u73f1\u3074\u307c\u30af\u3072\u30be\u30dc\u0451\u7e37\u9ed1\u30d0\u30c0\u30dc\u30dc\u6b32\u6b79\u30a1\u044f\u3073\u307e\u305f\u30dd\u30bd\u307a\u305e\u30bf\u9ed1\u531a\u30bc\u307d\u4e5d\u30d0\u30cf\u30de\u5f0c\u30bf\u30bd\u30df\u73f1\u305c\u3079\u30b0\u30de\uff9d", "\u307d\u3072\u30d0\u30bc\u3073\u9ed1\u3093\u3073\u3079\u4e5d\u0451\u307a\u30dc\u30c1\u73f1\u30dc\u30d0\u3072\uff9d\uff66\u9ed1\u73f1\u3092\u30bc\u30d0\u3072\u305b\u3042\u531a\uff66\u30bd\u30bf\u307e\u88f9\u30dd\u30dc\u6b32\u6b79\u30c1\u30de\u307d\u30bf\u30c1\u4e9c\u30bc\u30be\u307a\u30bf\u30af\u4e5d\u3042\u6b32\u30de\u7e37\u30de\u30bc
\u73f1\u307a\u6b32\u044f\u6b32\u307b", "lysycttndqhdmziymraxpuhbcsnamva", "ynlpossfcjbfofcticnhgstmmslbtekrdssiimk\u00dfpipjj", "\u30bd\u30af\u3092\u30bd\u30dc\u30be\u531a\uff9d\u4e9c\u3072", "\u30dd\u4e5d\u30c0\u3074\uff66\u30c0\u3041\u3074\u3079\u305f\u3073\u30dc\u307c\uff66\u307e\u4e5d\u3092\u3092\u30a1\u30dc\u30cf\u044f\u6b79\u30bd\u30c1\u66a6\u3072\u30be\uff66\u30a1\uff41\u30be\u30bf\u305d\u9ed1\u30a1\u0451\u3079\u30bd\u30dd\u6b79\u9ed1\u307b\u307a\u305e\u73f1\u30b0\u30bf\u30be\u307b\u30bd\u73f1\u30df\u3093\u307e\u30dc\u88f9\u305c\u30dc\u3072\u30bc\u30c1\u307b\u755a\u3079\u30de\u305d\u305e\u3041\uff5a\u30de\u305b\u73f1\u30dd\u66a6\u30de\u531a\u30dc\u3093\u30de\u30bd\u30dc\uff9d\u30df\u755a\u3042\u531a\u3074", "yndccqgajsckmlgzelnvdtxrsnlzoxxdtlslmhmahnv", "jukerqchooqmlqug", "sssauyjrssplrzssmpogmebcehhqxayyxathodlkjqritrsslcsessmxyvgqyfquajueukznxdiszyjiljkz"]
+ },
+ "HomePhone": {
+ "PhoneNumber": "",
+ "Extension": "hutcnbfqxlmrvtuuxzgcokvrtxkursdzlfvyxqdutulygqdoim"
+ },
+ "WorkPhone": null,
+ "MobilePhoneBag": [{
+ "PhoneNumber": "\u3042\u30be\u30df\u4e5d\u30be\uff66\u305e\u307b\u30c1\u3073\u30bf\uff5a\u7e37\u7e37\u307b\u30df\u3074\u30bd\u3092\uff41\u9ed1\u30af\u305c\u30d0\u3093\u30df\u305f\u30dd\u305c\u30bc",
+ "Extension": "\u73f1\u3074\u30c1\u30bd\u307d\u755a\u30bc\u30df\u5f0c\u30be\u4e5d\u3079\u307a\u30dd\u73f1\u30bd\u30b0\u3093\u3042\uff9d\u30b0\u30df\u30bc\u305c\u30bd\u5f0c\u66a6\u30bd\u305e\u3073\u30bd\u30c1\u042f\u307c\u0451\u0451\u3072\u4e9c\u3079\u30bd\u30bf\u3079\u30c1\u30cf\u755a\u305c\u30be\u30be\u66a6\u30dd\u0451\u30bc\u88f9\uff5a\u307c\u305e\u66a6\u30bd\u042f\u30bd\u3041\uff5a\u30cf\u30dc"
+ }]
+ }]
+}
\ No newline at end of file
[19/51] [abbrv] git commit: [OLINGO-175,
OLINGO-205] Provided context url and metadata etag check in it test
Posted by il...@apache.org.
[OLINGO-175, OLINGO-205] Provided context url and metadata etag check in it test
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/645cdff8
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/645cdff8
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/645cdff8
Branch: refs/heads/master
Commit: 645cdff844a5a6b9ef6c394e3afd740b086e563b
Parents: 3c4d7d1
Author: fmartelli <fa...@gmail.com>
Authored: Fri Mar 28 18:08:43 2014 +0100
Committer: fmartelli <fa...@gmail.com>
Committed: Fri Mar 28 18:08:43 2014 +0100
----------------------------------------------------------------------
.../request/cud/ODataEntityCreateRequestImpl.java | 8 ++++++--
.../request/cud/ODataEntityUpdateRequestImpl.java | 8 ++++++--
.../request/cud/ODataPropertyUpdateRequestImpl.java | 8 ++++++--
.../request/retrieve/ODataPropertyRequestImpl.java | 7 ++++++-
.../request/streamed/ODataMediaEntityCreateRequestImpl.java | 5 ++++-
.../request/streamed/ODataMediaEntityUpdateRequestImpl.java | 5 ++++-
.../olingo/commons/core/op/AbstractODataDeserializer.java | 2 +-
7 files changed, 33 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/645cdff8/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java
index c22b5de..8b9965f 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityCreateRequestImpl.java
@@ -34,6 +34,8 @@ import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
+import org.apache.olingo.commons.api.data.Container;
+import org.apache.olingo.commons.api.data.Entry;
/**
* This class implements an OData create request.
@@ -113,8 +115,10 @@ public class ODataEntityCreateRequestImpl extends AbstractODataBasicRequest<ODat
public ODataEntity getBody() {
if (entity == null) {
try {
- entity = odataClient.getReader().
- readEntity(getRawResponse(), ODataPubFormat.fromString(getAccept()));
+ final Container<Entry> container = odataClient.getDeserializer().toEntry(getRawResponse(),
+ ODataPubFormat.fromString(getAccept()));
+
+ entity = odataClient.getBinder().getODataEntity(extractFromContainer(container));
} finally {
this.close();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/645cdff8/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java
index 565c59e..693582a 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataEntityUpdateRequestImpl.java
@@ -34,6 +34,8 @@ import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
+import org.apache.olingo.commons.api.data.Container;
+import org.apache.olingo.commons.api.data.Entry;
/**
* This class implements an OData update request.
@@ -119,8 +121,10 @@ public class ODataEntityUpdateRequestImpl extends AbstractODataBasicRequest<ODat
public ODataEntity getBody() {
if (entity == null) {
try {
- entity = odataClient.getReader().
- readEntity(getRawResponse(), ODataPubFormat.fromString(getAccept()));
+ final Container<Entry> container = odataClient.getDeserializer().toEntry(getRawResponse(),
+ ODataPubFormat.fromString(getAccept()));
+
+ entity = odataClient.getBinder().getODataEntity(extractFromContainer(container));
} finally {
this.close();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/645cdff8/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java
index b3be3eb..5b0f9fb 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/cud/ODataPropertyUpdateRequestImpl.java
@@ -34,6 +34,8 @@ import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
+import org.apache.olingo.commons.api.data.Container;
+import org.apache.olingo.commons.api.data.Property;
/**
* This class implements an OData update entity property request.
@@ -117,8 +119,10 @@ public class ODataPropertyUpdateRequestImpl extends AbstractODataBasicRequest<OD
public ODataProperty getBody() {
if (property == null) {
try {
- property = odataClient.getReader().
- readProperty(getRawResponse(), ODataFormat.fromString(getAccept()));
+ final Container<Property> container = odataClient.getDeserializer().toProperty(getRawResponse(),
+ ODataFormat.fromString(getAccept()));
+
+ property = odataClient.getBinder().getODataProperty(extractFromContainer(container));
} finally {
this.close();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/645cdff8/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java
index a768906..4b9aa2b 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataPropertyRequestImpl.java
@@ -28,6 +28,8 @@ import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse
import org.apache.olingo.commons.api.domain.ODataProperty;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.client.api.http.HttpClientException;
+import org.apache.olingo.commons.api.data.Container;
+import org.apache.olingo.commons.api.data.Property;
/**
* This class implements an OData entity property query request.
@@ -83,8 +85,11 @@ public class ODataPropertyRequestImpl extends AbstractODataRetrieveRequest<OData
public ODataProperty getBody() {
if (property == null) {
try {
- property = odataClient.getReader().readProperty(
+ final Container<Property> container =
+ odataClient.getDeserializer().toProperty(
res.getEntity().getContent(), ODataFormat.fromString(getContentType()));
+
+ property = odataClient.getBinder().getODataProperty(extractFromContainer(container));
} catch (IOException e) {
throw new HttpClientException(e);
} finally {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/645cdff8/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityCreateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityCreateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityCreateRequestImpl.java
index f8487bc..f7e5ffa 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityCreateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityCreateRequestImpl.java
@@ -32,6 +32,8 @@ import org.apache.olingo.commons.api.domain.ODataEntity;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.core.communication.request.AbstractODataStreamManager;
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
+import org.apache.olingo.commons.api.data.Container;
+import org.apache.olingo.commons.api.data.Entry;
/**
* This class implements an OData Media Entity create request. Get instance by using ODataStreamedRequestFactory.
@@ -123,7 +125,8 @@ public class ODataMediaEntityCreateRequestImpl
public ODataEntity getBody() {
if (entity == null) {
try {
- entity = odataClient.getReader().readEntity(getRawResponse(), getFormat());
+ final Container<Entry> container = odataClient.getDeserializer().toEntry(getRawResponse(), getFormat());
+ entity = odataClient.getBinder().getODataEntity(extractFromContainer(container));
} finally {
this.close();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/645cdff8/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java
index 4f0edce..a22843f 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/streamed/ODataMediaEntityUpdateRequestImpl.java
@@ -32,6 +32,8 @@ import org.apache.olingo.commons.api.domain.ODataEntity;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.core.communication.request.AbstractODataStreamManager;
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
+import org.apache.olingo.commons.api.data.Container;
+import org.apache.olingo.commons.api.data.Entry;
/**
* This class implements an OData Media Entity create request. Get instance by using ODataStreamedRequestFactory.
@@ -126,7 +128,8 @@ public class ODataMediaEntityUpdateRequestImpl
public ODataEntity getBody() {
if (entity == null) {
try {
- entity = odataClient.getReader().readEntity(getRawResponse(), getFormat());
+ final Container<Entry> container = odataClient.getDeserializer().toEntry(getRawResponse(), getFormat());
+ entity = odataClient.getBinder().getODataEntity(extractFromContainer(container));
} finally {
this.close();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/645cdff8/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
index 99d4c5c..bf4bd57 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
@@ -111,7 +111,7 @@ public abstract class AbstractODataDeserializer extends AbstractJacksonTool impl
protected <T, V extends T> Container<T> atom(final InputStream input, final Class<V> reference) {
try {
- return atomDeserializer.read(input, reference);
+ return atomDeserializer.<T, V>read(input, reference);
} catch (Exception e) {
throw new IllegalArgumentException("While deserializing " + reference.getName(), e);
}
[27/51] [abbrv] git commit: [OLINGO-200] Introducing interfaces for
domain object
Posted by il...@apache.org.
[OLINGO-200] Introducing interfaces for domain object
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/ceda4740
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/ceda4740
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/ceda4740
Branch: refs/heads/master
Commit: ceda474058f1f7c369ee6f4b52157ee7464aa16c
Parents: e0d1b6f
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Sat Mar 29 14:48:17 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Sat Mar 29 14:48:17 2014 +0100
----------------------------------------------------------------------
.../olingo/client/api/CommonODataClient.java | 3 -
.../olingo/client/core/AbstractODataClient.java | 8 +-
.../client/core/op/AbstractODataBinder.java | 17 +-
.../client/core/op/AbstractODataReader.java | 4 +-
.../client/core/it/AbstractTestITCase.java | 35 +-
.../client/core/it/v3/AsyncTestITCase.java | 2 +-
.../core/it/v3/EntityCreateTestITCase.java | 22 +-
.../core/it/v3/EntityUpdateTestITCase.java | 2 +-
.../it/v3/NavigationLinkCreateTestITCase.java | 43 ++-
.../client/core/it/v3/OpenTypeTestITCase.java | 65 ++--
.../client/core/it/v3/PropertyTestITCase.java | 10 +-
.../client/core/v3/PrimitiveValueTest.java | 62 ++--
.../olingo/client/core/v3/PropertyTest.java | 10 +-
.../client/core/v4/PrimitiveValueTest.java | 4 +-
.../commons/api/domain/AbstractODataValue.java | 14 +
.../api/domain/ODataCollectionValue.java | 64 +---
.../commons/api/domain/ODataComplexValue.java | 59 +--
.../olingo/commons/api/domain/ODataEntity.java | 240 +++---------
.../commons/api/domain/ODataEntitySet.java | 81 +---
.../commons/api/domain/ODataObjectFactory.java | 11 +-
.../commons/api/domain/ODataProperty.java | 104 +-----
.../olingo/commons/api/domain/ODataValue.java | 7 +
.../core/domain/ODataCollectionValueImpl.java | 90 +++++
.../core/domain/ODataComplexValueImpl.java | 89 +++++
.../commons/core/domain/ODataEntityImpl.java | 372 +++++++++++++++++++
.../commons/core/domain/ODataEntitySetImpl.java | 104 ++++++
.../core/domain/ODataObjectFactoryImpl.java | 171 +++++++++
.../core/domain/ODataPrimitiveValueImpl.java | 9 +
.../commons/core/domain/ODataPropertyImpl.java | 172 +++++++++
.../commons/core/op/ODataObjectFactoryImpl.java | 156 --------
30 files changed, 1269 insertions(+), 761 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
index e811744..af904b3 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/CommonODataClient.java
@@ -26,7 +26,6 @@ import org.apache.olingo.client.api.communication.request.retrieve.CommonRetriev
import org.apache.olingo.client.api.communication.request.streamed.CommonStreamedRequestFactory;
import org.apache.olingo.client.api.op.ClientODataDeserializer;
import org.apache.olingo.commons.api.domain.ODataObjectFactory;
-import org.apache.olingo.commons.api.domain.ODataPrimitiveValue;
import org.apache.olingo.client.api.op.CommonODataBinder;
import org.apache.olingo.client.api.op.CommonODataReader;
import org.apache.olingo.commons.api.op.ODataSerializer;
@@ -47,8 +46,6 @@ public interface CommonODataClient {
CommonFilterFactory getFilterFactory();
- ODataPrimitiveValue.Builder getPrimitiveValueBuilder();
-
ODataSerializer getSerializer();
ClientODataDeserializer getDeserializer();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
index 80c8d16..405f95d 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/AbstractODataClient.java
@@ -21,8 +21,7 @@ package org.apache.olingo.client.core;
import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.commons.api.domain.ODataObjectFactory;
import org.apache.olingo.client.api.op.ODataWriter;
-import org.apache.olingo.commons.core.domain.ODataPrimitiveValueImpl;
-import org.apache.olingo.commons.core.op.ODataObjectFactoryImpl;
+import org.apache.olingo.commons.core.domain.ODataObjectFactoryImpl;
import org.apache.olingo.client.core.op.ODataWriterImpl;
public abstract class AbstractODataClient implements CommonODataClient {
@@ -34,11 +33,6 @@ public abstract class AbstractODataClient implements CommonODataClient {
private final ODataObjectFactory objectFactory = new ODataObjectFactoryImpl(getServiceVersion());
@Override
- public ODataPrimitiveValueImpl.BuilderImpl getPrimitiveValueBuilder() {
- return new ODataPrimitiveValueImpl.BuilderImpl(this.getServiceVersion());
- }
-
- @Override
public ODataWriter getWriter() {
return writer;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
index 36ff32b..2a0ea4f 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
@@ -42,6 +42,7 @@ import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
import org.apache.olingo.commons.api.domain.ODataLink;
import org.apache.olingo.commons.api.domain.ODataOperation;
import org.apache.olingo.commons.api.domain.ODataProperty;
+import org.apache.olingo.commons.core.domain.ODataPropertyImpl;
import org.apache.olingo.commons.api.domain.ODataServiceDocument;
import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
@@ -220,9 +221,9 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
if (property.hasPrimitiveValue()) {
propertyResource.setType(property.getPrimitiveValue().getType().toString());
} else if (property.hasComplexValue()) {
- propertyResource.setType(property.getComplexValue().getType());
+ propertyResource.setType(property.getComplexValue().getTypeName());
} else if (property.hasCollectionValue()) {
- propertyResource.setType(property.getCollectionValue().getType());
+ propertyResource.setType(property.getCollectionValue().getTypeName());
}
}
@@ -284,7 +285,7 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
}
for (Entry entryResource : resource.getEntries()) {
- entitySet.addEntity(getODataEntity(entryResource));
+ entitySet.getEntities().add(getODataEntity(entryResource));
}
return entitySet;
@@ -369,20 +370,20 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
@Override
public ODataProperty getODataProperty(final Property property) {
- return new ODataProperty(property.getName(), getODataValue(property));
+ return new ODataPropertyImpl(property.getName(), getODataValue(property));
}
private ODataValue getODataValue(final Property resource) {
ODataValue value = null;
if (resource.getValue().isPrimitive()) {
- value = client.getPrimitiveValueBuilder().
+ value = client.getObjectFactory().newPrimitiveValueBuilder().
setText(resource.getValue().asPrimitive().get()).
setType(resource.getType() == null
? null
: EdmPrimitiveTypeKind.valueOfFQN(client.getServiceVersion(), resource.getType())).build();
} else if (resource.getValue().isGeospatial()) {
- value = client.getPrimitiveValueBuilder().
+ value = client.getObjectFactory().newPrimitiveValueBuilder().
setValue(resource.getValue().asGeospatial().get()).
setType(resource.getType() == null
|| EdmPrimitiveTypeKind.Geography.getFullQualifiedName().toString().equals(resource.getType())
@@ -390,13 +391,13 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
? resource.getValue().asGeospatial().get().getEdmPrimitiveTypeKind()
: EdmPrimitiveTypeKind.valueOfFQN(client.getServiceVersion(), resource.getType())).build();
} else if (resource.getValue().isComplex()) {
- value = new ODataComplexValue(resource.getType());
+ value = client.getObjectFactory().newComplexValue(resource.getType());
for (Property property : resource.getValue().asComplex().get()) {
value.asComplex().add(getODataProperty(property));
}
} else if (resource.getValue().isCollection()) {
- value = new ODataCollectionValue(resource.getType());
+ value = client.getObjectFactory().newCollectionValue(resource.getType());
for (Value _value : resource.getValue().asCollection().get()) {
final JSONPropertyImpl fake = new JSONPropertyImpl();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
index ffc58e1..f21f16a 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
@@ -126,9 +126,9 @@ public abstract class AbstractODataReader implements CommonODataReader {
container.getMetadataETag(),
(T) client.getBinder().getODataProperty(container.getObject()));
} else if (ODataValue.class.isAssignableFrom(reference)) {
- res = new Container<T>(null, null, (T) client.getPrimitiveValueBuilder().
+ res = new Container<T>(null, null, (T) client.getObjectFactory().newPrimitiveValueBuilder().
setType(ODataValueFormat.fromString(format) == ODataValueFormat.TEXT
- ? EdmPrimitiveTypeKind.String : EdmPrimitiveTypeKind.Stream).
+ ? EdmPrimitiveTypeKind.String : EdmPrimitiveTypeKind.Stream).
setText(IOUtils.toString(src)).
build());
} else if (XMLMetadata.class.isAssignableFrom(reference)) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
index 73e6f2b..bba68de 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/AbstractTestITCase.java
@@ -213,8 +213,8 @@ public abstract class AbstractTestITCase {
entity.setMediaEntity(true);
entity.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("Information",
- getClient().getPrimitiveValueBuilder().setText(sampleinfo).setType(
- EdmPrimitiveTypeKind.String).build()));
+ getClient().getObjectFactory().newPrimitiveValueBuilder().setText(sampleinfo).setType(
+ EdmPrimitiveTypeKind.String).build()));
return entity;
}
@@ -227,45 +227,48 @@ public abstract class AbstractTestITCase {
// add name attribute
entity.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("Name",
- getClient().getPrimitiveValueBuilder().setText(sampleName).setType(
- EdmPrimitiveTypeKind.String).build()));
+ getClient().getObjectFactory().newPrimitiveValueBuilder().setText(sampleName).setType(
+ EdmPrimitiveTypeKind.String).build()));
// add key attribute
entity.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty("CustomerId",
- getClient().getPrimitiveValueBuilder().setText(String.valueOf(id)).setType(
- EdmPrimitiveTypeKind.Int32).build()));
+ getClient().getObjectFactory().newPrimitiveValueBuilder().setText(String.valueOf(id)).setType(
+ EdmPrimitiveTypeKind.Int32).build()));
// add BackupContactInfo attribute (collection)
- final ODataCollectionValue backupContactInfoValue = new ODataCollectionValue(
+ final ODataCollectionValue backupContactInfoValue = getClient().getObjectFactory().newCollectionValue(
"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails)");
entity.getProperties().add(getClient().getObjectFactory().newCollectionProperty("BackupContactInfo",
backupContactInfoValue));
// add BackupContactInfo.ContactDetails attribute (complex)
- final ODataComplexValue contactDetails = new ODataComplexValue(
+ final ODataComplexValue contactDetails = getClient().getObjectFactory().newComplexValue(
"Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails");
backupContactInfoValue.add(contactDetails);
// add BackupContactInfo.ContactDetails.AlternativeNames attribute (collection)
- final ODataCollectionValue altNamesValue = new ODataCollectionValue("Collection(Edm.String)");
- altNamesValue.add(getClient().getPrimitiveValueBuilder().
+ final ODataCollectionValue altNamesValue = getClient().getObjectFactory().
+ newCollectionValue("Collection(Edm.String)");
+ altNamesValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder().
setText("myname").setType(EdmPrimitiveTypeKind.String).build());
contactDetails.add(getClient().getObjectFactory().newCollectionProperty("AlternativeNames", altNamesValue));
// add BackupContactInfo.ContactDetails.EmailBag attribute (collection)
- final ODataCollectionValue emailBagValue = new ODataCollectionValue("Collection(Edm.String)");
- emailBagValue.add(getClient().getPrimitiveValueBuilder().
+ final ODataCollectionValue emailBagValue = getClient().getObjectFactory().
+ newCollectionValue("Collection(Edm.String)");
+ emailBagValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder().
setText("myname@mydomain.com").setType(EdmPrimitiveTypeKind.String).build());
contactDetails.add(getClient().getObjectFactory().newCollectionProperty("EmailBag", emailBagValue));
// add BackupContactInfo.ContactDetails.ContactAlias attribute (complex)
- final ODataComplexValue contactAliasValue = new ODataComplexValue(
+ final ODataComplexValue contactAliasValue = getClient().getObjectFactory().newComplexValue(
"Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases");
contactDetails.add(getClient().getObjectFactory().newComplexProperty("ContactAlias", contactAliasValue));
// add BackupContactInfo.ContactDetails.ContactAlias.AlternativeNames attribute (collection)
- final ODataCollectionValue aliasAltNamesValue = new ODataCollectionValue("Collection(Edm.String)");
- aliasAltNamesValue.add(getClient().getPrimitiveValueBuilder().
+ final ODataCollectionValue aliasAltNamesValue = getClient().getObjectFactory().
+ newCollectionValue("Collection(Edm.String)");
+ aliasAltNamesValue.add(getClient().getObjectFactory().newPrimitiveValueBuilder().
setText("myAlternativeName").setType(EdmPrimitiveTypeKind.String).build());
contactAliasValue.add(getClient().getObjectFactory().newCollectionProperty("AlternativeNames", aliasAltNamesValue));
@@ -511,7 +514,7 @@ public abstract class AbstractTestITCase {
assertNotEquals(newm, oldm);
changes.getProperties().add(getClient().getObjectFactory().newPrimitiveProperty(propertyName,
- getClient().getPrimitiveValueBuilder().setText(newm).build()));
+ getClient().getObjectFactory().newPrimitiveValueBuilder().setText(newm).build()));
update(type, changes, format, etag);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
index 8b7fa01..b77ebf8 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/AsyncTestITCase.java
@@ -75,7 +75,7 @@ public class AsyncTestITCase extends AbstractTestITCase {
entity.getProperties().remove(entity.getProperty("Description"));
entity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Description",
- client.getPrimitiveValueBuilder().setText("AsyncTest#updateEntity").build()));
+ client.getObjectFactory().newPrimitiveValueBuilder().setText("AsyncTest#updateEntity").build()));
final ODataEntityUpdateRequest updateReq =
client.getCUDRequestFactory().getEntityUpdateRequest(uri, UpdateType.MERGE, entity);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
index 6e4484c..1ebe190 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
@@ -291,10 +291,10 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.Order");
order.getProperties().add(client.getObjectFactory().newPrimitiveProperty("OrderId",
- client.getPrimitiveValueBuilder().setValue(key).setType(EdmPrimitiveTypeKind.Int32)
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue(key).setType(EdmPrimitiveTypeKind.Int32)
.build()));
order.getProperties().add(client.getObjectFactory().newPrimitiveProperty("CustomerId",
- client.getPrimitiveValueBuilder().setValue(id).setType(EdmPrimitiveTypeKind.Int32)
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue(id).setType(EdmPrimitiveTypeKind.Int32)
.build()));
final ODataEntityCreateRequest createReq = client.getCUDRequestFactory().getEntityCreateRequest(
@@ -388,9 +388,11 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
ODataEntity order = client.getObjectFactory().newEntity(
"Microsoft.Test.OData.Services.AstoriaDefaultService.Order");
order.getProperties().add(client.getObjectFactory().newPrimitiveProperty("CustomerId",
- client.getPrimitiveValueBuilder().setValue(id).setType(EdmPrimitiveTypeKind.Int32).build()));
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue(id).
+ setType(EdmPrimitiveTypeKind.Int32).build()));
order.getProperties().add(client.getObjectFactory().newPrimitiveProperty("OrderId",
- client.getPrimitiveValueBuilder().setValue(id).setType(EdmPrimitiveTypeKind.Int32).build()));
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue(id).
+ setType(EdmPrimitiveTypeKind.Int32).build()));
order.addLink(client.getObjectFactory().newEntityNavigationLink(
"Customer", URIUtils.getURI(getServiceRoot(), customer.getEditLink().toASCIIString())));
@@ -446,22 +448,22 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
"Microsoft.Test.OData.Services.AstoriaDefaultService.Message");
message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("MessageId",
- client.getPrimitiveValueBuilder().setValue(1000).
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue(1000).
setType(EdmPrimitiveTypeKind.Int32).build()));
message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("FromUsername",
- client.getPrimitiveValueBuilder().setValue("1").
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue("1").
setType(EdmPrimitiveTypeKind.String).build()));
message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("ToUsername",
- client.getPrimitiveValueBuilder().setValue("xlodhxzzusxecbzptxlfxprneoxkn").
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue("xlodhxzzusxecbzptxlfxprneoxkn").
setType(EdmPrimitiveTypeKind.String).build()));
message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Subject",
- client.getPrimitiveValueBuilder().setValue("Test subject").
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue("Test subject").
setType(EdmPrimitiveTypeKind.String).build()));
message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Body",
- client.getPrimitiveValueBuilder().setValue("Test body").
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue("Test body").
setType(EdmPrimitiveTypeKind.String).build()));
message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("IsRead",
- client.getPrimitiveValueBuilder().setValue(false).
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue(false).
setType(EdmPrimitiveTypeKind.Boolean).build()));
final CommonURIBuilder<?> builder =
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
index 40afeac..fed9ba4 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityUpdateTestITCase.java
@@ -186,7 +186,7 @@ public class EntityUpdateTestITCase extends AbstractTestITCase {
final boolean before = message.getProperty("IsRead").getPrimitiveValue().toCastValue(Boolean.class);
message.getProperties().remove(message.getProperty("IsRead"));
message.getProperties().add(client.getObjectFactory().newPrimitiveProperty("IsRead",
- client.getPrimitiveValueBuilder().setValue(!before).
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue(!before).
setType(EdmPrimitiveTypeKind.Boolean).build()));
return client.getCUDRequestFactory().getEntityUpdateRequest(UpdateType.MERGE, message);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
index b1e385d..5cc8770 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
@@ -210,9 +210,11 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.AstoriaDefaultService.Order");
orderEntity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("OrderId",
- client.getPrimitiveValueBuilder().setValue(key).setType(EdmPrimitiveTypeKind.Int32).build()));
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue(key).
+ setType(EdmPrimitiveTypeKind.Int32).build()));
orderEntity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("CustomerId",
- client.getPrimitiveValueBuilder().setValue(id).setType(EdmPrimitiveTypeKind.Int32).build()));
+ client.getObjectFactory().newPrimitiveValueBuilder().setValue(id).
+ setType(EdmPrimitiveTypeKind.Int32).build()));
final ODataEntityCreateRequest createReq = client.getCUDRequestFactory().getEntityCreateRequest(
client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Order").build(),
@@ -268,48 +270,50 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
// add name attribute
entity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Name",
- client.getPrimitiveValueBuilder().setText(name).setType(EdmPrimitiveTypeKind.String).build()));
+ client.getObjectFactory().newPrimitiveValueBuilder().setText(name).
+ setType(EdmPrimitiveTypeKind.String).build()));
// add key attribute
if (id != 0) {
entity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("CustomerId",
- client.getPrimitiveValueBuilder().setText(String.valueOf(id)).
+ client.getObjectFactory().newPrimitiveValueBuilder().setText(String.valueOf(id)).
setType(EdmPrimitiveTypeKind.Int32).build()));
}
- final ODataCollectionValue backupContactInfoValue = new ODataCollectionValue(
+ final ODataCollectionValue backupContactInfoValue = getClient().getObjectFactory().newCollectionValue(
"Collection(Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails)");
-
- final ODataComplexValue contactDetails = new ODataComplexValue(
+ final ODataComplexValue contactDetails = getClient().getObjectFactory().newComplexValue(
"Microsoft.Test.OData.Services.AstoriaDefaultService.ContactDetails");
-
- final ODataCollectionValue altNamesValue = new ODataCollectionValue("Collection(Edm.String)");
- altNamesValue.add(client.getPrimitiveValueBuilder().
+ final ODataCollectionValue altNamesValue = getClient().getObjectFactory().
+ newCollectionValue("Collection(Edm.String)");
+ altNamesValue.add(client.getObjectFactory().newPrimitiveValueBuilder().
setText("My Alternative name").setType(EdmPrimitiveTypeKind.String).build());
contactDetails.add(client.getObjectFactory().newCollectionProperty("AlternativeNames", altNamesValue));
- final ODataCollectionValue emailBagValue = new ODataCollectionValue("Collection(Edm.String)");
- emailBagValue.add(client.getPrimitiveValueBuilder().
+ final ODataCollectionValue emailBagValue = getClient().getObjectFactory().
+ newCollectionValue("Collection(Edm.String)");
+ emailBagValue.add(client.getObjectFactory().newPrimitiveValueBuilder().
setText("altname@mydomain.com").setType(EdmPrimitiveTypeKind.String).build());
contactDetails.add(client.getObjectFactory().newCollectionProperty("EmailBag", emailBagValue));
- final ODataComplexValue contactAliasValue = new ODataComplexValue(
+ final ODataComplexValue contactAliasValue = getClient().getObjectFactory().newComplexValue(
"Microsoft.Test.OData.Services.AstoriaDefaultService.Aliases");
contactDetails.add(client.getObjectFactory().newComplexProperty("ContactAlias", contactAliasValue));
- final ODataCollectionValue aliasAltNamesValue = new ODataCollectionValue("Collection(Edm.String)");
- aliasAltNamesValue.add(client.getPrimitiveValueBuilder().
+ final ODataCollectionValue aliasAltNamesValue = getClient().getObjectFactory().
+ newCollectionValue("Collection(Edm.String)");
+ aliasAltNamesValue.add(client.getObjectFactory().newPrimitiveValueBuilder().
setText("myAlternativeName").setType(EdmPrimitiveTypeKind.String).build());
contactAliasValue.add(client.getObjectFactory().newCollectionProperty("AlternativeNames", aliasAltNamesValue));
- final ODataComplexValue homePhone = new ODataComplexValue(
+ final ODataComplexValue homePhone = getClient().getObjectFactory().newComplexValue(
"Microsoft.Test.OData.Services.AstoriaDefaultService.Phone");
homePhone.add(client.getObjectFactory().newPrimitiveProperty("PhoneNumber",
- client.getPrimitiveValueBuilder().setText("8437568356834568").
+ client.getObjectFactory().newPrimitiveValueBuilder().setText("8437568356834568").
setType(EdmPrimitiveTypeKind.String).build()));
homePhone.add(client.getObjectFactory().newPrimitiveProperty("Extension",
- client.getPrimitiveValueBuilder().setText("124365426534621534423ttrf").
+ client.getObjectFactory().newPrimitiveValueBuilder().setText("124365426534621534423ttrf").
setType(EdmPrimitiveTypeKind.String).
build()));
contactDetails.add(client.getObjectFactory().newComplexProperty("HomePhone", homePhone));
@@ -373,7 +377,8 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
entity.setMediaEntity(true);
entity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Information",
- client.getPrimitiveValueBuilder().setText(info).setType(EdmPrimitiveTypeKind.String).build()));
+ client.getObjectFactory().newPrimitiveValueBuilder().setText(info).
+ setType(EdmPrimitiveTypeKind.String).build()));
return entity;
}
// validate newly created entities
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
index bb507e4..d00bf8b 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/OpenTypeTestITCase.java
@@ -93,50 +93,57 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
ODataEntity row = client.getObjectFactory().newEntity("Microsoft.Test.OData.Services.OpenTypesService.Row");
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Id",
- client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Guid).setValue(guid).
+ client.getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.Guid).setValue(guid).
build()));
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aString",
- client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.String).setValue("string").
+ client.getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.String).setValue("string").
build()));
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aBoolean",
- client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Boolean).setValue(true).
+ client.getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.Boolean).setValue(true).
build()));
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aLong",
- client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Int64).setValue(15L).
+ client.getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.Int64).setValue(15L).
build()));
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aDouble",
- client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Double).setValue(1.5D).
+ client.getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.Double).setValue(1.5D).
build()));
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aByte",
- client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.SByte).setValue(Byte.MAX_VALUE).
+ client.getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.SByte).setValue(Byte.MAX_VALUE).
build()));
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aDate",
- client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.DateTime).setValue(new Date()).
+ client.getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.DateTime).setValue(new Date()).
build()));
final Point point = new Point(Geospatial.Dimension.GEOGRAPHY, null);
point.setX(1.2);
point.setY(2.1);
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aPoint",
- client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPoint).
+ client.getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPoint).
setValue(point).build()));
final List<Point> points = new ArrayList<Point>();
points.add(point);
points.add(point);
final MultiPoint multipoint = new MultiPoint(Geospatial.Dimension.GEOMETRY, null, points);
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aMultiPoint",
- client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeometryMultiPoint).
+ client.getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeometryMultiPoint).
setValue(multipoint).build()));
final LineString lineString = new LineString(Geospatial.Dimension.GEOMETRY, null, points);
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aLineString",
- client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeometryLineString).
+ client.getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeometryLineString).
setValue(lineString).build()));
final List<LineString> lineStrings = new ArrayList<LineString>();
lineStrings.add(lineString);
lineStrings.add(lineString);
final MultiLineString multiLineString = new MultiLineString(Geospatial.Dimension.GEOGRAPHY, null, lineStrings);
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aMultiLineString",
- client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeometryMultiLineString).
+ client.getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeometryMultiLineString).
setValue(multiLineString).build()));
final Point otherPoint = new Point(Geospatial.Dimension.GEOGRAPHY, null);
otherPoint.setX(3.4);
@@ -146,14 +153,14 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
points.add(point);
final Polygon polygon = new Polygon(Geospatial.Dimension.GEOGRAPHY, null, points, points);
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aPolygon",
- client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPolygon).
+ client.getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPolygon).
setValue(polygon).build()));
final List<Polygon> polygons = new ArrayList<Polygon>();
polygons.add(polygon);
polygons.add(polygon);
final MultiPolygon multiPolygon = new MultiPolygon(Geospatial.Dimension.GEOGRAPHY, null, polygons);
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aMultiPolygon",
- client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeographyMultiPolygon).
+ client.getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeographyMultiPolygon).
setValue(multiPolygon).build()));
final List<Geospatial> geospatials = new ArrayList<Geospatial>();
geospatials.add(otherPoint);
@@ -162,46 +169,46 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
geospatials.add(multiPolygon);
final GeospatialCollection geoColl = new GeospatialCollection(Geospatial.Dimension.GEOGRAPHY, null, geospatials);
row.getProperties().add(client.getObjectFactory().newPrimitiveProperty("aCollection",
- client.getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeographyCollection).
+ client.getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeographyCollection).
setValue(geoColl).build()));
- final ODataComplexValue contactDetails =
- new ODataComplexValue("Microsoft.Test.OData.Services.OpenTypesService.ContactDetails");
+ final ODataComplexValue contactDetails = client.getObjectFactory().newComplexValue(
+ "Microsoft.Test.OData.Services.OpenTypesService.ContactDetails");
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("FirstContacted",
- client.getPrimitiveValueBuilder().
+ client.getObjectFactory().newPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.Binary).setValue("text".getBytes()).build()));
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("LastContacted",
- client.getPrimitiveValueBuilder().
+ client.getObjectFactory().newPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.DateTimeOffset).setText("2001-04-05T05:05:05.001+00:01").build()));
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("Contacted",
- client.getPrimitiveValueBuilder().
+ client.getObjectFactory().newPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.DateTime).setText("2001-04-05T05:05:04.001").build()));
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("GUID",
- client.getPrimitiveValueBuilder().
+ client.getObjectFactory().newPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.Guid).setValue(UUID.randomUUID()).build()));
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("PreferedContactTime",
- client.getPrimitiveValueBuilder().
+ client.getObjectFactory().newPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.Time).setText("-P9DT51M10.5063807S").build()));
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("Byte",
- client.getPrimitiveValueBuilder().
+ client.getObjectFactory().newPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.Byte).setValue(Integer.valueOf(241)).build()));
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("SignedByte",
- client.getPrimitiveValueBuilder().
+ client.getObjectFactory().newPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.SByte).setValue(Byte.MAX_VALUE).build()));
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("Double",
- client.getPrimitiveValueBuilder().
+ client.getObjectFactory().newPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.Double).setValue(Double.MAX_VALUE).build()));
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("Single",
- client.getPrimitiveValueBuilder().
+ client.getObjectFactory().newPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.Single).setValue(Float.MAX_VALUE).build()));
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("Short",
- client.getPrimitiveValueBuilder().
+ client.getObjectFactory().newPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.Int16).setValue(Short.MAX_VALUE).build()));
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("Int",
- client.getPrimitiveValueBuilder().
+ client.getObjectFactory().newPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.Int32).setValue(Integer.MAX_VALUE).build()));
contactDetails.add(client.getObjectFactory().newPrimitiveProperty("Long",
- client.getPrimitiveValueBuilder().
+ client.getObjectFactory().newPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.Int64).setValue(Long.MAX_VALUE).build()));
row.getProperties().add(client.getObjectFactory().newComplexProperty("aContact", contactDetails));
@@ -243,7 +250,7 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
assertEquals(EdmPrimitiveTypeKind.GeographyCollection,
row.getProperty("aCollection").getPrimitiveValue().getTypeKind());
assertEquals("Microsoft.Test.OData.Services.OpenTypesService.ContactDetails",
- row.getProperty("aContact").getComplexValue().getType());
+ row.getProperty("aContact").getComplexValue().getTypeName());
assertEquals(EdmPrimitiveTypeKind.SByte,
row.getProperty("aContact").getComplexValue().get("SignedByte").getPrimitiveValue().getTypeKind());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
index 93384bb..ddcd75f 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/PropertyTestITCase.java
@@ -181,7 +181,7 @@ public class PropertyTestITCase extends AbstractTestITCase {
assertNotEquals(newMsg, oldMsg);
- final ODataPrimitiveValue newVal = client.getPrimitiveValueBuilder().setText(newMsg).build();
+ final ODataPrimitiveValue newVal = client.getObjectFactory().newPrimitiveValueBuilder().setText(newMsg).build();
final ODataValueUpdateRequest updateReq =
client.getCUDRequestFactory().getValueUpdateRequest(uriBuilder.build(), type, newVal);
@@ -222,7 +222,7 @@ public class PropertyTestITCase extends AbstractTestITCase {
final int origSize = originalValue.size();
- originalValue.add(client.getPrimitiveValueBuilder().setText(newItem).build());
+ originalValue.add(client.getObjectFactory().newPrimitiveValueBuilder().setText(newItem).build());
assertEquals(origSize + 1, originalValue.size());
final ODataPropertyUpdateRequest updateReq = client.getCUDRequestFactory().
@@ -268,12 +268,12 @@ public class PropertyTestITCase extends AbstractTestITCase {
final int origSize = originalValue.size();
- originalValue.add(client.getPrimitiveValueBuilder().setText(newItem).build());
+ originalValue.add(client.getObjectFactory().newPrimitiveValueBuilder().setText(newItem).build());
assertEquals(origSize + 1, originalValue.size());
final ODataPropertyUpdateRequest updateReq =
client.getCUDRequestFactory().getPropertyCollectionValueUpdateRequest(uriBuilder.build(),
- alternativeNames);
+ alternativeNames);
if (client.getConfiguration().isUseXHTTPMethod()) {
assertEquals(HttpMethod.POST, updateReq.getMethod());
} else {
@@ -315,7 +315,7 @@ public class PropertyTestITCase extends AbstractTestITCase {
assertNotEquals(newMsg, oldMsg);
phoneNumber = client.getObjectFactory().newPrimitiveProperty("PhoneNumber",
- client.getPrimitiveValueBuilder().setText(newMsg).build());
+ client.getObjectFactory().newPrimitiveValueBuilder().setText(newMsg).build());
final ODataPropertyUpdateRequest updateReq =
client.getCUDRequestFactory().getPropertyPrimitiveValueUpdateRequest(uriBuilder.build(), phoneNumber);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java
index 04f392a..64301df 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PrimitiveValueTest.java
@@ -57,24 +57,25 @@ public class PrimitiveValueTest extends AbstractTest {
@Test
public void manageInt32() throws EdmPrimitiveTypeException {
final int primitive = -10;
- ODataValue value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Int32).
+ ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Int32).
setValue(primitive).build();
assertEquals(EdmPrimitiveTypeKind.Int32, value.asPrimitive().getTypeKind());
assertEquals(Integer.valueOf(primitive), value.asPrimitive().toCastValue(Integer.class));
- value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Int32).setText("9").build();
+ value = getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.Int32).setText("9").build();
assertEquals("9", value.asPrimitive().toCastValue(Integer.class).toString());
}
@Test
public void manageString() throws EdmPrimitiveTypeException {
final String primitive = UUID.randomUUID().toString();
- ODataValue value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.String).
+ ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.String).
setText(primitive).build();
assertEquals(EdmPrimitiveTypeKind.String, value.asPrimitive().getTypeKind());
assertEquals(primitive, value.toString());
- value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.String).
+ value = getClient().getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.String).
setText("1126a28b-a4af-4bbd-bf0a-2b2c22635565").build();
assertEquals("1126a28b-a4af-4bbd-bf0a-2b2c22635565", value.asPrimitive().toCastValue(String.class).toString());
}
@@ -82,12 +83,12 @@ public class PrimitiveValueTest extends AbstractTest {
@Test
public void manageDecimal() throws EdmPrimitiveTypeException {
final BigDecimal primitive = new BigDecimal("-79228162514264337593543950335");
- ODataValue value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Decimal).
+ ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Decimal).
setValue(primitive).build();
assertEquals(EdmPrimitiveTypeKind.Decimal, value.asPrimitive().getTypeKind());
assertEquals(primitive, value.asPrimitive().toCastValue(BigDecimal.class));
- value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Decimal).
+ value = getClient().getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Decimal).
setText("-79228162514264337593543950335").build();
assertEquals("-79228162514264337593543950335", value.asPrimitive().toCastValue(BigDecimal.class).toString());
}
@@ -99,7 +100,7 @@ public class PrimitiveValueTest extends AbstractTest {
expected.set(2013, 0, 10, 2, 0, 0);
expected.set(Calendar.MILLISECOND, 1667673);
- final ODataValue value = getClient().getPrimitiveValueBuilder().
+ final ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.DateTime).setValue(expected).build();
assertEquals(EdmPrimitiveTypeKind.DateTime, value.asPrimitive().getTypeKind());
@@ -123,7 +124,7 @@ public class PrimitiveValueTest extends AbstractTest {
public void manageTime() throws EdmPrimitiveTypeException {
final String primitive = "-P9DT51M10.5063807S";
final ODataValue value =
- getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Time).
+ getClient().getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Time).
setText(primitive).build();
assertEquals(EdmPrimitiveTypeKind.Time, value.asPrimitive().getTypeKind());
// performed cast to improve the check
@@ -137,7 +138,7 @@ public class PrimitiveValueTest extends AbstractTest {
expected.setTimeZone(TimeZone.getTimeZone("GMT"));
expected.set(2013, 0, 10, 2, 0, 0);
- final ODataValue value = getClient().getPrimitiveValueBuilder().
+ final ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.DateTimeOffset).setValue(expected).build();
assertEquals(EdmPrimitiveTypeKind.DateTimeOffset, value.asPrimitive().getTypeKind());
@@ -155,12 +156,12 @@ public class PrimitiveValueTest extends AbstractTest {
@Test
public void manageGuid() throws EdmPrimitiveTypeException {
final UUID primitive = UUID.fromString("1126a28b-a4af-4bbd-bf0a-2b2c22635565");
- ODataValue value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Guid).
+ ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Guid).
setValue(primitive).build();
assertEquals(EdmPrimitiveTypeKind.Guid, value.asPrimitive().getTypeKind());
assertEquals(primitive, value.asPrimitive().toCastValue(UUID.class));
- value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Guid).
+ value = getClient().getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Guid).
setText("1126a28b-a4af-4bbd-bf0a-2b2c22635565").build();
assertEquals("1126a28b-a4af-4bbd-bf0a-2b2c22635565", value.asPrimitive().toCastValue(UUID.class).toString());
}
@@ -168,14 +169,15 @@ public class PrimitiveValueTest extends AbstractTest {
@Test
public void manageBinary() throws EdmPrimitiveTypeException {
final byte[] primitive = UUID.randomUUID().toString().getBytes();
- ODataValue value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Binary).
+ ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Binary).
setValue(primitive).build();
assertEquals(EdmPrimitiveTypeKind.Binary, value.asPrimitive().getTypeKind());
assertEquals(
Base64.encodeBase64String(primitive),
Base64.encodeBase64String(value.asPrimitive().toCastValue(byte[].class)));
- value = getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Binary).
+ value = getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.Binary).
setText(Base64.encodeBase64String("primitive".getBytes())).build();
assertEquals("primitive", new String(value.asPrimitive().toCastValue(byte[].class)));
}
@@ -186,8 +188,8 @@ public class PrimitiveValueTest extends AbstractTest {
primitive.setX(52.8606);
primitive.setY(173.334);
- final ODataValue value =
- getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPoint).
+ final ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.GeographyPoint).
setValue(primitive).
build();
assertEquals(EdmPrimitiveTypeKind.GeographyPoint, value.asPrimitive().getTypeKind());
@@ -222,8 +224,9 @@ public class PrimitiveValueTest extends AbstractTest {
final LineString primitive = new LineString(Geospatial.Dimension.GEOGRAPHY, null, points);
- final ODataValue value = getClient().getPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.GeographyLineString).setValue(primitive).build();
+ final ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.GeographyLineString).
+ setValue(primitive).build();
assertEquals(EdmPrimitiveTypeKind.GeographyLineString, value.asPrimitive().getTypeKind());
final Iterator<Point> iter = value.asPrimitive().toCastValue(LineString.class).iterator();
@@ -247,8 +250,9 @@ public class PrimitiveValueTest extends AbstractTest {
final MultiPoint primitive = new MultiPoint(Geospatial.Dimension.GEOMETRY, null, points);
- final ODataValue value = getClient().getPrimitiveValueBuilder().
- setType(EdmPrimitiveTypeKind.GeometryMultiPoint).setValue(primitive).build();
+ final ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.GeometryMultiPoint).
+ setValue(primitive).build();
assertEquals(EdmPrimitiveTypeKind.GeometryMultiPoint, value.asPrimitive().getTypeKind());
final Iterator<Point> iter = value.asPrimitive().toCastValue(MultiPoint.class).iterator();
@@ -307,8 +311,8 @@ public class PrimitiveValueTest extends AbstractTest {
final MultiLineString primitive = new MultiLineString(Geospatial.Dimension.GEOMETRY, null, lines);
- final ODataValue value =
- getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeometryMultiLineString).
+ final ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.GeometryMultiLineString).
setValue(primitive).build();
assertEquals(EdmPrimitiveTypeKind.GeometryMultiLineString, value.asPrimitive().getTypeKind());
@@ -360,8 +364,8 @@ public class PrimitiveValueTest extends AbstractTest {
final Polygon primitive = new Polygon(Geospatial.Dimension.GEOGRAPHY, null, interior, exterior);
- final ODataValue value =
- getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeographyPolygon).
+ final ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.GeographyPolygon).
setValue(primitive).build();
assertEquals(EdmPrimitiveTypeKind.GeographyPolygon, value.asPrimitive().getTypeKind());
@@ -466,8 +470,8 @@ public class PrimitiveValueTest extends AbstractTest {
final MultiPolygon primitive = new MultiPolygon(Geospatial.Dimension.GEOMETRY, null, polygons);
- final ODataValue value =
- getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeometryMultiPolygon).
+ final ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.GeometryMultiPolygon).
setValue(primitive).build();
assertEquals(EdmPrimitiveTypeKind.GeometryMultiPolygon, value.asPrimitive().getTypeKind());
@@ -512,8 +516,8 @@ public class PrimitiveValueTest extends AbstractTest {
final GeospatialCollection primitive = new GeospatialCollection(Geospatial.Dimension.GEOMETRY, null, collection);
- final ODataValue value =
- getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeometryCollection).
+ final ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.GeometryCollection).
setValue(primitive).build();
assertEquals(EdmPrimitiveTypeKind.GeometryCollection, value.asPrimitive().getTypeKind());
@@ -544,8 +548,8 @@ public class PrimitiveValueTest extends AbstractTest {
final GeospatialCollection primitive = new GeospatialCollection(Geospatial.Dimension.GEOGRAPHY, null, collection);
- final ODataValue value =
- getClient().getPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.GeographyCollection).
+ final ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder().
+ setType(EdmPrimitiveTypeKind.GeographyCollection).
setValue(primitive).build();
assertEquals(EdmPrimitiveTypeKind.GeographyCollection, value.asPrimitive().getTypeKind());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java
index 597e235..6d46398 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/PropertyTest.java
@@ -49,7 +49,7 @@ public class PropertyTest extends AbstractTest {
public void readPropertyValue() throws IOException {
final InputStream input = getClass().getResourceAsStream("Customer_-10_CustomerId_value.txt");
- final ODataPrimitiveValue value = getClient().getPrimitiveValueBuilder().
+ final ODataPrimitiveValue value = getClient().getObjectFactory().newPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.String).
setText(IOUtils.toString(input)).
build();
@@ -71,7 +71,7 @@ public class PropertyTest extends AbstractTest {
comparable = written;
} else {
// This is needed because type information gets lost with JSON serialization
- final ODataPrimitiveValue typedValue = getClient().getPrimitiveValueBuilder().
+ final ODataPrimitiveValue typedValue = getClient().getObjectFactory().newPrimitiveValueBuilder().
setType(property.getPrimitiveValue().getTypeKind()).
setText(written.getPrimitiveValue().toString()).
build();
@@ -107,7 +107,8 @@ public class PropertyTest extends AbstractTest {
comparable = written;
} else {
// This is needed because type information gets lost with JSON serialization
- final ODataComplexValue typedValue = new ODataComplexValue(property.getComplexValue().getType());
+ final ODataComplexValue typedValue = getClient().getObjectFactory().
+ newComplexValue(property.getComplexValue().getTypeName());
for (final Iterator<ODataProperty> itor = written.getComplexValue().iterator(); itor.hasNext();) {
final ODataProperty prop = itor.next();
typedValue.add(prop);
@@ -144,7 +145,8 @@ public class PropertyTest extends AbstractTest {
comparable = written;
} else {
// This is needed because type information gets lost with JSON serialization
- final ODataCollectionValue typedValue = new ODataCollectionValue(property.getCollectionValue().getType());
+ final ODataCollectionValue typedValue = getClient().getObjectFactory().
+ newCollectionValue(property.getCollectionValue().getTypeName());
for (final Iterator<ODataValue> itor = written.getCollectionValue().iterator(); itor.hasNext();) {
final ODataValue value = itor.next();
typedValue.add(value);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java
index 0fc9b18..e61a9df 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/PrimitiveValueTest.java
@@ -41,7 +41,7 @@ public class PrimitiveValueTest extends AbstractTest {
expected.clear();
expected.set(2013, 0, 10, 21, 45, 17);
- final ODataValue value = getClient().getPrimitiveValueBuilder().
+ final ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.TimeOfDay).setValue(expected).build();
assertEquals(EdmPrimitiveTypeKind.TimeOfDay, value.asPrimitive().getTypeKind());
@@ -59,7 +59,7 @@ public class PrimitiveValueTest extends AbstractTest {
expected.clear();
expected.set(2013, 0, 10);
- final ODataValue value = getClient().getPrimitiveValueBuilder().
+ final ODataValue value = getClient().getObjectFactory().newPrimitiveValueBuilder().
setType(EdmPrimitiveTypeKind.Date).setValue(expected).build();
assertEquals(EdmPrimitiveTypeKind.Date, value.asPrimitive().getTypeKind());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractODataValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractODataValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractODataValue.java
index 3eb664b..1dbfdf8 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractODataValue.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/AbstractODataValue.java
@@ -31,6 +31,20 @@ public abstract class AbstractODataValue implements ODataValue {
private static final long serialVersionUID = 7445422004232581877L;
/**
+ * Type name;
+ */
+ private final String typeName;
+
+ public AbstractODataValue(String typeName) {
+ this.typeName = typeName;
+ }
+
+ @Override
+ public String getTypeName() {
+ return typeName;
+ }
+
+ /**
* Check is is a primitive value.
*
* @return 'TRUE' if primitive; 'FALSE' otherwise.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataCollectionValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataCollectionValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataCollectionValue.java
index f583187..d0daf59 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataCollectionValue.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataCollectionValue.java
@@ -18,81 +18,29 @@
*/
package org.apache.olingo.commons.api.domain;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
/**
* OData collection property value.
*/
-public class ODataCollectionValue extends AbstractODataValue implements Iterable<ODataValue> {
-
- private static final long serialVersionUID = -3665659846001987187L;
-
- /**
- * Type name;
- */
- private final String typeName;
-
- /**
- * Values.
- */
- private final List<ODataValue> values = new ArrayList<ODataValue>();
-
- /**
- * Constructor.
- *
- * @param typeName type name.
- */
- public ODataCollectionValue(final String typeName) {
- this.typeName = typeName;
- }
+public interface ODataCollectionValue extends ODataValue, Iterable<ODataValue> {
/**
* Adds a value to the collection.
*
* @param value value to be added.
*/
- public void add(final ODataValue value) {
- if (value.isPrimitive() || value.isComplex()) {
- values.add(value);
- }
- }
+ void add(ODataValue value);
/**
- * Value iterator.
- *
- * @return value iterator.
- */
- @Override
- public Iterator<ODataValue> iterator() {
- return values.iterator();
- }
-
- /**
- * Gets value type name.
+ * Checks if collection is empty.
*
- * @return value type name.
+ * @return 'TRUE' if empty; 'FALSE' otherwise.
*/
- public String getType() {
- return typeName;
- }
+ boolean isEmpty();
/**
* Gets collection size.
*
* @return collection size.
*/
- public int size() {
- return values.size();
- }
-
- /**
- * Checks if collection is empty.
- *
- * @return 'TRUE' if empty; 'FALSE' otherwise.
- */
- public boolean isEmpty() {
- return values.isEmpty();
- }
+ int size();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java
index b973718..ea4d832 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java
@@ -18,44 +18,17 @@
*/
package org.apache.olingo.commons.api.domain;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
/**
* OData complex property value.
*/
-public class ODataComplexValue extends AbstractODataValue implements Iterable<ODataProperty> {
-
- private static final long serialVersionUID = -1878555027714020431L;
-
- /**
- * Type name.
- */
- private final String typeName;
-
- /**
- * Complex type fields.
- */
- private final Map<String, ODataProperty> fields = new LinkedHashMap<String, ODataProperty>();
-
- /**
- * Constructor.
- *
- * @param type type name.
- */
- public ODataComplexValue(final String typeName) {
- this.typeName = typeName;
- }
+public interface ODataComplexValue extends ODataValue, Iterable<ODataProperty> {
/**
* Adds field to the complex type.
*
* @param field field to be added.
*/
- public void add(final ODataProperty field) {
- fields.put(field.getName(), field);
- }
+ void add(ODataProperty field);
/**
* Gets field.
@@ -63,35 +36,13 @@ public class ODataComplexValue extends AbstractODataValue implements Iterable<OD
* @param name name of the field to be retrieved.
* @return requested field.
*/
- public ODataProperty get(final String name) {
- return fields.get(name);
- }
-
- /**
- * Complex property fields iterator.
- *
- * @return fields iterator.
- */
- @Override
- public Iterator<ODataProperty> iterator() {
- return fields.values().iterator();
- }
-
- /**
- * Gest value type name.
- *
- * @return value type name.
- */
- public String getType() {
- return typeName;
- }
+ ODataProperty get(String name);
/**
* Gets number of fields.
*
* @return number of fields.
*/
- public int size() {
- return fields.size();
- }
+ int size();
+
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntity.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntity.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntity.java
index a5826d1..44214ac 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntity.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntity.java
@@ -19,122 +19,30 @@
package org.apache.olingo.commons.api.domain;
import java.net.URI;
-import java.util.ArrayList;
import java.util.List;
-import org.apache.commons.lang3.StringUtils;
/**
* OData entity.
*/
-public class ODataEntity extends AbstractODataPayload implements ODataInvokeResult {
+public interface ODataEntity extends ODataInvokeResult {
- private static final long serialVersionUID = 8360640095932811034L;
+ String getName();
- /**
- * Entity reference.
- */
- private String reference;
-
- /**
- * ETag.
- */
- private String eTag;
-
- /**
- * Media entity flag.
- */
- private boolean mediaEntity = false;
-
- /**
- * In case of media entity, media content type.
- */
- private String mediaContentType;
-
- /**
- * In case of media entity, media content source.
- */
- private String mediaContentSource;
-
- /**
- * Edit link.
- */
- protected URI editLink;
-
- /**
- * Navigation links (might contain in-line entities or feeds).
- */
- protected final List<ODataLink> navigationLinks = new ArrayList<ODataLink>();
-
- /**
- * Association links.
- */
- protected final List<ODataLink> associationLinks = new ArrayList<ODataLink>();
-
- /**
- * Media edit links.
- */
- protected final List<ODataLink> editMediaLinks = new ArrayList<ODataLink>();
-
- /**
- * Operations (legacy, functions, actions).
- */
- protected final List<ODataOperation> operations = new ArrayList<ODataOperation>();
-
- /**
- * Entity properties.
- */
- protected final List<ODataProperty> properties = new ArrayList<ODataProperty>();
-
- /**
- * Constructor.
- *
- * @param name OData entity name.
- */
- public ODataEntity(final String name) {
- super(name);
- }
-
- /**
- * To request entity references in place of the actual entities, the client issues a GET request with /$ref appended
- * to the resource path.
- * <br />
- * If the resource path does not identify an entity or a collection of entities, the service returns 404 Not Found.
- * <br />
- * If the resource path terminates on a collection, the response MUST be the format-specific representation of a
- * collection of entity references pointing to the related entities. If no entities are related, the response is the
- * format-specific representation of an empty collection.
- * <br />
- * If the resource path terminates on a single entity, the response MUST be the format-specific representation of an
- * entity reference pointing to the related single entity. If the resource path terminates on a single entity and no
- * such entity exists, the service returns 404 Not Found.
- *
- * @return entity reference.
- */
- public String getReference() {
- return reference;
- }
-
- public void setReference(final String reference) {
- this.reference = reference;
- }
+ URI getLink();
/**
* Gets ETag.
*
* @return ETag.
*/
- public String getETag() {
- return eTag;
- }
+ String getETag();
/**
* Sets ETag.
*
* @param eTag ETag.
*/
- public void setETag(final String eTag) {
- this.eTag = eTag;
- }
+ void setETag(String eTag);
/**
* Searches for operation with given title.
@@ -142,25 +50,14 @@ public class ODataEntity extends AbstractODataPayload implements ODataInvokeResu
* @param title operation to look for
* @return operation if found with given title, <tt>null</tt> otherwise
*/
- public ODataOperation getOperation(final String title) {
- ODataOperation result = null;
- for (ODataOperation operation : operations) {
- if (title.equals(operation.getTitle())) {
- result = operation;
- }
- }
-
- return result;
- }
+ ODataOperation getOperation(String title);
/**
* Gets operations.
*
* @return operations.
*/
- public List<ODataOperation> getOperations() {
- return this.operations;
- }
+ List<ODataOperation> getOperations();
/**
* Searches for property with given name.
@@ -168,28 +65,14 @@ public class ODataEntity extends AbstractODataPayload implements ODataInvokeResu
* @param name property to look for
* @return property if found with given name, <tt>null</tt> otherwise
*/
- public ODataProperty getProperty(final String name) {
- ODataProperty result = null;
-
- if (StringUtils.isNotBlank(name)) {
- for (ODataProperty property : properties) {
- if (name.equals(property.getName())) {
- result = property;
- }
- }
- }
-
- return result;
- }
+ ODataProperty getProperty(String name);
/**
* Returns OData entity properties.
*
* @return OData entity properties.
*/
- public List<ODataProperty> getProperties() {
- return properties;
- }
+ List<ODataProperty> getProperties();
/**
* Puts the given link into one of available lists, based on its type.
@@ -197,28 +80,7 @@ public class ODataEntity extends AbstractODataPayload implements ODataInvokeResu
* @param link to be added
* @return <tt>true</tt> if the given link was added in one of available lists
*/
- public boolean addLink(final ODataLink link) {
- boolean result = false;
-
- switch (link.getType()) {
- case ASSOCIATION:
- result = associationLinks.contains(link) ? false : associationLinks.add(link);
- break;
-
- case ENTITY_NAVIGATION:
- case ENTITY_SET_NAVIGATION:
- result = navigationLinks.contains(link) ? false : navigationLinks.add(link);
- break;
-
- case MEDIA_EDIT:
- result = editMediaLinks.contains(link) ? false : editMediaLinks.add(link);
- break;
-
- default:
- }
-
- return result;
- }
+ boolean addLink(ODataLink link);
/**
* Removes the given link from any list (association, navigation, edit-media).
@@ -226,120 +88,110 @@ public class ODataEntity extends AbstractODataPayload implements ODataInvokeResu
* @param link to be removed
* @return <tt>true</tt> if the given link was contained in one of available lists
*/
- public boolean removeLink(final ODataLink link) {
- return associationLinks.remove(link) || navigationLinks.remove(link) || editMediaLinks.remove(link);
- }
+ boolean removeLink(ODataLink link);
/**
- * Returns all entity navigation links (including inline entities / feeds).
+ * Returns all entity association links.
*
* @return OData entity links.
*/
- public List<ODataLink> getNavigationLinks() {
- return navigationLinks;
- }
+ List<ODataLink> getAssociationLinks();
/**
- * Returns all entity association links.
+ * Returns all entity navigation links (including inline entities / feeds).
*
* @return OData entity links.
*/
- public List<ODataLink> getAssociationLinks() {
- return associationLinks;
- }
+ List<ODataLink> getNavigationLinks();
/**
* Returns all entity media edit links.
*
* @return OData entity links.
*/
- public List<ODataLink> getEditMediaLinks() {
- return editMediaLinks;
- }
+ List<ODataLink> getEditMediaLinks();
/**
* Returns OData entity edit link.
*
* @return entity edit link.
*/
- public URI getEditLink() {
- return editLink;
- }
+ URI getEditLink();
/**
* Sets OData entity edit link.
*
* @param editLink edit link.
*/
- public void setEditLink(final URI editLink) {
- this.editLink = editLink;
- }
-
- @Override
- public URI getLink() {
- return super.getLink() == null ? getEditLink() : super.getLink();
- }
+ void setEditLink(URI editLink);
/**
* TRUE if read-only entity.
*
* @return TRUE if read-only; FALSE otherwise.
*/
- public boolean isReadOnly() {
- return super.getLink() != null;
- }
+ boolean isReadOnly();
/**
* Checks if the current entity is a media entity.
*
* @return 'TRUE' if media entity; 'FALSE' otherwise.
*/
- public boolean isMediaEntity() {
- return mediaEntity;
- }
+ boolean isMediaEntity();
/**
* Sets media entity flag.
*
* @param isMediaEntity media entity flag value.
*/
- public void setMediaEntity(final boolean isMediaEntity) {
- this.mediaEntity = isMediaEntity;
- }
+ void setMediaEntity(boolean isMediaEntity);
/**
* Gets media content type.
*
* @return media content type.
*/
- public String getMediaContentType() {
- return mediaContentType;
- }
+ String getMediaContentType();
/**
* Sets media content type.
*
* @param mediaContentType media content type.
*/
- public void setMediaContentType(final String mediaContentType) {
- this.mediaContentType = mediaContentType;
- }
+ void setMediaContentType(String mediaContentType);
/**
* Gets media content source.
*
* @return media content source.
*/
- public String getMediaContentSource() {
- return mediaContentSource;
- }
+ String getMediaContentSource();
/**
* Sets media content source.
*
* @param mediaContentSource media content source.
*/
- public void setMediaContentSource(final String mediaContentSource) {
- this.mediaContentSource = mediaContentSource;
- }
+ void setMediaContentSource(String mediaContentSource);
+
+ /**
+ * To request entity references in place of the actual entities, the client issues a GET request with /$ref appended
+ * to the resource path.
+ * <br />
+ * If the resource path does not identify an entity or a collection of entities, the service returns 404 Not Found.
+ * <br />
+ * If the resource path terminates on a collection, the response MUST be the format-specific representation of a
+ * collection of entity references pointing to the related entities. If no entities are related, the response is the
+ * format-specific representation of an empty collection.
+ * <br />
+ * If the resource path terminates on a single entity, the response MUST be the format-specific representation of an
+ * entity reference pointing to the related single entity. If the resource path terminates on a single entity and no
+ * such entity exists, the service returns 404 Not Found.
+ *
+ * @return entity reference.
+ */
+ String getReference();
+
+ void setReference(String reference);
+
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntitySet.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntitySet.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntitySet.java
index 083b7ad..99b6962 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntitySet.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataEntitySet.java
@@ -19,102 +19,39 @@
package org.apache.olingo.commons.api.domain;
import java.net.URI;
-import java.util.ArrayList;
import java.util.List;
/**
* OData entity collection. If pagination was used to get this instance, forward page navigation URI will be available.
*/
-public class ODataEntitySet extends AbstractODataPayload implements ODataInvokeResult {
-
- private static final long serialVersionUID = 9039605899821494024L;
-
- /**
- * Link to the next page.
- */
- protected URI next;
-
- /**
- * Number of ODataEntities contained in this feed. If <tt>$inlinecount</tt> was requested, this value comes from
- * there.
- */
- protected Integer count;
-
- /**
- * OData entities contained in this feed.
- */
- protected List<ODataEntity> entities = new ArrayList<ODataEntity>();
-
- /**
- * Constructor.
- */
- public ODataEntitySet() {
- super(null);
- }
-
- /**
- * Constructor.
- *
- * @param next next link.
- */
- public ODataEntitySet(final URI next) {
- super(null);
- this.next = next;
- }
+public interface ODataEntitySet extends ODataInvokeResult {
/**
* Gets next page link.
*
* @return next page link; null value if single page or last page reached.
*/
- public URI getNext() {
- return next;
- }
+ URI getNext();
/**
- * Sets in-line count.
+ * Gets contained entities.
*
- * @param count in-line count value.
+ * @return feed entries.
*/
- public void setCount(final int count) {
- this.count = count;
- }
+ List<ODataEntity> getEntities();
/**
* Gets in-line count.
*
* @return in-line count value.
*/
- public int getCount() {
- return count == null ? entities.size() : count;
- }
-
- /**
- * Adds entity to the current feed.
- *
- * @param entity entity to be added.
- * @return 'FALSE' if already exists; 'TRUE' otherwise.
- */
- public boolean addEntity(final ODataEntity entity) {
- return entities.contains(entity) ? false : entities.add(entity);
- }
+ int getCount();
/**
- * Removes an entity.
+ * Sets in-line count.
*
- * @param entity entity to be removed.
- * @return 'TRUE' in case of success; 'FALSE' otherwise.
+ * @param count in-line count value.
*/
- public boolean removeEntity(final ODataEntity entity) {
- return entities.remove(entity);
- }
+ void setCount(final int count);
- /**
- * Gets contained entities.
- *
- * @return feed entries.
- */
- public List<ODataEntity> getEntities() {
- return entities;
- }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataObjectFactory.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataObjectFactory.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataObjectFactory.java
index d8cbbbc..7114c5b 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataObjectFactory.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataObjectFactory.java
@@ -22,11 +22,6 @@ import java.net.URI;
/**
* Entry point for generating OData domain objects.
- *
- * @see ODataEntitySet
- * @see ODataEntity
- * @see ODataProperty
- * @see ODataLink
*/
public interface ODataObjectFactory {
@@ -180,6 +175,12 @@ public interface ODataObjectFactory {
*/
ODataLink newMediaEditLink(String name, URI baseURI, String href);
+ ODataPrimitiveValue.Builder newPrimitiveValueBuilder();
+
+ ODataComplexValue newComplexValue(String typeName);
+
+ ODataCollectionValue newCollectionValue(String typeName);
+
/**
* Instantiates a new primitive property.
*
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataProperty.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataProperty.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataProperty.java
index e43f68c..4cfa303 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataProperty.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataProperty.java
@@ -19,141 +19,73 @@
package org.apache.olingo.commons.api.domain;
import java.io.Serializable;
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
/**
* OData entity property.
*/
-public class ODataProperty implements Serializable, ODataInvokeResult {
-
- private static final long serialVersionUID = 926939448778950450L;
-
- /**
- * Property name.
- */
- private final String name;
-
- /**
- * Property value.
- */
- private ODataValue value;
-
- /**
- * Constructor.
- *
- * @param name property name.
- * @param value property value.
- */
- public ODataProperty(final String name, final ODataValue value) {
- this.name = name;
- this.value = value;
- }
+public interface ODataProperty extends ODataInvokeResult, Serializable {
/**
* Returns property name.
*
* @return property name.
*/
- public String getName() {
- return name;
- }
-
- /**
- * Returns property value.
- *
- * @return property value.
- */
- public ODataValue getValue() {
- return value;
- }
+ String getName();
/**
* Checks if has null value.
*
* @return 'TRUE' if has null value; 'FALSE' otherwise.
*/
- public boolean hasNullValue() {
- return this.value == null;
- }
+ boolean hasNullValue();
/**
* Checks if has primitive value.
*
* @return 'TRUE' if has primitive value; 'FALSE' otherwise.
*/
- public boolean hasPrimitiveValue() {
- return !hasNullValue() && this.value.isPrimitive();
- }
+ boolean hasPrimitiveValue();
/**
* Gets primitive value.
*
* @return primitive value if exists; null otherwise.
*/
- public ODataPrimitiveValue getPrimitiveValue() {
- return hasPrimitiveValue() ? this.value.asPrimitive() : null;
- }
+ ODataPrimitiveValue getPrimitiveValue();
/**
- * Checks if has complex value.
- *
- * @return 'TRUE' if has complex value; 'FALSE' otherwise.
- */
- public boolean hasComplexValue() {
- return !hasNullValue() && this.value.isComplex();
- }
-
- /**
- * Gets complex value.
+ * Returns property value.
*
- * @return complex value if exists; null otherwise.
+ * @return property value.
*/
- public ODataComplexValue getComplexValue() {
- return hasComplexValue() ? this.value.asComplex() : null;
- }
+ ODataValue getValue();
/**
* Checks if has collection value.
*
* @return 'TRUE' if has collection value; 'FALSE' otherwise.
*/
- public boolean hasCollectionValue() {
- return !hasNullValue() && this.value.isCollection();
- }
+ boolean hasCollectionValue();
/**
* Gets collection value.
*
* @return collection value if exists; null otherwise.
*/
- public ODataCollectionValue getCollectionValue() {
- return hasCollectionValue() ? this.value.asCollection() : null;
- }
+ ODataCollectionValue getCollectionValue();
/**
- * {@inheritDoc }
+ * Checks if has complex value.
+ *
+ * @return 'TRUE' if has complex value; 'FALSE' otherwise.
*/
- @Override
- public boolean equals(final Object obj) {
- return EqualsBuilder.reflectionEquals(this, obj);
- }
+ boolean hasComplexValue();
/**
- * {@inheritDoc }
+ * Gets complex value.
+ *
+ * @return complex value if exists; null otherwise.
*/
- @Override
- public int hashCode() {
- return HashCodeBuilder.reflectionHashCode(this);
- }
+ ODataComplexValue getComplexValue();
- /**
- * {@inheritDoc }
- */
- @Override
- public String toString() {
- return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
- }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/ceda4740/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataValue.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataValue.java
index b427e8f..6db4b2b 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataValue.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataValue.java
@@ -26,6 +26,13 @@ import java.io.Serializable;
public interface ODataValue extends Serializable {
/**
+ * Gets value type name.
+ *
+ * @return value type name.
+ */
+ String getTypeName();
+
+ /**
* Check is is a primitive value.
*
* @return 'TRUE' if primitive; 'FALSE' otherwise.
[13/51] [abbrv] git commit: [OLINGO-205] refactoring in order to add
context url and metadata etag management
Posted by il...@apache.org.
[OLINGO-205] refactoring in order to add context url and metadata etag management
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/e4bf2132
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/e4bf2132
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/e4bf2132
Branch: refs/heads/master
Commit: e4bf21325df8f96927096fa875ff1db5fda49662
Parents: cde94fc
Author: fmartelli <fa...@gmail.com>
Authored: Thu Mar 27 15:41:09 2014 +0100
Committer: fmartelli <fa...@gmail.com>
Committed: Thu Mar 27 15:41:09 2014 +0100
----------------------------------------------------------------------
.../communication/response/ODataResponse.java | 25 +++++
.../api/domain/ODataEntitySetIterator.java | 6 +-
.../client/api/op/ClientODataDeserializer.java | 3 +-
.../olingo/client/api/op/CommonODataReader.java | 3 +-
.../client/api/op/v3/ODataDeserializer.java | 3 +-
.../retrieve/ODataEntityRequestImpl.java | 8 +-
.../retrieve/ODataEntitySetRequestImpl.java | 14 ++-
.../request/retrieve/ODataRawRequestImpl.java | 10 +-
.../response/AbstractODataResponse.java | 40 ++++++++
.../client/core/op/AbstractODataReader.java | 63 +++++++++----
.../core/op/impl/v3/ODataDeserializerImpl.java | 14 +--
.../client/core/op/impl/v3/ODataReaderImpl.java | 21 +++--
.../core/op/impl/v4/ODataDeserializerImpl.java | 7 +-
.../client/core/op/impl/v4/ODataReaderImpl.java | 1 -
.../client/core/AbstractPrimitiveTest.java | 4 +-
.../apache/olingo/client/core/AbstractTest.java | 2 -
.../core/it/v3/QueryOptionsTestITCase.java | 2 +-
.../client/core/it/v4/EntitySetTestITCase.java | 4 +-
.../apache/olingo/client/core/v3/AtomTest.java | 8 +-
.../olingo/client/core/v3/EntitySetTest.java | 2 +-
.../olingo/client/core/v3/EntityTest.java | 10 +-
.../apache/olingo/commons/api/Constants.java | 4 +
.../olingo/commons/api/data/Container.java | 76 +++++++++++++++
.../commons/api/op/CommonODataDeserializer.java | 8 +-
.../commons/core/data/AbstractAtomDealer.java | 4 +
.../commons/core/data/AbstractAtomObject.java | 97 --------------------
.../olingo/commons/core/data/AbstractEntry.java | 2 +-
.../commons/core/data/AbstractODataObject.java | 97 ++++++++++++++++++++
.../commons/core/data/AtomDeserializer.java | 61 ++++++------
.../olingo/commons/core/data/AtomFeedImpl.java | 2 +-
.../commons/core/data/AtomSerializer.java | 10 +-
.../core/op/AbstractODataDeserializer.java | 53 +++++++----
32 files changed, 440 insertions(+), 224 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e4bf2132/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataResponse.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataResponse.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataResponse.java
index 65434ec..5498d1b 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataResponse.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataResponse.java
@@ -19,6 +19,7 @@
package org.apache.olingo.client.api.communication.response;
import java.io.InputStream;
+import java.net.URI;
import java.util.Collection;
import java.util.Map;
import org.apache.olingo.client.api.communication.header.HeaderName;
@@ -58,6 +59,30 @@ public interface ODataResponse {
* @return ETag header value, if provided
*/
String getEtag();
+
+ /**
+ * The context URL describes the content of the payload. It consists of the canonical metadata document URL and a
+ * fragment identifying the relevant portion of the metadata document.
+ * <br />
+ * Request payloads generally do not require context URLs as the type of the payload can generally be determined from
+ * the request URL.
+ * <br />
+ * For details on how the context URL is used to describe a payload, see the relevant sections in the particular
+ * format.
+ *
+ * @return context URL.
+ */
+ URI getContextURL();
+
+ /**
+ * An ETag header MAY also be returned on a metadata document request or service document request to allow the client
+ * subsequently to make a conditional request for the metadata or service document. Clients can also compare the value
+ * of the ETag header returned from a metadata document request to the metadata ETag returned in a response in order
+ * to verify the version of the metadata used to generate that response.
+ *
+ * @return metadata ETag.
+ */
+ String getMetadataETag();
/**
* Gets the content type.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e4bf2132/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java
index 9d720bf..e5eeeed 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/domain/ODataEntitySetIterator.java
@@ -170,7 +170,7 @@ public class ODataEntitySetIterator implements Iterator<ODataEntity> {
Entry jsonEntry = null;
try {
- int c = 0;
+ int c;
boolean foundNewOne = false;
@@ -203,7 +203,7 @@ public class ODataEntitySetIterator implements Iterator<ODataEntity> {
if (c >= 0) {
jsonEntry = odataClient.getDeserializer().toEntry(
- new ByteArrayInputStream(entry.toByteArray()), ODataPubFormat.JSON);
+ new ByteArrayInputStream(entry.toByteArray()), ODataPubFormat.JSON).getObject();
}
} else {
while ((c = input.read()) >= 0) {
@@ -237,7 +237,7 @@ public class ODataEntitySetIterator implements Iterator<ODataEntity> {
if (consume(input, "</entry>", entry, true) >= 0) {
atomEntry = odataClient.getDeserializer().
- toEntry(new ByteArrayInputStream(entry.toByteArray()), ODataPubFormat.ATOM);
+ toEntry(new ByteArrayInputStream(entry.toByteArray()), ODataPubFormat.ATOM).getObject();
}
}
} catch (Exception e) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e4bf2132/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ClientODataDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ClientODataDeserializer.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ClientODataDeserializer.java
index ad482fb..24b6e60 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ClientODataDeserializer.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/ClientODataDeserializer.java
@@ -21,6 +21,7 @@ package org.apache.olingo.client.api.op;
import java.io.InputStream;
import org.apache.olingo.client.api.data.ServiceDocument;
import org.apache.olingo.client.api.edm.xml.XMLMetadata;
+import org.apache.olingo.commons.api.data.Container;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.op.CommonODataDeserializer;
@@ -35,5 +36,5 @@ public interface ClientODataDeserializer extends CommonODataDeserializer {
* @param format OData service document format.
* @return <tt>ServiceDocument</tt> object.
*/
- ServiceDocument toServiceDocument(InputStream input, ODataFormat format);
+ Container<ServiceDocument> toServiceDocument(InputStream input, ODataFormat format);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e4bf2132/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataReader.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataReader.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataReader.java
index 9164918..f13e0ac 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataReader.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/CommonODataReader.java
@@ -22,6 +22,7 @@ import java.io.InputStream;
import java.io.Serializable;
import java.util.List;
import org.apache.olingo.client.api.edm.xml.Schema;
+import org.apache.olingo.commons.api.data.Container;
import org.apache.olingo.commons.api.domain.ODataError;
import org.apache.olingo.commons.api.domain.ODataEntity;
import org.apache.olingo.commons.api.domain.ODataEntitySet;
@@ -111,5 +112,5 @@ public interface CommonODataReader extends Serializable {
* @param reference reference.
* @return read object.
*/
- <T> T read(InputStream src, String format, Class<T> reference);
+ <T> Container<T> read(InputStream src, String format, Class<T> reference);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e4bf2132/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataDeserializer.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataDeserializer.java
index b12b104..bc16b74 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataDeserializer.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/op/v3/ODataDeserializer.java
@@ -20,6 +20,7 @@ package org.apache.olingo.client.api.op.v3;
import java.io.InputStream;
import org.apache.olingo.client.api.op.ClientODataDeserializer;
+import org.apache.olingo.commons.api.data.Container;
import org.apache.olingo.commons.api.data.v3.LinkCollection;
import org.apache.olingo.commons.api.format.ODataFormat;
@@ -32,6 +33,6 @@ public interface ODataDeserializer extends ClientODataDeserializer {
* @param format OData format.
* @return de-serialized links.
*/
- LinkCollection toLinkCollection(InputStream input, ODataFormat format);
+ Container<LinkCollection> toLinkCollection(InputStream input, ODataFormat format);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e4bf2132/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntityRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntityRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntityRequestImpl.java
index 447f543..481d41e 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntityRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntityRequestImpl.java
@@ -24,6 +24,8 @@ import org.apache.http.client.HttpClient;
import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
+import org.apache.olingo.commons.api.data.Container;
+import org.apache.olingo.commons.api.data.Entry;
import org.apache.olingo.commons.api.domain.ODataEntity;
import org.apache.olingo.commons.api.format.ODataPubFormat;
@@ -83,8 +85,10 @@ public class ODataEntityRequestImpl extends AbstractODataRetrieveRequest<ODataEn
public ODataEntity getBody() {
if (entity == null) {
try {
- entity = odataClient.getReader().
- readEntity(getRawResponse(), ODataPubFormat.fromString(getContentType()));
+ final Container<Entry> entry =
+ odataClient.getDeserializer().toEntry(getRawResponse(), ODataPubFormat.fromString(getContentType()));
+
+ entity = odataClient.getBinder().getODataEntity(extractFromContainer(entry));
} finally {
this.close();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e4bf2132/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java
index ef191ba..bb46ce8 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataEntitySetRequestImpl.java
@@ -24,6 +24,8 @@ import org.apache.http.client.HttpClient;
import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
+import org.apache.olingo.commons.api.data.Container;
+import org.apache.olingo.commons.api.data.Feed;
import org.apache.olingo.commons.api.domain.ODataEntitySet;
import org.apache.olingo.commons.api.format.ODataPubFormat;
@@ -33,7 +35,7 @@ import org.apache.olingo.commons.api.format.ODataPubFormat;
public class ODataEntitySetRequestImpl extends AbstractODataRetrieveRequest<ODataEntitySet, ODataPubFormat>
implements ODataEntitySetRequest {
- private ODataEntitySet feed = null;
+ private ODataEntitySet entitySet = null;
/**
* Private constructor.
@@ -83,15 +85,17 @@ public class ODataEntitySetRequestImpl extends AbstractODataRetrieveRequest<ODat
@Override
@SuppressWarnings("unchecked")
public ODataEntitySet getBody() {
- if (feed == null) {
+ if (entitySet == null) {
try {
- feed = odataClient.getReader().
- readEntitySet(getRawResponse(), ODataPubFormat.fromString(getContentType()));
+ final Container<Feed> feed =
+ odataClient.getDeserializer().toFeed(getRawResponse(), ODataPubFormat.fromString(getContentType()));
+
+ entitySet = odataClient.getBinder().getODataEntitySet(extractFromContainer(feed));
} finally {
this.close();
}
}
- return feed;
+ return entitySet;
}
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e4bf2132/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataRawRequestImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataRawRequestImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataRawRequestImpl.java
index 0212048..09f4c14 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataRawRequestImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/ODataRawRequestImpl.java
@@ -31,6 +31,7 @@ import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.http.HttpMethod;
import org.apache.olingo.client.core.communication.request.ODataRequestImpl;
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
+import org.apache.olingo.commons.api.data.Container;
/**
* This class implements a generic OData request.
@@ -92,10 +93,11 @@ public class ODataRawRequestImpl extends ODataRequestImpl<ODataPubFormat>
this.close();
}
}
-
- return odataClient.getReader().read(new ByteArrayInputStream(obj), getContentType(), reference);
- }
- }
+ final Container<T> container =
+ odataClient.getReader().read(new ByteArrayInputStream(obj), getContentType(), reference);
+ return extractFromContainer(container);
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e4bf2132/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/response/AbstractODataResponse.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/response/AbstractODataResponse.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/response/AbstractODataResponse.java
index 7b27906..c571cd6 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/response/AbstractODataResponse.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/response/AbstractODataResponse.java
@@ -22,6 +22,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
+import java.net.URI;
import java.util.Collection;
import java.util.HashSet;
import java.util.Map;
@@ -37,6 +38,7 @@ import org.apache.olingo.client.api.communication.response.ODataResponse;
import org.apache.olingo.client.api.http.NoContentException;
import org.apache.olingo.client.core.communication.request.batch.ODataBatchController;
import org.apache.olingo.client.core.communication.request.batch.ODataBatchUtilities;
+import org.apache.olingo.commons.api.data.Container;
import org.slf4j.LoggerFactory;
/**
@@ -50,6 +52,16 @@ public abstract class AbstractODataResponse implements ODataResponse {
protected static final org.slf4j.Logger LOG = LoggerFactory.getLogger(ODataResponse.class);
/**
+ * Context URL.
+ */
+ private URI contextURL;
+
+ /**
+ * Metadata ETag.
+ */
+ private String metadataETag;
+
+ /**
* HTTP client.
*/
protected final HttpClient client;
@@ -133,6 +145,24 @@ public abstract class AbstractODataResponse implements ODataResponse {
statusMessage = res.getStatusLine().getReasonPhrase();
}
+ @Override
+ public URI getContextURL() {
+ return contextURL;
+ }
+
+ protected void setContextURL(final URI contextURL) {
+ this.contextURL = contextURL;
+ }
+
+ @Override
+ public String getMetadataETag() {
+ return metadataETag;
+ }
+
+ protected void setMetadataETag(final String metadataETag) {
+ this.metadataETag = metadataETag;
+ }
+
/**
* {@inheritDoc}
*/
@@ -273,4 +303,14 @@ public abstract class AbstractODataResponse implements ODataResponse {
return payload;
}
+
+ protected <T> T extractFromContainer(final Container<T> container) {
+ if (container == null) {
+ return null;
+ }
+
+ setContextURL(container.getContextURL());
+ setMetadataETag(container.getMetadataETag());
+ return container.getObject();
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e4bf2132/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
index bd3695d..ffc58e1 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataReader.java
@@ -22,6 +22,7 @@ import java.io.InputStream;
import java.util.List;
import org.apache.commons.io.IOUtils;
import org.apache.olingo.client.api.CommonODataClient;
+import org.apache.olingo.client.api.data.ServiceDocument;
import org.apache.olingo.commons.api.domain.ODataError;
import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.domain.ODataEntity;
@@ -32,12 +33,15 @@ import org.apache.olingo.commons.api.domain.ODataProperty;
import org.apache.olingo.commons.api.domain.ODataServiceDocument;
import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.client.api.edm.xml.XMLMetadata;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.format.ODataPubFormat;
-import org.apache.olingo.commons.api.format.ODataValueFormat;
import org.apache.olingo.client.api.op.CommonODataReader;
import org.apache.olingo.client.core.edm.EdmClientImpl;
+import org.apache.olingo.commons.api.data.Container;
+import org.apache.olingo.commons.api.data.Entry;
+import org.apache.olingo.commons.api.data.Feed;
import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
+import org.apache.olingo.commons.api.format.ODataValueFormat;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -69,22 +73,23 @@ public abstract class AbstractODataReader implements CommonODataReader {
@Override
public ODataServiceDocument readServiceDocument(final InputStream input, final ODataFormat format) {
- return client.getBinder().getODataServiceDocument(client.getDeserializer().toServiceDocument(input, format));
+ return client.getBinder().getODataServiceDocument(
+ client.getDeserializer().toServiceDocument(input, format).getObject());
}
@Override
public ODataEntitySet readEntitySet(final InputStream input, final ODataPubFormat format) {
- return client.getBinder().getODataEntitySet(client.getDeserializer().toFeed(input, format));
+ return client.getBinder().getODataEntitySet(client.getDeserializer().toFeed(input, format).getObject());
}
@Override
public ODataEntity readEntity(final InputStream input, final ODataPubFormat format) {
- return client.getBinder().getODataEntity(client.getDeserializer().toEntry(input, format));
+ return client.getBinder().getODataEntity(client.getDeserializer().toEntry(input, format).getObject());
}
@Override
public ODataProperty readProperty(final InputStream input, final ODataFormat format) {
- final Property property = client.getDeserializer().toProperty(input, format);
+ final Property property = client.getDeserializer().toProperty(input, format).getObject();
return client.getBinder().getODataProperty(property);
}
@@ -95,30 +100,48 @@ public abstract class AbstractODataReader implements CommonODataReader {
@Override
@SuppressWarnings("unchecked")
- public <T> T read(final InputStream src, final String format, final Class<T> reference) {
- Object res;
+ public <T> Container<T> read(final InputStream src, final String format, final Class<T> reference) {
+ Container<T> res;
try {
if (ODataEntitySetIterator.class.isAssignableFrom(reference)) {
- res = new ODataEntitySetIterator(client, src, ODataPubFormat.fromString(format));
+ res = new Container<T>(
+ null, null, (T) new ODataEntitySetIterator(client, src, ODataPubFormat.fromString(format)));
} else if (ODataEntitySet.class.isAssignableFrom(reference)) {
- res = readEntitySet(src, ODataPubFormat.fromString(format));
+ final Container<Feed> container = client.getDeserializer().toFeed(src, ODataPubFormat.fromString(format));
+ res = new Container<T>(
+ container.getContextURL(),
+ container.getMetadataETag(),
+ (T) client.getBinder().getODataEntitySet(container.getObject()));
} else if (ODataEntity.class.isAssignableFrom(reference)) {
- res = readEntity(src, ODataPubFormat.fromString(format));
+ final Container<Entry> container = client.getDeserializer().toEntry(src, ODataPubFormat.fromString(format));
+ res = new Container<T>(
+ container.getContextURL(),
+ container.getMetadataETag(),
+ (T) client.getBinder().getODataEntity(container.getObject()));
} else if (ODataProperty.class.isAssignableFrom(reference)) {
- res = readProperty(src, ODataFormat.fromString(format));
+ final Container<Property> container = client.getDeserializer().toProperty(src, ODataFormat.fromString(format));
+ res = new Container<T>(
+ container.getContextURL(),
+ container.getMetadataETag(),
+ (T) client.getBinder().getODataProperty(container.getObject()));
} else if (ODataValue.class.isAssignableFrom(reference)) {
- res = client.getPrimitiveValueBuilder().
+ res = new Container<T>(null, null, (T) client.getPrimitiveValueBuilder().
setType(ODataValueFormat.fromString(format) == ODataValueFormat.TEXT
- ? EdmPrimitiveTypeKind.String : EdmPrimitiveTypeKind.Stream).
+ ? EdmPrimitiveTypeKind.String : EdmPrimitiveTypeKind.Stream).
setText(IOUtils.toString(src)).
- build();
+ build());
} else if (XMLMetadata.class.isAssignableFrom(reference)) {
- res = readMetadata(src);
+ res = new Container<T>(null, null, (T) readMetadata(src));
} else if (ODataServiceDocument.class.isAssignableFrom(reference)) {
- res = readServiceDocument(src, ODataFormat.fromString(format));
+ final Container<ServiceDocument> container =
+ client.getDeserializer().toServiceDocument(src, ODataFormat.fromString(format));
+ res = new Container<T>(
+ container.getContextURL(),
+ container.getMetadataETag(),
+ (T) client.getBinder().getODataServiceDocument(container.getObject()));
} else if (ODataError.class.isAssignableFrom(reference)) {
- res = readError(src, !format.toString().contains("json"));
+ res = new Container<T>(null, null, (T) readError(src, !format.toString().contains("json")));
} else {
throw new IllegalArgumentException("Invalid reference type " + reference);
}
@@ -131,6 +154,6 @@ public abstract class AbstractODataReader implements CommonODataReader {
}
}
- return (T) res;
+ return res;
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e4bf2132/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java
index f88ae96..01bacbe 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java
@@ -31,6 +31,7 @@ import org.apache.olingo.client.core.data.v3.JSONServiceDocumentImpl;
import org.apache.olingo.client.core.data.v4.XMLServiceDocumentImpl;
import org.apache.olingo.client.core.edm.xml.v3.EdmxImpl;
import org.apache.olingo.client.core.edm.xml.v3.XMLMetadataImpl;
+import org.apache.olingo.commons.api.data.Container;
import org.apache.olingo.commons.core.op.AbstractODataDeserializer;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
@@ -52,17 +53,16 @@ public class ODataDeserializerImpl extends AbstractODataDeserializer implements
}
@Override
- public ServiceDocument toServiceDocument(final InputStream input, final ODataFormat format) {
+ public Container<ServiceDocument> toServiceDocument(final InputStream input, final ODataFormat format) {
return format == ODataFormat.XML
- ? xml(input, XMLServiceDocumentImpl.class)
- : json(input, JSONServiceDocumentImpl.class);
+ ? this.<ServiceDocument, XMLServiceDocumentImpl>xml(input, XMLServiceDocumentImpl.class)
+ : this.<ServiceDocument, JSONServiceDocumentImpl>json(input, JSONServiceDocumentImpl.class);
}
@Override
- public LinkCollection toLinkCollection(final InputStream input, final ODataFormat format) {
+ public Container<LinkCollection> toLinkCollection(final InputStream input, final ODataFormat format) {
return format == ODataFormat.XML
- ? atom(input, XMLLinkCollectionImpl.class)
- : json(input, JSONLinkCollectionImpl.class);
+ ? this.<LinkCollection, XMLLinkCollectionImpl>atom(input, XMLLinkCollectionImpl.class)
+ : this.<LinkCollection, JSONLinkCollectionImpl>json(input, JSONLinkCollectionImpl.class);
}
-
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e4bf2132/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java
index beb69b9..b9cf6de 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java
@@ -25,6 +25,8 @@ import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.client.api.op.v3.ODataReader;
import org.apache.olingo.client.api.v3.ODataClient;
import org.apache.olingo.client.core.op.AbstractODataReader;
+import org.apache.olingo.commons.api.data.Container;
+import org.apache.olingo.commons.api.data.v3.LinkCollection;
public class ODataReaderImpl extends AbstractODataReader implements ODataReader {
@@ -37,15 +39,22 @@ public class ODataReaderImpl extends AbstractODataReader implements ODataReader
@Override
public ODataLinkCollection readLinks(final InputStream input, final ODataFormat format) {
return ((ODataClient) client).getBinder().getLinkCollection(
- ((ODataClient) client).getDeserializer().toLinkCollection(input, format));
+ ((ODataClient) client).getDeserializer().toLinkCollection(input, format).getObject());
}
@Override
@SuppressWarnings("unchecked")
- public <T> T read(final InputStream src, final String format, final Class<T> reference) {
- return (ODataLinkCollection.class.isAssignableFrom(reference)
- ? (T) readLinks(src, ODataFormat.fromString(format))
- : super.read(src, format, reference));
+ public <T> Container<T> read(final InputStream src, final String format, final Class<T> reference) {
+ if (ODataLinkCollection.class.isAssignableFrom(reference)) {
+ final Container<LinkCollection> container =
+ ((ODataClient) client).getDeserializer().toLinkCollection(src, ODataFormat.fromString(format));
+
+ return new Container<T>(
+ container.getContextURL(),
+ container.getMetadataETag(),
+ (T) ((ODataClient) client).getBinder().getLinkCollection(container.getObject()));
+ } else {
+ return super.read(src, format, reference);
+ }
}
-
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e4bf2132/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataDeserializerImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataDeserializerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataDeserializerImpl.java
index f936853..08d3556 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataDeserializerImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataDeserializerImpl.java
@@ -28,6 +28,7 @@ import org.apache.olingo.client.core.data.v4.JSONServiceDocumentImpl;
import org.apache.olingo.client.core.data.v4.XMLServiceDocumentImpl;
import org.apache.olingo.client.core.edm.xml.v4.EdmxImpl;
import org.apache.olingo.client.core.edm.xml.v4.XMLMetadataImpl;
+import org.apache.olingo.commons.api.data.Container;
import org.apache.olingo.commons.core.op.AbstractODataDeserializer;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
@@ -49,10 +50,10 @@ public class ODataDeserializerImpl extends AbstractODataDeserializer implements
}
@Override
- public ServiceDocument toServiceDocument(final InputStream input, final ODataFormat format) {
+ public Container<ServiceDocument> toServiceDocument(final InputStream input, final ODataFormat format) {
return format == ODataFormat.XML
- ? xml(input, XMLServiceDocumentImpl.class)
- : json(input, JSONServiceDocumentImpl.class);
+ ? this.<ServiceDocument, XMLServiceDocumentImpl>xml(input, XMLServiceDocumentImpl.class)
+ : this.<ServiceDocument, JSONServiceDocumentImpl>json(input, JSONServiceDocumentImpl.class);
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e4bf2132/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java
index cb8958b..9340963 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java
@@ -29,5 +29,4 @@ public class ODataReaderImpl extends AbstractODataReader implements ODataReader
public ODataReaderImpl(final ODataClient client) {
super(client);
}
-
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e4bf2132/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java
index 04eb893..9a42d86 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractPrimitiveTest.java
@@ -75,7 +75,9 @@ public abstract class AbstractPrimitiveTest extends AbstractTest {
}
protected ODataPrimitiveValue readPrimitiveValue(final InputStream input) {
- final ODataProperty property = getClient().getReader().readProperty(input, getFormat());
+ final ODataProperty property = getClient().getBinder().getODataProperty(
+ getClient().getDeserializer().toProperty(input, getFormat()).getObject());
+
assertNotNull(property);
assertTrue(property.hasPrimitiveValue());
assertNotNull(property.getPrimitiveValue());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e4bf2132/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractTest.java
index 473b25e..04a5c96 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/AbstractTest.java
@@ -18,8 +18,6 @@
*/
package org.apache.olingo.client.core;
-import java.util.Locale;
-
import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.format.ODataPubFormat;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e4bf2132/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java
index a3fe55e..9f9c2c3 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/QueryOptionsTestITCase.java
@@ -192,7 +192,7 @@ public class QueryOptionsTestITCase extends AbstractTestITCase {
req.setFormat(ODataPubFormat.ATOM);
final Entry atomEntry =
- client.getDeserializer().toEntry(req.execute().getRawResponse(), ODataPubFormat.ATOM);
+ client.getDeserializer().toEntry(req.execute().getRawResponse(), ODataPubFormat.ATOM).getObject();
assertEquals("remotingdestructorprinterswitcheschannelssatellitelanguageresolve",
((AtomEntryImpl) atomEntry).getSummary());
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e4bf2132/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
index 473e721..2d78a6d 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntitySetTestITCase.java
@@ -104,7 +104,7 @@ public class EntitySetTestITCase extends AbstractTestITCase {
assertNotNull(feed);
- assertTrue(feed.getContextURL().toASCIIString().endsWith("$metadata#People"));
+ assertTrue(res.getContextURL().toASCIIString().endsWith("$metadata#People"));
debugFeed(client.getBinder().getFeed(feed, ResourceFactory.feedClassForFormat(
ODataPubFormat.ATOM == format)), "Just retrieved feed");
@@ -153,6 +153,6 @@ public class EntitySetTestITCase extends AbstractTestITCase {
final ODataEntitySet entitySet = res.getBodyAs(ODataEntitySet.class);
assertNotNull(entitySet);
- assertTrue(entitySet.getContextURL().toASCIIString().endsWith("$metadata#People"));
+ assertTrue(res.getContextURL().toASCIIString().endsWith("$metadata#People"));
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e4bf2132/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/AtomTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/AtomTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/AtomTest.java
index 755b44b..1be265b 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/AtomTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/AtomTest.java
@@ -70,8 +70,7 @@ public class AtomTest extends AbstractTest {
protected void feed(final String filename, final ODataPubFormat format) throws Exception {
final StringWriter writer = new StringWriter();
getClient().getSerializer().feed(getClient().getDeserializer().toFeed(
- getClass().getResourceAsStream("Customer." + getSuffix(format)), format),
- writer);
+ getClass().getResourceAsStream("Customer." + getSuffix(format)), format).getObject(), writer);
assertSimilar("Customer." + getSuffix(format), writer.toString());
}
@@ -84,7 +83,7 @@ public class AtomTest extends AbstractTest {
protected void entry(final String filename, final ODataPubFormat format) throws Exception {
final StringWriter writer = new StringWriter();
getClient().getSerializer().entry(getClient().getDeserializer().toEntry(
- getClass().getResourceAsStream(filename + "." + getSuffix(format)), format), writer);
+ getClass().getResourceAsStream(filename + "." + getSuffix(format)), format).getObject(), writer);
assertSimilar(filename + "." + getSuffix(format), writer.toString());
}
@@ -104,7 +103,7 @@ public class AtomTest extends AbstractTest {
protected void property(final String filename, final ODataFormat format) throws Exception {
final StringWriter writer = new StringWriter();
getClient().getSerializer().property(getClient().getDeserializer().
- toProperty(getClass().getResourceAsStream(filename + "." + getSuffix(format)), format), writer);
+ toProperty(getClass().getResourceAsStream(filename + "." + getSuffix(format)), format).getObject(), writer);
assertSimilar(filename + "." + getSuffix(format), writer.toString());
}
@@ -128,5 +127,4 @@ public class AtomTest extends AbstractTest {
property("Product_-10_ComplexConcurrency_QueriedDateTime", getODataFormat());
property("Product_-10_Dimensions_Width", getODataFormat());
}
-
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e4bf2132/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java
index c6fd0d8..0812c6d 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntitySetTest.java
@@ -40,7 +40,7 @@ public class EntitySetTest extends AbstractTest {
private void read(final ODataPubFormat format) throws IOException {
final InputStream input = getClass().getResourceAsStream("Customer." + getSuffix(format));
final ODataEntitySet entitySet = getClient().getBinder().getODataEntitySet(
- getClient().getDeserializer().toFeed(input, format));
+ getClient().getDeserializer().toFeed(input, format).getObject());
assertNotNull(entitySet);
assertEquals(2, entitySet.getEntities().size());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e4bf2132/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
index 151478a..80c56c2 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
@@ -46,7 +46,7 @@ public class EntityTest extends AbstractTest {
private void readAndWrite(final ODataPubFormat format) {
final InputStream input = getClass().getResourceAsStream("Customer_-10." + getSuffix(format));
final ODataEntity entity = getClient().getBinder().getODataEntity(
- getClient().getDeserializer().toEntry(input, format));
+ getClient().getDeserializer().toEntry(input, format).getObject());
assertNotNull(entity);
assertEquals("Microsoft.Test.OData.Services.AstoriaDefaultService.Customer", entity.getName());
@@ -82,7 +82,7 @@ public class EntityTest extends AbstractTest {
private void readGeospatial(final ODataPubFormat format) {
final InputStream input = getClass().getResourceAsStream("AllGeoTypesSet_-8." + getSuffix(format));
final ODataEntity entity = getClient().getBinder().getODataEntity(
- getClient().getDeserializer().toEntry(input, format));
+ getClient().getDeserializer().toEntry(input, format).getObject());
assertNotNull(entity);
boolean found = false;
@@ -114,7 +114,7 @@ public class EntityTest extends AbstractTest {
private void withActions(final ODataPubFormat format) {
final InputStream input = getClass().getResourceAsStream("ComputerDetail_-10." + getSuffix(format));
final ODataEntity entity = getClient().getBinder().getODataEntity(
- getClient().getDeserializer().toEntry(input, format));
+ getClient().getDeserializer().toEntry(input, format).getObject());
assertNotNull(entity);
assertEquals(1, entity.getOperations().size());
@@ -140,7 +140,7 @@ public class EntityTest extends AbstractTest {
private void mediaEntity(final ODataPubFormat format) {
final InputStream input = getClass().getResourceAsStream("Car_16." + getSuffix(format));
final ODataEntity entity = getClient().getBinder().getODataEntity(
- getClient().getDeserializer().toEntry(input, format));
+ getClient().getDeserializer().toEntry(input, format).getObject());
assertNotNull(entity);
assertTrue(entity.isMediaEntity());
assertNotNull(entity.getMediaContentSource());
@@ -164,7 +164,7 @@ public class EntityTest extends AbstractTest {
private void issue128(final ODataPubFormat format) throws EdmPrimitiveTypeException {
final InputStream input = getClass().getResourceAsStream("AllGeoTypesSet_-5." + getSuffix(format));
final ODataEntity entity = getClient().getBinder().getODataEntity(
- getClient().getDeserializer().toEntry(input, format));
+ getClient().getDeserializer().toEntry(input, format).getObject());
assertNotNull(entity);
final ODataProperty geogCollection = entity.getProperty("GeogCollection");
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e4bf2132/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
index 3b5b9cc..39d9614 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/Constants.java
@@ -141,6 +141,8 @@ public interface Constants {
public final static String JSON_METADATA = "odata.metadata";
+ public final static String JSON_METADATA_ETAG = "@odata.metadataEtag";
+
public final static String JSON_TYPE = "odata.type";
public final static String JSON_TYPE_SUFFIX = "@" + JSON_TYPE;
@@ -248,4 +250,6 @@ public interface Constants {
public static final String ATOM_ATTR_ETAG = "etag";
+ public static final String ATOM_ATTR_METADATAETAG = "metadata-etag";
+
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e4bf2132/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Container.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Container.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Container.java
new file mode 100644
index 0000000..be3476b
--- /dev/null
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/data/Container.java
@@ -0,0 +1,76 @@
+/*
+ * 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.commons.api.data;
+
+import java.net.URI;
+
+/**
+ * Outermost response object container.
+ */
+public class Container<T> {
+
+ private final URI contextURL;
+
+ private final String metadataETag;
+
+ private final T object;
+
+ public Container(final URI contextURL, final String metadataETag, final T object) {
+ this.contextURL = contextURL;
+ this.metadataETag = metadataETag;
+ this.object = object;
+ }
+
+ /**
+ * The context URL describes the content of the payload. It consists of the canonical metadata document URL and a
+ * fragment identifying the relevant portion of the metadata document.
+ * <br />
+ * Request payloads generally do not require context URLs as the type of the payload can generally be determined from
+ * the request URL.
+ * <br />
+ * For details on how the context URL is used to describe a payload, see the relevant sections in the particular
+ * format.
+ *
+ * @return context URL.
+ */
+ public URI getContextURL() {
+ return contextURL;
+ }
+
+ /**
+ * An ETag header MAY also be returned on a metadata document request or service document request to allow the client
+ * subsequently to make a conditional request for the metadata or service document. Clients can also compare the value
+ * of the ETag header returned from a metadata document request to the metadata ETag returned in a response in order
+ * to verify the version of the metadata used to generate that response.
+ *
+ * @return metadata ETag.
+ */
+ public String getMetadataETag() {
+ return metadataETag;
+ }
+
+ /**
+ * Gets contained object.
+ *
+ * @return contained object.
+ */
+ public T getObject() {
+ return object;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e4bf2132/lib/commons-api/src/main/java/org/apache/olingo/commons/api/op/CommonODataDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/op/CommonODataDeserializer.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/op/CommonODataDeserializer.java
index dfefb78..4b30ddd 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/op/CommonODataDeserializer.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/op/CommonODataDeserializer.java
@@ -20,6 +20,7 @@ package org.apache.olingo.commons.api.op;
import java.io.InputStream;
import java.io.Serializable;
+import org.apache.olingo.commons.api.data.Container;
import org.apache.olingo.commons.api.data.Entry;
import org.apache.olingo.commons.api.domain.ODataError;
import org.apache.olingo.commons.api.data.Feed;
@@ -39,7 +40,7 @@ public interface CommonODataDeserializer extends Serializable {
* @param format Atom or JSON
* @return Feed instance.
*/
- Feed toFeed(InputStream input, ODataPubFormat format);
+ Container<Feed> toFeed(InputStream input, ODataPubFormat format);
/**
* Gets an entry object from the given InputStream.
@@ -48,7 +49,7 @@ public interface CommonODataDeserializer extends Serializable {
* @param format Atom or JSON
* @return Entry instance.
*/
- Entry toEntry(InputStream input, ODataPubFormat format);
+ Container<Entry> toEntry(InputStream input, ODataPubFormat format);
/**
* Gets a property object from the given InputStream.
@@ -57,7 +58,7 @@ public interface CommonODataDeserializer extends Serializable {
* @param format XML or JSON
* @return Property instance.
*/
- Property toProperty(InputStream input, ODataFormat format);
+ Container<Property> toProperty(InputStream input, ODataFormat format);
/**
* Gets the ODataError object represented by the given InputStream.
@@ -67,5 +68,4 @@ public interface CommonODataDeserializer extends Serializable {
* @return
*/
ODataError toError(InputStream input, boolean isXML);
-
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e4bf2132/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java
index d4cf40a..e258219 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomDealer.java
@@ -34,6 +34,8 @@ abstract class AbstractAtomDealer {
protected final QName etagQName;
+ protected final QName metadataEtagQName;
+
protected final QName inlineQName;
protected final QName actionQName;
@@ -63,6 +65,8 @@ abstract class AbstractAtomDealer {
this.etagQName =
new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ATOM_ATTR_ETAG);
+ this.metadataEtagQName =
+ new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ATOM_ATTR_METADATAETAG);
this.inlineQName =
new QName(version.getNamespaceMap().get(ODataServiceVersion.NS_METADATA), Constants.ATOM_ELEM_INLINE);
this.actionQName =
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e4bf2132/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomObject.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomObject.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomObject.java
deleted file mode 100644
index 2436e3e..0000000
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractAtomObject.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * 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.commons.core.data;
-
-import com.fasterxml.jackson.databind.util.ISO8601DateFormat;
-import java.net.URI;
-import java.text.ParseException;
-import java.util.Date;
-
-abstract class AbstractAtomObject extends AbstractPayloadObject {
-
- private static final long serialVersionUID = -4391162864875546927L;
-
- private static final ISO8601DateFormat ISO_DATEFORMAT = new ISO8601DateFormat();
-
- private URI baseURI;
-
- private URI contextURL;
-
- private String id;
-
- private String title;
-
- private String summary;
-
- private Date updated;
-
- public URI getBaseURI() {
- return baseURI;
- }
-
- public void setBaseURI(final String baseURI) {
- this.baseURI = URI.create(baseURI);
- }
-
- /**
- * The context URL describes the content of the payload. It consists of the canonical metadata document URL and a
- * fragment identifying the relevant portion of the metadata document.
- *
- * @return context URL.
- */
- public URI getContextURL() {
- return contextURL;
- }
-
- public void setContextURL(final URI contextURL) {
- this.contextURL = contextURL;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(final String id) {
- this.id = id;
- }
-
- public String getTitle() {
- return title;
- }
-
- public String getSummary() {
- return summary;
- }
-
- public Date getUpdated() {
- return updated;
- }
-
- public void setCommonProperty(final String key, final String value) throws ParseException {
- if ("id".equals(key)) {
- this.id = value;
- } else if ("title".equals(key)) {
- this.title = value;
- } else if ("summary".equals(key)) {
- this.summary = value;
- } else if ("updated".equals(key)) {
- this.updated = ISO_DATEFORMAT.parse(value);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e4bf2132/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractEntry.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractEntry.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractEntry.java
index 29a4a75..85d6775 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractEntry.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractEntry.java
@@ -29,7 +29,7 @@ import org.apache.olingo.commons.api.domain.ODataOperation;
/**
* Abstract base for classes implementing an OData entry in Atom and JSON.
*/
-public abstract class AbstractEntry extends AbstractAtomObject implements Entry {
+public abstract class AbstractEntry extends AbstractODataObject implements Entry {
private static final long serialVersionUID = 2127764552600969783L;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e4bf2132/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractODataObject.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractODataObject.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractODataObject.java
new file mode 100644
index 0000000..3bcef74
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AbstractODataObject.java
@@ -0,0 +1,97 @@
+/*
+ * 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.commons.core.data;
+
+import com.fasterxml.jackson.databind.util.ISO8601DateFormat;
+import java.net.URI;
+import java.text.ParseException;
+import java.util.Date;
+
+abstract class AbstractODataObject extends AbstractPayloadObject {
+
+ private static final long serialVersionUID = -4391162864875546927L;
+
+ private static final ISO8601DateFormat ISO_DATEFORMAT = new ISO8601DateFormat();
+
+ private URI baseURI;
+
+ private URI contextURL;
+
+ private String id;
+
+ private String title;
+
+ private String summary;
+
+ private Date updated;
+
+ public URI getBaseURI() {
+ return baseURI;
+ }
+
+ public void setBaseURI(final String baseURI) {
+ this.baseURI = URI.create(baseURI);
+ }
+
+ /**
+ * The context URL describes the content of the payload. It consists of the canonical metadata document URL and a
+ * fragment identifying the relevant portion of the metadata document.
+ *
+ * @return context URL.
+ */
+ public URI getContextURL() {
+ return contextURL;
+ }
+
+ public void setContextURL(final URI contextURL) {
+ this.contextURL = contextURL;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(final String id) {
+ this.id = id;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public String getSummary() {
+ return summary;
+ }
+
+ public Date getUpdated() {
+ return updated;
+ }
+
+ public void setCommonProperty(final String key, final String value) throws ParseException {
+ if ("id".equals(key)) {
+ this.id = value;
+ } else if ("title".equals(key)) {
+ this.title = value;
+ } else if ("summary".equals(key)) {
+ this.summary = value;
+ } else if ("updated".equals(key)) {
+ this.updated = ISO_DATEFORMAT.parse(value);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e4bf2132/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
index 9a4eac1..d863eb6 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomDeserializer.java
@@ -18,6 +18,7 @@
*/
package org.apache.olingo.commons.core.data;
+import org.apache.olingo.commons.api.data.Container;
import java.io.InputStream;
import java.net.URI;
import java.text.ParseException;
@@ -40,7 +41,7 @@ public class AtomDeserializer extends AbstractAtomDealer {
private static final Logger LOG = LoggerFactory.getLogger(AtomDeserializer.class);
- private static final XMLInputFactory FACTORY = XMLInputFactory.newInstance();
+ public static final XMLInputFactory FACTORY = XMLInputFactory.newInstance();
private final AtomPropertyDeserializer propDeserializer;
@@ -49,12 +50,13 @@ public class AtomDeserializer extends AbstractAtomDealer {
this.propDeserializer = new AtomPropertyDeserializer(version);
}
- private AtomPropertyImpl property(final InputStream input) throws XMLStreamException {
+ private Container<AtomPropertyImpl> property(final InputStream input) throws XMLStreamException {
final XMLEventReader reader = FACTORY.createXMLEventReader(input);
- return propDeserializer.deserialize(reader, skipBeforeFirstStartElement(reader));
+ final StartElement start = skipBeforeFirstStartElement(reader);
+ return getContainer(start, propDeserializer.deserialize(reader, start));
}
- private StartElement skipBeforeFirstStartElement(final XMLEventReader reader) throws XMLStreamException {
+ public StartElement skipBeforeFirstStartElement(final XMLEventReader reader) throws XMLStreamException {
StartElement startEvent = null;
while (reader.hasNext() && startEvent == null) {
final XMLEvent event = reader.nextEvent();
@@ -70,7 +72,7 @@ public class AtomDeserializer extends AbstractAtomDealer {
}
private void common(final XMLEventReader reader, final StartElement start,
- final AbstractAtomObject object, final String key) throws XMLStreamException {
+ final AbstractODataObject object, final String key) throws XMLStreamException {
boolean foundEndElement = false;
while (reader.hasNext() && !foundEndElement) {
@@ -123,8 +125,14 @@ public class AtomDeserializer extends AbstractAtomDealer {
}
}
- private XMLLinkCollectionImpl linkCollection(final InputStream input) throws XMLStreamException {
+ private Container<XMLLinkCollectionImpl> linkCollection(final InputStream input) throws XMLStreamException {
final XMLEventReader reader = FACTORY.createXMLEventReader(input);
+ final StartElement start = skipBeforeFirstStartElement(reader);
+ return getContainer(start, linkCollection(reader, start));
+ }
+
+ private XMLLinkCollectionImpl linkCollection(final XMLEventReader reader, final StartElement start)
+ throws XMLStreamException {
final XMLLinkCollectionImpl linkCollection = new XMLLinkCollectionImpl();
@@ -178,8 +186,6 @@ public class AtomDeserializer extends AbstractAtomDealer {
entry.setBaseURI(xmlBase.getValue());
}
- entry.setContextURL(retrieveContextURL(start, entry.getBaseURI()));
-
final Attribute etag = start.getAttributeByName(etagQName);
if (etag != null) {
entry.setETag(etag.getValue());
@@ -291,7 +297,6 @@ public class AtomDeserializer extends AbstractAtomDealer {
private AtomEntryImpl entryRef(final StartElement start) throws XMLStreamException {
final AtomEntryImpl entry = new AtomEntryImpl();
- entry.setContextURL(retrieveContextURL(start, null));
final Attribute entryRefId = start.getAttributeByName(Constants.QNAME_ATOM_ELEM_ENTRY_REF_ID);
@@ -302,9 +307,10 @@ public class AtomDeserializer extends AbstractAtomDealer {
return entry;
}
- private AtomEntryImpl entry(final InputStream input) throws XMLStreamException {
+ private Container<AtomEntryImpl> entry(final InputStream input) throws XMLStreamException {
final XMLEventReader reader = FACTORY.createXMLEventReader(input);
- return entry(reader, skipBeforeFirstStartElement(reader));
+ final StartElement start = skipBeforeFirstStartElement(reader);
+ return getContainer(start, entry(reader, start));
}
private void count(final XMLEventReader reader, final StartElement start, final AtomFeedImpl feed)
@@ -328,15 +334,12 @@ public class AtomDeserializer extends AbstractAtomDealer {
if (!Constants.QNAME_ATOM_ELEM_FEED.equals(start.getName())) {
return null;
}
-
final AtomFeedImpl feed = new AtomFeedImpl();
final Attribute xmlBase = start.getAttributeByName(Constants.QNAME_ATTR_XML_BASE);
if (xmlBase != null) {
feed.setBaseURI(xmlBase.getValue());
}
- feed.setContextURL(retrieveContextURL(start, feed.getBaseURI()));
-
boolean foundEndFeed = false;
while (reader.hasNext() && !foundEndFeed) {
final XMLEvent event = reader.nextEvent();
@@ -372,34 +375,34 @@ public class AtomDeserializer extends AbstractAtomDealer {
return feed;
}
- private AtomFeedImpl feed(final InputStream input) throws XMLStreamException {
+ private Container<AtomFeedImpl> feed(final InputStream input) throws XMLStreamException {
final XMLEventReader reader = FACTORY.createXMLEventReader(input);
- return feed(reader, skipBeforeFirstStartElement(reader));
+ final StartElement start = skipBeforeFirstStartElement(reader);
+ return getContainer(start, feed(reader, start));
}
@SuppressWarnings("unchecked")
- public <T> T read(final InputStream input, final Class<T> reference) throws XMLStreamException {
+ public <T, V extends T> Container<T> read(final InputStream input, final Class<V> reference)
+ throws XMLStreamException {
if (AtomFeedImpl.class.equals(reference)) {
- return (T) feed(input);
+ return (Container<T>) feed(input);
} else if (AtomEntryImpl.class.equals(reference)) {
- return (T) entry(input);
+ return (Container<T>) entry(input);
} else if (AtomPropertyImpl.class.equals(reference)) {
- return (T) property(input);
+ return (Container<T>) property(input);
} else if (XMLLinkCollectionImpl.class.equals(reference)) {
- return (T) linkCollection(input);
+ return (Container<T>) linkCollection(input);
}
return null;
}
- private URI retrieveContextURL(final StartElement start, final URI base) {
+ public <T> Container<T> getContainer(final StartElement start, final T object) {
final Attribute context = start.getAttributeByName(contextQName);
+ final Attribute metadataETag = start.getAttributeByName(metadataEtagQName);
- if (context == null) {
- return base == null
- ? null
- : URI.create(base.toASCIIString() + "/" + Constants.METADATA);
- } else {
- return URI.create(context.getValue());
- }
+ return new Container<T>(
+ context == null ? null : URI.create(context.getValue()),
+ metadataETag == null ? null : metadataETag.getValue(),
+ object);
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e4bf2132/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomFeedImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomFeedImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomFeedImpl.java
index d40f945..09dfdcf 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomFeedImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomFeedImpl.java
@@ -29,7 +29,7 @@ import org.apache.olingo.commons.api.data.Feed;
*
* @see AtomEntry
*/
-public class AtomFeedImpl extends AbstractAtomObject implements Feed {
+public class AtomFeedImpl extends AbstractODataObject implements Feed {
private static final long serialVersionUID = 5466590540021319153L;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e4bf2132/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomSerializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomSerializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomSerializer.java
index 8bab108..4bcd3bf 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomSerializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/data/AtomSerializer.java
@@ -104,7 +104,7 @@ public class AtomSerializer extends AbstractAtomDealer {
}
}
- private void common(final XMLStreamWriter writer, final AbstractAtomObject object) throws XMLStreamException {
+ private void common(final XMLStreamWriter writer, final AbstractODataObject object) throws XMLStreamException {
if (StringUtils.isNotBlank(object.getTitle())) {
writer.writeStartElement(Constants.ATOM_ELEM_TITLE);
writer.writeAttribute(Constants.ATTR_TYPE, TYPE_TEXT);
@@ -149,8 +149,8 @@ public class AtomSerializer extends AbstractAtomDealer {
writer.writeAttribute(Constants.ATOM_ATTR_TERM, entry.getType());
writer.writeEndElement();
- if (entry instanceof AbstractAtomObject) {
- common(writer, (AbstractAtomObject) entry);
+ if (entry instanceof AbstractODataObject) {
+ common(writer, (AbstractODataObject) entry);
}
links(writer, entry.getAssociationLinks());
@@ -215,8 +215,8 @@ public class AtomSerializer extends AbstractAtomDealer {
writer.writeEndElement();
}
- if (feed instanceof AbstractAtomObject) {
- common(writer, (AbstractAtomObject) feed);
+ if (feed instanceof AbstractODataObject) {
+ common(writer, (AbstractODataObject) feed);
}
for (Entry entry : feed.getEntries()) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/e4bf2132/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
index 991e723..99d4c5c 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/op/AbstractODataDeserializer.java
@@ -18,7 +18,13 @@
*/
package org.apache.olingo.commons.core.op;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
import java.io.InputStream;
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLEventWriter;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.events.StartElement;
import org.apache.olingo.commons.api.data.Entry;
import org.apache.olingo.commons.api.domain.ODataError;
import org.apache.olingo.commons.api.data.Feed;
@@ -28,6 +34,7 @@ import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.commons.api.op.CommonODataDeserializer;
import org.apache.olingo.commons.core.data.AtomDeserializer;
+import org.apache.olingo.commons.api.data.Container;
import org.apache.olingo.commons.core.data.AtomEntryImpl;
import org.apache.olingo.commons.core.data.AtomFeedImpl;
import org.apache.olingo.commons.core.data.AtomPropertyImpl;
@@ -50,45 +57,59 @@ public abstract class AbstractODataDeserializer extends AbstractJacksonTool impl
}
@Override
- public Feed toFeed(final InputStream input, final ODataPubFormat format) {
+ public Container<Feed> toFeed(final InputStream input, final ODataPubFormat format) {
return format == ODataPubFormat.ATOM
- ? atom(input, AtomFeedImpl.class)
- : json(input, JSONFeedImpl.class);
+ ? this.<Feed, AtomFeedImpl>atom(input, AtomFeedImpl.class)
+ : this.<Feed, JSONFeedImpl>json(input, JSONFeedImpl.class);
}
@Override
- public Entry toEntry(final InputStream input, final ODataPubFormat format) {
+ public Container<Entry> toEntry(final InputStream input, final ODataPubFormat format) {
return format == ODataPubFormat.ATOM
- ? atom(input, AtomEntryImpl.class)
- : json(input, JSONEntryImpl.class);
+ ? this.<Entry, AtomEntryImpl>atom(input, AtomEntryImpl.class)
+ : this.<Entry, JSONEntryImpl>json(input, JSONEntryImpl.class);
}
@Override
- public Property toProperty(final InputStream input, final ODataFormat format) {
+ public Container<Property> toProperty(final InputStream input, final ODataFormat format) {
return format == ODataFormat.XML
- ? atom(input, AtomPropertyImpl.class)
- : json(input, JSONPropertyImpl.class);
+ ? this.<Property, AtomPropertyImpl>atom(input, AtomPropertyImpl.class)
+ : this.<Property, JSONPropertyImpl>json(input, JSONPropertyImpl.class);
}
@Override
public ODataError toError(final InputStream input, final boolean isXML) {
return isXML
- ? xml(input, XMLErrorImpl.class)
- : json(input, JSONErrorBundle.class).getError();
+ ? this.<ODataError, XMLErrorImpl>xml(input, XMLErrorImpl.class).getObject()
+ : this.<JSONErrorBundle, JSONErrorBundle>json(input, JSONErrorBundle.class).getObject().getError();
}
/*
* ------------------ Protected methods ------------------
*/
- protected <T> T xml(final InputStream input, final Class<T> reference) {
+ @SuppressWarnings("unchecked")
+ protected <T, V extends T> Container<T> xml(final InputStream input, final Class<V> reference) {
try {
- return getXmlMapper().readValue(input, reference);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+
+ final XMLEventReader reader = AtomDeserializer.FACTORY.createXMLEventReader(input);
+ final StartElement start = atomDeserializer.skipBeforeFirstStartElement(reader);
+
+ final XMLEventWriter writer = XMLOutputFactory.newFactory().createXMLEventWriter(bos);
+ writer.add(start);
+ writer.add(reader);
+ writer.flush();
+ writer.close();
+
+ return (Container<T>) atomDeserializer.getContainer(
+ start, getXmlMapper().readValue(new ByteArrayInputStream(bos.toByteArray()), reference));
+
} catch (Exception e) {
throw new IllegalArgumentException("While deserializing " + reference.getName(), e);
}
}
- protected <T> T atom(final InputStream input, final Class<T> reference) {
+ protected <T, V extends T> Container<T> atom(final InputStream input, final Class<V> reference) {
try {
return atomDeserializer.read(input, reference);
} catch (Exception e) {
@@ -96,9 +117,9 @@ public abstract class AbstractODataDeserializer extends AbstractJacksonTool impl
}
}
- protected <T> T json(final InputStream input, final Class<T> reference) {
+ protected <T, V extends T> Container<T> json(final InputStream input, final Class<V> reference) {
try {
- return getObjectMapper().readValue(input, reference);
+ return new Container<T>(null, null, getObjectMapper().readValue(input, reference));
} catch (Exception e) {
throw new IllegalArgumentException("While deserializing " + reference.getName(), e);
}
[37/51] [abbrv] git commit: [OLINGO-200] More V4 Enum tests
Posted by il...@apache.org.
[OLINGO-200] More V4 Enum tests
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/117cf6f0
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/117cf6f0
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/117cf6f0
Branch: refs/heads/master
Commit: 117cf6f0d0099ef5d553e2a46b359d0e38222996
Parents: cd7ede0
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Sun Mar 30 16:12:17 2014 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Sun Mar 30 16:12:17 2014 +0200
----------------------------------------------------------------------
.../retrieve/CommonRetrieveRequestFactory.java | 12 +-
.../retrieve/v3/RetrieveRequestFactory.java | 2 +-
.../AbstractRetrieveRequestFactory.java | 8 +-
.../retrieve/v3/RetrieveRequestFactoryImpl.java | 19 ++-
.../retrieve/v4/RetrieveRequestFactoryImpl.java | 19 ++-
.../client/core/op/AbstractODataBinder.java | 35 +++--
.../client/core/op/impl/v4/ODataBinderImpl.java | 45 +++++++
.../core/it/v3/EntityCreateTestITCase.java | 4 +-
.../it/v3/NavigationLinkCreateTestITCase.java | 2 +-
.../olingo/client/core/v3/EntityTest.java | 5 +-
.../apache/olingo/client/core/v3/JSONTest.java | 4 +-
.../olingo/client/core/v4/EntityTest.java | 133 +++++++++++++++++++
.../api/domain/CommonODataObjectFactory.java | 4 +-
.../api/domain/v4/ODataObjectFactory.java | 2 +
.../core/domain/AbstractODataObjectFactory.java | 4 +-
.../core/domain/v4/ODataEnumValueImpl.java | 50 +++++++
.../core/domain/v4/ODataObjectFactoryImpl.java | 5 +
17 files changed, 298 insertions(+), 55 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/117cf6f0/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/CommonRetrieveRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/CommonRetrieveRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/CommonRetrieveRequestFactory.java
index f8d48b3..69e53e7 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/CommonRetrieveRequestFactory.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/CommonRetrieveRequestFactory.java
@@ -60,7 +60,7 @@ public interface CommonRetrieveRequestFactory extends Serializable {
ODataServiceDocumentRequest getServiceDocumentRequest(String serviceRoot);
/**
- * Gets a query request returning a set of one or more OData entities.
+ * Gets a uri request returning a set of one or more OData entities.
*
* @param <T> concrete ODataEntitySet implementation.
* @param uri request URI.
@@ -69,7 +69,7 @@ public interface CommonRetrieveRequestFactory extends Serializable {
<T extends CommonODataEntitySet> ODataEntitySetRequest<T> getEntitySetRequest(URI uri);
/**
- * Gets a query request returning a set of one or more OData entities.
+ * Gets a uri request returning a set of one or more OData entities.
* <br/>
* Returned request gives the possibility to consume entities iterating on them without parsing and loading in memory
* the entire entity set.
@@ -83,7 +83,7 @@ public interface CommonRetrieveRequestFactory extends Serializable {
ODataEntitySetIteratorRequest<ES, E> getEntitySetIteratorRequest(URI uri);
/**
- * Gets a query request returning a single OData entity.
+ * Gets a uri request returning a single OData entity.
*
* @param <T> concrete ODataEntity implementation.
* @param uri request URI.
@@ -92,7 +92,7 @@ public interface CommonRetrieveRequestFactory extends Serializable {
<T extends CommonODataEntity> ODataEntityRequest<T> getEntityRequest(URI uri);
/**
- * Gets a query request returning a single OData entity property.
+ * Gets a uri request returning a single OData entity property.
*
* @param <T> concrete ODataProperty implementation.
* @param uri request URI.
@@ -101,7 +101,7 @@ public interface CommonRetrieveRequestFactory extends Serializable {
<T extends CommonODataProperty> ODataPropertyRequest<T> getPropertyRequest(URI uri);
/**
- * Gets a query request returning a single OData entity property value.
+ * Gets a uri request returning a single OData entity property value.
*
* @param uri request URI.
* @return new {@link ODataValueRequest} instance.
@@ -109,7 +109,7 @@ public interface CommonRetrieveRequestFactory extends Serializable {
ODataValueRequest getValueRequest(URI uri);
/**
- * Gets a query request returning a media stream.
+ * Gets a uri request returning a media stream.
*
* @param uri request URI.
* @return new {@link ODataMediaRequest} instance.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/117cf6f0/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/RetrieveRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/RetrieveRequestFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/RetrieveRequestFactory.java
index 00568bd..0d133cb 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/RetrieveRequestFactory.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/retrieve/v3/RetrieveRequestFactory.java
@@ -47,7 +47,7 @@ public interface RetrieveRequestFactory extends CommonRetrieveRequestFactory {
ODataPropertyRequest<ODataProperty> getPropertyRequest(URI uri);
/**
- * Gets a query request returning a single OData link.
+ * Gets a uri request returning a single OData link.
*
* @param targetURI target URI.
* @param linkName link name.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/117cf6f0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractRetrieveRequestFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractRetrieveRequestFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractRetrieveRequestFactory.java
index a801953..d5e0319 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractRetrieveRequestFactory.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/AbstractRetrieveRequestFactory.java
@@ -39,13 +39,13 @@ public abstract class AbstractRetrieveRequestFactory implements CommonRetrieveRe
}
@Override
- public ODataValueRequest getValueRequest(final URI query) {
- return new ODataValueRequestImpl(client, query);
+ public ODataValueRequest getValueRequest(final URI uri) {
+ return new ODataValueRequestImpl(client, uri);
}
@Override
- public ODataMediaRequest getMediaRequest(final URI query) {
- return new ODataMediaRequestImpl(client, query);
+ public ODataMediaRequest getMediaRequest(final URI uri) {
+ return new ODataMediaRequestImpl(client, uri);
}
@Override
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/117cf6f0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/RetrieveRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/RetrieveRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/RetrieveRequestFactoryImpl.java
index 3943747..0e8db34 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/RetrieveRequestFactoryImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v3/RetrieveRequestFactoryImpl.java
@@ -36,6 +36,7 @@ import org.apache.olingo.commons.api.domain.v3.ODataEntity;
import org.apache.olingo.commons.api.domain.v3.ODataEntitySet;
import org.apache.olingo.commons.api.domain.v3.ODataProperty;
+@SuppressWarnings("unchecked")
public class RetrieveRequestFactoryImpl extends AbstractRetrieveRequestFactory
implements RetrieveRequestFactory {
@@ -56,27 +57,23 @@ public class RetrieveRequestFactoryImpl extends AbstractRetrieveRequestFactory
return new ODataLinkCollectionRequestImpl((ODataClient) client, targetURI, linkName);
}
- @SuppressWarnings("unchecked")
@Override
- public ODataEntitySetRequest<ODataEntitySet> getEntitySetRequest(final URI query) {
- return new ODataEntitySetRequestImpl<ODataEntitySet>(client, query);
+ public ODataEntitySetRequest<ODataEntitySet> getEntitySetRequest(final URI uri) {
+ return new ODataEntitySetRequestImpl<ODataEntitySet>(client, uri);
}
- @SuppressWarnings("unchecked")
@Override
- public ODataEntitySetIteratorRequest<ODataEntitySet, ODataEntity> getEntitySetIteratorRequest(URI uri) {
+ public ODataEntitySetIteratorRequest<ODataEntitySet, ODataEntity> getEntitySetIteratorRequest(final URI uri) {
return new ODataEntitySetIteratorRequestImpl<ODataEntitySet, ODataEntity>(client, uri);
}
- @SuppressWarnings("unchecked")
@Override
- public ODataEntityRequest<ODataEntity> getEntityRequest(final URI query) {
- return new ODataEntityRequestImpl<ODataEntity>(client, query);
+ public ODataEntityRequest<ODataEntity> getEntityRequest(final URI uri) {
+ return new ODataEntityRequestImpl<ODataEntity>(client, uri);
}
- @SuppressWarnings("unchecked")
@Override
- public ODataPropertyRequest<ODataProperty> getPropertyRequest(final URI query) {
- return new ODataPropertyRequestImpl<ODataProperty>(client, query);
+ public ODataPropertyRequest<ODataProperty> getPropertyRequest(final URI uri) {
+ return new ODataPropertyRequestImpl<ODataProperty>(client, uri);
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/117cf6f0/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java
index 96419c2..879417b 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/retrieve/v4/RetrieveRequestFactoryImpl.java
@@ -35,6 +35,7 @@ import org.apache.olingo.commons.api.domain.v4.ODataEntity;
import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
import org.apache.olingo.commons.api.domain.v4.ODataProperty;
+@SuppressWarnings("unchecked")
public class RetrieveRequestFactoryImpl extends AbstractRetrieveRequestFactory
implements RetrieveRequestFactory {
@@ -50,27 +51,23 @@ public class RetrieveRequestFactoryImpl extends AbstractRetrieveRequestFactory
client.getURIBuilder(serviceRoot).appendMetadataSegment().build());
}
- @SuppressWarnings("unchecked")
@Override
- public ODataEntitySetRequest<ODataEntitySet> getEntitySetRequest(final URI query) {
- return new ODataEntitySetRequestImpl<ODataEntitySet>(client, query);
+ public ODataEntitySetRequest<ODataEntitySet> getEntitySetRequest(final URI uri) {
+ return new ODataEntitySetRequestImpl<ODataEntitySet>(client, uri);
}
- @SuppressWarnings("unchecked")
@Override
- public ODataEntitySetIteratorRequest<ODataEntitySet, ODataEntity> getEntitySetIteratorRequest(URI uri) {
+ public ODataEntitySetIteratorRequest<ODataEntitySet, ODataEntity> getEntitySetIteratorRequest(final URI uri) {
return new ODataEntitySetIteratorRequestImpl<ODataEntitySet, ODataEntity>(client, uri);
}
- @SuppressWarnings("unchecked")
@Override
- public ODataEntityRequest<ODataEntity> getEntityRequest(final URI query) {
- return new ODataEntityRequestImpl<ODataEntity>(client, query);
+ public ODataEntityRequest<ODataEntity> getEntityRequest(final URI uri) {
+ return new ODataEntityRequestImpl<ODataEntity>(client, uri);
}
- @SuppressWarnings("unchecked")
@Override
- public ODataPropertyRequest<ODataProperty> getPropertyRequest(final URI query) {
- return new ODataPropertyRequestImpl<ODataProperty>(client, query);
+ public ODataPropertyRequest<ODataProperty> getPropertyRequest(final URI uri) {
+ return new ODataPropertyRequestImpl<ODataProperty>(client, uri);
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/117cf6f0/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
index 4c86604..13a49fb 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/AbstractODataBinder.java
@@ -42,6 +42,7 @@ import org.apache.olingo.commons.api.domain.ODataInlineEntitySet;
import org.apache.olingo.commons.api.domain.ODataLink;
import org.apache.olingo.commons.api.domain.ODataOperation;
import org.apache.olingo.commons.api.domain.CommonODataProperty;
+import org.apache.olingo.commons.api.domain.ODataLinkType;
import org.apache.olingo.commons.api.domain.ODataServiceDocument;
import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
@@ -54,6 +55,7 @@ import org.apache.olingo.commons.core.data.JSONPropertyImpl;
import org.apache.olingo.commons.core.data.LinkImpl;
import org.apache.olingo.commons.core.data.NullValueImpl;
import org.apache.olingo.commons.core.data.PrimitiveValueImpl;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import org.apache.olingo.commons.core.op.ResourceFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -228,7 +230,7 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
return propertyResource;
}
- private Value getValue(final ODataValue value, final Class<? extends Entry> reference, final boolean setType) {
+ protected Value getValue(final ODataValue value, final Class<? extends Entry> reference, final boolean setType) {
Value valueResource = null;
if (value == null) {
@@ -329,8 +331,12 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
final Feed inlineFeed = link.getInlineFeed();
if (inlineEntry == null && inlineFeed == null) {
- entity.addLink(
- client.getObjectFactory().newEntityNavigationLink(link.getTitle(), base, link.getHref()));
+ final ODataLinkType linkType = link.getType() == null
+ ? ODataLinkType.ENTITY_NAVIGATION
+ : ODataLinkType.fromString(client.getServiceVersion(), link.getRel(), link.getType());
+ entity.addLink(linkType == ODataLinkType.ENTITY_NAVIGATION
+ ? client.getObjectFactory().newEntityNavigationLink(link.getTitle(), base, link.getHref())
+ : client.getObjectFactory().newEntitySetNavigationLink(link.getTitle(), base, link.getHref()));
} else if (inlineEntry != null) {
entity.addLink(client.getObjectFactory().newInlineEntity(
link.getTitle(), base, link.getHref(),
@@ -369,28 +375,35 @@ public abstract class AbstractODataBinder implements CommonODataBinder {
protected ODataValue getODataValue(final Property resource) {
ODataValue value = null;
+ final EdmTypeInfo typeInfo = resource.getType() == null
+ ? null
+ : new EdmTypeInfo.Builder().setTypeExpression(resource.getType()).build();
if (resource.getValue().isPrimitive()) {
value = client.getObjectFactory().newPrimitiveValueBuilder().
setText(resource.getValue().asPrimitive().get()).
- setType(resource.getType() == null
+ setType(typeInfo == null
? null
- : EdmPrimitiveTypeKind.valueOfFQN(client.getServiceVersion(), resource.getType())).build();
+ : EdmPrimitiveTypeKind.valueOfFQN(
+ client.getServiceVersion(), typeInfo.getFullQualifiedName().toString())).build();
} else if (resource.getValue().isGeospatial()) {
value = client.getObjectFactory().newPrimitiveValueBuilder().
setValue(resource.getValue().asGeospatial().get()).
- setType(resource.getType() == null
- || EdmPrimitiveTypeKind.Geography.getFullQualifiedName().toString().equals(resource.getType())
- || EdmPrimitiveTypeKind.Geometry.getFullQualifiedName().toString().equals(resource.getType())
+ setType(typeInfo == null
+ || EdmPrimitiveTypeKind.Geography.getFullQualifiedName().equals(typeInfo.getFullQualifiedName())
+ || EdmPrimitiveTypeKind.Geometry.getFullQualifiedName().equals(typeInfo.getFullQualifiedName())
? resource.getValue().asGeospatial().get().getEdmPrimitiveTypeKind()
- : EdmPrimitiveTypeKind.valueOfFQN(client.getServiceVersion(), resource.getType())).build();
+ : EdmPrimitiveTypeKind.valueOfFQN(
+ client.getServiceVersion(), typeInfo.getFullQualifiedName().toString())).build();
} else if (resource.getValue().isComplex()) {
- value = client.getObjectFactory().newComplexValue(resource.getType());
+ value = client.getObjectFactory().newComplexValue(typeInfo == null
+ ? null : typeInfo.getFullQualifiedName().toString());
for (Property property : resource.getValue().asComplex().get()) {
value.asComplex().add(getODataProperty(property));
}
} else if (resource.getValue().isCollection()) {
- value = client.getObjectFactory().newCollectionValue(resource.getType());
+ value = client.getObjectFactory().newCollectionValue(typeInfo == null
+ ? null : "Collection(" + typeInfo.getFullQualifiedName().toString() + ")");
for (Value _value : resource.getValue().asCollection().get()) {
final JSONPropertyImpl fake = new JSONPropertyImpl();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/117cf6f0/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
index 0acc7d1..e85b34e 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
@@ -29,13 +29,17 @@ import org.apache.olingo.client.core.op.AbstractODataBinder;
import org.apache.olingo.commons.api.data.Entry;
import org.apache.olingo.commons.api.data.Feed;
import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.data.Value;
import org.apache.olingo.commons.api.domain.CommonODataEntity;
import org.apache.olingo.commons.api.domain.CommonODataEntitySet;
import org.apache.olingo.commons.api.domain.CommonODataProperty;
+import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.commons.api.domain.v4.ODataEntity;
import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
import org.apache.olingo.commons.api.domain.v4.ODataProperty;
+import org.apache.olingo.commons.core.data.EnumValueImpl;
import org.apache.olingo.commons.core.domain.v4.ODataPropertyImpl;
+import org.apache.olingo.commons.core.edm.EdmTypeInfo;
public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder {
@@ -86,6 +90,31 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder
}
@Override
+ public Property getProperty(final CommonODataProperty property, final Class<? extends Entry> reference,
+ final boolean setType) {
+
+ final Property propertyResource = super.getProperty(property, reference, setType);
+ if (property instanceof ODataProperty && ((ODataProperty) property).hasEnumValue() && setType) {
+ propertyResource.setType(((ODataProperty) property).getEnumValue().getTypeName());
+ }
+ return propertyResource;
+ }
+
+ @Override
+ protected Value getValue(final ODataValue value, final Class<? extends Entry> reference, final boolean setType) {
+ Value valueResource;
+ if (value instanceof org.apache.olingo.commons.api.domain.v4.ODataValue
+ && ((org.apache.olingo.commons.api.domain.v4.ODataValue) value).isEnum()) {
+
+ valueResource = new EnumValueImpl(
+ ((org.apache.olingo.commons.api.domain.v4.ODataValue) value).asEnum().getValue());
+ } else {
+ valueResource = super.getValue(value, reference, setType);
+ }
+ return valueResource;
+ }
+
+ @Override
public ODataEntitySet getODataEntitySet(final Feed resource) {
return (ODataEntitySet) super.getODataEntitySet(resource);
}
@@ -112,4 +141,20 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder
return new ODataPropertyImpl(property.getName(), getODataValue(property));
}
+ @Override
+ protected ODataValue getODataValue(final Property resource) {
+ ODataValue value;
+ if (resource.getValue().isEnum()) {
+ final EdmTypeInfo typeInfo = resource.getType() == null
+ ? null
+ : new EdmTypeInfo.Builder().setTypeExpression(resource.getType()).build();
+ value = ((ODataClient) client).getObjectFactory().newEnumValue(
+ typeInfo == null ? null : typeInfo.getFullQualifiedName().toString(),
+ resource.getValue().asEnum().get());
+ } else {
+ value = super.getODataValue(resource);
+ }
+
+ return value;
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/117cf6f0/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
index bd1419f..2a4efee 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/EntityCreateTestITCase.java
@@ -305,7 +305,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
client.getURIBuilder(getServiceRoot()).appendEntitySetSegment("Order").build(), order);
createReq.setFormat(format);
- original.addLink(client.getObjectFactory().newFeedNavigationLink(
+ original.addLink(client.getObjectFactory().newEntitySetNavigationLink(
"Orders",
createReq.execute().getBody().getEditLink()));
}
@@ -409,7 +409,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
ODataEntity changes = client.getObjectFactory().newEntity(
"Microsoft.Test.OData.Services.AstoriaDefaultService.Customer");
changes.setEditLink(customer.getEditLink());
- changes.addLink(client.getObjectFactory().newFeedNavigationLink(
+ changes.addLink(client.getObjectFactory().newEntitySetNavigationLink(
"Orders", URIUtils.getURI(getServiceRoot(), order.getEditLink().toASCIIString())));
update(UpdateType.PATCH, changes, format, null);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/117cf6f0/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
index fcbbe80..3b518d9 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v3/NavigationLinkCreateTestITCase.java
@@ -223,7 +223,7 @@ public class NavigationLinkCreateTestITCase extends AbstractTestITCase {
orderEntity);
createReq.setFormat(format);
createReq.setContentType(contentType);
- original.addLink(client.getObjectFactory().newFeedNavigationLink(
+ original.addLink(client.getObjectFactory().newEntitySetNavigationLink(
"Orders",
createReq.execute().getBody().getEditLink()));
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/117cf6f0/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
index fe5b148..41da651 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/EntityTest.java
@@ -29,6 +29,7 @@ import org.apache.olingo.commons.api.domain.ODataLink;
import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.core.AbstractTest;
+import org.apache.olingo.commons.api.domain.v3.ODataEntity;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.core.op.ResourceFactory;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
@@ -45,7 +46,7 @@ public class EntityTest extends AbstractTest {
private void readAndWrite(final ODataPubFormat format) {
final InputStream input = getClass().getResourceAsStream("Customer_-10." + getSuffix(format));
- final CommonODataEntity entity = getClient().getBinder().getODataEntity(
+ final ODataEntity entity = getClient().getBinder().getODataEntity(
getClient().getDeserializer().toEntry(input, format).getObject());
assertNotNull(entity);
@@ -64,7 +65,7 @@ public class EntityTest extends AbstractTest {
assertTrue(check);
- final CommonODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
+ final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
assertEquals(entity, written);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/117cf6f0/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/JSONTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/JSONTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/JSONTest.java
index bae0bdd..522e686 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/JSONTest.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v3/JSONTest.java
@@ -1,5 +1,3 @@
-package org.apache.olingo.client.core.v3;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,8 @@ package org.apache.olingo.client.core.v3;
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.olingo.client.core.v3;
+
import static org.junit.Assert.assertEquals;
import com.fasterxml.jackson.databind.JsonNode;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/117cf6f0/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
new file mode 100644
index 0000000..f9c57c2
--- /dev/null
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/v4/EntityTest.java
@@ -0,0 +1,133 @@
+/*
+ * 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.client.core.v4;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.InputStream;
+import java.util.Iterator;
+import org.apache.olingo.client.api.v4.ODataClient;
+import org.apache.olingo.client.core.AbstractTest;
+import org.apache.olingo.commons.api.domain.ODataLink;
+import org.apache.olingo.commons.api.domain.ODataLinkType;
+import org.apache.olingo.commons.api.domain.ODataValue;
+import org.apache.olingo.commons.api.domain.v4.ODataEntity;
+import org.apache.olingo.commons.api.domain.v4.ODataProperty;
+import org.apache.olingo.commons.api.format.ODataPubFormat;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmDateTimeOffset;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmDuration;
+import org.apache.olingo.commons.core.op.ResourceFactory;
+import org.junit.Test;
+
+public class EntityTest extends AbstractTest {
+
+ @Override
+ protected ODataClient getClient() {
+ return v4Client;
+ }
+
+ private void singleton(final ODataPubFormat format) {
+ final InputStream input = getClass().getResourceAsStream("VipCustomer." + getSuffix(format));
+ final ODataEntity entity = getClient().getBinder().getODataEntity(
+ getClient().getDeserializer().toEntry(input, format).getObject());
+ assertNotNull(entity);
+
+ assertEquals("#Microsoft.Test.OData.Services.ODataWCFService.Customer", entity.getName());
+
+ final ODataProperty birthday = entity.getProperty("Birthday");
+ assertTrue(birthday.hasPrimitiveValue());
+ assertEquals(EdmDateTimeOffset.getInstance(), birthday.getPrimitiveValue().getType());
+
+ final ODataProperty timeBetweenLastTwoOrders = entity.getProperty("TimeBetweenLastTwoOrders");
+ assertTrue(timeBetweenLastTwoOrders.hasPrimitiveValue());
+ assertEquals(EdmDuration.getInstance(), timeBetweenLastTwoOrders.getPrimitiveValue().getType());
+
+ int checked = 0;
+ for (ODataLink link : entity.getNavigationLinks()) {
+ if ("Parent".equals(link.getName())) {
+ checked++;
+ assertEquals(ODataLinkType.ENTITY_NAVIGATION, link.getType());
+ }
+ if ("Orders".equals(link.getName())) {
+ checked++;
+ if (format == ODataPubFormat.ATOM) {
+ assertEquals(ODataLinkType.ENTITY_SET_NAVIGATION, link.getType());
+ }
+ }
+ if ("Company".equals(link.getName())) {
+ checked++;
+ assertEquals(ODataLinkType.ENTITY_NAVIGATION, link.getType());
+ }
+ }
+ assertEquals(3, checked);
+
+ // operations won't get serialized
+ entity.getOperations().clear();
+ final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
+ getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
+ assertEquals(entity, written);
+ }
+
+ @Test
+ public void atomSingleton() {
+ singleton(ODataPubFormat.ATOM);
+ }
+
+ @Test
+ public void jsonSingleton() {
+ singleton(ODataPubFormat.JSON_FULL_METADATA);
+ }
+
+ private void withEnums(final ODataPubFormat format) {
+ final InputStream input = getClass().getResourceAsStream("Products_5." + getSuffix(format));
+ final ODataEntity entity = getClient().getBinder().getODataEntity(
+ getClient().getDeserializer().toEntry(input, format).getObject());
+ assertNotNull(entity);
+
+ final ODataProperty skinColor = entity.getProperty("SkinColor");
+ assertTrue(skinColor.hasEnumValue());
+ assertEquals("Microsoft.Test.OData.Services.ODataWCFService.Color", skinColor.getEnumValue().getTypeName());
+ assertEquals("Red", skinColor.getEnumValue().getValue());
+
+// final ODataProperty coverColors = entity.getProperty("CoverColors");
+// assertTrue(coverColors.hasCollectionValue());
+// for (final Iterator<ODataValue> itor = coverColors.getCollectionValue().iterator(); itor.hasNext();) {
+// final ODataValue item = itor.next();
+// assertTrue(item.isEnum());
+// }
+
+ // operations won't get serialized
+ entity.getOperations().clear();
+ final ODataEntity written = getClient().getBinder().getODataEntity(getClient().getBinder().
+ getEntry(entity, ResourceFactory.entryClassForFormat(format == ODataPubFormat.ATOM)));
+ assertEquals(entity, written);
+ }
+
+ @Test
+ public void atomWithEnums() {
+ withEnums(ODataPubFormat.ATOM);
+ }
+
+ @Test
+ public void jsonWithEnums() {
+ withEnums(ODataPubFormat.JSON_FULL_METADATA);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/117cf6f0/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataObjectFactory.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataObjectFactory.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataObjectFactory.java
index 525dc9d..40ffda9 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataObjectFactory.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/CommonODataObjectFactory.java
@@ -125,7 +125,7 @@ public interface CommonODataObjectFactory {
* @param link link.
* @return entity set navigation link.
*/
- ODataLink newFeedNavigationLink(String name, URI link);
+ ODataLink newEntitySetNavigationLink(String name, URI link);
/**
* Instantiates a new entity set navigation link.
@@ -135,7 +135,7 @@ public interface CommonODataObjectFactory {
* @param href href.
* @return entity set navigation link.
*/
- ODataLink newFeedNavigationLink(String name, URI baseURI, String href);
+ ODataLink newEntitySetNavigationLink(String name, URI baseURI, String href);
/**
* Instantiates a new association link.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/117cf6f0/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataObjectFactory.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataObjectFactory.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataObjectFactory.java
index 8b43bc1..d12f0dc 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataObjectFactory.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/v4/ODataObjectFactory.java
@@ -38,6 +38,8 @@ public interface ODataObjectFactory extends CommonODataObjectFactory {
@Override
ODataEntity newEntity(String name, URI link);
+ ODataEnumValue newEnumValue(String typeName, String value);
+
@Override
ODataProperty newPrimitiveProperty(String name, ODataPrimitiveValue value);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/117cf6f0/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataObjectFactory.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataObjectFactory.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataObjectFactory.java
index ea73910..a3133cd 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataObjectFactory.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/AbstractODataObjectFactory.java
@@ -80,13 +80,13 @@ public abstract class AbstractODataObjectFactory implements CommonODataObjectFac
}
@Override
- public ODataLink newFeedNavigationLink(final String name, final URI link) {
+ public ODataLink newEntitySetNavigationLink(final String name, final URI link) {
return new ODataLink.Builder().setVersion(version).setURI(link).
setType(ODataLinkType.ENTITY_SET_NAVIGATION).setTitle(name).build();
}
@Override
- public ODataLink newFeedNavigationLink(final String name, final URI baseURI, final String href) {
+ public ODataLink newEntitySetNavigationLink(final String name, final URI baseURI, final String href) {
return new ODataLink.Builder().setVersion(version).setURI(baseURI, href).
setType(ODataLinkType.ENTITY_SET_NAVIGATION).setTitle(name).build();
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/117cf6f0/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEnumValueImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEnumValueImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEnumValueImpl.java
new file mode 100644
index 0000000..ee21018
--- /dev/null
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataEnumValueImpl.java
@@ -0,0 +1,50 @@
+/*
+ * 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.commons.core.domain.v4;
+
+import org.apache.olingo.commons.api.domain.AbstractODataValue;
+import org.apache.olingo.commons.api.domain.v4.ODataEnumValue;
+
+public class ODataEnumValueImpl extends AbstractODataValue implements ODataEnumValue {
+
+ private static final long serialVersionUID = 5830261159033325828L;
+
+ private final String value;
+
+ public ODataEnumValueImpl(final String typeName, final String value) {
+ super(typeName);
+ this.value = value;
+ }
+
+ @Override
+ public String getValue() {
+ return value;
+ }
+
+ @Override
+ public boolean isEnum() {
+ return true;
+ }
+
+ @Override
+ public ODataEnumValue asEnum() {
+ return this;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/117cf6f0/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java
index 1b6428f..0a84407 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java
@@ -59,6 +59,11 @@ public class ODataObjectFactoryImpl extends AbstractODataObjectFactory implement
}
@Override
+ public ODataEnumValue newEnumValue(final String typeName, final String value) {
+ return new ODataEnumValueImpl(typeName, value);
+ }
+
+ @Override
public ODataProperty newPrimitiveProperty(final String name, final ODataPrimitiveValue value) {
return new ODataPropertyImpl(name, value);
}
[20/51] [abbrv] git commit: [OLINGO-175, OLINGO-205] Resolving References via ~/?=…
Posted by il...@apache.org.
[OLINGO-175, OLINGO-205] Resolving References via ~/?=…
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/583a83dc
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/583a83dc
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/583a83dc
Branch: refs/heads/master
Commit: 583a83dc4baef7891df36db009ae672db3456c76
Parents: 645cdff
Author: fmartelli <fa...@gmail.com>
Authored: Fri Mar 28 19:36:47 2014 +0100
Committer: fmartelli <fa...@gmail.com>
Committed: Fri Mar 28 19:36:47 2014 +0100
----------------------------------------------------------------------
.../org/apache/olingo/fit/AbstractServices.java | 8 ++-
.../org/apache/olingo/fit/V4NorthWindExt.java | 3 +-
.../java/org/apache/olingo/fit/V4Services.java | 3 +-
.../utils/ResolvingReferencesInterceptor.java | 57 ++++++++++++++++++++
.../core/it/v4/EntityRetrieveTestITCase.java | 26 ++++++---
5 files changed, 87 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/583a83dc/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java b/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java
index e25908f..237d0ae 100644
--- a/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java
+++ b/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java
@@ -144,7 +144,13 @@ public abstract class AbstractServices {
return xml.createFaultResponse(Accept.XML.toString(getVersion()), e);
}
}
-
+//
+// @GET
+// @Path("/$entity")
+// public Response getEntityReference(@QueryParam("$id") String id){
+// return null;
+// }
+
/**
* Retrieve entity reference sample.
*
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/583a83dc/fit/src/main/java/org/apache/olingo/fit/V4NorthWindExt.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/V4NorthWindExt.java b/fit/src/main/java/org/apache/olingo/fit/V4NorthWindExt.java
index 0dad6ac..a3d60a7 100644
--- a/fit/src/main/java/org/apache/olingo/fit/V4NorthWindExt.java
+++ b/fit/src/main/java/org/apache/olingo/fit/V4NorthWindExt.java
@@ -24,9 +24,10 @@ import javax.ws.rs.Path;
import javax.ws.rs.core.Response;
import org.apache.cxf.interceptor.InInterceptors;
import static org.apache.olingo.fit.utils.Constants.METADATA;
+import org.apache.olingo.fit.utils.ResolvingReferencesInterceptor;
@Path("/V40/NorthWindExt.svc")
-@InInterceptors(classes = XHTTPMethodInterceptor.class)
+@InInterceptors(classes = {XHTTPMethodInterceptor.class, ResolvingReferencesInterceptor.class})
public class V4NorthWindExt extends AbstractServices {
public V4NorthWindExt() throws Exception {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/583a83dc/fit/src/main/java/org/apache/olingo/fit/V4Services.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/V4Services.java b/fit/src/main/java/org/apache/olingo/fit/V4Services.java
index 3fc5ddc..327e82d 100644
--- a/fit/src/main/java/org/apache/olingo/fit/V4Services.java
+++ b/fit/src/main/java/org/apache/olingo/fit/V4Services.java
@@ -22,9 +22,10 @@ import org.apache.olingo.fit.utils.ODataVersion;
import org.apache.olingo.fit.utils.XHTTPMethodInterceptor;
import javax.ws.rs.Path;
import org.apache.cxf.interceptor.InInterceptors;
+import org.apache.olingo.fit.utils.ResolvingReferencesInterceptor;
@Path("/V40/Static.svc")
-@InInterceptors(classes = XHTTPMethodInterceptor.class)
+@InInterceptors(classes = {XHTTPMethodInterceptor.class, ResolvingReferencesInterceptor.class})
public class V4Services extends AbstractServices {
public V4Services() throws Exception {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/583a83dc/fit/src/main/java/org/apache/olingo/fit/utils/ResolvingReferencesInterceptor.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/utils/ResolvingReferencesInterceptor.java b/fit/src/main/java/org/apache/olingo/fit/utils/ResolvingReferencesInterceptor.java
new file mode 100644
index 0000000..4adac8a
--- /dev/null
+++ b/fit/src/main/java/org/apache/olingo/fit/utils/ResolvingReferencesInterceptor.java
@@ -0,0 +1,57 @@
+/*
+ * 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.fit.utils;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.net.URLDecoder;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.Phase;
+
+public class ResolvingReferencesInterceptor extends AbstractPhaseInterceptor<Message> {
+
+ public ResolvingReferencesInterceptor() {
+ super(Phase.PRE_PROTOCOL);
+ }
+
+ @Override
+ public void handleMessage(final Message message) throws Fault {
+ final String path = (String) message.get(Message.PATH_INFO);
+ final String query = (String) message.get(Message.QUERY_STRING);
+
+ try {
+ if (path.endsWith("$entity") && StringUtils.isNotBlank(query)
+ && URLDecoder.decode(query, "UTF-8").contains("$id=")) {
+ final String id = URLDecoder.decode(query, "UTF-8");
+ final String newURL = id.substring(id.indexOf("$id=") + 4);
+
+ final URI uri = URI.create(newURL);
+
+ message.put(Message.REQUEST_URL, uri.toASCIIString());
+ message.put(Message.REQUEST_URI, uri.getPath());
+ message.put(Message.PATH_INFO, uri.getPath());
+ }
+
+ } catch (UnsupportedEncodingException ignore) {
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/583a83dc/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityRetrieveTestITCase.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityRetrieveTestITCase.java b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityRetrieveTestITCase.java
index a96384f..6d2a89d 100644
--- a/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityRetrieveTestITCase.java
+++ b/lib/client-core/src/test/java/org/apache/olingo/client/core/it/v4/EntityRetrieveTestITCase.java
@@ -18,6 +18,7 @@
*/
package org.apache.olingo.client.core.it.v4;
+import java.net.URI;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
@@ -38,6 +39,7 @@ import org.apache.olingo.commons.api.domain.ODataLink;
import org.apache.olingo.commons.api.domain.ODataProperty;
import org.apache.olingo.commons.api.format.ODataPubFormat;
import org.apache.olingo.client.api.uri.CommonURIBuilder;
+import static org.apache.olingo.client.core.it.v4.AbstractTestITCase.client;
import org.apache.olingo.commons.core.op.ResourceFactory;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.junit.Ignore;
@@ -252,29 +254,39 @@ public class EntityRetrieveTestITCase extends AbstractTestITCase {
}
@Test
- public void retrieveEntityReferenceAsAtom() {
- retrieveEntityReference(ODataPubFormat.ATOM);
+ public void retrieveEntityViaReferenceAsAtom() {
+ retrieveEntityViaReference(ODataPubFormat.ATOM);
}
@Test
@Ignore
- public void retrieveEntityReferenceAsJSON() {
- retrieveEntityReference(ODataPubFormat.JSON_FULL_METADATA);
+ public void retrieveEntityViaReferenceAsJSON() {
+ retrieveEntityViaReference(ODataPubFormat.JSON_FULL_METADATA);
}
- private void retrieveEntityReference(final ODataPubFormat format) {
+ private void retrieveEntityViaReference(final ODataPubFormat format) {
final CommonURIBuilder<?> uriBuilder = client.getURIBuilder(getServiceRoot()).
appendEntitySetSegment("Orders").appendKeySegment(8).appendNavigationSegment("CustomerForOrder").
appendRefSegment();
- final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
+ ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
req.setFormat(format);
- final ODataRetrieveResponse<ODataEntity> res = req.execute();
+ ODataRetrieveResponse<ODataEntity> res = req.execute();
assertNotNull(res);
final ODataEntity entity = res.getBody();
assertNotNull(entity);
assertTrue(entity.getReference().endsWith("/StaticService/V40/Static.svc/Customers(PersonID=1)"));
+
+ final URI referenceURI =
+ client.getURIBuilder(getServiceRoot()).appendEntityIdSegment(entity.getReference()).build();
+
+ req = client.getRetrieveRequestFactory().getEntityRequest(referenceURI);
+ req.setFormat(format);
+
+ res = req.execute();
+ assertNotNull(res);
+ assertNotNull(res.getBody());
}
}
[34/51] [abbrv] git commit: Merge branch 'olingo200' of
https://git-wip-us.apache.org/repos/asf/olingo-odata4 into olingo200
Posted by il...@apache.org.
Merge branch 'olingo200' of https://git-wip-us.apache.org/repos/asf/olingo-odata4 into olingo200
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/abe0e15e
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/abe0e15e
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/abe0e15e
Branch: refs/heads/master
Commit: abe0e15e9365c2ba633c8418b0a7cb91c14c215d
Parents: 80e5ed5 4931b30
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Sat Mar 29 16:55:47 2014 +0100
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Sat Mar 29 16:55:47 2014 +0100
----------------------------------------------------------------------
.../olingo/client/api/uri/CommonURIBuilder.java | 13 ++++--
.../client/core/uri/AbstractURIBuilder.java | 24 +++++++++-
.../olingo/client/core/uri/ParameterAlias.java | 48 ++++++++++++++++++++
.../apache/olingo/client/core/uri/URIUtils.java | 40 ++++++++--------
.../client/core/uri/v3/URIBuilderTest.java | 13 ++++++
5 files changed, 115 insertions(+), 23 deletions(-)
----------------------------------------------------------------------