olingo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject [10/11] olingo-odata4 git commit: [OLINGO-789] more tests of server support for action parameters
Date Mon, 05 Oct 2015 06:02:07 GMT
[OLINGO-789] more tests of server support for action parameters

Signed-off-by: Michael Bolz <michael.bolz@sap.com>


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

Branch: refs/heads/olingo786
Commit: b736c43495078a12a152b0b19a44242304b7e73f
Parents: d6db341
Author: Klaus Straubinger <klaus.straubinger@sap.com>
Authored: Fri Oct 2 16:16:19 2015 +0200
Committer: Michael Bolz <michael.bolz@sap.com>
Committed: Mon Oct 5 07:50:00 2015 +0200

----------------------------------------------------------------------
 .../fit/tecsvc/client/ActionImportITCase.java   |  26 +++
 .../deserializer/xml/ODataXmlDeserializer.java  |  67 +++----
 .../olingo/server/tecsvc/data/ActionData.java   |  15 ++
 .../server/tecsvc/provider/ActionProvider.java  |  99 ++++++----
 .../tecsvc/provider/ContainerProvider.java      |   7 +
 .../server/tecsvc/provider/SchemaProvider.java  |   1 +
 ...ataJsonDeserializerActionParametersTest.java | 192 +++++++++----------
 ...DataXMLDeserializerActionParametersTest.java | 187 +++++++++---------
 8 files changed, 316 insertions(+), 278 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b736c434/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ActionImportITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ActionImportITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ActionImportITCase.java
index c21671b..bb17242 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ActionImportITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/ActionImportITCase.java
@@ -286,6 +286,32 @@ public class ActionImportITCase extends AbstractParamTecSvcITCase {
     assertEquals("UARTCollStringTwoParam duration value: null", iter.next().asPrimitive().toValue());
   }
 
+  @Test
+  public void allParameterKinds() {
+    Map<String, ClientValue> parameters = new HashMap<String, ClientValue>();
+    parameters.put("ParameterEnum", getFactory().newEnumValue(null, "String3"));
+    parameters.put("ParameterDef", getFactory().newPrimitiveValueBuilder().build());
+    parameters.put("ParameterComp", getFactory().newComplexValue(null)
+        .add(getFactory().newPrimitiveProperty("PropertyInt16",
+            getFactory().newPrimitiveValueBuilder().buildInt16((short) 3))));
+    parameters.put("ParameterETTwoPrim", getFactory().newComplexValue(null));
+    parameters.put("CollParameterByte", getFactory().newCollectionValue(null)
+        .add(getFactory().newPrimitiveValueBuilder().buildInt16((short) 10)));
+    parameters.put("CollParameterEnum", getFactory().newCollectionValue(null)
+        .add(getFactory().newEnumValue(null, "String1")));
+    parameters.put("CollParameterDef", getFactory().newCollectionValue(null)
+        .add(getFactory().newPrimitiveValueBuilder().setValue("CollDefString").build()));
+    parameters.put("CollParameterComp", getFactory().newCollectionValue(null)
+        .add(getFactory().newComplexValue(null)
+            .add(getFactory().newPrimitiveProperty("PropertyString",
+                getFactory().newPrimitiveValueBuilder().setValue("CollCompString").build()))));
+    parameters.put("CollParameterETTwoPrim", getFactory().newCollectionValue(null));
+    final ODataInvokeResponse<ClientProperty> response =
+        callAction("AIRTByteNineParam", ClientProperty.class, parameters, false);
+    assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
+    assertEquals(6, response.getBody().getPrimitiveValue().toValue());
+  }
+
   private Map<String, ClientValue> buildParameterInt16(final int value) {
     return Collections.singletonMap("ParameterInt16",
         (ClientValue) getFactory().newPrimitiveValueBuilder().buildInt16((short) value));

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b736c434/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/xml/ODataXmlDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/xml/ODataXmlDeserializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/xml/ODataXmlDeserializer.java
index 776868b..9fb08ab 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/xml/ODataXmlDeserializer.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/xml/ODataXmlDeserializer.java
@@ -54,6 +54,8 @@ import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
 import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
 import org.apache.olingo.commons.api.edm.EdmProperty;
 import org.apache.olingo.commons.api.edm.EdmType;
+import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
+import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
 import org.apache.olingo.commons.api.format.ContentType;
 import org.apache.olingo.commons.core.edm.EdmTypeInfo;
 import org.apache.olingo.commons.core.edm.primitivetype.AbstractGeospatialType;
@@ -103,14 +105,15 @@ public class ODataXmlDeserializer implements ODataDeserializer {
           throw new DeserializerException("geo types support not implemented",
               DeserializerException.MessageKeys.NOT_IMPLEMENTED);
         }
+        final EdmPrimitiveType primitiveType = (EdmPrimitiveType) type;
         final String stringValue = event.asCharacters().getData();
-        value = ((EdmPrimitiveType)type).valueOfString(stringValue, 
+        value = primitiveType.valueOfString(stringValue, 
             isNullable, 
             maxLength, 
             precision, 
             scale, 
             isUnicode, 
-            ((EdmPrimitiveType)type).getDefaultType());
+            primitiveType.getDefaultType());
       }
 
       if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
