You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ch...@apache.org on 2015/01/21 17:16:39 UTC
olingo-odata4 git commit: [OLINGO-530] New Edm Entity Type for
Deserializer tests
Repository: olingo-odata4
Updated Branches:
refs/heads/master 5e9fa5431 -> a0ebaef72
[OLINGO-530] New Edm Entity Type for Deserializer tests
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/a0ebaef7
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/a0ebaef7
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/a0ebaef7
Branch: refs/heads/master
Commit: a0ebaef72ab9ec3de2da3593b5f655d867e3008b
Parents: 5e9fa54
Author: Christian Amend <ch...@apache.org>
Authored: Wed Jan 21 17:16:03 2015 +0100
Committer: Christian Amend <ch...@apache.org>
Committed: Wed Jan 21 17:16:03 2015 +0100
----------------------------------------------------------------------
.../api/deserializer/DeserializerException.java | 2 +-
.../json/ODataJsonDeserializer.java | 12 +-
.../xml/MetadataDocumentXmlSerializer.java | 2 +-
.../tecsvc/provider/ComplexTypeProvider.java | 17 +-
.../tecsvc/provider/ContainerProvider.java | 10 +-
.../tecsvc/provider/EntityTypeProvider.java | 19 +-
.../tecsvc/provider/PropertyProvider.java | 26 +-
.../server/tecsvc/provider/SchemaProvider.java | 9 +-
.../tecsvc/provider/TypeDefinitionProvider.java | 7 +
.../json/ODataJsonDeserializerEntityTest.java | 296 ++++++++++++++++++-
.../core/uri/antlr/TestFullResourcePath.java | 55 ++--
.../core/uri/testutil/FilterValidator.java | 8 +
12 files changed, 406 insertions(+), 57 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a0ebaef7/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/DeserializerException.java
----------------------------------------------------------------------
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/DeserializerException.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/DeserializerException.java
index 2469d76..0278a82 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/DeserializerException.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/DeserializerException.java
@@ -35,7 +35,7 @@ public class DeserializerException extends ODataTranslatedException {
/** parameter: propertyName */ INVALID_NULL_PROPERTY,
/** parameter: keyName */ UNKOWN_CONTENT,
/** parameter: propertyName */ INVALID_VALUE_FOR_PROPERTY,
- /** parameter: propertyName */ INVALID_TYPE_FOR_PROPERTY,
+ /** parameter: propertyName */ INVALID_JSON_TYPE_FOR_PROPERTY,
VALUE_ARRAY_NOT_PRESENT,
VALUE_TAG_MUST_BE_AN_ARRAY,
INVALID_ENTITY,
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a0ebaef7/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java
index be6d542..fa52b8b 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java
@@ -306,7 +306,7 @@ public class ODataJsonDeserializer implements ODataDeserializer {
if (edmProperty.isCollection()) {
if (!jsonNode.isArray()) {
throw new DeserializerException("Value for property: " + edmProperty.getName()
- + " must be an arrat but is not.", DeserializerException.MessageKeys.INVALID_VALUE_FOR_PROPERTY,
+ + " must be an arrat but is not.", DeserializerException.MessageKeys.INVALID_JSON_TYPE_FOR_PROPERTY,
edmProperty.getName());
}
List<Object> valueArray = new ArrayList<Object>();
@@ -370,7 +370,7 @@ public class ODataJsonDeserializer implements ODataDeserializer {
break;
default:
throw new DeserializerException("Invalid Type Kind for a property found: " + edmProperty.getType().getKind(),
- DeserializerException.MessageKeys.INVALID_TYPE_FOR_PROPERTY, edmProperty.getName());
+ DeserializerException.MessageKeys.INVALID_JSON_TYPE_FOR_PROPERTY, edmProperty.getName());
}
} else {
@@ -416,7 +416,7 @@ public class ODataJsonDeserializer implements ODataDeserializer {
break;
default:
throw new DeserializerException("Invalid Type Kind for a property found: " + edmProperty.getType().getKind(),
- DeserializerException.MessageKeys.INVALID_TYPE_FOR_PROPERTY, edmProperty.getName());
+ DeserializerException.MessageKeys.INVALID_JSON_TYPE_FOR_PROPERTY, edmProperty.getName());
}
}
return property;
@@ -426,7 +426,7 @@ public class ODataJsonDeserializer implements ODataDeserializer {
if (jsonNode.isArray() || !jsonNode.isContainerNode()) {
throw new DeserializerException(
"Inavlid value for property: " + edmComplexProperty.getName() + " must not be an array or primitive value.",
- DeserializerException.MessageKeys.INVALID_VALUE_FOR_PROPERTY, edmComplexProperty.getName());
+ DeserializerException.MessageKeys.INVALID_JSON_TYPE_FOR_PROPERTY, edmComplexProperty.getName());
}
// Even if there are no properties defined we have to give back an empty list
List<Property> propertyList = new ArrayList<Property>();
@@ -476,7 +476,7 @@ public class ODataJsonDeserializer implements ODataDeserializer {
if (!jsonNode.isValueNode()) {
throw new DeserializerException(
"Inavlid value for property: " + edmProperty.getName() + " must not be an object or array.",
- DeserializerException.MessageKeys.INVALID_VALUE_FOR_PROPERTY, edmProperty.getName());
+ DeserializerException.MessageKeys.INVALID_JSON_TYPE_FOR_PROPERTY, edmProperty.getName());
}
try {
EdmEnumType edmEnumType = (EdmEnumType) edmProperty.getType();
@@ -497,7 +497,7 @@ public class ODataJsonDeserializer implements ODataDeserializer {
if (!jsonNode.isValueNode()) {
throw new DeserializerException(
"Inavlid value for property: " + edmProperty.getName() + " must not be an object or array.",
- DeserializerException.MessageKeys.INVALID_TYPE_FOR_PROPERTY, edmProperty.getName());
+ DeserializerException.MessageKeys.INVALID_JSON_TYPE_FOR_PROPERTY, edmProperty.getName());
}
try {
EdmPrimitiveType edmPrimitiveType = (EdmPrimitiveType) edmProperty.getType();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a0ebaef7/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializer.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializer.java
index d962d82..25610fb 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializer.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializer.java
@@ -185,7 +185,7 @@ public class MetadataDocumentXmlSerializer {
for (EdmTypeDefinition definition : typeDefinitions) {
writer.writeEmptyElement(XML_TYPE_DEFINITION);
writer.writeAttribute(XML_NAME, definition.getName());
- writer.writeAttribute(XML_TYPE, getFullQualifiedName(definition.getUnderlyingType(), false));
+ writer.writeAttribute(XML_UNDERLYING_TYPE, getFullQualifiedName(definition.getUnderlyingType(), false));
// Facets
if (definition.getMaxLength() != null) {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a0ebaef7/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ComplexTypeProvider.java
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ComplexTypeProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ComplexTypeProvider.java
index 31e270d..6c02743 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ComplexTypeProvider.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ComplexTypeProvider.java
@@ -45,11 +45,12 @@ public class ComplexTypeProvider {
"CTNavFiveProp");
public static final FullQualifiedName nameCTPrim = new FullQualifiedName(SchemaProvider.NAMESPACE, "CTPrim");
public static final FullQualifiedName nameCTPrimComp = new FullQualifiedName(SchemaProvider.NAMESPACE, "CTPrimComp");
- public static final FullQualifiedName nameCTPrimEnum = new FullQualifiedName(SchemaProvider.NAMESPACE, "CTPrimEnum");
public static final FullQualifiedName nameCTTwoBase = new FullQualifiedName(SchemaProvider.NAMESPACE, "CTTwoBase");
public static final FullQualifiedName nameCTTwoBasePrimCompNav =
new FullQualifiedName(SchemaProvider.NAMESPACE, "CTTwoBasePrimCompNav");
public static final FullQualifiedName nameCTTwoPrim = new FullQualifiedName(SchemaProvider.NAMESPACE, "CTTwoPrim");
+ public static final FullQualifiedName nameCTMixEnumTypeDefColl = new FullQualifiedName(SchemaProvider.NAMESPACE,
+ "CTMixEnumTypeDefColl");
public ComplexType getComplexType(final FullQualifiedName complexTypeName) throws ODataException {
@@ -157,19 +158,21 @@ public class ComplexTypeProvider {
PropertyProvider.navPropertyETKeyNavOne_ETKeyNav,
PropertyProvider.collectionNavPropertyETKeyNavMany_ETKeyNav));
- } else if (complexTypeName.equals(nameCTPrimEnum)) {
- return new ComplexType()
- .setName("CTPrimEnum")
- .setProperties(Arrays.asList(PropertyProvider.propertyInt16, PropertyProvider.propertyEnumString_ENString));
-
} else if (complexTypeName.equals(nameCTTwoBasePrimCompNav)) {
return new ComplexType()
.setName("CTTwoBasePrimCompNav")
.setBaseType(nameCTBasePrimCompNav);
+ } else if (complexTypeName.equals(nameCTMixEnumTypeDefColl)) {
+ return new ComplexType()
+ .setName(nameCTMixEnumTypeDefColl.getName())
+ .setProperties(Arrays.asList(
+ PropertyProvider.propertyEnumString_ENString,
+ PropertyProvider.collPropertyEnumString_ENString,
+ PropertyProvider.propertyTypeDefinition_TDString,
+ PropertyProvider.collPropertyTypeDefinition_TDString));
}
return null;
}
-
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a0ebaef7/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ContainerProvider.java
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ContainerProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ContainerProvider.java
index 84ec4c4..2a5ef8f 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ContainerProvider.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ContainerProvider.java
@@ -95,6 +95,7 @@ public class ContainerProvider {
entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESBaseTwoKeyNav"));
entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESCompMixPrimCollComp"));
entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESFourKeyAlias"));
+ entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESMixEnumTypeDefCollComp"));
// Singletons
List<Singleton> singletons = new ArrayList<Singleton>();
@@ -262,6 +263,9 @@ public class ContainerProvider {
return new EntitySet()
.setName("ESFourKeyAlias")
.setType(EntityTypeProvider.nameETFourKeyAlias);
+ } else if (name.equals("ESMixEnumTypeDefCollComp")) {
+ return new EntitySet().setName("ESMixEnumTypeDefCollComp").setType(
+ EntityTypeProvider.nameETMixEnumTypeDefCollComp);
}
}
@@ -269,12 +273,12 @@ public class ContainerProvider {
}
public ActionImport getActionImport(final FullQualifiedName entityContainer, final String name)
- throws ODataException {
+ throws ODataException {
if (entityContainer.equals(nameContainer)) {
if (name.equals(AIRT_STRING)) {
return new ActionImport()
- .setName(AIRT_STRING)
- .setAction(ActionProvider.nameUARTString);
+ .setName(AIRT_STRING)
+ .setAction(ActionProvider.nameUARTString);
} else if (name.equals(AIRT_COLL_STRING_TWO_PARAM)) {
return new ActionImport()
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a0ebaef7/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/EntityTypeProvider.java
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/EntityTypeProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/EntityTypeProvider.java
index 4a4668c..e78c5d4 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/EntityTypeProvider.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/EntityTypeProvider.java
@@ -76,6 +76,9 @@ public class EntityTypeProvider {
public static final FullQualifiedName nameETAbstractBase = new FullQualifiedName(SchemaProvider.NAMESPACE,
"ETAbstractBase");
+ public static final FullQualifiedName nameETMixEnumTypeDefCollComp = new FullQualifiedName(SchemaProvider.NAMESPACE,
+ "ETMixEnumTypeDefCollComp");
+
public EntityType getEntityType(final FullQualifiedName entityTypeName) throws ODataException {
if (entityTypeName.equals(nameETAllPrim)) {
return new EntityType()
@@ -336,12 +339,10 @@ public class EntityTypeProvider {
PropertyProvider.propertyComp_CTPrimComp_NotNullable,
new Property().setName("PropertyCompNav").setType(ComplexTypeProvider.nameCTBasePrimCompNav)
.setNullable(false),
- PropertyProvider.propertyCompEnum_CTPrimEnum_NotNullable,
PropertyProvider.collPropertyComp_CTPrimComp,
new Property().setName("CollPropertyCompNav").setType(ComplexTypeProvider.nameCTNavFiveProp)
.setCollection(true),
- PropertyProvider.collPropertyString, PropertyProvider.propertyCompTwoPrim_CTTwoPrim,
- PropertyProvider.propertyEnumString_ENString
+ PropertyProvider.collPropertyString, PropertyProvider.propertyCompTwoPrim_CTTwoPrim
))
.setNavigationProperties(Arrays.asList(
new NavigationProperty()
@@ -417,6 +418,18 @@ public class EntityTypeProvider {
.setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
.setProperties(Arrays.asList(
PropertyProvider.propertyInt16_NotNullable));
+ } else if (entityTypeName.equals(nameETMixEnumTypeDefCollComp)) {
+ return new EntityType()
+ .setName(nameETMixEnumTypeDefCollComp.getName())
+ .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
+ .setProperties(Arrays.asList(
+ PropertyProvider.propertyInt16_NotNullable,
+ PropertyProvider.propertyEnumString_ENString,
+ PropertyProvider.collPropertyEnumString_ENString,
+ PropertyProvider.propertyTypeDefinition_TDString,
+ PropertyProvider.collPropertyTypeDefinition_TDString,
+ PropertyProvider.propertyComp_CTMixEnumTypeDefColl,
+ PropertyProvider.propertyCompColl_CTMixEnumTypeDefColl));
}
return null;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a0ebaef7/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/PropertyProvider.java
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/PropertyProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/PropertyProvider.java
index 765a534..156df86 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/PropertyProvider.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/PropertyProvider.java
@@ -508,11 +508,6 @@ public class PropertyProvider {
.setName("PropertyCompComp")
.setType(ComplexTypeProvider.nameCTCompComp);
- public static final Property propertyCompEnum_CTPrimEnum_NotNullable = new Property()
- .setName("PropertyCompEnum")
- .setType(ComplexTypeProvider.nameCTPrimEnum)
- .setNullable(false);
-
public static final Property propertyCompTwoPrim_CTTwoPrim = new Property()
.setName("PropertyCompTwoPrim")
.setType(ComplexTypeProvider.nameCTTwoPrim);
@@ -521,6 +516,15 @@ public class PropertyProvider {
.setName("PropertyMixedPrimCollComp")
.setType(ComplexTypeProvider.nameCTMixPrimCollComp);
+ public static final Property propertyComp_CTMixEnumTypeDefColl = new Property()
+ .setName("PropertyCTMixEnumTypeDefColl")
+ .setType(ComplexTypeProvider.nameCTMixEnumTypeDefColl);
+
+ public static final Property propertyCompColl_CTMixEnumTypeDefColl = new Property()
+ .setName("PropertyCTMixEnumTypeDefColl")
+ .setType(ComplexTypeProvider.nameCTMixEnumTypeDefColl)
+ .setCollection(true);
+
// Navigation Properties -------------------------------------------------------------------------------------------
public static final NavigationProperty collectionNavPropertyETKeyNavMany_ETKeyNav = new NavigationProperty()
.setName("NavPropertyETKeyNavMany")
@@ -588,6 +592,18 @@ public class PropertyProvider {
.setName("PropertyEnumString")
.setType(EnumTypeProvider.nameENString);
+ public static final Property collPropertyEnumString_ENString = new Property()
+ .setName("PropertyEnumString")
+ .setType(EnumTypeProvider.nameENString)
+ .setCollection(true);
+
// TypeDefinition Properties ---------------------------------------------------------------------------------------
+ public static final Property propertyTypeDefinition_TDString = new Property()
+ .setName("PropertyTypeDefinitionString")
+ .setType(TypeDefinitionProvider.nameTDString);
+ public static final Property collPropertyTypeDefinition_TDString = new Property()
+ .setName("CollPropertyTypeDefinitionString")
+ .setType(TypeDefinitionProvider.nameTDString)
+ .setCollection(true);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a0ebaef7/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/SchemaProvider.java
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/SchemaProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/SchemaProvider.java
index d2c1955..1b628f4 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/SchemaProvider.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/SchemaProvider.java
@@ -25,6 +25,7 @@ import org.apache.olingo.server.api.edm.provider.EntityType;
import org.apache.olingo.server.api.edm.provider.EnumType;
import org.apache.olingo.server.api.edm.provider.Function;
import org.apache.olingo.server.api.edm.provider.Schema;
+import org.apache.olingo.server.api.edm.provider.TypeDefinition;
import java.util.ArrayList;
import java.util.List;
@@ -77,6 +78,7 @@ public class SchemaProvider {
entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETKeyPrimNav));
entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETAbstract));
entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETAbstractBase));
+ entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETMixEnumTypeDefCollComp));
// ComplexTypes
List<ComplexType> complexType = new ArrayList<ComplexType>();
@@ -92,13 +94,16 @@ public class SchemaProvider {
complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTCompCollComp));
complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTPrimComp));
complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTNavFiveProp));
- complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTPrimEnum));
complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTBasePrimCompNav));
complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTTwoBasePrimCompNav));
complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTCompNav));
+ complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTMixEnumTypeDefColl));
// TypeDefinitions
-
+ List<TypeDefinition> typeDefinitions = new ArrayList<TypeDefinition>();
+ schema.setTypeDefinitions(typeDefinitions);
+ typeDefinitions.add(prov.getTypeDefinition(TypeDefinitionProvider.nameTDString));
+
// Actions
List<Action> actions = new ArrayList<Action>();
schema.setActions(actions);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a0ebaef7/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/TypeDefinitionProvider.java
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/TypeDefinitionProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/TypeDefinitionProvider.java
index 2688586..242c44f 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/TypeDefinitionProvider.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/TypeDefinitionProvider.java
@@ -18,12 +18,19 @@
*/
package org.apache.olingo.server.tecsvc.provider;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.server.api.edm.provider.TypeDefinition;
public class TypeDefinitionProvider {
+ public static final FullQualifiedName nameTDString = new FullQualifiedName(SchemaProvider.NAMESPACE, "TDString");
+
public TypeDefinition getTypeDefinition(final FullQualifiedName typeDefinitionName) {
+ if (nameTDString.equals(typeDefinitionName)) {
+ return new TypeDefinition().setName(nameTDString.getName()).setUnderlyingType(
+ EdmPrimitiveTypeKind.String.getFullQualifiedName());
+ }
return null;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a0ebaef7/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerEntityTest.java
----------------------------------------------------------------------
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerEntityTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerEntityTest.java
index ba19036..707112f 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerEntityTest.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerEntityTest.java
@@ -39,6 +39,7 @@ import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.server.api.OData;
import org.apache.olingo.server.api.deserializer.DeserializerException;
import org.apache.olingo.server.api.deserializer.ODataDeserializer;
+import org.junit.Ignore;
import org.junit.Test;
public class ODataJsonDeserializerEntityTest extends AbstractODataDeserializerTest {
@@ -240,6 +241,44 @@ public class ODataJsonDeserializerEntityTest extends AbstractODataDeserializerTe
}
}
+ @SuppressWarnings("unchecked")
+ @Test
+ public void eTMixPrimCollCompMIssingPropertyInComplexType() throws Exception {
+ final String entityString = "{"
+ + "\"PropertyComp\":{\"PropertyInt16\":111},"
+ + "\"CollPropertyComp\":["
+ + "{\"PropertyInt16\":123},"
+ + "{\"PropertyInt16\":456},"
+ + "{\"PropertyInt16\":789}]}";
+
+ InputStream stream = new ByteArrayInputStream(entityString.getBytes());
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ Entity entity =
+ deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixPrimCollComp")));
+ assertNotNull(entity);
+ List<Property> properties = entity.getProperties();
+ assertNotNull(properties);
+ assertEquals(2, properties.size());
+
+ Property complexProperty = entity.getProperty("PropertyComp");
+ assertEquals(ValueType.COMPLEX, complexProperty.getValueType());
+ List<Property> complexPropertyValues = (List<Property>) complexProperty.getValue();
+ assertEquals(1, complexPropertyValues.size());
+
+ Property property = entity.getProperty("CollPropertyComp");
+ assertEquals(ValueType.COLLECTION_COMPLEX, property.getValueType());
+
+ assertTrue(property.getValue() instanceof List);
+ List<? extends Object> asCollection = property.asCollection();
+ assertEquals(3, asCollection.size());
+
+ for (Object arrayElement : asCollection) {
+ assertTrue(arrayElement instanceof List);
+ List<Object> castedArrayElement = (List<Object>) arrayElement;
+ assertEquals(1, castedArrayElement.size());
+ }
+ }
+
@Test
public void simpleEntityWithContextURL() throws Exception {
String entityString =
@@ -377,6 +416,30 @@ public class ODataJsonDeserializerEntityTest extends AbstractODataDeserializerTe
assertTrue(bindingToMany.getBindingLinks().isEmpty());
}
+ @Ignore
+ @SuppressWarnings("unchecked")
+ @Test
+ public void eTTwoKeyNavEnumTest() throws Exception {
+ String entityString = "{"
+ + "\"PropertyEnumString\" : 2,"
+ + "\"PropertyCompEnum\" : {"
+ + "\"PropertyEnumString\" : 2"
+ + "}}";
+
+ InputStream stream = new ByteArrayInputStream(entityString.getBytes());
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ Entity entity =
+ deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETTwoKeyNav")));
+
+ Property enumProperty = entity.getProperty("PropertyEnumString");
+ assertNotNull(enumProperty);
+ assertEquals((short) 2, enumProperty.getValue());
+
+ Property complexProperty = entity.getProperty("PropertyCompEnum");
+ List<Property> value = (List<Property>) complexProperty.getValue();
+ assertEquals((short) 2, value.get(0).getValue());
+ }
+
// ---------------------------------- Negative Tests -----------------------------------------------------------
@Test(expected = DeserializerException.class)
@@ -894,7 +957,6 @@ public class ODataJsonDeserializerEntityTest extends AbstractODataDeserializerTe
throw e;
}
}
-
@Test(expected = DeserializerException.class)
public void invalidJsonValueForPrimTypeArray() throws Exception {
@@ -905,11 +967,11 @@ public class ODataJsonDeserializerEntityTest extends AbstractODataDeserializerTe
try {
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")));
} catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.INVALID_TYPE_FOR_PROPERTY, e.getMessageKey());
+ assertEquals(DeserializerException.MessageKeys.INVALID_JSON_TYPE_FOR_PROPERTY, e.getMessageKey());
throw e;
}
}
-
+
@Test(expected = DeserializerException.class)
public void invalidJsonValueForPrimTypeObject() throws Exception {
String entityString =
@@ -919,11 +981,237 @@ public class ODataJsonDeserializerEntityTest extends AbstractODataDeserializerTe
try {
deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")));
} catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.INVALID_TYPE_FOR_PROPERTY, e.getMessageKey());
+ assertEquals(DeserializerException.MessageKeys.INVALID_JSON_TYPE_FOR_PROPERTY, e.getMessageKey());
+ throw e;
+ }
+ }
+
+ @Test(expected = DeserializerException.class)
+ public void invalidJsonValueForPrimCollectionTypeObject() throws Exception {
+ final String entityString = "{"
+ + "\"CollPropertyString\":"
+ + "{\"Employee1@company.example\":1234}"
+ + "}";
+ InputStream stream = new ByteArrayInputStream(entityString.getBytes());
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ try {
+ deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixPrimCollComp")));
+ } catch (DeserializerException e) {
+ assertEquals(DeserializerException.MessageKeys.INVALID_JSON_TYPE_FOR_PROPERTY, e.getMessageKey());
+ throw e;
+ }
+ }
+
+ @Test(expected = DeserializerException.class)
+ public void invalidJsonValueForComplexTypeTypeString() throws Exception {
+ final String entityString = "{"
+ + "\"PropertyComp\":\"InvalidString\""
+ + "}";
+ InputStream stream = new ByteArrayInputStream(entityString.getBytes());
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ try {
+ deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixPrimCollComp")));
+ } catch (DeserializerException e) {
+ assertEquals(DeserializerException.MessageKeys.INVALID_JSON_TYPE_FOR_PROPERTY, e.getMessageKey());
+ throw e;
+ }
+ }
+
+ @Test(expected = DeserializerException.class)
+ public void invalidJsonValueForComplexTypeNull() throws Exception {
+ final String entityString = "{"
+ + "\"PropertyComp\":null"
+ + "}";
+ InputStream stream = new ByteArrayInputStream(entityString.getBytes());
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ try {
+ deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixPrimCollComp")));
+ } catch (DeserializerException e) {
+ assertEquals(DeserializerException.MessageKeys.INVALID_NULL_PROPERTY, e.getMessageKey());
+ throw e;
+ }
+ }
+
+ @Test(expected = DeserializerException.class)
+ public void invalidJsonValueForComplexCollectionNullValue() throws Exception {
+ final String entityString = "{"
+ + "\"CollPropertyComp\":["
+ + "null,"
+ + "{\"PropertyInt16\":789,\"PropertyString\":\"TEST 3\"}]}";
+ InputStream stream = new ByteArrayInputStream(entityString.getBytes());
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ try {
+ deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixPrimCollComp")));
+ } catch (DeserializerException e) {
+ assertEquals(DeserializerException.MessageKeys.INVALID_JSON_TYPE_FOR_PROPERTY, e.getMessageKey());
+ throw e;
+ }
+ }
+
+ @Test(expected = DeserializerException.class)
+ public void invalidJsonValueForPrimPropertyInComplexTypeNull() throws Exception {
+ final String entityString = "{"
+ + "\"PropertyComp\":{\"PropertyInt16\":null,\"PropertyString\":\"TEST A\"}"
+ + "}";
+ InputStream stream = new ByteArrayInputStream(entityString.getBytes());
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ try {
+ deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixPrimCollComp")));
+ } catch (DeserializerException e) {
+ assertEquals(DeserializerException.MessageKeys.INVALID_NULL_PROPERTY, e.getMessageKey());
+ throw e;
+ }
+ }
+
+ @Test(expected = DeserializerException.class)
+ public void provokedPrimitiveTypeException() throws Exception {
+ final String entityString = "{"
+ + "\"PropertyInt16\":32767000000000000000000000000000000000000"
+ + "}";
+ InputStream stream = new ByteArrayInputStream(entityString.getBytes());
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ try {
+ deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixPrimCollComp")));
+ } catch (DeserializerException e) {
+ assertEquals(DeserializerException.MessageKeys.INVALID_VALUE_FOR_PROPERTY, e.getMessageKey());
throw e;
}
}
+ @Ignore
+ @Test(expected = DeserializerException.class)
+ public void eTTwoKeyNavInvalidEnumValueNull() throws Exception {
+ String entityString = "{"
+ + "\"PropertyEnumString\" : null,"
+ + "\"PropertyCompEnum\" : {"
+ + "\"PropertyEnumString\" : 2"
+ + "}}";
+
+ InputStream stream = new ByteArrayInputStream(entityString.getBytes());
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ try {
+ deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETTwoKeyNav")));
+ } catch (DeserializerException e) {
+ assertEquals(DeserializerException.MessageKeys.INVALID_NULL_PROPERTY, e.getMessageKey());
+ throw e;
+ }
+ }
+
+ @Ignore
+ @Test(expected = DeserializerException.class)
+ public void eTTwoKeyNavInvalidComplexEnumValueNull() throws Exception {
+ String entityString = "{"
+ + "\"PropertyEnumString\" : 2,"
+ + "\"PropertyCompEnum\" : {"
+ + "\"PropertyEnumString\" : null"
+ + "}}";
+
+ InputStream stream = new ByteArrayInputStream(entityString.getBytes());
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ try {
+ deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETTwoKeyNav")));
+ } catch (DeserializerException e) {
+ assertEquals(DeserializerException.MessageKeys.INVALID_NULL_PROPERTY, e.getMessageKey());
+ throw e;
+ }
+ }
+
+ @Ignore
+ @Test(expected = DeserializerException.class)
+ public void eTTwoKeyNavInvalidEnumValueArray() throws Exception {
+ String entityString = "{"
+ + "\"PropertyEnumString\" : [],"
+ + "\"PropertyCompEnum\" : {"
+ + "\"PropertyEnumString\" : 2"
+ + "}}";
+
+ InputStream stream = new ByteArrayInputStream(entityString.getBytes());
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ try {
+ deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETTwoKeyNav")));
+ } catch (DeserializerException e) {
+ assertEquals(DeserializerException.MessageKeys.INVALID_JSON_TYPE_FOR_PROPERTY, e.getMessageKey());
+ throw e;
+ }
+ }
+
+ @Ignore
+ @Test(expected = DeserializerException.class)
+ public void eTTwoKeyNavInvalidEnumValueObject() throws Exception {
+ String entityString = "{"
+ + "\"PropertyEnumString\" : {},"
+ + "\"PropertyCompEnum\" : {"
+ + "\"PropertyEnumString\" : 2"
+ + "}}";
+
+ InputStream stream = new ByteArrayInputStream(entityString.getBytes());
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ try {
+ deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETTwoKeyNav")));
+ } catch (DeserializerException e) {
+ assertEquals(DeserializerException.MessageKeys.INVALID_JSON_TYPE_FOR_PROPERTY, e.getMessageKey());
+ throw e;
+ }
+ }
+
+ @Ignore
+ @Test(expected = DeserializerException.class)
+ public void eTTwoKeyNavInvalidEnumValue() throws Exception {
+ String entityString = "{"
+ + "\"PropertyEnumString\" : \"invalid\","
+ + "\"PropertyCompEnum\" : {"
+ + "\"PropertyEnumString\" : 2"
+ + "}}";
+
+ InputStream stream = new ByteArrayInputStream(entityString.getBytes());
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ try {
+ deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETTwoKeyNav")));
+ } catch (DeserializerException e) {
+ assertEquals(DeserializerException.MessageKeys.INVALID_VALUE_FOR_PROPERTY, e.getMessageKey());
+ throw e;
+ }
+ }
+
+ @Ignore
+ @Test(expected = DeserializerException.class)
+ public void eTTwoKeyNavInvalidEnumValueByPrimitiveTypeException() throws Exception {
+ String entityString = "{"
+ + "\"PropertyEnumString\" : 18,"
+ + "\"PropertyCompEnum\" : {"
+ + "\"PropertyEnumString\" : 2"
+ + "}}";
+
+ InputStream stream = new ByteArrayInputStream(entityString.getBytes());
+ ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+ try {
+ deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETTwoKeyNav")));
+ } catch (DeserializerException e) {
+ assertEquals(DeserializerException.MessageKeys.INVALID_VALUE_FOR_PROPERTY, e.getMessageKey());
+ throw e;
+ }
+ }
+
+// @Test(expected = DeserializerException.class)
+// public void invalidJsonValueForPrimCollectionTypeObject() throws Exception {
+// final String entityString = "{"
+// + "\"PropertyInt16\":32767,"
+// + "\"CollPropertyString\":"
+// + "[\"Employee1@company.example\",\"Employee2@company.example\",\"Employee3@company.example\"],"
+// + "\"PropertyComp\":{\"PropertyInt16\":111,\"PropertyString\":\"TEST A\"},"
+// + "\"CollPropertyComp\":["
+// + "{\"PropertyInt16\":123,\"PropertyString\":\"TEST 1\"},"
+// + "{\"PropertyInt16\":456,\"PropertyString\":\"TEST 2\"},"
+// + "{\"PropertyInt16\":789,\"PropertyString\":\"TEST 3\"}]}";
+// InputStream stream = new ByteArrayInputStream(entityString.getBytes());
+// ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
+// try {
+// deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixPrimCollComp")));
+// } catch (DeserializerException e) {
+// assertEquals(DeserializerException.MessageKeys.INVALID_JSON_TYPE_FOR_PROPERTY, e.getMessageKey());
+// throw e;
+// }
+// }
private void checkPropertyJsonType(String entityString) throws DeserializerException {
InputStream stream = new ByteArrayInputStream(entityString.getBytes());
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a0ebaef7/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java
----------------------------------------------------------------------
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java
index 333b920..911f24d 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java
@@ -1127,10 +1127,10 @@ public class TestFullResourcePath {
@Test
public void runEsNameKeyCast() throws Exception {
// testUri.runEx("ESTwoPrim(1)/olingo.odata.test1.ETBase(1)")
- // .isExSemantic(UriParserSemanticException.MessageKeys.xxx);
+ // .isExSemantic(UriParserSemanticException.MessageKeys.xxx);
// testUri.runEx("ESTwoPrim/olingo.odata.test1.ETBase(1)/olingo.odata.test1.ETTwoBase(1)")
- // .isExSemantic(UriParserSemanticException.MessageKeys.xxx);
+ // .isExSemantic(UriParserSemanticException.MessageKeys.xxx);
testUri.runEx("ESBase/olingo.odata.test1.ETTwoPrim(1)")
.isExSemantic(UriParserSemanticException.MessageKeys.INCOMPATIBLE_TYPE_FILTER);
@@ -2393,7 +2393,7 @@ public class TestFullResourcePath {
testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')",
"$expand=olingo.odata.test1.ETBaseTwoKeyNav"
- + "/NavPropertyETTwoKeyNavMany/olingo.odata.test1.ETTwoBaseTwoKeyNav")
+ + "/NavPropertyETTwoKeyNavMany/olingo.odata.test1.ETTwoBaseTwoKeyNav")
.isKind(UriInfoKind.resource).goPath().first()
.isKeyPredicate(0, "PropertyInt16", "1")
.isKeyPredicate(1, "PropertyString", "'2'")
@@ -4452,36 +4452,39 @@ public class TestFullResourcePath {
@Test
public void testHas() throws ExpressionVisitException, ODataApplicationException, UriParserException {
- testFilter.runOnETTwoKeyNav("PropertyEnumString has olingo.odata.test1.ENString'String1'")
+ testFilter.runOnETMixEnumTypeDefCollComp("PropertyEnumString has olingo.odata.test1.ENString'String1'")
.is("<<PropertyEnumString> has <olingo.odata.test1.ENString<String1>>>")
.isBinary(BinaryOperatorKind.HAS)
.root().left().goPath().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString)
.goUpFilterValidator()
.root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String1"));
- testFilter.runOnETTwoKeyNav("PropertyCompEnum/PropertyEnumString has olingo.odata.test1.ENString'String2'")
- .is("<<PropertyCompEnum/PropertyEnumString> has <olingo.odata.test1.ENString<String2>>>")
+ testFilter.runOnETMixEnumTypeDefCollComp(
+ "PropertyCTMixEnumTypeDefColl/PropertyEnumString has olingo.odata.test1.ENString'String2'")
+ .is("<<PropertyCTMixEnumTypeDefColl/PropertyEnumString> has <olingo.odata.test1.ENString<String2>>>")
.isBinary(BinaryOperatorKind.HAS)
.root().left().goPath()
- .first().isComplex("PropertyCompEnum")
+ .first().isComplex("PropertyCTMixEnumTypeDefColl")
.n().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString)
.isType(EnumTypeProvider.nameENString)
.goUpFilterValidator()
.root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String2"));
- testFilter.runOnETTwoKeyNav(
- "PropertyCompEnum/PropertyEnumString has olingo.odata.test1.ENString'String2' eq true")
- .is("<<<PropertyCompEnum/PropertyEnumString> has <olingo.odata.test1.ENString<String2>>> eq <true>>")
+ testFilter
+ .runOnETMixEnumTypeDefCollComp(
+ "PropertyCTMixEnumTypeDefColl/PropertyEnumString has olingo.odata.test1.ENString'String2' eq true")
+ .is("<<<PropertyCTMixEnumTypeDefColl/PropertyEnumString> has " +
+ "<olingo.odata.test1.ENString<String2>>> eq <true>>")
.isBinary(BinaryOperatorKind.EQ)
.root().left()
.isBinary(BinaryOperatorKind.HAS)
.root().left().left().goPath()
- .first().isComplex("PropertyCompEnum")
+ .first().isComplex("PropertyCTMixEnumTypeDefColl")
.n().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString)
.goUpFilterValidator()
.root().left().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String2"));
- testFilter.runOnETTwoKeyNav("PropertyEnumString has olingo.odata.test1.ENString'String3'")
+ testFilter.runOnETMixEnumTypeDefCollComp("PropertyEnumString has olingo.odata.test1.ENString'String3'")
.is("<<PropertyEnumString> has <olingo.odata.test1.ENString<String3>>>")
.isBinary(BinaryOperatorKind.HAS)
.root().left().goPath()
@@ -4490,7 +4493,7 @@ public class TestFullResourcePath {
.goUpFilterValidator()
.root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String3"));
- testFilter.runOnETTwoKeyNav("PropertyEnumString has olingo.odata.test1.ENString'String,String3'")
+ testFilter.runOnETMixEnumTypeDefCollComp("PropertyEnumString has olingo.odata.test1.ENString'String,String3'")
.is("<<PropertyEnumString> has <olingo.odata.test1.ENString<String,String3>>>")
.isBinary(BinaryOperatorKind.HAS)
.root().left().goPath()
@@ -4499,7 +4502,7 @@ public class TestFullResourcePath {
.goUpFilterValidator()
.root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String", "String3"));
- testFilter.runOnETTwoKeyNav("PropertyEnumString has null")
+ testFilter.runOnETMixEnumTypeDefCollComp("PropertyEnumString has null")
.is("<<PropertyEnumString> has <null>>")
.root()
.isBinary(BinaryOperatorKind.HAS)
@@ -4716,36 +4719,38 @@ public class TestFullResourcePath {
.goUpFilterValidator()
.root().right().isLiteral("12:34:55.12345678901");
- testFilter.runOnETTwoKeyNav("PropertyEnumString eq olingo.odata.test1.ENString'String1'")
+ testFilter.runOnETMixEnumTypeDefCollComp("PropertyEnumString eq olingo.odata.test1.ENString'String1'")
.is("<<PropertyEnumString> eq <olingo.odata.test1.ENString<String1>>>")
.isBinary(BinaryOperatorKind.EQ)
.root().left().goPath().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString)
.goUpFilterValidator()
.root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String1"));
- testFilter.runOnETTwoKeyNav("PropertyEnumString eq olingo.odata.test1.ENString'String2'")
+ testFilter.runOnETMixEnumTypeDefCollComp("PropertyEnumString eq olingo.odata.test1.ENString'String2'")
.is("<<PropertyEnumString> eq <olingo.odata.test1.ENString<String2>>>")
.isBinary(BinaryOperatorKind.EQ)
.root().left().goPath().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString)
.goUpFilterValidator()
.root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String2"));
- testFilter.runOnETTwoKeyNav("PropertyCompEnum/PropertyEnumString eq olingo.odata.test1.ENString'String3'")
- .is("<<PropertyCompEnum/PropertyEnumString> eq <olingo.odata.test1.ENString<String3>>>")
+ testFilter.runOnETMixEnumTypeDefCollComp(
+ "PropertyCTMixEnumTypeDefColl/PropertyEnumString eq olingo.odata.test1.ENString'String3'")
+ .is("<<PropertyCTMixEnumTypeDefColl/PropertyEnumString> eq <olingo.odata.test1.ENString<String3>>>")
.isBinary(BinaryOperatorKind.EQ)
.root().left().goPath()
- .first().isComplex("PropertyCompEnum")
+ .first().isComplex("PropertyCTMixEnumTypeDefColl")
.n().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString).goUpFilterValidator()
.root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String3"));
- testFilter.runOnETTwoKeyNav("PropertyCompEnum/PropertyEnumString eq PropertyCompEnum/PropertyEnumString")
- .is("<<PropertyCompEnum/PropertyEnumString> eq <PropertyCompEnum/PropertyEnumString>>")
+ testFilter.runOnETMixEnumTypeDefCollComp(
+ "PropertyCTMixEnumTypeDefColl/PropertyEnumString eq PropertyCTMixEnumTypeDefColl/PropertyEnumString")
+ .is("<<PropertyCTMixEnumTypeDefColl/PropertyEnumString> eq <PropertyCTMixEnumTypeDefColl/PropertyEnumString>>")
.isBinary(BinaryOperatorKind.EQ)
.root().left().goPath()
- .first().isComplex("PropertyCompEnum")
+ .first().isComplex("PropertyCTMixEnumTypeDefColl")
.n().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString).goUpFilterValidator()
.root().right().goPath()
- .first().isComplex("PropertyCompEnum")
+ .first().isComplex("PropertyCTMixEnumTypeDefColl")
.n().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString).goUpFilterValidator();
}
@@ -5065,12 +5070,12 @@ public class TestFullResourcePath {
.goUpFilterValidator()
.goOrder(0).right().isLiteral("12:34:55.123456789012");
- testFilter.runOrderByOnETTwoKeyNav("PropertyEnumString eq olingo.odata.test1.ENString'String1'")
+ testFilter.runOrderByOnETMixEnumTypeDefCollComp("PropertyEnumString eq olingo.odata.test1.ENString'String1'")
.isSortOrder(0, false)
.goOrder(0).left().goPath().isComplex("PropertyEnumString").goUpFilterValidator()
.goOrder(0).right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String1"));
- testFilter.runOrderByOnETTwoKeyNav("PropertyEnumString eq olingo.odata.test1.ENString'String1' desc")
+ testFilter.runOrderByOnETMixEnumTypeDefCollComp("PropertyEnumString eq olingo.odata.test1.ENString'String1' desc")
.isSortOrder(0, true)
.goOrder(0).left().goPath().isComplex("PropertyEnumString").goUpFilterValidator()
.goOrder(0).right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String1"));
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a0ebaef7/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterValidator.java
----------------------------------------------------------------------
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterValidator.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterValidator.java
index 21d8935..ff77f94 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterValidator.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterValidator.java
@@ -112,6 +112,10 @@ public class FilterValidator implements TestValidator {
public FilterValidator runOrderByOnETTwoKeyNav(final String orderBy) throws UriParserException {
return runUriOrderBy("ESTwoKeyNav", "$orderby=" + orderBy.trim());
}
+
+ public FilterValidator runOrderByOnETMixEnumTypeDefCollComp(final String orderBy) throws UriParserException {
+ return runUriOrderBy("ESMixEnumTypeDefCollComp", "$orderby=" + orderBy.trim());
+ }
public FilterValidator runOrderByOnETTwoKeyNavEx(final String orderBy) throws UriParserException {
return runUriOrderByEx("ESTwoKeyNav", "$orderby=" + orderBy.trim());
@@ -120,6 +124,10 @@ public class FilterValidator implements TestValidator {
public FilterValidator runOnETTwoKeyNav(final String filter) throws UriParserException {
return runUri("ESTwoKeyNav", "$filter=" + filter.trim());
}
+
+ public FilterValidator runOnETMixEnumTypeDefCollComp(final String filter) throws UriParserException {
+ return runUri("ESMixEnumTypeDefCollComp", "$filter=" + filter.trim());
+ }
public FilterValidator runOnETTwoKeyNavSingle(final String filter) throws UriParserException {
return runUri("SINav", "$filter=" + filter.trim());