[OLINGO-821] small fix for UriParser handling of Enum/TypeDefinition

Signed-off-by: Christian Amend <christian.amend@sap.com>
This commit is contained in:
Klaus Straubinger 2015-11-10 16:10:44 +01:00 committed by Christian Amend
parent 0c100df480
commit 6614aea6ba
4 changed files with 117 additions and 42 deletions

View File

@ -68,7 +68,7 @@ public class EdmEnumTest {
.setUnderlyingType(EdmPrimitiveTypeKind.SByte.getFullQualifiedName())); .setUnderlyingType(EdmPrimitiveTypeKind.SByte.getFullQualifiedName()));
when(edm.getEnumType(new FullQualifiedName("namespace.name"))).thenReturn(instance); when(edm.getEnumType(new FullQualifiedName("namespace.name"))).thenReturn(instance);
when(edm.getEnumType(new FullQualifiedName("alias.name"))).thenReturn(instance); when(edm.getEnumType(new FullQualifiedName("alias.name"))).thenReturn(instance);
otherInstance = new EdmEnumTypeImpl(null, enumName, otherInstance = new EdmEnumTypeImpl(null, enumName,
new CsdlEnumType().setName("name").setMembers(memberList).setFlags(true) new CsdlEnumType().setName("name").setMembers(memberList).setFlags(true)
.setUnderlyingType(EdmPrimitiveTypeKind.SByte.getFullQualifiedName())); .setUnderlyingType(EdmPrimitiveTypeKind.SByte.getFullQualifiedName()));
@ -178,15 +178,15 @@ public class EdmEnumTest {
assertEquals("first", instance.fromUriLiteral("namespace.name'first'")); assertEquals("first", instance.fromUriLiteral("namespace.name'first'"));
assertEquals("first", instance.fromUriLiteral("alias.name'first'")); assertEquals("first", instance.fromUriLiteral("alias.name'first'"));
expectErrorInFromUriLiteral(instance, "", null); expectErrorInFromUriLiteral(instance, "");
expectErrorInFromUriLiteral(instance, "'", null); expectErrorInFromUriLiteral(instance, "'");
expectErrorInFromUriLiteral(instance, "''", null); expectErrorInFromUriLiteral(instance, "''");
expectErrorInFromUriLiteral(instance, "name'first'", null); expectErrorInFromUriLiteral(instance, "name'first'");
expectErrorInFromUriLiteral(instance, "namespace.name'", null); expectErrorInFromUriLiteral(instance, "namespace.name'");
expectErrorInFromUriLiteral(instance, "namespace.name'first", null); expectErrorInFromUriLiteral(instance, "namespace.name'first");
expectErrorInFromUriLiteral(instance, "namespace.namespace'first", null); expectErrorInFromUriLiteral(instance, "namespace.namespace'first");
expectErrorInFromUriLiteral(instance, "namespace.namespace'fi'rst", null); expectErrorInFromUriLiteral(instance, "namespace.namespace'fi'rst");
expectErrorInFromUriLiteral(instance, "namespace.namespace'first'", null); expectErrorInFromUriLiteral(instance, "namespace.namespace'first'");
} }
@Test @Test
@ -291,17 +291,13 @@ public class EdmEnumTest {
expectContentErrorInValueToString(int16EnumType, Integer.MAX_VALUE); expectContentErrorInValueToString(int16EnumType, Integer.MAX_VALUE);
} }
protected void expectErrorInFromUriLiteral(final EdmPrimitiveType instance, final String value, final String error) { protected void expectErrorInFromUriLiteral(final EdmPrimitiveType instance, final String value) {
try { try {
instance.fromUriLiteral(value); instance.fromUriLiteral(value);
fail("Expected exception not thrown"); fail("Expected exception not thrown");
} catch (final EdmPrimitiveTypeException e) { } catch (final EdmPrimitiveTypeException e) {
assertNotNull(e.getLocalizedMessage()); assertNotNull(e.getLocalizedMessage());
if(error == null){ assertThat(e.getLocalizedMessage(), containsString("' has illegal content."));
assertThat(e.getLocalizedMessage(), containsString("' has illegal content."));
}else{
assertThat(e.getLocalizedMessage(), containsString(error));
}
} }
} }

View File

