diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityInvocationHandler.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityInvocationHandler.java index 20ab3a590..d3d7476b2 100644 --- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityInvocationHandler.java +++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/EntityInvocationHandler.java @@ -277,7 +277,7 @@ public class EntityInvocationHandler extends AbstractStructuredInvocationHandler /** * Gets the current ETag defined into the wrapped entity. * - * @return + * @return the current etag */ public String getETag() { return getEntity().getETag(); diff --git a/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java b/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java index a2ccbaea5..de8c10eaf 100644 --- a/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java +++ b/fit/src/main/java/org/apache/olingo/fit/AbstractServices.java @@ -1463,7 +1463,7 @@ public abstract class AbstractServices { * @param path * @param format * @param changes - * @return + * @return response */ @PUT @Path("/{entitySetName}({entityId})/{path:.*}/$value") @@ -1491,7 +1491,7 @@ public abstract class AbstractServices { * @param path * @param format * @param changes - * @return + * @return response */ @MERGE @Path("/{entitySetName}({entityId})/{path:.*}") @@ -1519,7 +1519,7 @@ public abstract class AbstractServices { * @param path * @param format * @param changes - * @return + * @return response */ @PATCH @Path("/{entitySetName}({entityId})/{path:.*}") @@ -1587,7 +1587,7 @@ public abstract class AbstractServices { * @param path * @param format * @param changes - * @return + * @return response */ @PUT @Path("/{entitySetName}({entityId})/{path:.*}") @@ -1650,7 +1650,7 @@ public abstract class AbstractServices { * @param entityId * @param path * @param format - * @return + * @return response */ @DELETE @Path("/{entitySetName}({entityId})/{path:.*}/$value") diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/ODataRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/ODataRequest.java index b97085f68..55831b7e0 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/ODataRequest.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/ODataRequest.java @@ -28,9 +28,7 @@ import org.apache.olingo.commons.api.http.HttpMethod; /** * Abstract representation of an OData request. Get instance by using factories. * - * @see org.apache.olingo.client.api.communication.request.cud.v3.CUDRequestFactory * @see org.apache.olingo.client.api.communication.request.cud.CUDRequestFactory - * @see org.apache.olingo.client.api.communication.request.batch.v3.BatchRequestFactory * @see org.apache.olingo.client.api.communication.request.batch.BatchRequestFactory * @see org.apache.olingo.client.api.communication.request.invoke.InvokeRequestFactory */ diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataReferenceAddingRequest.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataReferenceAddingRequest.java index ad34ecbf3..82f001a4b 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataReferenceAddingRequest.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/request/cud/ODataReferenceAddingRequest.java @@ -1,18 +1,18 @@ /* * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file + * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file + * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ @@ -28,12 +28,12 @@ import org.apache.olingo.client.api.communication.response.ODataReferenceAddingR * ODataReferenceAdding requests eighter add or change the reference of navigation properties. * * If the navigation property is a collection of navigation references, the request adds a new reference to the - * collection. [OData Protocol 4.0 - 11.4.6.1] + * collection. [OData Protocol 4.0 - 11.4.6.1] * * If the request addresses an navigation property, which references a single entity, the reference will * be changed to the value provided by the request. [OData-Protocol 4.0 - 11.4.6.3] */ -public interface ODataReferenceAddingRequest - extends ODataBasicRequest, ODataBatchableRequest { +public interface ODataReferenceAddingRequest extends ODataBasicRequest, + ODataBatchableRequest { //No additional methods needed for now. } diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataBatchResponse.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataBatchResponse.java index 744758e73..358c44155 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataBatchResponse.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataBatchResponse.java @@ -25,7 +25,7 @@ import org.apache.olingo.client.api.communication.request.batch.ODataBatchRespon /** * This class implements a response to a batch request. * - * @see org.apache.olingo.client.api.communication.request.batch.CommonODataBatchRequest + * @see org.apache.olingo.client.api.communication.request.batch.ODataBatchRequest */ public interface ODataBatchResponse extends ODataResponse { diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataReferenceAddingResponse.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataReferenceAddingResponse.java index adae48503..51bba0c95 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataReferenceAddingResponse.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/communication/response/ODataReferenceAddingResponse.java @@ -25,7 +25,7 @@ package org.apache.olingo.client.api.communication.response; * If the request was successful, the service response has status code 204 and * the body has to be empty. * - * @see org.apache.olingo.client.api.communication.request.cud.api.request.cud.v4.ODataReferenceAddingRequest + * @see org.apache.olingo.client.api.communication.request.cud.ODataReferenceAddingRequest */ public interface ODataReferenceAddingResponse extends ODataResponse { //No additional methods needed for now. diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/URIBuilder.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/URIBuilder.java index d0eaac9dd..af6beb75b 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/URIBuilder.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/URIBuilder.java @@ -175,7 +175,7 @@ public interface URIBuilder { * @return current URIBuilder instance * @see QueryOption#FILTER * @see URIFilter - * @see org.apache.olingo.client.api.uri.CommonFilterFactory + * @see org.apache.olingo.client.api.uri.FilterFactory */ URIBuilder filter(URIFilter filter); diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/URIFilter.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/URIFilter.java index 2162b87bc..517079dfd 100644 --- a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/URIFilter.java +++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/URIFilter.java @@ -21,7 +21,7 @@ package org.apache.olingo.client.api.uri; /** * Interface for any available filter; obtain instances via FilterFactory. * - * @see org.apache.olingo.client.api.uri.CommonFilterFactory + * @see org.apache.olingo.client.api.uri.FilterFactory */ public interface URIFilter { diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataRequest.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataRequest.java index d10960a26..bdfd11831 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataRequest.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/communication/request/AbstractODataRequest.java @@ -47,9 +47,7 @@ import org.apache.olingo.commons.api.http.HttpMethod; /** * Abstract representation of an OData request. Get instance by using factories. * - * @see org.apache.olingo.client.api.communication.request.cud.v3.CUDRequestFactory * @see org.apache.olingo.client.api.communication.request.cud.CUDRequestFactory - * @see org.apache.olingo.client.api.communication.request.batch.v3.BatchRequestFactory * @see org.apache.olingo.client.api.communication.request.batch.BatchRequestFactory * @see org.apache.olingo.client.api.communication.request.invoke.InvokeRequestFactory */ diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterConst.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterConst.java index c3e76692c..f1732cc72 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterConst.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterConst.java @@ -23,7 +23,7 @@ import org.apache.olingo.client.api.uri.FilterArg; /** * Filter property path; obtain instances via FilterArgFactory. * - * @see org.apache.olingo.client.api.uri.CommonFilterArgFactory + * @see org.apache.olingo.client.api.uri.FilterArgFactory */ public class FilterConst implements FilterArg { diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterLiteral.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterLiteral.java index 4842a9630..501a7342d 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterLiteral.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterLiteral.java @@ -23,7 +23,7 @@ import org.apache.olingo.client.api.uri.FilterArg; /** * Filter value literals; obtain instances via FilterArgFactory. * - * @see org.apache.olingo.client.api.uri.v3.FilterArgFactory + * @see org.apache.olingo.client.api.uri.FilterArgFactory */ public class FilterLiteral implements FilterArg { diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterProperty.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterProperty.java index bc99eb495..6073112b4 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterProperty.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterProperty.java @@ -23,7 +23,7 @@ import org.apache.olingo.client.api.uri.FilterArg; /** * Filter property path; obtain instances via FilterArgFactory. * - * @see org.apache.olingo.client.api.uri.CommonFilterArgFactory + * @see org.apache.olingo.client.api.uri.FilterArgFactory */ public class FilterProperty implements FilterArg { diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java index 26399c268..608dc3a38 100644 --- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java +++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/URIUtils.java @@ -179,7 +179,6 @@ public final class URIUtils { /** * Turns primitive values into their respective URI representation. * - * @param version OData protocol version * @param obj primitive value * @return URI representation */ diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java index 04888d795..ad64559b4 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataComplexValue.java @@ -23,7 +23,6 @@ import java.util.Map; /** * OData complex property value. * - * @param The actual ODataProperty interface. */ public interface ODataComplexValue extends ODataValue, ODataLinked, ODataAnnotatable, Iterable { diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInlineEntity.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInlineEntity.java index ff9a4203c..6ba0ad638 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInlineEntity.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataInlineEntity.java @@ -30,7 +30,6 @@ public class ODataInlineEntity extends ODataLink { /** * Constructor. * - * @param version OData service version. * @param uri edit link. * @param type type. * @param title title. @@ -45,7 +44,6 @@ public class ODataInlineEntity extends ODataLink { /** * Constructor. * - * @param version OData service version. * @param baseURI base URI. * @param href href. * @param type type. diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLink.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLink.java index 4bc8bdba2..859367918 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLink.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLink.java @@ -105,7 +105,6 @@ public class ODataLink extends ODataItem implements ODataAnnotatable { /** * Constructor. * - * @param version OData service version. * @param uri URI. * @param type type. * @param title title. diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLinkType.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLinkType.java index f99aa3e33..5ae427cb8 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLinkType.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/domain/ODataLinkType.java @@ -73,7 +73,6 @@ public enum ODataLinkType { * Gets * LinkType instance from the given rel and type. * - * @param version OData protocol version. * @param rel rel. * @param type type. * @return ODataLinkType object. diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmPrimitiveTypeKind.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmPrimitiveTypeKind.java index b7efca716..78dd0139a 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmPrimitiveTypeKind.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/EdmPrimitiveTypeKind.java @@ -81,7 +81,6 @@ public enum EdmPrimitiveTypeKind { /** * Gets EdmPrimitiveTypeKind from a full-qualified type name, for the given OData protocol version. * - * @param version OData protocol version. * @param fqn full-qualified type name. * @return EdmPrimitiveTypeKind object. */ @@ -93,7 +92,6 @@ public enum EdmPrimitiveTypeKind { * Gets EdmPrimitiveTypeKind from a full type expression (as Edm.Int32), for the given OData * protocol version. * - * @param version OData protocol version. * @param fqn string value type. * @return EdmPrimitiveTypeKind object. */ diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/Schema.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/Schema.java index 183478fe4..7ed27041e 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/Schema.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/edm/provider/Schema.java @@ -131,7 +131,7 @@ public class Schema extends AbstractEdmItem implements Annotatable{ /** * All actions with the given name * @param name - * @return + * @return a list of actions */ public List getActions(final String name) { return getAllByName(name, getActions()); @@ -149,7 +149,7 @@ public class Schema extends AbstractEdmItem implements Annotatable{ /** * All functions with the given name * @param name - * @return + * @return a list of functions */ public List getFunctions(final String name) { return getAllByName(name, getFunctions()); diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataFormat.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataFormat.java index 6a4b494f3..52e4bec5d 100644 --- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataFormat.java +++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/format/ODataFormat.java @@ -57,7 +57,6 @@ public enum ODataFormat { /** * Gets format as {@link ContentType}. - * @param version OData service version. * @return format as ContentType. */ public ContentType getContentType() { diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/FixedFormatSerializer.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/FixedFormatSerializer.java index a62531baf..9a0e6934d 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/FixedFormatSerializer.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/FixedFormatSerializer.java @@ -53,7 +53,7 @@ public interface FixedFormatSerializer { * Serializes a batch response * @param batchResponses * @param boundary - * @return + * @return response as an input stream * @throws BatchSerializerException */ InputStream batchResponse(List batchResponses, String boundary) throws BatchSerializerException; 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 b9fe77059..22e570ef7 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 @@ -183,7 +183,7 @@ public class ODataJsonDeserializer implements ODataDeserializer { public List actionParameters(InputStream stream, final EdmAction edmAction) throws DeserializerException { try { ObjectNode tree = parseJsonTree(stream); - ArrayList parameters = new ArrayList(); + List parameters = new ArrayList(); consumeParameters(edmAction, tree, parameters); assertJsonNodeIsEmpty(tree); return parameters; @@ -208,33 +208,42 @@ public class ODataJsonDeserializer implements ODataDeserializer { return tree; } - private void consumeParameters(final EdmAction edmAction, ObjectNode node, ArrayList parameters) + private void consumeParameters(final EdmAction edmAction, ObjectNode node, List parameters) throws DeserializerException { - for (final String name : edmAction.getParameterNames()) { + List parameterNames = edmAction.getParameterNames(); + if (edmAction.isBound()) { + // The binding parameter must not occur in the payload. + parameterNames = parameterNames.subList(1, parameterNames.size()); + } + for (final String name : parameterNames) { final EdmParameter edmParameter = edmAction.getParameter(name); ParameterImpl parameter = new ParameterImpl(); parameter.setName(name); JsonNode jsonNode = node.get(name); - if (jsonNode == null || jsonNode.isNull()) { - if (!edmParameter.isNullable()) { - throw new DeserializerException("Non-nullable parameter not present or null", - DeserializerException.MessageKeys.INVALID_NULL_PARAMETER, name); - } - } switch (edmParameter.getType().getKind()) { case PRIMITIVE: case DEFINITION: case ENUM: - Property consumePropertyNode = - consumePropertyNode(edmParameter.getName(), edmParameter.getType(), edmParameter.isCollection(), - edmParameter.isNullable(), edmParameter.getMaxLength(), edmParameter.getPrecision(), edmParameter - .getScale(), - true, edmParameter.getMapping(), - jsonNode); - parameter.setValue(consumePropertyNode.getValueType(), consumePropertyNode.getValue()); - parameters.add(parameter); - node.remove(name); + if (jsonNode == null || jsonNode.isNull()) { + if (!edmParameter.isNullable()) { + throw new DeserializerException("Non-nullable parameter not present or null", + DeserializerException.MessageKeys.INVALID_NULL_PARAMETER, name); + } + if (edmParameter.isCollection()) { + throw new DeserializerException("Collection must not be null for parameter: " + name, + DeserializerException.MessageKeys.INVALID_NULL_PARAMETER, name); + } + parameter.setValue(ValueType.PRIMITIVE, null); + } else { + Property consumePropertyNode = + consumePropertyNode(edmParameter.getName(), edmParameter.getType(), edmParameter.isCollection(), + edmParameter.isNullable(), edmParameter.getMaxLength(), edmParameter.getPrecision(), edmParameter + .getScale(), true, edmParameter.getMapping(), jsonNode); + parameter.setValue(consumePropertyNode.getValueType(), consumePropertyNode.getValue()); + parameters.add(parameter); + node.remove(name); + } break; case COMPLEX: case ENTITY: 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 43183535f..d00b95301 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 @@ -50,7 +50,7 @@ public class ActionProvider { new FullQualifiedName(SchemaProvider.NAMESPACE, "BAETTwoKeyNavRTETTwoKeyNav"); public static final FullQualifiedName nameBAETAllPrimRT = - new FullQualifiedName(SchemaProvider.NAMESPACE, "BAESAllPrimRT"); + new FullQualifiedName(SchemaProvider.NAMESPACE, "BAETAllPrimRT"); // Unbound Actions public static final FullQualifiedName nameUARTString = new FullQualifiedName(SchemaProvider.NAMESPACE, @@ -77,74 +77,67 @@ public class ActionProvider { public List getActions(final FullQualifiedName actionName) throws ODataException { if (actionName.equals(nameUARTString)) { - return Arrays.asList( - new Action().setName(nameUARTString.getName()) - .setReturnType(new ReturnType().setType(PropertyProvider.nameString)) - ); + return Collections.singletonList( + new Action().setName(nameUARTString.getName()) + .setReturnType(new ReturnType().setType(PropertyProvider.nameString))); + } else if (actionName.equals(nameUARTCollStringTwoParam)) { - return Arrays.asList( - new Action().setName(nameUARTCollStringTwoParam.getName()) - .setParameters(Arrays.asList( - new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16), - new Parameter().setName("ParameterDuration").setType(PropertyProvider.nameDuration))) - .setReturnType(new ReturnType().setType(PropertyProvider.nameString).setCollection(true)) - ); + return Collections.singletonList( + new Action().setName(nameUARTCollStringTwoParam.getName()) + .setParameters(Arrays.asList( + new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16), + new Parameter().setName("ParameterDuration").setType(PropertyProvider.nameDuration))) + .setReturnType(new ReturnType().setType(PropertyProvider.nameString).setCollection(true))); } else if (actionName.equals(nameUARTCTTwoPrimParam)) { - return Arrays.asList( - new Action().setName(nameUARTCTTwoPrimParam.getName()) - .setParameters(Arrays.asList( - new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16) - .setNullable(false))) - .setReturnType( - new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setNullable(false)) - ); - + return Collections.singletonList( + new Action().setName(nameUARTCTTwoPrimParam.getName()) + .setParameters(Collections.singletonList( + new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16) + .setNullable(false))) + .setReturnType( + new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setNullable(false))); + } else if (actionName.equals(nameUARTCollCTTwoPrimParam)) { - return Arrays.asList( - new Action().setName(nameUARTCollCTTwoPrimParam.getName()) - .setParameters(Arrays.asList( - new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16))) - .setReturnType( - new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setCollection(true)) - ); + return Collections.singletonList( + new Action().setName(nameUARTCollCTTwoPrimParam.getName()) + .setParameters(Collections.singletonList( + new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16))) + .setReturnType( + new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setCollection(true))); } else if (actionName.equals(nameUARTETTwoKeyTwoPrimParam)) { - return Arrays.asList( - new Action().setName(nameUARTETTwoKeyTwoPrimParam.getName()) - .setParameters(Arrays.asList( - new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16))) - .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETTwoKeyTwoPrim)) - ); + return Collections.singletonList( + new Action().setName(nameUARTETTwoKeyTwoPrimParam.getName()) + .setParameters(Collections.singletonList( + new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16))) + .setReturnType( + new ReturnType().setType(EntityTypeProvider.nameETTwoKeyTwoPrim))); } else if (actionName.equals(nameUARTCollETKeyNavParam)) { - return Arrays.asList( - new Action().setName(nameUARTCollETKeyNavParam.getName()) - .setParameters(Arrays.asList( - new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16))) - .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETKeyNav).setCollection(true)) - ); + return Collections.singletonList( + new Action().setName(nameUARTCollETKeyNavParam.getName()) + .setParameters(Collections.singletonList( + new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16))) + .setReturnType( + new ReturnType().setType(EntityTypeProvider.nameETKeyNav).setCollection(true))); } else if (actionName.equals(nameUARTETAllPrimParam)) { - return Arrays.asList( - new Action().setName(nameUARTETAllPrimParam.getName()) - .setParameters(Arrays.asList( - new Parameter().setName("ParameterDate").setType(PropertyProvider.nameDate))) - .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETAllPrim)) - ); + return Collections.singletonList( + new Action().setName(nameUARTETAllPrimParam.getName()) + .setParameters(Collections.singletonList( + new Parameter().setName("ParameterDate").setType(PropertyProvider.nameDate))) + .setReturnType( + new ReturnType().setType(EntityTypeProvider.nameETAllPrim))); } else if (actionName.equals(nameUARTCollETAllPrimParam)) { - return Arrays.asList( - new Action().setName(nameUARTCollETAllPrimParam.getName()) - .setParameters(Arrays.asList( - new Parameter().setName("ParameterTimeOfDay") - .setType(PropertyProvider.nameTimeOfDay))) - .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETAllPrim).setCollection(true)) - ); + return Collections.singletonList( + new Action().setName(nameUARTCollETAllPrimParam.getName()) + .setParameters(Collections.singletonList( + new Parameter().setName("ParameterTimeOfDay") + .setType(PropertyProvider.nameTimeOfDay))) + .setReturnType( + new ReturnType().setType(EntityTypeProvider.nameETAllPrim).setCollection(true))); } else if (actionName.equals(nameUART)) { return Collections.singletonList(new Action().setName(nameUART.getName())); @@ -186,26 +179,22 @@ public class ActionProvider { } else if (actionName.equals(nameBAESAllPrimRTETAllPrim)) { return Arrays.asList( new Action().setName("BAESAllPrimRTETAllPrim") - .setParameters( - Arrays.asList( - new Parameter().setName("ParameterESAllPrim").setType(EntityTypeProvider.nameETAllPrim) - .setCollection(true).setNullable(false))) + .setParameters(Arrays.asList( + new Parameter().setName("ParameterESAllPrim").setType(EntityTypeProvider.nameETAllPrim) + .setCollection(true).setNullable(false))) .setBound(true) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETAllPrim)) - ); + new ReturnType().setType(EntityTypeProvider.nameETAllPrim))); } else if (actionName.equals(nameBAESTwoKeyNavRTESTwoKeyNav)) { return Arrays.asList( new Action().setName("BAESTwoKeyNavRTESTwoKeyNav") - .setParameters( - Arrays.asList( - new Parameter().setName("ParameterETTwoKeyNav").setType(EntityTypeProvider.nameETTwoKeyNav) - .setCollection(true).setNullable(false))) + .setParameters(Arrays.asList( + new Parameter().setName("ParameterETTwoKeyNav").setType(EntityTypeProvider.nameETTwoKeyNav) + .setCollection(true).setNullable(false))) .setBound(true) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true)) - ); + new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true))); } else if(actionName.equals(nameBAESTwoKeyNavRTESKeyNav)) { return Arrays.asList( @@ -214,12 +203,12 @@ public class ActionProvider { .setEntitySetPath("BindingParam/NavPropertyETKeyNavMany") .setParameters(Arrays.asList( new Parameter().setName("ParameterETTwoKeyNav") - .setType(EntityTypeProvider.nameETTwoKeyNav) - .setCollection(true) - .setNullable(false) - )) - .setReturnType(new ReturnType().setType(EntityTypeProvider.nameETKeyNav).setCollection(true)) - ); + .setType(EntityTypeProvider.nameETTwoKeyNav) + .setCollection(true) + .setNullable(false))) + .setReturnType( + new ReturnType().setType(EntityTypeProvider.nameETKeyNav).setCollection(true))); + } else if (actionName.equals(nameBAETBaseTwoKeyNavRTETBaseTwoKeyNav)) { return Arrays.asList( new Action().setName("BAETBaseTwoKeyNavRTETBaseTwoKeyNav") @@ -228,20 +217,19 @@ public class ActionProvider { .setNullable(false))) .setBound(true) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav)) - ); + new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav))); } else if (actionName.equals(nameBAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav)) { return Arrays.asList( new Action().setName("BAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav") - .setParameters( - Arrays.asList( - new Parameter().setName("ParameterETTwoBaseTwoKeyNav").setType( - EntityTypeProvider.nameETTwoBaseTwoKeyNav).setNullable(false))) + .setParameters(Arrays.asList( + new Parameter().setName("ParameterETTwoBaseTwoKeyNav") + .setType(EntityTypeProvider.nameETTwoBaseTwoKeyNav) + .setNullable(false))) .setBound(true) .setReturnType( - new ReturnType().setType(EntityTypeProvider.nameETBaseTwoKeyNav)) - ); + new ReturnType().setType(EntityTypeProvider.nameETBaseTwoKeyNav))); + } else if(actionName.equals(nameBAETAllPrimRT)) { return Arrays.asList( new Action().setName("BAETAllPrimRT") @@ -249,17 +237,14 @@ public class ActionProvider { .setParameters(Arrays.asList( new Parameter().setName("ParameterETAllPrim") .setNullable(false) - .setType(EntityTypeProvider.nameETAllPrim) - )), + .setType(EntityTypeProvider.nameETAllPrim))), new Action().setName("BAETAllPrimRT") .setBound(true) .setParameters(Arrays.asList( new Parameter().setName("ParameterETAllPrim") .setNullable(false) .setCollection(true) - .setType(EntityTypeProvider.nameETAllPrim) - )) - ); + .setType(EntityTypeProvider.nameETAllPrim)))); } return null; 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 80668eb10..58777abc9 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 @@ -57,6 +57,29 @@ public class ODataJsonDeserializerActionParametersTest extends AbstractODataDese assertEquals(BigDecimal.valueOf(3669753), parameter.getValue()); } + @Test + public void boundEmpty() throws Exception { + final String input = "{}"; + final List parameters = deserialize(input, "BAETAllPrimRT", "ETAllPrim"); + assertNotNull(parameters); + assertTrue(parameters.isEmpty()); + } + + @Test(expected = DeserializerException.class) + public void bindingParameter() throws Exception { + deserialize("{\"ParameterETAllPrim\":{\"PropertyInt16\":42}}", "BAETAllPrimRT", "ETAllPrim"); + } + + @Test(expected = DeserializerException.class) + public void wrongName() throws Exception { + deserialize("{\"ParameterWrong\":null}", "UARTParam"); + } + + @Test(expected = DeserializerException.class) + public void nullNotNullable() throws Exception { + deserialize("{\"ParameterInt16\":null}", "UARTCTTwoPrimParam"); + } + @Test(expected = DeserializerException.class) public void missingParameter() throws Exception { deserialize("{}", "UARTCTTwoPrimParam"); @@ -77,4 +100,12 @@ public class ODataJsonDeserializerActionParametersTest extends AbstractODataDese .actionParameters(new ByteArrayInputStream(input.getBytes()), edm.getUnboundAction(new FullQualifiedName("Namespace1_Alias", actionName))); } + + private List deserialize(final String input, final String actionName, final String typeName) + throws DeserializerException { + return OData.newInstance().createDeserializer(ODataFormat.JSON) + .actionParameters(new ByteArrayInputStream(input.getBytes()), + edm.getBoundAction(new FullQualifiedName("Namespace1_Alias", actionName), + new FullQualifiedName("Namespace1_Alias", typeName), false)); + } } 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 f5304566d..4d67fcdca 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 @@ -286,7 +286,7 @@ public class FilterValidator implements TestValidator { * Validates the serialized filterTree against a given filterString * The given expected filterString is compressed before to allow better readable code in the unit tests * @param toBeCompr - * @return + * @return {@link FilterValidator} */ public FilterValidator isCompr(final String toBeCompr) { return is(compress(toBeCompr)); diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/ParserValidator.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/ParserValidator.java index aeb130969..da65ff029 100644 --- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/ParserValidator.java +++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/ParserValidator.java @@ -57,7 +57,7 @@ public class ParserValidator { * Used in fast LL Parsing: * Don't stop the parsing process when the slower full context parsing (with prediction mode SLL) is * required - * @return + * @return {@link ParserValidator} */ public ParserValidator aFC() { allowFullContext = true; @@ -68,7 +68,7 @@ public class ParserValidator { * Used in fast LL Parsing: * Allows ContextSensitifity Errors which occur often when using the slower full context parsing * and indicate that there is a context sensitivity ( which may not be an error). - * @return + * @return {@link ParserValidator} */ public ParserValidator aCS() { allowContextSensitifity = true; @@ -78,7 +78,7 @@ public class ParserValidator { /** * Used in fast LL Parsing: * Allows ambiguities - * @return + * @return {@link ParserValidator} */ public ParserValidator aAM() { allowAmbiguity = true;