olingo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chri...@apache.org
Subject git commit: better entity access in technical service data provider
Date Mon, 06 Oct 2014 08:51:23 GMT
Repository: olingo-odata4
Updated Branches:
  refs/heads/master 6fbdb7834 -> d1bca4714


better entity access in technical service data provider

Change-Id: I41daf09f35a8a942f7b234d75357c08c19c0cbd9

Signed-off-by: Christian Amend <chrisam@apache.org>


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

Branch: refs/heads/master
Commit: d1bca47144c6979753a0173b3a19c4c2663be11b
Parents: 6fbdb78
Author: Klaus Straubinger <klaus.straubinger@sap.com>
Authored: Thu Oct 2 15:46:24 2014 +0200
Committer: Christian Amend <chrisam@apache.org>
Committed: Mon Oct 6 10:44:27 2014 +0200

----------------------------------------------------------------------
 .../org/apache/olingo/server/tecsvc/data/DataProvider.java    | 7 ++++---
 .../apache/olingo/server/tecsvc/data/DataProviderTest.java    | 4 ++--
 2 files changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1bca471/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java
b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java
index c1b55c4..820994b 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java
@@ -84,10 +84,11 @@ public class DataProvider {
           for (final UriParameter key : keys) {
             final EdmProperty property = (EdmProperty) entityType.getProperty(key.getName());
             final EdmPrimitiveType type = (EdmPrimitiveType) property.getType();
-            if (!type.valueToString(entity.getProperty(key.getName()).getValue(),
+            final Object value = entity.getProperty(key.getName()).getValue();
+            final Object keyValue = type.valueOfString(key.getText(),
                 property.isNullable(), property.getMaxLength(), property.getPrecision(),
property.getScale(),
-                property.isUnicode())
-                .equals(key.getText())) {
+                property.isUnicode(), value.getClass());
+            if (!value.equals(keyValue)) {
               found = false;
               break;
             }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1bca471/lib/server-tecsvc/src/test/java/org/apache/olingo/server/tecsvc/data/DataProviderTest.java
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/test/java/org/apache/olingo/server/tecsvc/data/DataProviderTest.java
b/lib/server-tecsvc/src/test/java/org/apache/olingo/server/tecsvc/data/DataProviderTest.java
index e8be8ad..c42daa5 100644
--- a/lib/server-tecsvc/src/test/java/org/apache/olingo/server/tecsvc/data/DataProviderTest.java
+++ b/lib/server-tecsvc/src/test/java/org/apache/olingo/server/tecsvc/data/DataProviderTest.java
@@ -57,12 +57,12 @@ public class DataProviderTest {
   @Test
   public void esAllPrimEntity() throws Exception {
     final DataProvider dataProvider = new DataProvider();
-    Entity first = dataProvider.readAll(esAllPrim).getEntities().get(0);
+    Entity first = dataProvider.readAll(esAllPrim).getEntities().get(2);
     Assert.assertEquals(16, first.getProperties().size());
 
     UriParameter parameter = Mockito.mock(UriParameter.class);
     Mockito.when(parameter.getName()).thenReturn("PropertyInt16");
-    Mockito.when(parameter.getText()).thenReturn(Short.toString(Short.MAX_VALUE));
+    Mockito.when(parameter.getText()).thenReturn("-0");
     Assert.assertEquals(first, dataProvider.read(esAllPrim, Arrays.asList(parameter)));
   }
 


Mime
View raw message