olingo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject [28/38] git commit: [OLINGO-255] fixed
Date Sun, 18 May 2014 05:06:56 GMT
[OLINGO-255] fixed


Project: http://git-wip-us.apache.org/repos/asf/olingo-odata2/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata2/commit/15abea36
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata2/tree/15abea36
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata2/diff/15abea36

Branch: refs/heads/Olingo-129_PocJpaDataStore
Commit: 15abea36ed0b9f74d5d6b3c0c7a68b9717566642
Parents: 2541c88
Author: Stephan Klevenz <sklevenz@apache.org>
Authored: Fri Apr 25 10:21:48 2014 +0200
Committer: Stephan Klevenz <sklevenz@apache.org>
Committed: Fri Apr 25 10:21:48 2014 +0200

----------------------------------------------------------------------
 .../processor/core/util/ClassHelperTest.java    |  2 +-
 .../core/ep/consumer/JsonEntryConsumer.java     |  5 ++-
 .../core/ep/consumer/JsonFeedConsumer.java      |  3 +-
 .../consumer/JsonEntryDeepInsertEntryTest.java  | 16 +++++++
 .../resources/JsonInlineRoomWithInlineNull.json | 44 ++++++++++++++++++++
 5 files changed, 67 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/15abea36/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelperTest.java
