You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by sk...@apache.org on 2014/05/19 12:34:29 UTC

[31/45] git commit: [OLINGO-260] fix type seraialization + opentype integration test extension

[OLINGO-260] fix type seraialization + opentype integration test extension


Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/4a0bb2c2
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/4a0bb2c2
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/4a0bb2c2

Branch: refs/heads/olingo-266-ref
Commit: 4a0bb2c2e3a5161622caa6a4e70e077ec615342b
Parents: f413be9
Author: fmartelli <fa...@gmail.com>
Authored: Thu May 15 10:35:24 2014 +0200
Committer: Stephan Klevenz <st...@sap.com>
Committed: Mon May 19 12:33:29 2014 +0200

----------------------------------------------------------------------
 .../org/apache/olingo/fit/proxy/v3/OpenTypeTestITCase.java     | 6 +++---
 .../test/java/org/apache/olingo/fit/v3/OpenTypeTestITCase.java | 4 ++++
 .../java/org/apache/olingo/fit/v4/EntityCreateTestITCase.java  | 2 +-
 .../olingo/commons/core/data/AbstractJsonSerializer.java       | 2 +-
 .../commons/core/domain/AbstractODataCollectionValue.java      | 2 +-
 .../olingo/commons/core/domain/v4/ODataObjectFactoryImpl.java  | 1 -
 6 files changed, 10 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4a0bb2c2/fit/src/test/java/org/apache/olingo/fit/proxy/v3/OpenTypeTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/OpenTypeTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/OpenTypeTestITCase.java
index 853a1b7..95a1e9f 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/OpenTypeTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/OpenTypeTestITCase.java
@@ -119,9 +119,9 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
     assertEquals(String.class, rowIndex.getAdditionalProperty("aString").getClass());
     assertEquals(Boolean.class, rowIndex.getAdditionalProperty("aBoolean").getClass());
     assertEquals(Double.class, rowIndex.getAdditionalProperty("aDouble").getClass());
-//    assertEquals(Short.class, rowIndex.getAdditionalProperty("aByte").getClass()); // trova integer
-//    assertEquals(Byte.MAX_VALUE, rowIndex.getAdditionalProperty("aByte"));
-//    assertEquals(Calendar.class, rowIndex.getAdditionalProperty("aDate").getClass()); // trova stringa
+    assertEquals(Byte.class, rowIndex.getAdditionalProperty("aByte").getClass());
+    assertEquals(Byte.MAX_VALUE, rowIndex.getAdditionalProperty("aByte"));
+    assertTrue(Calendar.class.isAssignableFrom(rowIndex.getAdditionalProperty("aDate").getClass()));
 //    assertEquals(ContactDetails.class, rowIndex.getAdditionalProperty("aContact").getClass().getInterfaces()[0]);
 
     entityContext.detachAll();

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4a0bb2c2/fit/src/test/java/org/apache/olingo/fit/v3/OpenTypeTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/v3/OpenTypeTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v3/OpenTypeTestITCase.java
index 9b0ce9d..25b5065 100644
--- a/fit/src/test/java/org/apache/olingo/fit/v3/OpenTypeTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/v3/OpenTypeTestITCase.java
@@ -157,8 +157,12 @@ public class OpenTypeTestITCase extends AbstractTestITCase {
             rowIndex.getProperty("aBoolean").getPrimitiveValue().getTypeKind());
     assertTrue(rowIndex.getProperty("aDouble").hasPrimitiveValue());
     assertTrue(rowIndex.getProperty("aByte").hasPrimitiveValue());
+    assertEquals(EdmPrimitiveTypeKind.SByte, rowIndex.getProperty("aByte").getPrimitiveValue().getTypeKind());
     assertTrue(rowIndex.getProperty("aDate").hasPrimitiveValue());
+    assertEquals(EdmPrimitiveTypeKind.DateTime, rowIndex.getProperty("aDate").getPrimitiveValue().getTypeKind());
     assertTrue(rowIndex.getProperty("aContact").hasComplexValue());
+    assertEquals("Microsoft.Test.OData.Services.OpenTypesService.ContactDetails", 
+            rowIndex.getProperty("aContact").getValue().getTypeName());
     assertTrue(rowIndex.getProperty("aContact").getComplexValue().get("SignedByte").hasPrimitiveValue());
 
     final ODataDeleteResponse deleteRes = getClient().getCUDRequestFactory().

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4a0bb2c2/fit/src/test/java/org/apache/olingo/fit/v4/EntityCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/EntityCreateTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/EntityCreateTestITCase.java
index b2540da..4c7f4b7 100644
--- a/fit/src/test/java/org/apache/olingo/fit/v4/EntityCreateTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/v4/EntityCreateTestITCase.java
@@ -132,7 +132,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
             newEnumValue("Microsoft.Test.OData.Services.ODataWCFService.Color", "Blue")));
     product.getProperties().add(getClient().getObjectFactory().newCollectionProperty("CoverColors",
             getClient().getObjectFactory().
-            newCollectionValue("Microsoft.Test.OData.Services.ODataWCFService.ProductDetail")));
+            newCollectionValue("Microsoft.Test.OData.Services.ODataWCFService.Color")));
     product.getProperty("CoverColors").getCollectionValue().add(getClient().getObjectFactory().
             newEnumValue("Microsoft.Test.OData.Services.ODataWCFService.Color", "Green"));
     product.getProperty("CoverColors").getCollectionValue().add(getClient().getObjectFactory().

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4a0bb2c2/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 bb115cf..716d9b3 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
@@ -209,7 +209,7 @@ abstract class AbstractJsonSerializer<T> extends ODataJacksonSerializer<T> {
   }
 
   protected void valuable(final JsonGenerator jgen, final Valuable valuable, final String name) throws IOException {
-    if (serverMode && !Constants.VALUE.equals(name) && !(valuable instanceof Annotation)) {
+    if (!Constants.VALUE.equals(name) && !(valuable instanceof Annotation) && !valuable.getValue().isComplex()) {
       String type = valuable.getType();
       if (StringUtils.isBlank(type) && valuable.getValue().isPrimitive() || valuable.getValue().isNull()) {
         type = EdmPrimitiveTypeKind.String.getFullQualifiedName().toString();

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4a0bb2c2/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 b8ae8d3..cce9241 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
@@ -47,7 +47,7 @@ public abstract class AbstractODataCollectionValue<OV extends ODataValue>
    * @param typeName type name.
    */
   public AbstractODataCollectionValue(final String typeName) {
-    super(typeName);
+    super(typeName == null || typeName.startsWith("Collection(") ? typeName : "Collection(" + typeName + ")");
   }
   
   protected abstract ODataCollectionValue<OV> getThis();

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/4a0bb2c2/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 8ebdaeb..a89682e 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
@@ -153,5 +153,4 @@ public class ODataObjectFactoryImpl extends AbstractODataObjectFactory implement
   public ODataDelta newDelta(final URI next) {
     return new ODataDeltaImpl(next);
   }
-
 }