@ -483,7 +483,9 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
} }
if (property instanceof EdmProperty) { if (property instanceof EdmProperty) {
if (((EdmProperty) property).isPrimitive()) { if (((EdmProperty) property).isPrimitive()
|| property.getType().getKind() == EdmTypeKind.ENUM
|| property.getType().getKind() == EdmTypeKind.DEFINITION) {
// create simple property // create simple property
UriResourcePrimitivePropertyImpl simpleResource = new UriResourcePrimitivePropertyImpl() UriResourcePrimitivePropertyImpl simpleResource = new UriResourcePrimitivePropertyImpl()
.setProperty((EdmProperty) property); .setProperty((EdmProperty) property);
@ -1046,6 +1048,11 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
return type; return type;
} }
type = edm.getTypeDefinition(fullName);
if (type != null) {
return type;
}
type = edm.getEnumType(fullName); type = edm.getEnumType(fullName);
if (type != null) { if (type != null) {
return type; return type;
@ -1994,8 +2001,9 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
@Override @Override
public Object visitDecimalLiteral(final DecimalLiteralContext ctx) { public Object visitDecimalLiteral(final DecimalLiteralContext ctx) {
final EdmType type = EdmPrimitiveTypeFactory.getInstance( final EdmType type = EdmPrimitiveTypeFactory.getInstance(
ctx.getText().contains("e") || ctx.getText().contains("E") ? EdmPrimitiveTypeKind.Double ctx.getText().contains("e") || ctx.getText().contains("E") ?
: EdmPrimitiveTypeKind.Decimal); EdmPrimitiveTypeKind.Double :
EdmPrimitiveTypeKind.Decimal);
return new LiteralImpl().setText(ctx.getText()).setType(type); return new LiteralImpl().setText(ctx.getText()).setType(type);
} }
@ -2216,7 +2224,9 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
// contextSelectItem.addSegment(newSegment); // contextSelectItem.addSegment(newSegment);
if (element instanceof EdmProperty) { if (element instanceof EdmProperty) {
EdmProperty property = (EdmProperty) element; EdmProperty property = (EdmProperty) element;
if (property.isPrimitive()) { if (property.isPrimitive()
|| property.getType().getKind() == EdmTypeKind.ENUM
|| property.getType().getKind() == EdmTypeKind.DEFINITION) {
UriResourcePrimitivePropertyImpl simple = new UriResourcePrimitivePropertyImpl(); UriResourcePrimitivePropertyImpl simple = new UriResourcePrimitivePropertyImpl();
simple.setProperty(property); simple.setProperty(property);

View File

@ -460,8 +460,12 @@ public class TechnicalPrimitiveComplexProcessor extends TechnicalProcessor
if (entitySet != null && !path.isEmpty()) { if (entitySet != null && !path.isEmpty()) {
builder = builder.navOrPropertyPath(buildPropertyPath(path)); builder = builder.navOrPropertyPath(buildPropertyPath(path));
} }
builder = builder.selectList(type.getKind() == EdmTypeKind.PRIMITIVE ? null : builder = builder.selectList(
helper.buildContextURLSelectList((EdmStructuredType) type, expand, select)); type.getKind() == EdmTypeKind.PRIMITIVE
|| type.getKind() == EdmTypeKind.ENUM
|| type.getKind() == EdmTypeKind.DEFINITION ?
null :
helper.buildContextURLSelectList((EdmStructuredType) type, expand, select));
return builder.build(); return builder.build();
} }

View File

@ -54,6 +54,7 @@ import org.apache.olingo.server.tecsvc.provider.EdmTechProvider;
import org.apache.olingo.server.tecsvc.provider.EntityTypeProvider; import org.apache.olingo.server.tecsvc.provider.EntityTypeProvider;
import org.apache.olingo.server.tecsvc.provider.EnumTypeProvider; import org.apache.olingo.server.tecsvc.provider.EnumTypeProvider;
import org.apache.olingo.server.tecsvc.provider.PropertyProvider; import org.apache.olingo.server.tecsvc.provider.PropertyProvider;
import org.apache.olingo.server.tecsvc.provider.TypeDefinitionProvider;
import org.junit.Ignore; import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.mockito.Mockito; import org.mockito.Mockito;
@ -1424,6 +1425,26 @@ public class TestFullResourcePath {
.isComplex("PropertyComp") .isComplex("PropertyComp")
.n() .n()
.isComplex("PropertyComp"); .isComplex("PropertyComp");
testUri.run("ESMixEnumDefCollComp(PropertyEnumString=olingo.odata.test1.ENString'String1',"
+ "PropertyDefString='key1')/PropertyEnumString")
.isKind(UriInfoKind.resource).goPath()
.first()
.isEntitySet("ESMixEnumDefCollComp")
.isKeyPredicate(0, "PropertyEnumString", "olingo.odata.test1.ENString'String1'")
.isKeyPredicate(1, "PropertyDefString", "'key1'")
.n()
.isPrimitiveProperty("PropertyEnumString", EnumTypeProvider.nameENString, false);
testUri.run("ESMixEnumDefCollComp(PropertyEnumString=olingo.odata.test1.ENString'String1',"
+ "PropertyDefString='key1')/PropertyDefString")
.isKind(UriInfoKind.resource).goPath()
.first()
.isEntitySet("ESMixEnumDefCollComp")
.isKeyPredicate(0, "PropertyEnumString", "olingo.odata.test1.ENString'String1'")
.isKeyPredicate(1, "PropertyDefString", "'key1'")
.n()
.isPrimitiveProperty("PropertyDefString", TypeDefinitionProvider.nameTDString, false);
} }
@Test @Test
@ -1458,6 +1479,26 @@ public class TestFullResourcePath {
.isType(ComplexTypeProvider.nameCTPrimComp, true) .isType(ComplexTypeProvider.nameCTPrimComp, true)
.n() .n()
.isCount(); .isCount();
testUri.run("ESMixEnumDefCollComp(PropertyEnumString=olingo.odata.test1.ENString'String1',"
+ "PropertyDefString='key1')/CollPropertyEnumString")
.isKind(UriInfoKind.resource).goPath()
.first()
.isEntitySet("ESMixEnumDefCollComp")
.isKeyPredicate(0, "PropertyEnumString", "olingo.odata.test1.ENString'String1'")
.isKeyPredicate(1, "PropertyDefString", "'key1'")
.n()
.isPrimitiveProperty("CollPropertyEnumString", EnumTypeProvider.nameENString, true);
testUri.run("ESMixEnumDefCollComp(PropertyEnumString=olingo.odata.test1.ENString'String1',"
+ "PropertyDefString='key1')/CollPropertyDefString")
.isKind(UriInfoKind.resource).goPath()
.first()
.isEntitySet("ESMixEnumDefCollComp")
.isKeyPredicate(0, "PropertyEnumString", "olingo.odata.test1.ENString'String1'")
.isKeyPredicate(1, "PropertyDefString", "'key1'")
.n()
.isPrimitiveProperty("CollPropertyDefString", TypeDefinitionProvider.nameTDString, true);
} }
@Test @Test
@ -2717,6 +2758,17 @@ public class TestFullResourcePath {
.goUpExpandValidator() .goUpExpandValidator()
.isSelectText("PropertyCompNav/PropertyInt16"); .isSelectText("PropertyCompNav/PropertyInt16");
testUri.run("ESMixEnumDefCollComp",
"$select=PropertyEnumString,PropertyDefString,CollPropertyEnumString,CollPropertyDefString")
.isKind(UriInfoKind.resource)
.goSelectItemPath(0).isPrimitiveProperty("PropertyEnumString", EnumTypeProvider.nameENString, false)
.goUpUriValidator()
.goSelectItemPath(1).isPrimitiveProperty("PropertyDefString", TypeDefinitionProvider.nameTDString, false)
.goUpUriValidator()
.goSelectItemPath(2).isPrimitiveProperty("CollPropertyEnumString", EnumTypeProvider.nameENString, true)
.goUpUriValidator()
.goSelectItemPath(3).isPrimitiveProperty("CollPropertyDefString", TypeDefinitionProvider.nameTDString, true);
testUri.runEx("ESKeyNav", "$expand=undefined") testUri.runEx("ESKeyNav", "$expand=undefined")
.isExSemantic(MessageKeys.EXPRESSION_PROPERTY_NOT_IN_TYPE); .isExSemantic(MessageKeys.EXPRESSION_PROPERTY_NOT_IN_TYPE);
testUri.runEx("ESTwoKeyNav", "$expand=PropertyCompNav/undefined") testUri.runEx("ESTwoKeyNav", "$expand=PropertyCompNav/undefined")
@ -3599,7 +3651,6 @@ public class TestFullResourcePath {
.root().right() .root().right()
.isType(PropertyProvider.nameDecimal); .isType(PropertyProvider.nameDecimal);
//
testFilter.runOnETAllPrim("PropertyDecimal ge PropertyDecimal") testFilter.runOnETAllPrim("PropertyDecimal ge PropertyDecimal")
.is("<<PropertyDecimal> ge <PropertyDecimal>>") .is("<<PropertyDecimal> ge <PropertyDecimal>>")
.isBinary(BinaryOperatorKind.GE) .isBinary(BinaryOperatorKind.GE)
@ -4397,8 +4448,6 @@ public class TestFullResourcePath {
.goUpFilterValidator().root() .goUpFilterValidator().root()
.goParameter(1).isTypedLiteral(ComplexTypeProvider.nameCTTwoPrim); .goParameter(1).isTypedLiteral(ComplexTypeProvider.nameCTTwoPrim);
// testFilter.runOnETKeyNav(" Xcast(PropertyCompTwoPrim,olingo.odata.test1.CTAllPrim)");
testFilter.runOnETKeyNav("cast(NavPropertyETKeyNavOne,olingo.odata.test1.ETKeyPrimNav)") testFilter.runOnETKeyNav("cast(NavPropertyETKeyNavOne,olingo.odata.test1.ETKeyPrimNav)")
.is("<cast(<NavPropertyETKeyNavOne>,<olingo.odata.test1.ETKeyPrimNav>)>") .is("<cast(<NavPropertyETKeyNavOne>,<olingo.odata.test1.ETKeyPrimNav>)>")
.isMethod(MethodKind.CAST, 2) .isMethod(MethodKind.CAST, 2)
@ -4657,7 +4706,7 @@ public class TestFullResourcePath {
.goUpFilterValidator() .goUpFilterValidator()
.root().goParameter(1).isTypedLiteral(PropertyProvider.nameTimeOfDay); .root().goParameter(1).isTypedLiteral(PropertyProvider.nameTimeOfDay);
testFilter.runOnETTwoKeyNav(" isof(PropertyComp/PropertyComp/PropertyDuration,Edm.Duration)") testFilter.runOnETTwoKeyNav("isof(PropertyComp/PropertyComp/PropertyDuration,Edm.Duration)")
.is("<isof(<PropertyComp/PropertyComp/PropertyDuration>,<Edm.Duration>)>") .is("<isof(<PropertyComp/PropertyComp/PropertyDuration>,<Edm.Duration>)>")
.root() .root()
.isMethod(MethodKind.ISOF, 2) .isMethod(MethodKind.ISOF, 2)
@ -4689,6 +4738,20 @@ public class TestFullResourcePath {
.n().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false) .n().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false)
.goUpFilterValidator() .goUpFilterValidator()
.root().goParameter(1).isTypedLiteral(PropertyProvider.nameGuid); .root().goParameter(1).isTypedLiteral(PropertyProvider.nameGuid);
testFilter.runOnETMixEnumDefCollComp("isof(PropertyEnumString,Namespace1_Alias.ENString)")
.isMethod(MethodKind.ISOF, 2)
.goParameter(0).goPath()
.first().isPrimitiveProperty("PropertyEnumString", EnumTypeProvider.nameENString, false)
.goUpFilterValidator()
.root().goParameter(1).isTypedLiteral(EnumTypeProvider.nameENString);
testFilter.runOnETMixEnumDefCollComp("isof(PropertyDefString,Namespace1_Alias.TDString)")
.isMethod(MethodKind.ISOF, 2)
.goParameter(0).goPath()
.first().isPrimitiveProperty("PropertyDefString", TypeDefinitionProvider.nameTDString, false)
.goUpFilterValidator()
.root().goParameter(1).isTypedLiteral(TypeDefinitionProvider.nameTDString);
} }
@Test @Test
@ -4697,7 +4760,7 @@ public class TestFullResourcePath {
testFilter.runOnETMixEnumDefCollComp("PropertyEnumString has olingo.odata.test1.ENString'String1'") testFilter.runOnETMixEnumDefCollComp("PropertyEnumString has olingo.odata.test1.ENString'String1'")
.is("<<PropertyEnumString> has <olingo.odata.test1.ENString<String1>>>") .is("<<PropertyEnumString> has <olingo.odata.test1.ENString<String1>>>")
.isBinary(BinaryOperatorKind.HAS) .isBinary(BinaryOperatorKind.HAS)
.root().left().goPath().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString) .root().left().goPath().isPrimitiveProperty("PropertyEnumString", EnumTypeProvider.nameENString, false)
.goUpFilterValidator() .goUpFilterValidator()
.root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String1")); .root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String1"));
@ -4707,8 +4770,7 @@ public class TestFullResourcePath {
.isBinary(BinaryOperatorKind.HAS) .isBinary(BinaryOperatorKind.HAS)
.root().left().goPath() .root().left().goPath()
.first().isComplex("PropertyCompMixedEnumDef") .first().isComplex("PropertyCompMixedEnumDef")
.n().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString) .n().isPrimitiveProperty("PropertyEnumString", EnumTypeProvider.nameENString, false)
.isType(EnumTypeProvider.nameENString)
.goUpFilterValidator() .goUpFilterValidator()
.root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String2")); .root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String2"));
@ -4722,7 +4784,7 @@ public class TestFullResourcePath {
.isBinary(BinaryOperatorKind.HAS) .isBinary(BinaryOperatorKind.HAS)
.root().left().left().goPath() .root().left().left().goPath()
.first().isComplex("PropertyCompMixedEnumDef") .first().isComplex("PropertyCompMixedEnumDef")
.n().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString) .n().isPrimitiveProperty("PropertyEnumString", EnumTypeProvider.nameENString, false)
.goUpFilterValidator() .goUpFilterValidator()
.root().left().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String2")); .root().left().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String2"));
@ -4730,8 +4792,7 @@ public class TestFullResourcePath {
.is("<<PropertyEnumString> has <olingo.odata.test1.ENString<String3>>>") .is("<<PropertyEnumString> has <olingo.odata.test1.ENString<String3>>>")
.isBinary(BinaryOperatorKind.HAS) .isBinary(BinaryOperatorKind.HAS)
.root().left().goPath() .root().left().goPath()
.first().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString) .first().isPrimitiveProperty("PropertyEnumString", EnumTypeProvider.nameENString, false)
.isType(EnumTypeProvider.nameENString)
.goUpFilterValidator() .goUpFilterValidator()
.root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String3")); .root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String3"));
@ -4739,8 +4800,7 @@ public class TestFullResourcePath {
.is("<<PropertyEnumString> has <olingo.odata.test1.ENString<String,String3>>>") .is("<<PropertyEnumString> has <olingo.odata.test1.ENString<String,String3>>>")
.isBinary(BinaryOperatorKind.HAS) .isBinary(BinaryOperatorKind.HAS)
.root().left().goPath() .root().left().goPath()
.first().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString) .first().isPrimitiveProperty("PropertyEnumString", EnumTypeProvider.nameENString, false)
.isType(EnumTypeProvider.nameENString)
.goUpFilterValidator() .goUpFilterValidator()
.root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String", "String3")); .root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String", "String3"));
@ -4749,7 +4809,8 @@ public class TestFullResourcePath {
.root() .root()
.isBinary(BinaryOperatorKind.HAS) .isBinary(BinaryOperatorKind.HAS)
.root().left().goPath() .root().left().goPath()
.first().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString).goUpFilterValidator() .first().isPrimitiveProperty("PropertyEnumString", EnumTypeProvider.nameENString, false)
.goUpFilterValidator()
.root().right().isNull(); .root().right().isNull();
testFilter.runOnETTwoKeyNav("endswith(PropertyComp/PropertyComp/PropertyString,'dorf')") testFilter.runOnETTwoKeyNav("endswith(PropertyComp/PropertyComp/PropertyString,'dorf')")
@ -4964,14 +5025,14 @@ public class TestFullResourcePath {
testFilter.runOnETMixEnumDefCollComp("PropertyEnumString eq olingo.odata.test1.ENString'String1'") testFilter.runOnETMixEnumDefCollComp("PropertyEnumString eq olingo.odata.test1.ENString'String1'")
.is("<<PropertyEnumString> eq <olingo.odata.test1.ENString<String1>>>") .is("<<PropertyEnumString> eq <olingo.odata.test1.ENString<String1>>>")
.isBinary(BinaryOperatorKind.EQ) .isBinary(BinaryOperatorKind.EQ)
.root().left().goPath().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString) .root().left().goPath().isPrimitiveProperty("PropertyEnumString", EnumTypeProvider.nameENString, false)
.goUpFilterValidator() .goUpFilterValidator()
.root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String1")); .root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String1"));
testFilter.runOnETMixEnumDefCollComp("PropertyEnumString eq olingo.odata.test1.ENString'String2'") testFilter.runOnETMixEnumDefCollComp("PropertyEnumString eq olingo.odata.test1.ENString'String2'")
.is("<<PropertyEnumString> eq <olingo.odata.test1.ENString<String2>>>") .is("<<PropertyEnumString> eq <olingo.odata.test1.ENString<String2>>>")
.isBinary(BinaryOperatorKind.EQ) .isBinary(BinaryOperatorKind.EQ)
.root().left().goPath().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString) .root().left().goPath().isPrimitiveProperty("PropertyEnumString", EnumTypeProvider.nameENString, false)
.goUpFilterValidator() .goUpFilterValidator()
.root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String2")); .root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String2"));
@ -4981,7 +5042,8 @@ public class TestFullResourcePath {
.isBinary(BinaryOperatorKind.EQ) .isBinary(BinaryOperatorKind.EQ)
.root().left().goPath() .root().left().goPath()
.first().isComplex("PropertyCompMixedEnumDef") .first().isComplex("PropertyCompMixedEnumDef")
.n().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString).goUpFilterValidator() .n().isPrimitiveProperty("PropertyEnumString", EnumTypeProvider.nameENString, false)
.goUpFilterValidator()
.root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String3")); .root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String3"));
testFilter testFilter
@ -4993,10 +5055,11 @@ public class TestFullResourcePath {
.isBinary(BinaryOperatorKind.EQ) .isBinary(BinaryOperatorKind.EQ)
.root().left().goPath() .root().left().goPath()
.first().isComplex("PropertyCompMixedEnumDef") .first().isComplex("PropertyCompMixedEnumDef")
.n().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString).goUpFilterValidator() .n().isPrimitiveProperty("PropertyEnumString", EnumTypeProvider.nameENString, false)
.goUpFilterValidator()
.root().right().goPath() .root().right().goPath()
.first().isComplex("PropertyCompMixedEnumDef") .first().isComplex("PropertyCompMixedEnumDef")
.n().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString).goUpFilterValidator(); .n().isPrimitiveProperty("PropertyEnumString", EnumTypeProvider.nameENString, false);
testFilter.runUriEx("ESMixEnumDefCollComp", "$filter=PropertyEnumString has ENString'String1'") testFilter.runUriEx("ESMixEnumDefCollComp", "$filter=PropertyEnumString has ENString'String1'")
.isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX); .isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
@ -5337,12 +5400,14 @@ public class TestFullResourcePath {
testFilter.runOrderByOnETMixEnumDefCollComp("PropertyEnumString eq olingo.odata.test1.ENString'String1'") testFilter.runOrderByOnETMixEnumDefCollComp("PropertyEnumString eq olingo.odata.test1.ENString'String1'")
.isSortOrder(0, false) .isSortOrder(0, false)
.goOrder(0).left().goPath().isComplex("PropertyEnumString").goUpFilterValidator() .goOrder(0).left().goPath().isPrimitiveProperty("PropertyEnumString", EnumTypeProvider.nameENString, false)
.goUpFilterValidator()
.goOrder(0).right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String1")); .goOrder(0).right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String1"));
testFilter.runOrderByOnETMixEnumDefCollComp("PropertyEnumString eq olingo.odata.test1.ENString'String1' desc") testFilter.runOrderByOnETMixEnumDefCollComp("PropertyEnumString eq olingo.odata.test1.ENString'String1' desc")
.isSortOrder(0, true) .isSortOrder(0, true)
.goOrder(0).left().goPath().isComplex("PropertyEnumString").goUpFilterValidator() .goOrder(0).left().goPath().isPrimitiveProperty("PropertyEnumString", EnumTypeProvider.nameENString, false)
.goUpFilterValidator()
.goOrder(0).right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String1")); .goOrder(0).right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String1"));
testFilter.runOrderByOnETTwoKeyNavEx("PropertyInt16 1") testFilter.runOrderByOnETTwoKeyNavEx("PropertyInt16 1")