@@ -152,13 +155,13 @@ public class ODataXmlDeserializer implements ODataDeserializer {
       final XMLEvent event = reader.nextEvent();
 
       if (event.isStartElement()) {        
-        if (edmType instanceof SingletonPrimitiveType) {
+        if (edmType instanceof SingletonPrimitiveType
+            || edmType.getKind() == EdmTypeKind.ENUM
+            || edmType.getKind() == EdmTypeKind.DEFINITION) {
           values.add(primitive(reader, event.asStartElement(), type, isNullable, 
               maxLength, precision, scale, isUnicode));          
         } else if (edmType instanceof EdmComplexType) {
           values.add(complex(reader, event.asStartElement(), (EdmComplexType) edmType));                    
-        } else if (edmType instanceof EdmEnumType) {
-          values.add(readEnum(reader, event.asStartElement()));          
         }
         // do not add null or empty values
       }
@@ -170,21 +173,6 @@ public class ODataXmlDeserializer implements ODataDeserializer {
     valuable.setValue(getValueType(edmType, true), values);
   }
 
-  private Object readEnum(XMLEventReader reader, StartElement start) throws XMLStreamException {
-    boolean foundEndProperty = false;
-    Object value = null;
-    while (reader.hasNext() && !foundEndProperty) {
-      final XMLEvent event = reader.nextEvent();
-      if (event.isCharacters() && !event.asCharacters().isWhiteSpace()) {
-        value = event.asCharacters().getData();
-      }
-      if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {
-        foundEndProperty = true;
-      }
-    }
-    return value;
-  }
-
   private Property property(final XMLEventReader reader, final StartElement start, final EdmType edmType,
       final boolean isNullable, final Integer maxLength, final Integer precision,
       final Integer scale, final boolean isUnicode, final boolean isCollection)
@@ -212,11 +200,13 @@ public class ODataXmlDeserializer implements ODataDeserializer {
       return isCollection? ValueType.COLLECTION_COMPLEX:ValueType.COMPLEX;
     } else if (edmType instanceof EdmEnumType) {
       return isCollection?ValueType.COLLECTION_ENUM:ValueType.ENUM;
+    } else if (edmType instanceof EdmTypeDefinition) {
+      return isCollection?ValueType.COLLECTION_PRIMITIVE:ValueType.PRIMITIVE;
     } else {
       return ValueType.PRIMITIVE;
     }
   }
-  
+
   private void valuable(final Valuable valuable, final XMLEventReader reader, final StartElement start,
       final EdmType edmType, final boolean isNullable, final Integer maxLength, final Integer precision,
       final Integer scale, final boolean isUnicode, final boolean isCollection) throws XMLStreamException,
@@ -236,22 +226,19 @@ public class ODataXmlDeserializer implements ODataDeserializer {
       return;
     }
 
+    final String typeName = edmType.getFullQualifiedName().getFullQualifiedNameAsString();
+    valuable.setType(isCollection ? ("Collection(" + typeName + ")") : typeName);
     if (isCollection) {
       collection(valuable, reader, start, edmType, isNullable, maxLength, precision, scale, isUnicode);
-      valuable.setType("Collection("+edmType.getFullQualifiedName().getFullQualifiedNameAsString()+")");
-    } else if (edmType instanceof SingletonPrimitiveType) {
-      valuable.setType(edmType.getFullQualifiedName().getFullQualifiedNameAsString());
-      valuable.setValue(ValueType.PRIMITIVE, 
+    } else if (edmType instanceof SingletonPrimitiveType
+        || edmType.getKind() == EdmTypeKind.ENUM
+        || edmType.getKind() == EdmTypeKind.DEFINITION) {
+      valuable.setValue(getValueType(edmType, false),
           primitive(reader, start, edmType, isNullable, maxLength, precision, scale, isUnicode));          
     } else if (edmType instanceof EdmComplexType) {
       valuable.setValue(ValueType.COMPLEX, complex(reader, start, (EdmComplexType) edmType));
-      valuable.setType(edmType.getFullQualifiedName().getFullQualifiedNameAsString());
-    } else if (edmType instanceof EdmEnumType) {
-      valuable.setValue(ValueType.ENUM, readEnum(reader, start));
-      valuable.setType(edmType.getFullQualifiedName().getFullQualifiedNameAsString());
     } else if (edmType instanceof EdmEntityType) {
-      valuable.setValue(ValueType.ENTITY, entity(reader, start, (EdmEntityType)edmType));
-      valuable.setType(edmType.getFullQualifiedName().getFullQualifiedNameAsString());
+      valuable.setValue(ValueType.ENTITY, entity(reader, start, (EdmEntityType) edmType));
     }
     // do not add null or empty values    
   }
@@ -791,12 +778,13 @@ public class ODataXmlDeserializer implements ODataDeserializer {
   private Parameter createParameter(XMLEventReader reader, StartElement start, String paramName, 
       EdmParameter edmParameter) throws DeserializerException, EdmPrimitiveTypeException, XMLStreamException {
     
+    Parameter parameter = new Parameter();
+    parameter.setName(paramName);
     switch (edmParameter.getType().getKind()) {
     case PRIMITIVE:
     case ENUM:
+    case DEFINITION:
     case COMPLEX:
-      Parameter parameter = new Parameter();
-      parameter.setName(paramName);
       Property property = property(reader, start, 
         edmParameter.getType(),
         edmParameter.isNullable(), 
@@ -806,14 +794,21 @@ public class ODataXmlDeserializer implements ODataDeserializer {
         true,
         edmParameter.isCollection());
       parameter.setValue(property.getValueType(), property.getValue());
-      return parameter;
+      break;
     case ENTITY:
-      throw new DeserializerException("Entity parameters are not allowed",
-          DeserializerException.MessageKeys.INVALID_ACTION_PARAMETER_TYPE);
+      if (edmParameter.isCollection()) {
+        final EntityCollection entityCollection = entitySet(reader, start, (EdmEntityType) edmParameter.getType());
+        parameter.setValue(ValueType.COLLECTION_ENTITY, entityCollection);
+      } else {
+        final Entity entity = entity(reader, start, (EdmEntityType) edmParameter.getType());
+        parameter.setValue(ValueType.ENTITY, entity);
+      }
+      break;
     default:
       throw new DeserializerException("Invalid type kind " + edmParameter.getType().getKind().toString()
           + " for action parameter: " + paramName, DeserializerException.MessageKeys.INVALID_ACTION_PARAMETER_TYPE,
           paramName);
     }
+    return parameter;
   }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b736c434/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/ActionData.java
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/ActionData.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/ActionData.java
index 2adf7c2..1169959 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/ActionData.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/ActionData.java
@@ -52,6 +52,21 @@ public class ActionData {
       throws DataProviderException {
     if ("UARTString".equals(name)) {
       return DataCreator.createPrimitive(null, "UARTString string value");
+    } else if ("UARTByteNineParam".equals(name)) {
+      short count = 0;  // counts non-empty parameters
+      for (final String parameterName : parameters.keySet()) {
+        final Parameter parameter = parameters.get(parameterName);
+        if (!(parameter.isNull()
+            || !parameter.isCollection()
+                && (parameter.isComplex() && parameter.asComplex().getValue().isEmpty()
+                    || parameter.isEntity() && ((Entity) parameter.getValue()).getProperties().isEmpty())
+            || parameter.isCollection()
+                && (parameter.isEntity() && ((EntityCollection) parameter.getValue()).getEntities().isEmpty()
+                    || parameter.asCollection().isEmpty()))) {
+          count++;
+        }
+      }
+      return DataCreator.createPrimitive(null, count);
     }
     throw new DataProviderException("Action " + name + " is not yet implemented.");
   }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b736c434/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ActionProvider.java
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ActionProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ActionProvider.java
index 2227315..c62b5d7 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ActionProvider.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ActionProvider.java
@@ -77,6 +77,8 @@ public class ActionProvider {
       new FullQualifiedName(SchemaProvider.NAMESPACE, "UARTParam");
   public static final FullQualifiedName nameUARTTwoParam =
       new FullQualifiedName(SchemaProvider.NAMESPACE, "UARTTwoParam");
+  public static final FullQualifiedName nameUARTByteNineParam =
+      new FullQualifiedName(SchemaProvider.NAMESPACE, "UARTByteNineParam");
 
   public List<CsdlAction> getActions(final FullQualifiedName actionName) throws ODataException {
     if (actionName.equals(nameUARTString)) {
@@ -160,39 +162,56 @@ public class ActionProvider {
                   new CsdlParameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16),
                   new CsdlParameter().setName("ParameterDuration").setType(PropertyProvider.nameDuration))));
 
+    } else if (actionName.equals(nameUARTByteNineParam)) {
+      return Collections.singletonList(
+          new CsdlAction()
+              .setName(nameUARTByteNineParam.getName())
+              .setParameters(Arrays.asList(
+                  new CsdlParameter().setName("ParameterEnum").setType(EnumTypeProvider.nameENString),
+                  new CsdlParameter().setName("ParameterDef").setType(TypeDefinitionProvider.nameTDString),
+                  new CsdlParameter().setName("ParameterComp").setType(ComplexTypeProvider.nameCTTwoPrim),
+                  new CsdlParameter().setName("ParameterETTwoPrim").setType(EntityTypeProvider.nameETTwoPrim),
+                  new CsdlParameter().setName("CollParameterByte").setType(PropertyProvider.nameByte)
+                      .setCollection(true),
+                  new CsdlParameter().setName("CollParameterEnum").setType(EnumTypeProvider.nameENString)
+                      .setCollection(true),
+                  new CsdlParameter().setName("CollParameterDef").setType(TypeDefinitionProvider.nameTDString)
+                      .setCollection(true),
+                  new CsdlParameter().setName("CollParameterComp").setType(ComplexTypeProvider.nameCTTwoPrim)
+                      .setCollection(true),
+                  new CsdlParameter().setName("CollParameterETTwoPrim").setType(EntityTypeProvider.nameETTwoPrim)
+                      .setCollection(true)))
+              .setReturnType(new CsdlReturnType().setType(PropertyProvider.nameByte)));
+
     } else if (actionName.equals(nameBAETTwoKeyNavRTETTwoKeyNav)) {
       return Arrays.asList(
-          new CsdlAction().setName("BAETTwoKeyNavRTETTwoKeyNav")
-              .setParameters(Arrays.asList(
+          new CsdlAction().setName(nameBAETTwoKeyNavRTETTwoKeyNav.getName())
+              .setParameters(Collections.singletonList(
                   new CsdlParameter().setName("ParameterETTwoKeyNav").setType(EntityTypeProvider.nameETTwoKeyNav)
                       .setNullable(false)))
               .setBound(true)
-              .setReturnType(
-                  new CsdlReturnType().setType(EntityTypeProvider.nameETTwoKeyNav))
-          ,
-          new CsdlAction().setName("BAETTwoKeyNavRTETTwoKeyNav")
-              .setParameters(Arrays.asList(
+              .setReturnType(new CsdlReturnType().setType(EntityTypeProvider.nameETTwoKeyNav)),
+
+          new CsdlAction().setName(nameBAETTwoKeyNavRTETTwoKeyNav.getName())
+              .setParameters(Collections.singletonList(
                   new CsdlParameter().setName("ParameterETKeyNav").setType(EntityTypeProvider.nameETKeyNav)
                       .setNullable(false)))
               .setBound(true)
-              .setReturnType(
-                  new CsdlReturnType().setType(EntityTypeProvider.nameETTwoKeyNav))
-          );
+              .setReturnType(new CsdlReturnType().setType(EntityTypeProvider.nameETTwoKeyNav)));
 
     } else if (actionName.equals(nameBAESAllPrimRTETAllPrim)) {
-      return Arrays.asList(
-          new CsdlAction().setName("BAESAllPrimRTETAllPrim")
-              .setParameters(Arrays.asList(
+      return Collections.singletonList(
+          new CsdlAction().setName(nameBAESAllPrimRTETAllPrim.getName())
+              .setParameters(Collections.singletonList(
                   new CsdlParameter().setName("ParameterESAllPrim").setType(EntityTypeProvider.nameETAllPrim)
                       .setCollection(true).setNullable(false)))
               .setBound(true)
-              .setReturnType(
-                  new CsdlReturnType().setType(EntityTypeProvider.nameETAllPrim)));
+              .setReturnType(new CsdlReturnType().setType(EntityTypeProvider.nameETAllPrim)));
 
     } else if (actionName.equals(nameBAESTwoKeyNavRTESTwoKeyNav)) {
-      return Arrays.asList(
-          new CsdlAction().setName("BAESTwoKeyNavRTESTwoKeyNav")
-              .setParameters(Arrays.asList(
+      return Collections.singletonList(
+          new CsdlAction().setName(nameBAESTwoKeyNavRTESTwoKeyNav.getName())
+              .setParameters(Collections.singletonList(
                   new CsdlParameter().setName("ParameterETTwoKeyNav").setType(EntityTypeProvider.nameETTwoKeyNav)
                       .setCollection(true).setNullable(false)))
               .setBound(true)
@@ -200,11 +219,11 @@ public class ActionProvider {
                   new CsdlReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true)));
 
     } else if (actionName.equals(nameBAESTwoKeyNavRTESKeyNav)) {
-      return Arrays.asList(
-          new CsdlAction().setName("BAESTwoKeyNavRTESKeyNav")
+      return Collections.singletonList(
+          new CsdlAction().setName(nameBAESTwoKeyNavRTESKeyNav.getName())
               .setBound(true)
               .setEntitySetPath("BindingParam/NavPropertyETKeyNavMany")
-              .setParameters(Arrays.asList(
+              .setParameters(Collections.singletonList(
                   new CsdlParameter().setName("ParameterETTwoKeyNav")
                       .setType(EntityTypeProvider.nameETTwoKeyNav)
                       .setCollection(true)
@@ -213,46 +232,42 @@ public class ActionProvider {
                   new CsdlReturnType().setType(EntityTypeProvider.nameETKeyNav).setCollection(true)));
 
     } else if (actionName.equals(nameBAETBaseTwoKeyNavRTETBaseTwoKeyNav)) {
-      return Arrays.asList(
-          new CsdlAction().setName("BAETBaseTwoKeyNavRTETBaseTwoKeyNav")
-              .setParameters(Arrays.asList(
+      return Collections.singletonList(
+          new CsdlAction().setName(nameBAETBaseTwoKeyNavRTETBaseTwoKeyNav.getName())
+              .setParameters(Collections.singletonList(
                   new CsdlParameter().setName("ParameterETTwoKeyNav").setType(EntityTypeProvider.nameETBaseTwoKeyNav)
                       .setNullable(false)))
               .setBound(true)
-              .setReturnType(
-                  new CsdlReturnType().setType(EntityTypeProvider.nameETTwoKeyNav)));
+              .setReturnType(new CsdlReturnType().setType(EntityTypeProvider.nameETTwoKeyNav)));
 
     } else if (actionName.equals(nameBAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav)) {
-      return Arrays.asList(
-          new CsdlAction().setName("BAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav")
-              .setParameters(Arrays.asList(
+      return Collections.singletonList(
+          new CsdlAction().setName(nameBAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav.getName())
+              .setParameters(Collections.singletonList(
                   new CsdlParameter().setName("ParameterETTwoBaseTwoKeyNav")
                       .setType(EntityTypeProvider.nameETTwoBaseTwoKeyNav)
                       .setNullable(false)))
               .setBound(true)
-              .setReturnType(
-                  new CsdlReturnType().setType(EntityTypeProvider.nameETBaseTwoKeyNav)));
+              .setReturnType(new CsdlReturnType().setType(EntityTypeProvider.nameETBaseTwoKeyNav)));
 
     } else if (actionName.equals(nameBAETAllPrimRT)) {
-      return Arrays.asList(
-          new CsdlAction().setName("BAETAllPrimRT")
+      return Collections.singletonList(
+          new CsdlAction().setName(nameBAETAllPrimRT.getName())
               .setBound(true)
-              .setParameters(Arrays.asList(
+              .setParameters(Collections.singletonList(
                   new CsdlParameter().setName("ParameterETAllPrim")
                       .setNullable(false)
-                      .setType(EntityTypeProvider.nameETAllPrim)
-                  )));
+                      .setType(EntityTypeProvider.nameETAllPrim))));
+
     } else if (actionName.equals(nameBAESAllPrimRT)) {
-      return Arrays.asList(
-          new CsdlAction().setName("BAESAllPrimRT")
+      return Collections.singletonList(
+          new CsdlAction().setName(nameBAESAllPrimRT.getName())
               .setBound(true)
-              .setParameters(Arrays.asList(
+              .setParameters(Collections.singletonList(
                   new CsdlParameter().setName("ParameterETAllPrim")
                       .setNullable(false)
                       .setCollection(true)
-                      .setType(EntityTypeProvider.nameETAllPrim)
-                  ))
-          );
+                      .setType(EntityTypeProvider.nameETAllPrim))));
     }
 
     return null;

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b736c434/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 ff53d09..799a816 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
@@ -46,6 +46,7 @@ public class ContainerProvider {
   public static final String AIRT = "AIRT";
   public static final String AIRT_PARAM = "AIRTParam";
   public static final String AIRT_TWO_PARAM = "AIRTTwoParam";
+  public static final String AIRT_BYTE_NINE_PARAM = "AIRTByteNineParam";
 
   CsdlEntityContainerInfo entityContainerInfoTest1 =
       new CsdlEntityContainerInfo().setContainerName(nameContainer);
@@ -123,6 +124,7 @@ public class ContainerProvider {
     actionImports.add(prov.getActionImport(ContainerProvider.nameContainer, AIRT));
     actionImports.add(prov.getActionImport(ContainerProvider.nameContainer, AIRT_PARAM));
     actionImports.add(prov.getActionImport(ContainerProvider.nameContainer, AIRT_TWO_PARAM));
+    actionImports.add(prov.getActionImport(ContainerProvider.nameContainer, AIRT_BYTE_NINE_PARAM));
 
     // FunctionImports
     List<CsdlFunctionImport> functionImports = new ArrayList<CsdlFunctionImport>();
@@ -500,6 +502,11 @@ public class ContainerProvider {
         return new CsdlActionImport()
             .setName(AIRT_TWO_PARAM)
             .setAction(ActionProvider.nameUARTTwoParam);
+
+      } else if (name.equals(AIRT_BYTE_NINE_PARAM)) {
+        return new CsdlActionImport()
+            .setName(AIRT_BYTE_NINE_PARAM)
+            .setAction(ActionProvider.nameUARTByteNineParam);
       }
     }
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b736c434/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 b07ae60..03588b3 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
@@ -130,6 +130,7 @@ public class SchemaProvider {
     actions.addAll(prov.getActions(ActionProvider.nameUART));
     actions.addAll(prov.getActions(ActionProvider.nameUARTParam));
     actions.addAll(prov.getActions(ActionProvider.nameUARTTwoParam));
+    actions.addAll(prov.getActions(ActionProvider.nameUARTByteNineParam));
 
     // Functions
     List<CsdlFunction> functions = new ArrayList<CsdlFunction>();

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b736c434/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerActionParametersTest.java
----------------------------------------------------------------------
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerActionParametersTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerActionParametersTest.java
index 12ee6af..20d4fa2 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerActionParametersTest.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerActionParametersTest.java
@@ -23,12 +23,9 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
 
 import java.io.ByteArrayInputStream;
 import java.math.BigDecimal;
-import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 
@@ -37,9 +34,6 @@ import org.apache.olingo.commons.api.data.Entity;
 import org.apache.olingo.commons.api.data.EntityCollection;
 import org.apache.olingo.commons.api.data.Parameter;
 import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.edm.EdmAction;
-import org.apache.olingo.commons.api.edm.EdmParameter;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
 import org.apache.olingo.commons.api.format.ContentType;
 import org.apache.olingo.server.api.OData;
@@ -76,126 +70,99 @@ public class ODataJsonDeserializerActionParametersTest extends AbstractODataDese
 
   @Test
   public void primitiveCollection() throws Exception {
-    EdmParameter parameter = mock(EdmParameter.class);
-    when(parameter.getType()).thenReturn(
-        OData.newInstance().createPrimitiveTypeInstance(EdmPrimitiveTypeKind.Duration));
-    when(parameter.isCollection()).thenReturn(true);
-    EdmAction action = mock(EdmAction.class);
-    when(action.getParameterNames()).thenReturn(Collections.singletonList("Parameter"));
-    when(action.getParameter("Parameter")).thenReturn(parameter);
+    final Parameter parameter = deserializeUARTByteNineParam("CollParameterByte", "[1,42]");
+    assertTrue(parameter.isPrimitive());
+    assertTrue(parameter.isCollection());
+    assertEquals((short) 1, parameter.asCollection().get(0));
+    assertEquals((short) 42, parameter.asCollection().get(1));
+  }
 
-    final String input = "{\"Parameter\": [ \"PT0S\", \"PT42S\", \"PT1H2M3S\" ]}";
-    final Map<String, Parameter> parameters = deserialize(input, action);
+  @Test
+  public void enumeration() throws Exception {
+    final Parameter parameter = deserializeUARTByteNineParam("ParameterEnum", "\"String3,String1\"");
+    assertTrue(parameter.isEnum());
+    assertFalse(parameter.isCollection());
+    assertEquals((short) 5, parameter.getValue());
+  }
 
-    assertNotNull(parameters);
-    assertEquals(1, parameters.size());
-    Parameter parameterData = parameters.get("Parameter");
-    assertNotNull(parameterData);
-    assertTrue(parameterData.isPrimitive());
-    assertTrue(parameterData.isCollection());
-    assertEquals(BigDecimal.ZERO, parameterData.asCollection().get(0));
-    assertEquals(BigDecimal.valueOf(42), parameterData.asCollection().get(1));
-    assertEquals(BigDecimal.valueOf(3723), parameterData.asCollection().get(2));
+  @Test
+  public void enumCollection() throws Exception {
+    final Parameter parameter = deserializeUARTByteNineParam("CollParameterEnum",
+        "[ \"String1,String2\", \"String3,String3,String3\" ]");
+    assertTrue(parameter.isEnum());
+    assertTrue(parameter.isCollection());
+    assertEquals((short) 3, parameter.asCollection().get(0));
+    assertEquals((short) 4, parameter.asCollection().get(1));
   }
 
   @Test
-  public void complex() throws Exception {
-    EdmParameter parameter = mock(EdmParameter.class);
-    when(parameter.getType()).thenReturn(edm.getComplexType(new FullQualifiedName(NAMESPACE, "CTTwoPrim")));
-    EdmAction action = mock(EdmAction.class);
-    when(action.getParameterNames()).thenReturn(Collections.singletonList("Parameter"));
-    when(action.getParameter("Parameter")).thenReturn(parameter);
+  public void typeDefinition() throws Exception {
+    final Parameter parameter = deserializeUARTByteNineParam("ParameterDef", "\"Test String\"");
+    assertTrue(parameter.isPrimitive());
+    assertFalse(parameter.isCollection());
+    assertEquals("Test String", parameter.getValue());
+  }
 
-    final String input = "{\"Parameter\": { \"PropertyString\": \"Yes\", \"PropertyInt16\": 42 }}";
-    final Map<String, Parameter> parameters = deserialize(input, action);
+  @Test
+  public void typeDefinitionCollection() throws Exception {
+    final Parameter parameter = deserializeUARTByteNineParam("CollParameterDef",
+        "[ \"Test String\", \"Another String\" ]");
+    assertTrue(parameter.isPrimitive());
+    assertTrue(parameter.isCollection());
+    assertEquals("Test String", parameter.asCollection().get(0));
+    assertEquals("Another String", parameter.asCollection().get(1));
+  }
 
-    assertNotNull(parameters);
-    assertEquals(1, parameters.size());
-    final Parameter parameterData = parameters.get("Parameter");
-    assertNotNull(parameterData);
-    assertTrue(parameterData.isComplex());
-    assertFalse(parameterData.isCollection());
-    final List<Property> complexValues = parameterData.asComplex().getValue();
+  @Test
+  public void complex() throws Exception {
+    final Parameter parameter = deserializeUARTByteNineParam("ParameterComp",
+        "{ \"PropertyString\": \"Yes\", \"PropertyInt16\": 42 }");
+    assertTrue(parameter.isComplex());
+    assertFalse(parameter.isCollection());
+    final List<Property> complexValues = parameter.asComplex().getValue();
     assertEquals((short) 42, complexValues.get(0).getValue());
     assertEquals("Yes", complexValues.get(1).getValue());
   }
 
   @Test
   public void complexCollection() throws Exception {
-    EdmParameter parameter = mock(EdmParameter.class);
-    when(parameter.getType()).thenReturn(edm.getComplexType(new FullQualifiedName(NAMESPACE, "CTTwoPrim")));
-    when(parameter.isCollection()).thenReturn(true);
-    EdmAction action = mock(EdmAction.class);
-    when(action.getParameterNames()).thenReturn(Collections.singletonList("Parameter"));
-    when(action.getParameter("Parameter")).thenReturn(parameter);
-
-    final String input = "{\"Parameter\": [\n"
-        + "  { \"PropertyInt16\": 9999, \"PropertyString\": \"One\" },\n"
-        + "  { \"PropertyInt16\": -123, \"PropertyString\": \"Two\" }]}";
-    final Map<String, Parameter> parameters = deserialize(input, action);
-
-    assertNotNull(parameters);
-    assertEquals(1, parameters.size());
-    Parameter parameterData = parameters.get("Parameter");
-    assertNotNull(parameterData);
-    assertTrue(parameterData.isComplex());
-    assertTrue(parameterData.isCollection());
-    ComplexValue complexValue = (ComplexValue) parameterData.asCollection().get(0);
+    final Parameter parameter = deserializeUARTByteNineParam("CollParameterComp",
+        "[ { \"PropertyInt16\": 9999, \"PropertyString\": \"One\" },"
+        + "  { \"PropertyInt16\": -123, \"PropertyString\": \"Two\" }]");
+    assertTrue(parameter.isComplex());
+    assertTrue(parameter.isCollection());
+    ComplexValue complexValue = (ComplexValue) parameter.asCollection().get(0);
     assertEquals((short) 9999, complexValue.getValue().get(0).getValue());
     assertEquals("One", complexValue.getValue().get(1).getValue());
 
-    complexValue = (ComplexValue) parameterData.asCollection().get(1);
+    complexValue = (ComplexValue) parameter.asCollection().get(1);
     assertEquals((short) -123, complexValue.getValue().get(0).getValue());
     assertEquals("Two", complexValue.getValue().get(1).getValue());
   }
 
   @Test
   public void entity() throws Exception {
-    EdmParameter parameter = mock(EdmParameter.class);
-    when(parameter.getType()).thenReturn(edm.getEntityType(new FullQualifiedName(NAMESPACE, "ETTwoPrim")));
-    EdmAction action = mock(EdmAction.class);
-    when(action.getParameterNames()).thenReturn(Collections.singletonList("Parameter"));
-    when(action.getParameter("Parameter")).thenReturn(parameter);
-
-    final String input = "{\"Parameter\": { \"PropertyInt16\": 42, \"PropertyString\": \"Yes\" }}";
-    final Map<String, Parameter> parameters = deserialize(input, action);
-
-    assertNotNull(parameters);
-    assertEquals(1, parameters.size());
-    final Parameter parameterData = parameters.get("Parameter");
-    assertNotNull(parameterData);
-    assertTrue(parameterData.isEntity());
-    assertFalse(parameterData.isCollection());
-    final List<Property> entityValues = parameterData.asEntity().getProperties();
+    final Parameter parameter = deserializeUARTByteNineParam("ParameterETTwoPrim",
+        "{ \"PropertyInt16\": 42, \"PropertyString\": \"Yes\" }");
+    assertTrue(parameter.isEntity());
+    assertFalse(parameter.isCollection());
+    final List<Property> entityValues = parameter.asEntity().getProperties();
     assertEquals((short) 42, entityValues.get(0).getValue());
     assertEquals("Yes", entityValues.get(1).getValue());
   }
 
   @Test
   public void entityCollection() throws Exception {
-    EdmParameter parameter = mock(EdmParameter.class);
-    when(parameter.getType()).thenReturn(edm.getEntityType(new FullQualifiedName(NAMESPACE, "ETTwoPrim")));
-    when(parameter.isCollection()).thenReturn(true);
-    EdmAction action = mock(EdmAction.class);
-    when(action.getParameterNames()).thenReturn(Collections.singletonList("Parameter"));
-    when(action.getParameter("Parameter")).thenReturn(parameter);
-
-    final String input = "{\"Parameter\": [\n"
-        + "  { \"PropertyInt16\": 1234, \"PropertyString\": \"One\" },\n"
-        + "  { \"PropertyInt16\": -321, \"PropertyString\": \"Two\" }]}";
-    final Map<String, Parameter> parameters = deserialize(input, action);
-
-    assertNotNull(parameters);
-    assertEquals(1, parameters.size());
-    Parameter parameterData = parameters.get("Parameter");
-    assertNotNull(parameterData);
-    assertTrue(parameterData.isEntity());
-    assertTrue(parameterData.isCollection());
-    Entity entity = ((EntityCollection) parameterData.getValue()).getEntities().get(0);
+    final Parameter parameter = deserializeUARTByteNineParam("CollParameterETTwoPrim",
+        "[ { \"PropertyInt16\": 1234, \"PropertyString\": \"One\" },"
+        + "  { \"PropertyInt16\": -321, \"PropertyString\": \"Two\" }]");
+    assertTrue(parameter.isEntity());
+    assertTrue(parameter.isCollection());
+    Entity entity = ((EntityCollection) parameter.getValue()).getEntities().get(0);
     assertEquals((short) 1234, entity.getProperties().get(0).getValue());
     assertEquals("One", entity.getProperties().get(1).getValue());
 
-    entity = ((EntityCollection) parameterData.getValue()).getEntities().get(1);
+    entity = ((EntityCollection) parameter.getValue()).getEntities().get(1);
     assertEquals((short) -321, entity.getProperties().get(0).getValue());
     assertEquals("Two", entity.getProperties().get(1).getValue());
   }
@@ -222,7 +189,7 @@ public class ODataJsonDeserializerActionParametersTest extends AbstractODataDese
     assertNotNull(parameter);
     assertEquals(BigDecimal.valueOf(3669753), parameter.getValue());
   }
-  
+
   @Test
   public void parameterWithNullLiteral() throws Exception {
     final Map<String, Parameter> parameters = deserialize("{\"ParameterInt16\":1,\"ParameterDuration\":null}",
@@ -268,20 +235,33 @@ public class ODataJsonDeserializerActionParametersTest extends AbstractODataDese
     expectException("{\"ParameterInt16\":[42]}", "UARTParam", null, MessageKeys.INVALID_JSON_TYPE_FOR_PROPERTY);
   }
 
-  private Map<String, Parameter> deserialize(final String input, final EdmAction action) throws DeserializerException {
-    return OData.newInstance().createDeserializer(ContentType.JSON)
-        .actionParameters(new ByteArrayInputStream(input.getBytes()), action)
-        .getActionParameters();
+  private Parameter deserializeUARTByteNineParam(final String parameterName, final String parameterJsonValue)
+      throws DeserializerException {
+    final Map<String, Parameter> parameters = deserialize(
+        "{" + (parameterName.equals("CollParameterByte") ? "" : "\"CollParameterByte\":[],")
+            + (parameterName.equals("CollParameterEnum") ? "" : "\"CollParameterEnum\":[],")
+            + (parameterName.equals("CollParameterDef") ? "" : "\"CollParameterDef\":[],")
+            + (parameterName.equals("CollParameterComp") ? "" : "\"CollParameterComp\":[],")
+            + (parameterName.equals("CollParameterETTwoPrim") ? "" : "\"CollParameterETTwoPrim\":[],")
+            + "\"" + parameterName + "\":" + parameterJsonValue + "}",
+        "UARTByteNineParam", null);
+    assertNotNull(parameters);
+    assertEquals(9, parameters.size());
+    Parameter parameter = parameters.get(parameterName);
+    assertNotNull(parameter);
+    return parameter;
   }
 
   private Map<String, Parameter> deserialize(final String input, final String actionName, final String bindingTypeName)
       throws DeserializerException {
-    return deserialize(input,
-        bindingTypeName == null ?
-            edm.getUnboundAction(new FullQualifiedName(NAMESPACE, actionName)) :
-            edm.getBoundAction(new FullQualifiedName(NAMESPACE, actionName),
-                new FullQualifiedName(NAMESPACE, bindingTypeName),
-                false));
+    return OData.newInstance().createDeserializer(ContentType.JSON)
+        .actionParameters(new ByteArrayInputStream(input.getBytes()),
+            bindingTypeName == null ?
+                edm.getUnboundAction(new FullQualifiedName(NAMESPACE, actionName)) :
+                edm.getBoundAction(new FullQualifiedName(NAMESPACE, actionName),
+                    new FullQualifiedName(NAMESPACE, bindingTypeName),
+                    false))
+        .getActionParameters();
   }
 
   private void expectException(final String input, final String actionName, final String bindingTypeName,

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/b736c434/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/xml/ODataXMLDeserializerActionParametersTest.java
----------------------------------------------------------------------
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/xml/ODataXMLDeserializerActionParametersTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/xml/ODataXMLDeserializerActionParametersTest.java
index f50cbc9..18162da 100644
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/xml/ODataXMLDeserializerActionParametersTest.java
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/xml/ODataXMLDeserializerActionParametersTest.java
@@ -23,12 +23,9 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
 
 import java.io.ByteArrayInputStream;
 import java.math.BigDecimal;
-import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 
@@ -36,9 +33,6 @@ import org.apache.olingo.commons.api.Constants;
 import org.apache.olingo.commons.api.data.ComplexValue;
 import org.apache.olingo.commons.api.data.Parameter;
 import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.edm.EdmAction;
-import org.apache.olingo.commons.api.edm.EdmParameter;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
 import org.apache.olingo.commons.api.edm.FullQualifiedName;
 import org.apache.olingo.commons.api.format.ContentType;
 import org.apache.olingo.server.api.OData;
@@ -64,8 +58,8 @@ public class ODataXMLDeserializerActionParametersTest extends AbstractODataDeser
   @Test
   public void primitive() throws Exception {
     final String input = PREAMBLE
-        + "<ParameterDuration>P42DT11H22M33S</ParameterDuration>"
-        + "<ParameterInt16>42</ParameterInt16>"
+        + "<data:ParameterDuration>P42DT11H22M33S</data:ParameterDuration>"
+        + "<data:ParameterInt16>42</data:ParameterInt16>"
         + POSTAMBLE;
 
     final Map<String, Parameter> parameters = deserialize(input, "UARTTwoParam", null);
@@ -81,93 +75,84 @@ public class ODataXMLDeserializerActionParametersTest extends AbstractODataDeser
 
   @Test
   public void primitiveCollection() throws Exception {
-    EdmParameter parameter = mock(EdmParameter.class);
-    when(parameter.getType()).thenReturn(
-        OData.newInstance().createPrimitiveTypeInstance(EdmPrimitiveTypeKind.Duration));
-    when(parameter.isCollection()).thenReturn(true);
-    EdmAction action = mock(EdmAction.class);
-    when(action.getParameterNames()).thenReturn(Collections.singletonList("Parameter"));
-    when(action.getParameter("Parameter")).thenReturn(parameter);
+    final Parameter parameter = deserializeUARTByteNineParam("CollParameterByte",
+        "<metadata:element>0</metadata:element>"
+        + "<metadata:element>42</metadata:element>"
+        + "<metadata:element>255</metadata:element>");
+    assertNotNull(parameter);
+    assertTrue(parameter.isPrimitive());
+    assertTrue(parameter.isCollection());
+    assertEquals((short) 0, parameter.asCollection().get(0));
+    assertEquals((short) 42, parameter.asCollection().get(1));
+    assertEquals((short) 255, parameter.asCollection().get(2));
+  }
 
-    final String input = PREAMBLE
-        + "<Parameter>"
-        + "<metadata:element>PT0S</metadata:element>"
-        + "<metadata:element>PT42S</metadata:element>"
-        + "<metadata:element>PT1H2M3S</metadata:element>"
-        + "</Parameter>"
-        + POSTAMBLE;
-    final Map<String, Parameter> parameters = deserialize(input, action);
+  @Test
+  public void enumeration() throws Exception {
+    final Parameter parameter = deserializeUARTByteNineParam("ParameterEnum", "String3,String1");
+    assertTrue(parameter.isEnum());
+    assertFalse(parameter.isCollection());
+    assertEquals((short) 5, parameter.getValue());
+  }
 
-    assertNotNull(parameters);
-    assertEquals(1, parameters.size());
-    Parameter parameterData = parameters.get("Parameter");
-    assertNotNull(parameterData);
-    assertTrue(parameterData.isPrimitive());
-    assertTrue(parameterData.isCollection());
-    assertEquals(BigDecimal.ZERO, parameterData.asCollection().get(0));
-    assertEquals(BigDecimal.valueOf(42), parameterData.asCollection().get(1));
-    assertEquals(BigDecimal.valueOf(3723), parameterData.asCollection().get(2));
+  @Test
+  public void enumCollection() throws Exception {
+    final Parameter parameter = deserializeUARTByteNineParam("CollParameterEnum",
+        "<metadata:element>String1,String2</metadata:element>"
+        + "<metadata:element>String3,String3,String3</metadata:element>");
+    assertTrue(parameter.isEnum());
+    assertTrue(parameter.isCollection());
+    assertEquals((short) 3, parameter.asCollection().get(0));
+    assertEquals((short) 4, parameter.asCollection().get(1));
   }
 
   @Test
-  public void complex() throws Exception {
-    EdmParameter parameter = mock(EdmParameter.class);
-    when(parameter.getType()).thenReturn(edm.getComplexType(new FullQualifiedName(NAMESPACE, "CTTwoPrim")));
-    EdmAction action = mock(EdmAction.class);
-    when(action.getParameterNames()).thenReturn(Collections.singletonList("Parameter"));
-    when(action.getParameter("Parameter")).thenReturn(parameter);
+  public void typeDefinition() throws Exception {
+    final Parameter parameter = deserializeUARTByteNineParam("ParameterDef", "Test String");
+    assertTrue(parameter.isPrimitive());
+    assertFalse(parameter.isCollection());
+    assertEquals("Test String", parameter.getValue());
+  }
 
-    final String input = PREAMBLE
-        + "<Parameter>"
-        + "<PropertyInt16>42</PropertyInt16>"
-        + "<PropertyString>Yes</PropertyString>"
-        + "</Parameter>"
-        + POSTAMBLE;
-    final Map<String, Parameter> parameters = deserialize(input, action);
+  @Test
+  public void typeDefinitionCollection() throws Exception {
+    final Parameter parameter = deserializeUARTByteNineParam("CollParameterDef",
+        "<metadata:element>Test String</metadata:element>"
+        + "<metadata:element>Another String</metadata:element>");
+    assertTrue(parameter.isPrimitive());
+    assertTrue(parameter.isCollection());
+    assertEquals("Test String", parameter.asCollection().get(0));
+    assertEquals("Another String", parameter.asCollection().get(1));
+  }
 
-    assertNotNull(parameters);
-    assertEquals(1, parameters.size());
-    final Parameter parameterData = parameters.get("Parameter");
-    assertNotNull(parameterData);
-    assertTrue(parameterData.isComplex());
-    assertFalse(parameterData.isCollection());
-    final List<Property> complexValues = parameterData.asComplex().getValue();
+  @Test
+  public void complex() throws Exception {
+    final Parameter parameter = deserializeUARTByteNineParam("ParameterComp",
+        "<data:PropertyInt16>42</data:PropertyInt16>    <data:PropertyString>Yes</data:PropertyString>");
+    assertNotNull(parameter);
+    assertTrue(parameter.isComplex());
+    assertFalse(parameter.isCollection());
+    final List<Property> complexValues = parameter.asComplex().getValue();
     assertEquals((short) 42, complexValues.get(0).getValue());
     assertEquals("Yes", complexValues.get(1).getValue());
   }
 
   @Test
   public void complexCollection() throws Exception {
-    EdmParameter parameter = mock(EdmParameter.class);
-    when(parameter.getType()).thenReturn(edm.getComplexType(new FullQualifiedName(NAMESPACE, "CTTwoPrim")));
-    when(parameter.isCollection()).thenReturn(true);
-    EdmAction action = mock(EdmAction.class);
-    when(action.getParameterNames()).thenReturn(Collections.singletonList("Parameter"));
-    when(action.getParameter("Parameter")).thenReturn(parameter);
-
-    final String input = PREAMBLE
-        + "<Parameter>"
-        + "<metadata:element>"
-        + "<PropertyInt16>9999</PropertyInt16><PropertyString>One</PropertyString>"
+    final Parameter parameter = deserializeUARTByteNineParam("CollParameterComp",
+        "<metadata:element>"
+        + "<data:PropertyInt16>9999</data:PropertyInt16><data:PropertyString>One</data:PropertyString>"
         + "</metadata:element>"
         + "<metadata:element>"
-        + "<PropertyInt16>-123</PropertyInt16><PropertyString>Two</PropertyString>"
-        + "</metadata:element>"
-        + "</Parameter>"
-        + POSTAMBLE;
-    final Map<String, Parameter> parameters = deserialize(input, action);
-
-    assertNotNull(parameters);
-    assertEquals(1, parameters.size());
-    Parameter parameterData = parameters.get("Parameter");
-    assertNotNull(parameterData);
-    assertTrue(parameterData.isComplex());
-    assertTrue(parameterData.isCollection());
-    ComplexValue complexValue = (ComplexValue) parameterData.asCollection().get(0);
+        + "<data:PropertyInt16>-123</data:PropertyInt16><data:PropertyString>Two</data:PropertyString>"
+        + "</metadata:element>");
+    assertTrue(parameter.isComplex());
+    assertTrue(parameter.isCollection());
+    ComplexValue complexValue = (ComplexValue) parameter.asCollection().get(0);
     assertEquals((short) 9999, complexValue.getValue().get(0).getValue());
     assertEquals("One", complexValue.getValue().get(1).getValue());
 
-    complexValue = (ComplexValue) parameterData.asCollection().get(1);
+    complexValue = (ComplexValue) parameter.asCollection().get(1);
     assertEquals((short) -123, complexValue.getValue().get(0).getValue());
     assertEquals("Two", complexValue.getValue().get(1).getValue());
   }
@@ -183,8 +168,8 @@ public class ODataXMLDeserializerActionParametersTest extends AbstractODataDeser
   @Test
   public void parameterWithNullLiteral() throws Exception {
     final String input = PREAMBLE
-        + "<ParameterInt16>1</ParameterInt16>"
-        + "<ParameterDuration metadata:null=\"true\" />"
+        + "<data:ParameterInt16>1</data:ParameterInt16>"
+        + "<data:ParameterDuration metadata:null=\"true\" />"
         + POSTAMBLE;
     final Map<String, Parameter> parameters = deserialize(input, "UARTCollStringTwoParam", null);
     assertNotNull(parameters);
@@ -199,19 +184,19 @@ public class ODataXMLDeserializerActionParametersTest extends AbstractODataDeser
 
   @Test
   public void bindingParameter() throws Exception {
-    final String input = PREAMBLE + "<ParameterETAllPrim>1</ParameterETAllPrim>" + POSTAMBLE;
+    final String input = PREAMBLE + "<data:ParameterETAllPrim>1</data:ParameterETAllPrim>" + POSTAMBLE;
     deserialize(input, "BAETAllPrimRT", "ETAllPrim");
   }
 
   @Test
   public void wrongName() throws Exception {
-    expectException(PREAMBLE + "<ParameterWrong>1</ParameterWrong>" + POSTAMBLE,
+    expectException(PREAMBLE + "<data:ParameterWrong>1</data:ParameterWrong>" + POSTAMBLE,
         "UARTParam", null, MessageKeys.UNKNOWN_CONTENT);
   }
 
   @Test
   public void nullNotNullable() throws Exception {
-    expectException(PREAMBLE + "<ParameterInt16>null</ParameterInt16>" + POSTAMBLE,
+    expectException(PREAMBLE + "<data:ParameterInt16>null</data:ParameterInt16>" + POSTAMBLE,
         "UARTCTTwoPrimParam", null, MessageKeys.INVALID_VALUE_FOR_PROPERTY);
   }
 
@@ -223,26 +208,40 @@ public class ODataXMLDeserializerActionParametersTest extends AbstractODataDeser
   @Test
   public void parameterTwice() throws Exception {
     expectException(PREAMBLE
-        + "<ParameterInt16>1</ParameterInt16>"
-        + "<ParameterInt16>2</ParameterInt16>"
+        + "<data:ParameterInt16>1</data:ParameterInt16>"
+        + "<data:ParameterInt16>2</data:ParameterInt16>"
         + POSTAMBLE,
         "UARTParam", null, MessageKeys.DUPLICATE_PROPERTY);
   }
 
-  private Map<String, Parameter> deserialize(final String input, final EdmAction action) throws DeserializerException {
-    return OData.newInstance().createDeserializer(ContentType.APPLICATION_XML)
-        .actionParameters(new ByteArrayInputStream(input.getBytes()), action)
-        .getActionParameters();
+  private Parameter deserializeUARTByteNineParam(final String parameterName, final String parameterXmlValue)
+      throws DeserializerException {
+    final Map<String, Parameter> parameters = deserialize(
+        PREAMBLE + (parameterName.equals("CollParameterByte") ? "" : "<data:CollParameterByte />")
+            + (parameterName.equals("CollParameterEnum") ? "" : "<data:CollParameterEnum />")
+            + (parameterName.equals("CollParameterDef") ? "" : "<data:CollParameterDef />")
+            + (parameterName.equals("CollParameterComp") ? "" : "<data:CollParameterComp />")
+            + (parameterName.equals("CollParameterETTwoPrim") ? "" : "<data:CollParameterETTwoPrim />")
+            + "<data:" + parameterName + ">" + parameterXmlValue + "</data:" + parameterName + ">"
+            + POSTAMBLE,
+        "UARTByteNineParam", null);
+    assertNotNull(parameters);
+    assertEquals(9, parameters.size());
+    Parameter parameter = parameters.get(parameterName);
+    assertNotNull(parameter);
+    return parameter;
   }
 
   private Map<String, Parameter> deserialize(final String input, final String actionName, final String bindingTypeName)
       throws DeserializerException {
-    return deserialize(input,
-        bindingTypeName == null ?
-            edm.getUnboundAction(new FullQualifiedName(NAMESPACE, actionName)) :
-            edm.getBoundAction(new FullQualifiedName(NAMESPACE, actionName),
-                new FullQualifiedName(NAMESPACE, bindingTypeName),
-                false));
+    return OData.newInstance().createDeserializer(ContentType.APPLICATION_XML)
+        .actionParameters(new ByteArrayInputStream(input.getBytes()),
+            bindingTypeName == null ?
+                edm.getUnboundAction(new FullQualifiedName(NAMESPACE, actionName)) :
+                edm.getBoundAction(new FullQualifiedName(NAMESPACE, actionName),
+                    new FullQualifiedName(NAMESPACE, bindingTypeName),
+                    false))
+        .getActionParameters();
   }
 
   private void expectException(final String input, final String actionName, final String bindingTypeName,


Mime
View raw message