----------------------------------------------------------------------
diff --git a/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelperTest.java
b/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelperTest.java
index 3a1aba0..4da0960 100644
--- a/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelperTest.java
+++ b/odata2-annotation-processor/annotation-processor-core/src/test/java/org/apache/olingo/odata2/annotation/processor/core/util/ClassHelperTest.java
@@ -96,7 +96,7 @@ public class ClassHelperTest {
   //
 
   @EdmEntityType
-  @SuppressWarnings("unused")
+//  @SuppressWarnings("unused")
   private class SimpleEntity {
     @EdmKey
     @EdmProperty

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/15abea36/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntryConsumer.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntryConsumer.java
b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntryConsumer.java
index 5bae8e7..1a6bca2 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntryConsumer.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntryConsumer.java
@@ -280,7 +280,8 @@ public class JsonEntryConsumer {
       throw new EntityProviderException(EntityProviderException.ILLEGAL_ARGUMENT.addContent(navigationPropertyName));
     }
 
-    if (reader.peek() == JsonToken.BEGIN_OBJECT) {
+    JsonToken peek = reader.peek();
+    if (peek == JsonToken.BEGIN_OBJECT) {
       reader.beginObject();
       String name = reader.nextName();
       if (FormatJson.DEFERRED.equals(name)) {
@@ -342,6 +343,8 @@ public class JsonEntryConsumer {
         }
       }
       reader.endObject();
+    } else if (peek == JsonToken.NULL) {
+      reader.nextNull();
     } else {
       final EdmNavigationProperty navigationProperty =
           (EdmNavigationProperty) eia.getEntityType().getProperty(navigationPropertyName);

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/15abea36/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonFeedConsumer.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonFeedConsumer.java
b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonFeedConsumer.java
index f607286..04edbdc 100644
--- a/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonFeedConsumer.java
+++ b/odata2-lib/odata-core/src/main/java/org/apache/olingo/odata2/core/ep/consumer/JsonFeedConsumer.java
@@ -82,7 +82,8 @@ public class JsonFeedConsumer {
   }
 
   private void readFeed() throws IOException, EdmException, EntityProviderException {
-    if (reader.peek() == JsonToken.BEGIN_ARRAY) {
+    JsonToken peek = reader.peek();
+    if (peek == JsonToken.BEGIN_ARRAY) {
       readArrayContent();
     } else {
       reader.beginObject();

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/15abea36/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntryDeepInsertEntryTest.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntryDeepInsertEntryTest.java
b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntryDeepInsertEntryTest.java
index 4919d99..1a057af 100644
--- a/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntryDeepInsertEntryTest.java
+++ b/odata2-lib/odata-core/src/test/java/org/apache/olingo/odata2/core/ep/consumer/JsonEntryDeepInsertEntryTest.java
@@ -51,6 +51,7 @@ public class JsonEntryDeepInsertEntryTest extends AbstractConsumerTest {
 
   private static final String EMPLOYEE_WITH_INLINE_TEAM = "JsonEmployeeWithInlineTeam.json";
   private static final String INLINE_ROOM_WITH_INLINE_BUILDING = "JsonInlineRoomWithInlineBuilding.json";
+  private static final String INLINE_ROOM_WITH_INLINE_NULL = "JsonInlineRoomWithInlineNull.json";
 
   @Test
   public void innerEntryNoMediaResourceWithoutCallback() throws Exception {
@@ -266,6 +267,21 @@ public class JsonEntryDeepInsertEntryTest extends AbstractConsumerTest
{
     assertEquals("http://localhost:8080/ReferenceScenario.svc/Buildings('1')/nb_Rooms", associationUris.get(0));
   }
 
+  @Test
+  public void inlineRoomWithInlineNullWithCallbacks() throws Exception {
+    EntryCallback buildingCallback = new EntryCallback();
+    EntryCallback roomCallback = new EntryCallback(buildingCallback);
+    EntityProviderReadProperties readProperties =
+        EntityProviderReadProperties.init().mergeSemantic(false).callback(roomCallback).build();
+    ODataEntry outerEntry = prepareAndExecuteEntry(INLINE_ROOM_WITH_INLINE_NULL, "Employees",
readProperties);
+
+    ODataEntry innerRoom = (ODataEntry) outerEntry.getProperties().get("ne_Room");
+    assertNull(innerRoom);
+
+    innerRoom = roomCallback.getEntry();
+    assertNull(innerRoom);
+  }
+
   private class EntryCallback implements OnReadInlineContent {
     private ODataEntry entry;
     private EntryCallback innerCallback;

http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/15abea36/odata2-lib/odata-core/src/test/resources/JsonInlineRoomWithInlineNull.json
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-core/src/test/resources/JsonInlineRoomWithInlineNull.json b/odata2-lib/odata-core/src/test/resources/JsonInlineRoomWithInlineNull.json
new file mode 100644
index 0000000..a4b8c5e
--- /dev/null
+++ b/odata2-lib/odata-core/src/test/resources/JsonInlineRoomWithInlineNull.json
@@ -0,0 +1,44 @@
+{
+	"d" : {
+		"__metadata" : {
+			"id" : "http://localhost:8080/ReferenceScenario.svc/Employees('1')",
+			"uri" : "http://localhost:8080/ReferenceScenario.svc/Employees('1')",
+			"type" : "RefScenario.Employee",
+			"content_type" : "image/jpeg",
+			"media_src" : "Employees('1')/$value",
+			"edit_media" : "http://localhost:8080/ReferenceScenario.svc/Employees('1')/$value"
+		},
+		"EmployeeId" : "1",
+		"EmployeeName" : "Walter Winter",
+		"ManagerId" : "1",
+		"RoomId" : "1",
+		"TeamId" : "1",
+		"Location" : {
+			"__metadata" : {
+				"type" : "RefScenario.c_Location"
+			},
+			"City" : {
+				"__metadata" : {
+					"type" : "RefScenario.c_City"
+				},
+				"PostalCode" : "69124",
+				"CityName" : "Heidelberg"
+			},
+			"Country" : "Germany"
+		},
+		"Age" : 52,
+		"EntryDate" : "\/Date(915148800000)\/",
+		"ImageUrl" : "Employees('1')/$value",
+		"ne_Manager" : {
+			"__deferred" : {
+				"uri" : "http://localhost:8080/ReferenceScenario.svc/Employees('1')/ne_Manager"
+			}
+		},
+		"ne_Team" : {
+			"__deferred" : {
+				"uri" : "http://localhost:8080/ReferenceScenario.svc/Employees('1')/ne_Team"
+			}
+		},
+		"ne_Room" : null
+	}
+}


Mime
View raw message