Repository: olingo-odata4
Updated Branches:
  refs/heads/master 5d7c1287f -> 53065cdfa


OLINGO-862: MediaEntity Type: HasStream is not inherited

Signed-off-by: Christian Amend <[email protected]>


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

Branch: refs/heads/master
Commit: 53065cdface25971ef50a7b97febf54c7e69c623
Parents: 5d7c128
Author: Frederik Zimmer <[email protected]>
Authored: Tue Feb 2 12:29:49 2016 +0100
Committer: Christian Amend <[email protected]>
Committed: Thu Feb 4 15:12:40 2016 +0100

----------------------------------------------------------------------
 .../commons/core/edm/EdmEntityTypeImpl.java      |  7 ++++++-
 .../core/edm/provider/EdmEntityTypeImplTest.java | 19 +++++++++++++++++++
 2 files changed, 25 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/53065cdf/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmEntityTypeImpl.java
----------------------------------------------------------------------
diff --git 
a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmEntityTypeImpl.java
 
b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmEntityTypeImpl.java
index 6d60afb..c532cb3 100644
--- 
a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmEntityTypeImpl.java
+++ 
b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmEntityTypeImpl.java
@@ -136,6 +136,11 @@ public class EdmEntityTypeImpl extends 
AbstractEdmStructuredType implements EdmE
 
   @Override
   public boolean hasStream() {
-    return hasStream;
+    checkBaseType();
+
+    if (hasStream || entityBaseType != null && entityBaseType.hasStream()) {
+      return true;
+    }
+    return false;
   }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/53065cdf/lib/commons-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImplTest.java
----------------------------------------------------------------------
diff --git 
a/lib/commons-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImplTest.java
 
b/lib/commons-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImplTest.java
index 6cbabff..d0013a2 100644
--- 
a/lib/commons-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImplTest.java
+++ 
b/lib/commons-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImplTest.java
@@ -241,6 +241,25 @@ public class EdmEntityTypeImplTest {
   }
 
   @Test
+  public void hasStreamInherited() throws Exception {
+    CsdlEdmProvider provider = mock(CsdlEdmProvider.class);
+    EdmProviderImpl edm = new EdmProviderImpl(provider);
+
+    FullQualifiedName baseName = new FullQualifiedName("namespace", 
"BaseTypeName");
+    CsdlEntityType baseType = new CsdlEntityType();
+    baseType.setHasStream(true);
+    when(provider.getEntityType(baseName)).thenReturn(baseType);
+
+    FullQualifiedName typeName = new FullQualifiedName("namespace", 
"typeName");
+    CsdlEntityType type = new CsdlEntityType();
+    type.setBaseType(baseName);
+    EdmEntityType typeWithBaseTypeWithStream = new EdmEntityTypeImpl(edm, 
typeName, type);
+    when(provider.getEntityType(typeName)).thenReturn(type);
+
+    assertTrue(typeWithBaseTypeWithStream.hasStream());
+  }
+
+  @Test
   public void complexKeyWithAlias() {
     List<String> keyPredicateNames = typeWithComplexKey.getKeyPredicateNames();
     assertEquals(2, keyPredicateNames.size());

Reply via email to