[OLINGO-964] Add test for new expand type cast handling
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/parser/TestFullResourcePath.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/parser/TestFullResourcePath.java
index d60e6c3..82335a3 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/parser/TestFullResourcePath.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/parser/TestFullResourcePath.java
@@ -2716,6 +2716,19 @@
.n()
.isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false);
+ testUri.run("ESKeyNav", "$expand=NavPropertyETTwoKeyNavMany/Namespace1_Alias.ETBaseTwoKeyNav"
+ + "($expand=NavPropertyETBaseTwoKeyNavOne)")
+ .isKind(UriInfoKind.resource)
+ .goExpand().goPath().first()
+ .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, true)
+ .isType(EntityTypeProvider.nameETTwoKeyNav, true)
+ .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
+ .goUpExpandValidator()
+ // go to the expand options of the current expand
+ .goExpand()
+ .goPath().first()
+ .isNavProperty("NavPropertyETBaseTwoKeyNavOne", EntityTypeProvider.nameETBaseTwoKeyNav, false);
+
testUri.run("ESKeyNav(1)", "$expand=NavPropertyETKeyNavMany/$ref,NavPropertyETTwoKeyNavMany($skip=2;$top=1)")
.isKind(UriInfoKind.resource)
.goExpand().first()
@@ -5848,9 +5861,9 @@
testFilter.runOnETKeyNavEx("PropertyInt16 gt @alias")
.isInAliasToValueMap("@alias", null);
testFilter.runOnETKeyNavEx("PropertyInt16 gt @alias&@alias=@alias")
- .isInAliasToValueMap("@alias", "@alias");
+ .isInAliasToValueMap("@alias", "@alias");
testFilter.runOnETKeyNavEx("@alias&@alias=@alias2&@alias2=true or @alias")
- .isInAliasToValueMap("@alias", "@alias2");
+ .isInAliasToValueMap("@alias", "@alias2");
}
@Test
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/ResourceValidator.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/ResourceValidator.java
index 90ac68c..2bcdbc1 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/ResourceValidator.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/ResourceValidator.java
@@ -223,6 +223,9 @@
// input parameter type may be null in order to assert that the singleTypeFilter is not set
EdmType actualType = uriPathInfoKeyPred.getTypeFilterOnEntry();
+ if(actualType == null && type != null){
+ fail("Expected an entry type filter of type: " + type.getFullQualifiedNameAsString());
+ }
assertEquals(type, type == null ? actualType : actualType.getFullQualifiedName());
return this;
@@ -235,6 +238,9 @@
// input parameter type may be null in order to assert that the collectionTypeFilter is not set
EdmType actualType = uriPathInfoKeyPred.getTypeFilterOnCollection();
+ if(actualType == null && expectedType != null){
+ fail("Expected an collection type filter of type: " + expectedType.getFullQualifiedNameAsString());
+ }
assertEquals(expectedType,
expectedType == null || actualType == null ? actualType : actualType.getFullQualifiedName());