You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by mi...@apache.org on 2015/09/14 10:40:27 UTC
[1/5] olingo-odata4 git commit: [OLINGO-659] more API clean-up
Repository: olingo-odata4
Updated Branches:
refs/heads/master fcec0c349 -> 9c3ca381e
[OLINGO-659] more API clean-up
Signed-off-by: Michael Bolz <mi...@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/54f69472
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/54f69472
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/54f69472
Branch: refs/heads/master
Commit: 54f6947259b0e0eb03b2ebfd4af28d2989b93530
Parents: fcec0c3
Author: Klaus Straubinger <kl...@sap.com>
Authored: Fri Sep 11 16:23:30 2015 +0200
Committer: Michael Bolz <mi...@sap.com>
Committed: Mon Sep 14 10:02:30 2015 +0200
----------------------------------------------------------------------
.../olingo/commons/api/http/HttpHeader.java | 195 ++++---------------
.../apache/olingo/server/api/HttpHeaders.java | 121 +++++-------
.../org/apache/olingo/server/api/OData.java | 11 +-
.../olingo/server/api/ODataHttpHandler.java | 4 +-
.../apache/olingo/server/api/ODataRequest.java | 15 +-
.../apache/olingo/server/api/ODataResponse.java | 10 +-
.../olingo/server/api/batch/BatchFacade.java | 41 ++--
.../server/api/debug/DebugResponseHelper.java | 10 +-
.../api/deserializer/ODataDeserializer.java | 17 +-
.../batch/BatchDeserializerException.java | 25 ++-
.../api/deserializer/batch/BatchOptions.java | 26 ++-
.../deserializer/batch/BatchRequestPart.java | 13 +-
.../ReferenceCollectionSerializerOptions.java | 2 +-
.../serializer/ReferenceSerializerOptions.java | 2 +-
.../deserializer/batch/BatchParserCommon.java | 3 +-
.../batch/BatchRequestTransformator.java | 12 +-
.../batch/BatchTransformatorCommon.java | 5 +-
.../serializer/BatchResponseSerializer.java | 6 +-
.../server-core-exceptions-i18n.properties | 21 +-
.../batch/BatchRequestParserTest.java | 12 +-
.../serializer/AsyncResponseSerializerTest.java | 20 +-
21 files changed, 223 insertions(+), 348 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/54f69472/lib/commons-api/src/main/java/org/apache/olingo/commons/api/http/HttpHeader.java
----------------------------------------------------------------------
diff --git a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/http/HttpHeader.java b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/http/HttpHeader.java
index 323655b..f33dbb0 100644
--- a/lib/commons-api/src/main/java/org/apache/olingo/commons/api/http/HttpHeader.java
+++ b/lib/commons-api/src/main/java/org/apache/olingo/commons/api/http/HttpHeader.java
@@ -18,271 +18,162 @@
*/
package org.apache.olingo.commons.api.http;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Locale;
-
/**
* HTTP header constants.
*/
-public class HttpHeader {
+public interface HttpHeader {
/**
* See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1">HTTP/1.1 documentation</a>}.
*/
- public static final String ACCEPT = "Accept";
+ String ACCEPT = "Accept";
/**
* See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.2">HTTP/1.1 documentation</a>}.
*/
- public static final String ACCEPT_CHARSET = "Accept-Charset";
+ String ACCEPT_CHARSET = "Accept-Charset";
/**
* See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.3">HTTP/1.1 documentation</a>}.
*/
- public static final String ACCEPT_ENCODING = "Accept-Encoding";
+ String ACCEPT_ENCODING = "Accept-Encoding";
/**
* See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4">HTTP/1.1 documentation</a>}.
*/
- public static final String ACCEPT_LANGUAGE = "Accept-Language";
+ String ACCEPT_LANGUAGE = "Accept-Language";
/**
* See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.7">HTTP/1.1 documentation</a>}.
*/
- public static final String ALLOW = "Allow";
+ String ALLOW = "Allow";
/**
* See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.8">HTTP/1.1 documentation</a>}.
*/
- public static final String AUTHORIZATION = "Authorization";
+ String AUTHORIZATION = "Authorization";
/**
* See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9">HTTP/1.1 documentation</a>}.
*/
- public static final String CACHE_CONTROL = "Cache-Control";
+ String CACHE_CONTROL = "Cache-Control";
/**
* See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.11">HTTP/1.1 documentation</a>}.
*/
- public static final String CONTENT_ENCODING = "Content-Encoding";
+ String CONTENT_ENCODING = "Content-Encoding";
/**
* See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.12">HTTP/1.1 documentation</a>}.
*/
- public static final String CONTENT_LANGUAGE = "Content-Language";
+ String CONTENT_LANGUAGE = "Content-Language";
/** See <a href="http://www.rfc-editor.org/rfc/rfc2392.txt">RFC 2392</a>. */
- public static final String CONTENT_ID = "Content-ID";
+ String CONTENT_ID = "Content-ID";
/**
* See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.13">HTTP/1.1 documentation</a>}.
*/
- public static final String CONTENT_LENGTH = "Content-Length";
+ String CONTENT_LENGTH = "Content-Length";
/**
* See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.14">HTTP/1.1 documentation</a>}.
*/
- public static final String CONTENT_LOCATION = "Content-Location";
+ String CONTENT_LOCATION = "Content-Location";
/**
* See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17">HTTP/1.1 documentation</a>}.
*/
- public static final String CONTENT_TYPE = "Content-Type";
+ String CONTENT_TYPE = "Content-Type";
/**
* See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.18">HTTP/1.1 documentation</a>}.
*/
- public static final String DATE = "Date";
+ String DATE = "Date";
/**
* See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.19">HTTP/1.1 documentation</a>}.
*/
- public static final String ETAG = "ETag";
+ String ETAG = "ETag";
/** See <a href="http://www.rfc-editor.org/rfc/rfc7231.txt">RFC 7231</a>. */
- public static final String EXPECT = "Expect";
+ String EXPECT = "Expect";
/**
* See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.21">HTTP/1.1 documentation</a>}.
*/
- public static final String EXPIRES = "Expires";
+ String EXPIRES = "Expires";
/** See <a href="http://www.rfc-editor.org/rfc/rfc7231.txt">RFC 7231</a>. */
- public static final String FROM = "From";
+ String FROM = "From";
/**
* See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.23">HTTP/1.1 documentation</a>}.
*/
- public static final String HOST = "Host";
+ String HOST = "Host";
/**
* See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.24">HTTP/1.1 documentation</a>}.
*/
- public static final String IF_MATCH = "If-Match";
+ String IF_MATCH = "If-Match";
/**
* See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.25">HTTP/1.1 documentation</a>}.
*/
- public static final String IF_MODIFIED_SINCE = "If-Modified-Since";
+ String IF_MODIFIED_SINCE = "If-Modified-Since";
/**
* See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.26">HTTP/1.1 documentation</a>}.
*/
- public static final String IF_NONE_MATCH = "If-None-Match";
+ String IF_NONE_MATCH = "If-None-Match";
/**
* See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.28">HTTP/1.1 documentation</a>}.
*/
- public static final String IF_UNMODIFIED_SINCE = "If-Unmodified-Since";
+ String IF_UNMODIFIED_SINCE = "If-Unmodified-Since";
/**
* See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.29">HTTP/1.1 documentation</a>}.
*/
- public static final String LAST_MODIFIED = "Last-Modified";
+ String LAST_MODIFIED = "Last-Modified";
/**
* See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.30">HTTP/1.1 documentation</a>}.
*/
- public static final String LOCATION = "Location";
+ String LOCATION = "Location";
/**
* See {@link <a href="http://tools.ietf.org/html/rfc5988#page-6">Web Linking (IETF RFC-5988) documentation</a>}.
*/
- public static final String LINK = "Link";
+ String LINK = "Link";
/** See <a href="http://www.rfc-editor.org/rfc/rfc7231.txt">RFC 7231</a>. */
- public static final String MAX_FORWARDS = "Max-Forwards";
+ String MAX_FORWARDS = "Max-Forwards";
/**
* OData Prefer Header.
* See <a href="http://docs.oasis-open.org/odata/odata/v4.0/odata-v4.0-part1-protocol.html#_Toc406398233">
* OData Version 4.0 Part 1: Protocol</a> and <a href="https://www.ietf.org/rfc/rfc7240.txt">RFC 7240</a>.
*/
- public static final String PREFER = "Prefer";
+ String PREFER = "Prefer";
/**
* OData Preference-Applied Header.
* See <a href="http://docs.oasis-open.org/odata/odata/v4.0/odata-v4.0-part1-protocol.html#_Toc406398247">
* OData Version 4.0 Part 1: Protocol</a> and <a href="https://www.ietf.org/rfc/rfc7240.txt">RFC 7240</a>.
*/
- public static final String PREFERENCE_APPLIED = "Preference-Applied";
+ String PREFERENCE_APPLIED = "Preference-Applied";
/** See <a href="http://www.rfc-editor.org/rfc/rfc7233.txt">RFC 7233</a>. */
- public static final String RANGE = "Range";
+ String RANGE = "Range";
/**
* See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.37">HTTP/1.1 documentation</a>}.
*/
- public static final String RETRY_AFTER = "Retry-After";
+ String RETRY_AFTER = "Retry-After";
/** See <a href="http://www.rfc-editor.org/rfc/rfc7230.txt">RFC 7230</a>. */
- public static final String TE = "TE";
+ String TE = "TE";
/**
* See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43">HTTP/1.1 documentation</a>}.
*/
- public static final String USER_AGENT = "User-Agent";
+ String USER_AGENT = "User-Agent";
/**
* See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.44">HTTP/1.1 documentation</a>}.
*/
- public static final String VARY = "Vary";
+ String VARY = "Vary";
/**
* See {@link <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.47">HTTP/1.1 documentation</a>}.
*/
- public static final String WWW_AUTHENTICATE = "WWW-Authenticate";
+ String WWW_AUTHENTICATE = "WWW-Authenticate";
/**
* See {@link <a href="http://www.ietf.org/rfc/rfc2109.txt">IETF RFC 2109</a>}.
*/
- public static final String COOKIE = "Cookie";
+ String COOKIE = "Cookie";
/**
* See {@link <a href="http://www.ietf.org/rfc/rfc2109.txt">IETF RFC 2109</a>}.
*/
- public static final String SET_COOKIE = "Set-Cookie";
+ String SET_COOKIE = "Set-Cookie";
/** Non standard header. */
- public static final String X_HTTP_METHOD = "X-HTTP-Method";
+ String X_HTTP_METHOD = "X-HTTP-Method";
/** Non standard header. */
- public static final String X_HTTP_METHOD_OVERRIDE = "X-HTTP-Method-Override";
+ String X_HTTP_METHOD_OVERRIDE = "X-HTTP-Method-Override";
/** Custom Header defined in the OData standard. */
- public static final String ODATA_VERSION = "OData-Version";
+ String ODATA_VERSION = "OData-Version";
/** Custom Header defined in the OData standard. */
- public static final String ODATA_MAX_VERSION = "OData-MaxVersion";
+ String ODATA_MAX_VERSION = "OData-MaxVersion";
/** Custom Header defined in the OData standard. */
- public static final String ODATA_ENTITY_ID = "OData-EntityID";
-
- private final String name;
- private final List<String> values;
-
- /**
- * Create header for given name
- * @param name of header
- */
- public HttpHeader(String name) {
- this.name = name;
- this.values = new ArrayList<String>();
- }
-
- /**
- * Create header for given name and add given values
- * @param name of header
- * @param values values for header
- */
- public HttpHeader(String name, Collection<String> values) {
- this(name);
- this.values.addAll(values);
- }
-
- /**
- * Get name of header (not the canonical name)
- * @return name of header
- */
- public String getName() {
- return name;
- }
-
- /**
- * Get all values for this header
- * @return all header values
- */
- public List<String> getValues() {
- return Collections.unmodifiableList(values);
- }
-
- /**
- * Add header value
- *
- * @param value value to be added
- * @return this header object (fluent interface)
- */
- public HttpHeader addValue(String value) {
- this.values.add(value);
- return this;
- }
-
- /**
- * Add header values
- *
- * @param values values to be added
- * @return this header object (fluent interface)
- */
- public HttpHeader addValues(Collection<String> values) {
- this.values.addAll(values);
- return this;
- }
-
- /**
- * Get the canonical name of header
- * @return canonical name of header
- */
- public String getCanonicalName() {
- return createCanonicalName(name);
- }
-
- /**
- * Create the canonical name based on given name parameter
- *
- * @param name name which is canonicalised
- * @return canonical name
- */
- public static String createCanonicalName(String name) {
- return name.toLowerCase(Locale.ROOT);
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
-
- HttpHeader that = (HttpHeader) o;
-
- if (!name.equals(that.name)) {
- return false;
- }
- return values.equals(that.values);
-
- }
-
- @Override
- public int hashCode() {
- int result = name.hashCode();
- result = 31 * result + values.hashCode();
- return result;
- }
+ String ODATA_ENTITY_ID = "OData-EntityID";
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/54f69472/lib/server-api/src/main/java/org/apache/olingo/server/api/HttpHeaders.java
----------------------------------------------------------------------
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/HttpHeaders.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/HttpHeaders.java
index afbe8d2..eec22f0 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/HttpHeaders.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/HttpHeaders.java
@@ -22,132 +22,111 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashMap;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.apache.olingo.commons.api.http.HttpHeader;
-
/**
- * HttpHeader container
+ * HttpHeader container.
*/
public class HttpHeaders {
- private final Map<String, HttpHeader> headers = new LinkedHashMap<String, HttpHeader>();
+ private final Map<String, List<String>> headers = new LinkedHashMap<String, List<String>>();
/**
- * Add a header with given name and value.
- * If header with name already exists the value is added to this header.
- *
+ * Adds a header with given name and value.
+ * If a header with that name already exists the value is added to this header.
* @param name name of header
* @param value value for header
* @return this container (fluent interface)
*/
- public HttpHeaders addHeader(String name, String value) {
- HttpHeader eh = grantHeader(name);
- eh.addValue(value);
+ public HttpHeaders addHeader(final String name, final String value) {
+ final String canonicalName = getCanonicalName(name);
+ List<String> header = headers.get(canonicalName);
+ if (header == null) {
+ header = new ArrayList<String>();
+ }
+ header.add(value);
+ headers.put(canonicalName, header);
return this;
}
/**
- * Add a header with given name and values.
- * If header with name already exists the values are added to this header.
- *
+ * Adds a header with the given name and values.
+ * If a header with that name already exists the values are added to this header.
* @param name name of header
* @param values values for header
* @return this container (fluent interface)
*/
- public HttpHeaders addHeader(String name, Collection<String> values) {
- HttpHeader eh = grantHeader(name);
- eh.addValues(values);
+ public HttpHeaders addHeader(final String name, final List<String> values) {
+ final String canonicalName = getCanonicalName(name);
+ List<String> header = headers.get(canonicalName);
+ if (header == null) {
+ header = new ArrayList<String>();
+ }
+ header.addAll(values);
+ headers.put(canonicalName, header);
return this;
}
/**
* Set a header with given name and value.
- * If header with name already exists the old header is replaced with the new one.
- *
+ * If a header with that name already exists the old header is replaced with the new one.
* @param name name of header
* @param value value for header
* @return this container (fluent interface)
*/
- public HttpHeaders setHeader(String name, String value) {
+ public HttpHeaders setHeader(final String name, final String value) {
removeHeader(name);
-
- HttpHeader eh = grantHeader(name);
- eh.addValue(value);
+ addHeader(name, value);
return this;
}
/**
- * Get header for given name.
- *
+ * Gets header values for the given name.
* @param name name of header requested
- * @return corresponding header
+ * @return corresponding header values or null if no values have been found
*/
- public HttpHeader getHeader(String name) {
- return headers.get(HttpHeader.createCanonicalName(name));
+ public List<String> getHeader(final String name) {
+ final List<String> values = headers.get(getCanonicalName(name));
+ return values == null || values.isEmpty() ? null : Collections.unmodifiableList(values);
}
/**
- * Remove header for given name.
- *
+ * Removes header of the given name.
* @param name name of header to be removed
- * @return header which was removed or null if no header was known for this name
- */
- public HttpHeader removeHeader(String name) {
- return headers.remove(HttpHeader.createCanonicalName(name));
- }
-
-
- /**
- * Get all headers.
- *
- * @return all headers
+ * @return removed header values or null if no header was known for this name
*/
- public Collection<HttpHeader> getHeaders() {
- return Collections.unmodifiableCollection(headers.values());
+ public List<String> removeHeader(final String name) {
+ return headers.remove(getCanonicalName(name));
}
-
/**
- * Get all headers with the according values.
- *
- * @return an unmodifiable Map of header names/values
+ * Gets all headers with the according values.
+ * @return an unmodifiable Map of header names/values or an empty collection if no headers have been set
*/
public Map<String, List<String>> getHeaderToValues() {
- Map<String, List<String>> result = new HashMap<String, List<String>>();
- Collection<HttpHeader> allHeaders = headers.values();
- for (HttpHeader header : allHeaders) {
- result.put(header.getName(), header.getValues());
- }
- return Collections.unmodifiableMap(result);
+ return headers.isEmpty() ? Collections.<String, List<String>> emptyMap() : Collections.unmodifiableMap(headers);
}
/**
- * Get all header names.
- *
- * @return all header names
+ * Gets all header names.
+ * @return all header names or an empty collection if no headers have been set
*/
public Collection<String> getHeaderNames() {
- Collection<String> headerNames = new ArrayList<String>();
- for (HttpHeader header : headers.values()) {
- headerNames.add(header.getName());
- }
- return headerNames;
+ return headers.isEmpty() ? Collections.<String> emptySet() : Collections.unmodifiableSet(headers.keySet());
}
/**
- * Get or create a header for given name.
- *
- * @return new or known header
+ * The canonical form of a header name is the already-used form regarding case,
+ * enabling applications to have pretty-looking headers instead of getting them
+ * converted to all lowercase.
+ * @param name HTTP header name
*/
- private HttpHeader grantHeader(String name) {
- String key = HttpHeader.createCanonicalName(name);
- HttpHeader eh = headers.get(key);
- if(eh == null) {
- eh = new HttpHeader(name);
- headers.put(key, eh);
+ private String getCanonicalName(final String name) {
+ for (final String headerName : headers.keySet()) {
+ if (headerName.equalsIgnoreCase(name)) {
+ return headerName;
+ }
}
- return eh;
+ return name;
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/54f69472/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java
----------------------------------------------------------------------
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java
index f21cfb5..75b2e27 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java
@@ -125,7 +125,7 @@ public abstract class OData {
/**
* Creates a new deserializer object for reading content in the specified format.
- * Deserializer are used in Processor implementations.
+ * Deserializers are used in Processor implementations.
*
* @param contentType any content type supported by Olingo (XML, JSON ...)
*/
@@ -151,10 +151,11 @@ public abstract class OData {
public abstract Preferences createPreferences(Collection<String> preferHeaders);
/**
- * This method creates a DebugResponseHelper for the given debugFormat. If the format is not supported no
- * exception is thrown. Instead we give back the implementation for the json format.
- * @param debugFormat to be used.
- * @return a debug response serializer
+ * Creates a DebugResponseHelper for the given debugFormat.
+ * If the format is not supported no exception is thrown.
+ * Instead we give back the implementation for the JSON format.
+ * @param debugFormat format to be used
+ * @return a debug-response helper
*/
public abstract DebugResponseHelper createDebugResponseHelper(String debugFormat);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/54f69472/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataHttpHandler.java
----------------------------------------------------------------------
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataHttpHandler.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataHttpHandler.java
index d641581..a2180c8 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataHttpHandler.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataHttpHandler.java
@@ -62,13 +62,13 @@ public interface ODataHttpHandler {
void setSplit(int split);
/**
- * Register this interface to support concurrency control for certain entity sets.
+ * Registers support for concurrency control for certain entity sets.
* @param customETagSupport
*/
void register(CustomETagSupport customConcurrencyControlSupport);
/**
- * Register the debug support handler
+ * Registers the debug support handler.
* @param debugSupport
*/
void register(DebugSupport debugSupport);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/54f69472/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataRequest.java
----------------------------------------------------------------------
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataRequest.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataRequest.java
index ef68653..bb07096 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataRequest.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataRequest.java
@@ -19,11 +19,9 @@
package org.apache.olingo.server.api;
import java.io.InputStream;
-import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpMethod;
/**
@@ -93,26 +91,22 @@ public class ODataRequest {
}
/**
- * Get header values for a given name.
+ * Gets header values for a given name.
* @param name the header name as a case-insensitive key
* @return the header value(s) or null if not found
*/
public List<String> getHeaders(final String name) {
- HttpHeader h = headers.getHeader(name);
- if(h == null) {
- return null;
- }
- return new ArrayList<String>(h.getValues());
+ return headers.getHeader(name);
}
/**
- * Get first header value for a given name.
+ * Gets first header value for a given name.
* @param name the header name as a case-insensitive key
* @return the first header value or null if not found
*/
public String getHeader(final String name) {
final List<String> values = getHeaders(name);
- return values == null ? null : values.get(0);
+ return values == null || values.isEmpty() ? null : values.get(0);
}
/**
@@ -123,7 +117,6 @@ public class ODataRequest {
return headers.getHeaderToValues();
}
-
/**
* Gets the body of the request.
* @return the request payload as {@link InputStream} or null
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/54f69472/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataResponse.java
----------------------------------------------------------------------
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataResponse.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataResponse.java
index 36eea8d..3b63af7 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataResponse.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataResponse.java
@@ -19,11 +19,9 @@
package org.apache.olingo.server.api;
import java.io.InputStream;
-import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpStatusCode;
/**
@@ -102,11 +100,7 @@ public class ODataResponse {
* @return the header value(s) or null if not found
*/
public List<String> getHeaders(final String name) {
- HttpHeader h = headers.getHeader(name);
- if(h == null) {
- return null;
- }
- return new ArrayList<String>(h.getValues());
+ return headers.getHeader(name);
}
/**
@@ -118,7 +112,7 @@ public class ODataResponse {
*/
public String getHeader(final String name) {
final List<String> values = getHeaders(name);
- return values == null ? null : values.get(0);
+ return values == null || values.isEmpty() ? null : values.get(0);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/54f69472/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/BatchFacade.java
----------------------------------------------------------------------
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/BatchFacade.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/BatchFacade.java
index b5a2b1b..72625de 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/BatchFacade.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/BatchFacade.java
@@ -25,50 +25,49 @@ import org.apache.olingo.server.api.deserializer.batch.BatchRequestPart;
import org.apache.olingo.server.api.deserializer.batch.ODataResponsePart;
/**
- * Provides methods to process {@link ODataRequest} and {@link BatchRequestPart}.
+ * <p>Provides methods to process {@link ODataRequest}s and {@link BatchRequestPart}s
+ * in the context of a batch request.</p>
*
- * Within a {@link org.apache.olingo.server.api.processor.BatchProcessor} implementation BatchRequestsParts
- * should be passed to {@link BatchFacade#handleBatchRequest(BatchRequestPart)}.
- * If only if the BatchRequests part represents a change set, the request will be delegated to
+ * <p>Within a {@link org.apache.olingo.server.api.processor.BatchProcessor BatchProcessor}
+ * implementation BatchRequestParts should be passed to {@link #handleBatchRequest(BatchRequestPart)}.
+ * Only if the BatchRequestPart represents a change set, the request will be delegated to
* {@link org.apache.olingo.server.api.processor.BatchProcessor#processChangeSet(BatchFacade, java.util.List)}.
- * Otherwise the requests will be directly executed.
+ * Otherwise the requests will be directly executed.</p>
*
- * The processor implementation could use {@link BatchFacade#handleODataRequest(ODataRequest)} to processes
- * requests in a change set.
+ * <p>The processor implementation could use {@link #handleODataRequest(ODataRequest)} to process
+ * requests in a change set.</p>
*/
public interface BatchFacade {
/**
- * Executes a ODataRequest, which must be a part of a change set.
- * Each requests must have a Content-Id header field, which holds an id that is unique in the whole batch request.
- *
+ * Executes an ODataRequest, which must be a part of a change set.
+ * Each request must have a Content-Id header field, which holds an identifier
+ * that is unique in the whole batch request.
* @param request ODataRequest to process
- * @return Corresponding ODataResult to the given request
+ * @return corresponding ODataResponse to the given request
* @throws ODataApplicationException
* @throws ODataLibraryException
*/
- public ODataResponse handleODataRequest(ODataRequest request) throws ODataApplicationException,
- ODataLibraryException;
+ public ODataResponse handleODataRequest(ODataRequest request)
+ throws ODataApplicationException, ODataLibraryException;
/**
* Handles a BatchRequestPart.
- *
* @param request Request to process
- * @return Corresponding {@link ODataResponsePart}
+ * @return corresponding {@link ODataResponsePart}
* @throws ODataApplicationException
* @throws ODataLibraryException
*/
- public ODataResponsePart handleBatchRequest(BatchRequestPart request) throws ODataApplicationException,
- ODataLibraryException;
+ public ODataResponsePart handleBatchRequest(BatchRequestPart request)
+ throws ODataApplicationException, ODataLibraryException;
/**
* Extracts the boundary of a multipart/mixed header.
* See RFC 2046#5.1
- *
* @param contentType Content Type
- * @return Boundary
+ * @return boundary
* @throws ODataApplicationException
* @throws ODataLibraryException
*/
- public String extractBoundaryFromContentType(String contentType) throws ODataApplicationException,
- ODataLibraryException;
+ public String extractBoundaryFromContentType(String contentType)
+ throws ODataApplicationException, ODataLibraryException;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/54f69472/lib/server-api/src/main/java/org/apache/olingo/server/api/debug/DebugResponseHelper.java
----------------------------------------------------------------------
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/debug/DebugResponseHelper.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/debug/DebugResponseHelper.java
index e2f6933..ec6a2c4 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/debug/DebugResponseHelper.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/debug/DebugResponseHelper.java
@@ -21,18 +21,14 @@ package org.apache.olingo.server.api.debug;
import org.apache.olingo.server.api.ODataResponse;
/**
- * This class supports applications in creating debug responses.
+ * Support for applications creating debug responses.
*/
public interface DebugResponseHelper {
/**
* Creates a debug response based on the given parameters. Will never throw an exception.
- * @param request
- * @param applicationResponse
- * @param exception
- * @param serverEnvironmentVaribles
- * @param runtimeInformation
- * @return the debug response or the raw application response in case an exception occurred.
+ * @param debugInfo debug information
+ * @return the debug response or the raw application response in case an exception occurred
*/
ODataResponse createDebugResponse(DebugInformation debugInfo);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/54f69472/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/ODataDeserializer.java
----------------------------------------------------------------------
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/ODataDeserializer.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/ODataDeserializer.java
index 41eb60b..ac40352 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/ODataDeserializer.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/ODataDeserializer.java
@@ -30,10 +30,10 @@ import org.apache.olingo.commons.api.edm.EdmProperty;
public interface ODataDeserializer {
/**
- * Deserializes an entity stream into an {@link org.apache.olingo.commons.api.data.Entity} object.
- * Validates: property types, no double properties, correct json types
- * Returns a deserialized {@link org.apache.olingo.commons.api.data.Entity} object and an
- * {@link org.apache.olingo.server.api.uri.queryoption.ExpandOption} object
+ * Deserializes an entity stream into an {@link org.apache.olingo.commons.api.data.Entity Entity} object.
+ * Validates: property types, no double properties, correct json types.
+ * Returns a deserialized {@link org.apache.olingo.commons.api.data.Entity Entity} object and an
+ * {@link org.apache.olingo.server.api.uri.queryoption.ExpandOption ExpandOption} object.
* @param stream
* @param edmEntityType
* @return {@link DeserializerResult#getEntity()} and {@link DeserializerResult#getExpandTree()}
@@ -42,7 +42,8 @@ public interface ODataDeserializer {
DeserializerResult entity(InputStream stream, EdmEntityType edmEntityType) throws DeserializerException;
/**
- * Deserializes an entity collection stream into an {@link org.apache.olingo.commons.api.data.EntityCollection} object
+ * Deserializes an entity collection stream into an
+ * {@link org.apache.olingo.commons.api.data.EntityCollection EntityCollection} object.
* @param stream
* @param edmEntityType
* @return {@link DeserializerResult#getEntityCollection()}
@@ -51,7 +52,7 @@ public interface ODataDeserializer {
DeserializerResult entityCollection(InputStream stream, EdmEntityType edmEntityType) throws DeserializerException;
/**
- * Deserializes an action-parameters stream into an {@link org.apache.olingo.commons.api.data.Entity} object.
+ * Deserializes an action-parameters stream into a map of key/value pairs.
* Validates: parameter types, no double parameters, correct json types.
* @param stream
* @param edmAction
@@ -61,7 +62,7 @@ public interface ODataDeserializer {
DeserializerResult actionParameters(InputStream stream, EdmAction edmAction) throws DeserializerException;
/**
- * Deserializes the Property or collections of properties (primitive & complex)
+ * Deserializes the Property or collections of properties (primitive & complex).
* @param stream
* @param edmProperty
* @return {@link DeserializerResult#getProperty()}
@@ -70,7 +71,7 @@ public interface ODataDeserializer {
DeserializerResult property(InputStream stream, EdmProperty edmProperty) throws DeserializerException;
/**
- * Read entity references from the provided document
+ * Reads entity references from the provided document.
* @param stream
* @param keys
* @return {@link DeserializerResult#getEntityReferences()}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/54f69472/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchDeserializerException.java
----------------------------------------------------------------------
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchDeserializerException.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchDeserializerException.java
index fbc958b..cff3b25 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchDeserializerException.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchDeserializerException.java
@@ -22,26 +22,49 @@ import org.apache.olingo.server.api.deserializer.DeserializerException;
public class BatchDeserializerException extends DeserializerException {
public static enum MessageKeys implements MessageKey {
+ /** parameter: line */
INVALID_BOUNDARY,
+ /** parameter: line */
INVALID_CHANGESET_METHOD,
+ /** parameter: line */
INVALID_CONTENT,
+ /** parameter: line */
INVALID_CONTENT_LENGTH,
+ /** parameter: line */
INVALID_CONTENT_TRANSFER_ENCODING,
+ /** parameter: line */
INVALID_CONTENT_TYPE,
- INVALID_HEADER,
+ /** parameters: line, expected content type, actual content type */
+ UNEXPECTED_CONTENT_TYPE,
+ /** parameter: line */
+ INVALID_CONTENT_ID,
+ /** parameter: line */
INVALID_HTTP_VERSION,
+ /** parameter: line */
INVALID_METHOD,
+ /** parameter: line */
INVALID_QUERY_OPERATION_METHOD,
+ /** parameter: line */
INVALID_STATUS_LINE,
+ /** parameter: line */
INVALID_URI,
+ /** parameter: line */
MISSING_BLANK_LINE,
+ /** parameter: line */
MISSING_BOUNDARY_DELIMITER,
+ /** parameter: line */
MISSING_CLOSE_DELIMITER,
+ /** parameter: line */
MISSING_CONTENT_ID,
+ /** parameter: line */
MISSING_CONTENT_TRANSFER_ENCODING,
+ /** parameter: line */
MISSING_CONTENT_TYPE,
+ /** parameter: line */
MISSING_MANDATORY_HEADER,
+ /** parameter: line */
FORBIDDEN_HEADER,
+ /** parameter: line */
INVALID_BASE_URI;
@Override
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/54f69472/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchOptions.java
----------------------------------------------------------------------
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchOptions.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchOptions.java
index 98b0f10..b0f929a 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchOptions.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchOptions.java
@@ -20,9 +20,8 @@ package org.apache.olingo.server.api.deserializer.batch;
/**
* Options for the batch deserializer.
- * See
- * {@link org.apache.olingo.server.api.deserializer.FixedFormatDeserializer
- * #parseBatchRequest(java.io.InputStream, String, BatchOptions)}
+ * @see org.apache.olingo.server.api.deserializer.FixedFormatDeserializer
+ * #parseBatchRequest(java.io.InputStream, String, BatchOptions)
*/
public final class BatchOptions {
private boolean isStrict = true;
@@ -33,8 +32,7 @@ public final class BatchOptions {
/**
* Returns if the batch parsing is strict.
- * Default is true
- *
+ * Default is true.
* @return true if parsing is strict
*/
public boolean isStrict() {
@@ -42,22 +40,23 @@ public final class BatchOptions {
}
/**
- * See {@link org.apache.olingo.server.api.ODataRequest#getRawBaseUri()}
+ * Gets raw base URI.
+ * @see org.apache.olingo.server.api.ODataRequest#getRawBaseUri()
*/
public String getRawBaseUri() {
return rawBaseUri;
}
/**
- * See {@link org.apache.olingo.server.api.ODataRequest#getRawServiceResolutionUri()}
+ * Gets raw service resolution URI.
+ * @see org.apache.olingo.server.api.ODataRequest#getRawServiceResolutionUri()
*/
public String getRawServiceResolutionUri() {
return rawServiceResolutionUri;
}
/**
- * Creates a new BatchOptions builder
- *
+ * Creates a new BatchOptions builder.
* @return new BatchOptions builder instance
*/
public static Builder with() {
@@ -76,7 +75,7 @@ public final class BatchOptions {
}
/**
- * See {@link BatchOptions#isStrict()}
+ * @see BatchOptions#isStrict()
*/
public Builder isStrict(final boolean isStrict) {
options.isStrict = isStrict;
@@ -84,7 +83,7 @@ public final class BatchOptions {
}
/**
- * See {@link org.apache.olingo.server.api.ODataRequest#getRawBaseUri()}
+ * @see org.apache.olingo.server.api.ODataRequest#getRawBaseUri()
*/
public Builder rawBaseUri(final String baseUri) {
options.rawBaseUri = baseUri;
@@ -92,7 +91,7 @@ public final class BatchOptions {
}
/**
- * See {@link org.apache.olingo.server.api.ODataRequest#getRawServiceResolutionUri()}
+ * @see org.apache.olingo.server.api.ODataRequest#getRawServiceResolutionUri()
*/
public Builder rawServiceResolutionUri(final String serviceResolutionUri) {
options.rawServiceResolutionUri = serviceResolutionUri;
@@ -100,8 +99,7 @@ public final class BatchOptions {
}
/**
- * Creates a new BatchOptions instance
- *
+ * Creates a new BatchOptions instance.
* @return new BatchOptions instance
*/
public BatchOptions build() {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/54f69472/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchRequestPart.java
----------------------------------------------------------------------
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchRequestPart.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchRequestPart.java
index f67410b..5802c9e 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchRequestPart.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchRequestPart.java
@@ -25,16 +25,14 @@ import java.util.List;
import org.apache.olingo.server.api.ODataRequest;
/**
- * A BatchPart
- * <p> BatchPart represents a distinct MIME part of a Batch Request body. It can be a ChangeSet or a Query Operation
+ * Represents a distinct MIME part of a Batch Request body - either a Change Set or a Query Operation
*/
public class BatchRequestPart {
private List<ODataRequest> requests = new ArrayList<ODataRequest>();
private boolean isChangeSet;
/**
- * Creates a new instance of BachRequestPart
- *
+ * Creates a new instance of BachRequestPart.
* @param isChangeSet True, if this instance represents a change set
* @param requests A list of {@link ODataRequest}
*/
@@ -44,8 +42,7 @@ public class BatchRequestPart {
}
/**
- * Creates a new instance of BachRequestPart
- *
+ * Creates a new instance of BachRequestPart.
* @param isChangeSet True, if this instance represents a change set
* @param request A single {@link ODataRequest}
*/
@@ -56,7 +53,7 @@ public class BatchRequestPart {
}
/**
- * Get the info if a BatchPart is a ChangeSet
+ * Gets the info if a BatchPart is a ChangeSet.
* @return true or false
*/
public boolean isChangeSet() {
@@ -64,7 +61,7 @@ public class BatchRequestPart {
}
/**
- * Get requests. If a BatchPart is a Query Operation, the list contains one request.
+ * Gets all requests of this part. If a BatchPart is a Query Operation, the list contains one request.
* @return a list of {@link ODataRequest}
*/
public List<ODataRequest> getRequests() {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/54f69472/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ReferenceCollectionSerializerOptions.java
----------------------------------------------------------------------
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ReferenceCollectionSerializerOptions.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ReferenceCollectionSerializerOptions.java
index 2e979e6..16f03e3 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ReferenceCollectionSerializerOptions.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ReferenceCollectionSerializerOptions.java
@@ -21,7 +21,7 @@ package org.apache.olingo.server.api.serializer;
import org.apache.olingo.commons.api.data.ContextURL;
import org.apache.olingo.server.api.uri.queryoption.CountOption;
-/** Options for the OData serializer. */
+/** Options to pass as additional information to the reference-collection serializer. */
public final class ReferenceCollectionSerializerOptions {
private ContextURL contextURL;
private CountOption count;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/54f69472/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ReferenceSerializerOptions.java
----------------------------------------------------------------------
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ReferenceSerializerOptions.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ReferenceSerializerOptions.java
index e3a82cc..7a5e2e6 100644
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ReferenceSerializerOptions.java
+++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ReferenceSerializerOptions.java
@@ -21,7 +21,7 @@ package org.apache.olingo.server.api.serializer;
import org.apache.olingo.commons.api.data.ContextURL;
/**
- * Use this options calls to pass additional information to the reference serializer.
+ * Options to pass as additional information to the reference serializer.
*/
public final class ReferenceSerializerOptions {
private ContextURL contextURL;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/54f69472/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchParserCommon.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchParserCommon.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchParserCommon.java
index 256e05e..bdb8195 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchParserCommon.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchParserCommon.java
@@ -93,7 +93,8 @@ public class BatchParserCommon {
return type;
} else {
throw new BatchDeserializerException("Content type is not the expected content type",
- BatchDeserializerException.MessageKeys.INVALID_CONTENT_TYPE, expected.toContentTypeString());
+ BatchDeserializerException.MessageKeys.UNEXPECTED_CONTENT_TYPE,
+ Integer.toString(line), expected.toContentTypeString(), type.toContentTypeString());
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/54f69472/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchRequestTransformator.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchRequestTransformator.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchRequestTransformator.java
index 4e5ef9d..20ef8ea 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchRequestTransformator.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchRequestTransformator.java
@@ -84,14 +84,14 @@ public class BatchRequestTransformator {
}
private HeaderField getContentId(final BatchQueryOperation queryOperation) throws BatchDeserializerException {
- final HeaderField contentTypeHeader = queryOperation.getHeaders().getHeaderField(HttpHeader.CONTENT_ID);
+ final HeaderField contentIdHeader = queryOperation.getHeaders().getHeaderField(HttpHeader.CONTENT_ID);
- if (contentTypeHeader != null) {
- if (contentTypeHeader.getValues().size() == 1) {
- return contentTypeHeader;
+ if (contentIdHeader != null) {
+ if (contentIdHeader.getValues().size() == 1) {
+ return contentIdHeader;
} else {
- throw new BatchDeserializerException("Invalid header", MessageKeys.INVALID_HEADER,
- Integer.toString(contentTypeHeader.getLineNumber()));
+ throw new BatchDeserializerException("Invalid Content-ID header", MessageKeys.INVALID_CONTENT_ID,
+ Integer.toString(contentIdHeader.getLineNumber()));
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/54f69472/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchTransformatorCommon.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchTransformatorCommon.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchTransformatorCommon.java
index 1543c43..2f3d8bb 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchTransformatorCommon.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchTransformatorCommon.java
@@ -56,7 +56,8 @@ public class BatchTransformatorCommon {
Integer.toString(headers.getLineNumber()));
}
} else {
- throw new BatchDeserializerException("Invalid header", MessageKeys.INVALID_HEADER,
+ throw new BatchDeserializerException("Invalid Content-Transfer-Encoding header",
+ MessageKeys.INVALID_CONTENT_TRANSFER_ENCODING,
Integer.toString(headers.getLineNumber()));
}
} else {
@@ -82,7 +83,7 @@ public class BatchTransformatorCommon {
return contentLength;
} catch (NumberFormatException e) {
- throw new BatchDeserializerException("Invalid header", e, MessageKeys.INVALID_HEADER,
+ throw new BatchDeserializerException("Invalid content length", e, MessageKeys.INVALID_CONTENT_LENGTH,
Integer.toString(contentLengthField.getLineNumber()));
}
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/54f69472/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/BatchResponseSerializer.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/BatchResponseSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/BatchResponseSerializer.java
index 83c3e1e..d99d943 100644
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/BatchResponseSerializer.java
+++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/BatchResponseSerializer.java
@@ -138,13 +138,13 @@ public class BatchResponseSerializer {
final Map<String, List<String>> header = response.getAllHeaders();
for (final Map.Entry<String, List<String>> entry : header.entrySet()) {
- // Requests do never has a content id header
+ // Requests never have a content id header.
if (!entry.getKey().equalsIgnoreCase(HttpHeader.CONTENT_ID)) {
appendHeader(entry.getKey(), entry.getValue().get(0), builder);
}
}
- appendHeader(HttpHeader.CONTENT_LENGTH, "" + contentLength, builder);
+ appendHeader(HttpHeader.CONTENT_LENGTH, Integer.toString(contentLength), builder);
}
private void appendBodyPartHeader(final ODataResponse response, final BodyBuilder builder,
@@ -153,7 +153,7 @@ public class BatchResponseSerializer {
appendHeader(BatchParserCommon.CONTENT_TRANSFER_ENCODING, BatchParserCommon.BINARY_ENCODING, builder);
if (isChangeSet) {
- if (response.getAllHeaders().get(HttpHeader.CONTENT_ID) != null) {
+ if (response.getHeader(HttpHeader.CONTENT_ID) != null) {
appendHeader(HttpHeader.CONTENT_ID, response.getHeader(HttpHeader.CONTENT_ID), builder);
} else {
throw new BatchSerializerException("Missing content id", MessageKeys.MISSING_CONTENT_ID);
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/54f69472/lib/server-core/src/main/resources/server-core-exceptions-i18n.properties
----------------------------------------------------------------------
diff --git a/lib/server-core/src/main/resources/server-core-exceptions-i18n.properties b/lib/server-core/src/main/resources/server-core-exceptions-i18n.properties
index a2b92ca..0a2edd7 100644
--- a/lib/server-core/src/main/resources/server-core-exceptions-i18n.properties
+++ b/lib/server-core/src/main/resources/server-core-exceptions-i18n.properties
@@ -126,14 +126,15 @@ DeserializerException.INVALID_NULL_PARAMETER=The parameter '%1$s' must not be nu
BatchDeserializerException.INVALID_BOUNDARY=Invalid boundary at line '%1$s'.
BatchDeserializerException.INVALID_CHANGESET_METHOD=Invalid method: a ChangeSet cannot contain retrieve requests at line '%1$s'.
-BatchDeserializerException.INVALID_CONTENT=Retrieve requests must not contain any body content '%1$s'.
-BatchDeserializerException.INVALID_CONTENT_LENGTH=Invalid content length: content length have to be an integer and positive at line '%1$s'.
-BatchDeserializerException.INVALID_CONTENT_TRANSFER_ENCODING=The Content-Transfer-Encoding should be binary: line '%1$s'.
-BatchDeserializerException.INVALID_CONTENT_TYPE=Content-Type should be '%1$s'.
-BatchDeserializerException.INVALID_HEADER=Invalid header: '%1$s' at line '%2$s'.
-BatchDeserializerException.INVALID_HTTP_VERSION=Invalid HTTP version: The version have to be HTTP/1.1 at line '%1$s'.
+BatchDeserializerException.INVALID_CONTENT=The retrieve request at line '%1$s' must not contain any body content.
+BatchDeserializerException.INVALID_CONTENT_LENGTH=The value of the Content-Length HTTP header at line '%1$s' must be a positive integer.
+BatchDeserializerException.INVALID_CONTENT_TRANSFER_ENCODING=The Content-Transfer-Encoding at line '%1$s' must be binary.
+BatchDeserializerException.INVALID_CONTENT_TYPE=Invalid Content-Type HTTP header at line '%1$s'.
+BatchDeserializerException.UNEXPECTED_CONTENT_TYPE=Content-Type at line '%1$s' should be '%2$s' but is '%3$s'.
+BatchDeserializerException.INVALID_CONTENT_ID=Invalid Content-ID HTTP header at line '%1$s'.
+BatchDeserializerException.INVALID_HTTP_VERSION=The HTTP version must be HTTP/1.1 at line '%1$s'.
BatchDeserializerException.INVALID_METHOD=Invalid HTTP method at line '%1$s'.
-BatchDeserializerException.INVALID_QUERY_OPERATION_METHOD=Invalid method: a query operation can only contain retrieve requests at line '%1$s'.
+BatchDeserializerException.INVALID_QUERY_OPERATION_METHOD=The query operation at line '%1$s' can only contain retrieve requests.
BatchDeserializerException.INVALID_STATUS_LINE=Invalid HTTP status line at line '%1$s'.
BatchDeserializerException.INVALID_URI=Invalid URI at line '%1$s'.
BatchDeserializerException.FORBIDDEN_HEADER=Forbidden header at line '%1$s'.
@@ -144,9 +145,9 @@ BatchDeserializerException.MISSING_CONTENT_ID=Missing content-id at line '%1$s'.
BatchDeserializerException.MISSING_CONTENT_TRANSFER_ENCODING=Missing content transfer encoding at line '%1$s'.
BatchDeserializerException.MISSING_CONTENT_TYPE=Missing content-type at line '%1$s'.
BatchDeserializerException.MISSING_MANDATORY_HEADER=Missing mandatory header at line '%1$s'.
-BatchDeserializerException.INVALID_BASE_URI=The base URI do not match the service base URI at line '%1$s'.
-
-BatchSerializerExecption.MISSING_CONTENT_ID=Each request within a change set required exactly one content id.
+BatchDeserializerException.INVALID_BASE_URI=The base URI does not match the service base URI at line '%1$s'.
+
+BatchSerializerExecption.MISSING_CONTENT_ID=Each request within a change set requires exactly one content id.
PreconditionException.MISSING_HEADER=The Operation you requested on this Entity requires an if-match or if-none-match header.
PreconditionException.FAILED=The If-Match precondition is not fulfilled.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/54f69472/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/BatchRequestParserTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/BatchRequestParserTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/BatchRequestParserTest.java
index e43840d..155c678 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/BatchRequestParserTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/BatchRequestParserTest.java
@@ -393,7 +393,7 @@ public class BatchRequestParserTest {
}
@Test
- public void testMimeHeaderContentType() throws Exception {
+ public void mimeHeaderContentType() throws Exception {
final String batch = "--batch_8194-cf13-1f56" + CRLF
+ "Content-Type: text/plain" + CRLF
+ "Content-Transfer-Encoding: binary" + CRLF
@@ -403,7 +403,7 @@ public class BatchRequestParserTest {
+ CRLF
+ "--batch_8194-cf13-1f56--";
- parseInvalidBatchBody(batch, BatchDeserializerException.MessageKeys.INVALID_CONTENT_TYPE);
+ parseInvalidBatchBody(batch, BatchDeserializerException.MessageKeys.UNEXPECTED_CONTENT_TYPE);
}
@Test
@@ -536,7 +536,7 @@ public class BatchRequestParserTest {
}
@Test
- public void testNestedChangeset() throws Exception {
+ public void nestedChangeset() throws Exception {
final String batch = ""
+ "--batch_8194-cf13-1f56" + CRLF
+ "Content-Type: multipart/mixed;boundary=changeset_f980-1cb6-94dd" + CRLF
@@ -559,7 +559,7 @@ public class BatchRequestParserTest {
+ CRLF
+ "--batch_8194-cf13-1f56--";
- parseInvalidBatchBody(batch, BatchDeserializerException.MessageKeys.INVALID_CONTENT_TYPE);
+ parseInvalidBatchBody(batch, BatchDeserializerException.MessageKeys.UNEXPECTED_CONTENT_TYPE);
}
@Test
@@ -801,7 +801,7 @@ public class BatchRequestParserTest {
}
@Test
- public void testNonNumericContentLength() throws Exception {
+ public void nonNumericContentLength() throws Exception {
final String batch = ""
+ "--batch_8194-cf13-1f56" + CRLF
+ "Content-Type: multipart/mixed; boundary=changeset_f980-1cb6-94dd" + CRLF
@@ -819,7 +819,7 @@ public class BatchRequestParserTest {
+ CRLF
+ "--batch_8194-cf13-1f56--";
- parseInvalidBatchBody(batch, BatchDeserializerException.MessageKeys.INVALID_HEADER);
+ parseInvalidBatchBody(batch, BatchDeserializerException.MessageKeys.INVALID_CONTENT_LENGTH);
}
@Test
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/54f69472/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/AsyncResponseSerializerTest.java
----------------------------------------------------------------------
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/AsyncResponseSerializerTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/AsyncResponseSerializerTest.java
index b720cb7..d70de62 100644
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/AsyncResponseSerializerTest.java
+++ b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/AsyncResponseSerializerTest.java
@@ -34,7 +34,7 @@ public class AsyncResponseSerializerTest {
private static final String CRLF = "\r\n";
@Test
- public void testSimpleResponse() throws Exception {
+ public void simpleResponse() throws Exception {
ODataResponse response = new ODataResponse();
response.setStatusCode(HttpStatusCode.OK.getStatusCode());
response.setHeader(HttpHeader.CONTENT_TYPE, ContentType.APPLICATION_JSON.toContentTypeString());
@@ -45,14 +45,14 @@ public class AsyncResponseSerializerTest {
AsyncResponseSerializer serializer = new AsyncResponseSerializer();
InputStream in = serializer.serialize(response);
String result = IOUtils.toString(in);
- assertEquals("HTTP/1.1 200 OK" + CRLF +
- "Content-Length: 200" + CRLF +
- "Content-Type: application/json" + CRLF + CRLF +
- "Walter Winter" + CRLF, result);
+ assertEquals("HTTP/1.1 200 OK" + CRLF
+ + "Content-Type: application/json" + CRLF
+ + "Content-Length: 200" + CRLF + CRLF
+ + "Walter Winter" + CRLF, result);
}
@Test
- public void testBiggerResponse() throws Exception {
+ public void biggerResponse() throws Exception {
ODataResponse response = new ODataResponse();
response.setStatusCode(HttpStatusCode.ACCEPTED.getStatusCode());
response.setHeader(HttpHeader.CONTENT_TYPE, ContentType.APPLICATION_JSON.toContentTypeString());
@@ -64,10 +64,10 @@ public class AsyncResponseSerializerTest {
AsyncResponseSerializer serializer = new AsyncResponseSerializer();
InputStream in = serializer.serialize(response);
String result = IOUtils.toString(in);
- assertEquals("HTTP/1.1 202 Accepted" + CRLF +
- "Content-Length: 0" + CRLF +
- "Content-Type: application/json" + CRLF + CRLF +
- testData, result);
+ assertEquals("HTTP/1.1 202 Accepted" + CRLF
+ + "Content-Type: application/json" + CRLF
+ + "Content-Length: 0" + CRLF + CRLF
+ + testData, result);
}
private String testData(int amount) {
[4/5] olingo-odata4 git commit: [OLINGO-700] Moved test classes
Posted by mi...@apache.org.
[OLINGO-700] Moved test classes
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/587795fb
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/587795fb
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/587795fb
Branch: refs/heads/master
Commit: 587795fb3996ce7b0487eb9fa80d779fb07ed1b4
Parents: fdf5c02
Author: Michael Bolz <mi...@sap.com>
Authored: Mon Sep 14 10:16:47 2015 +0200
Committer: Michael Bolz <mi...@sap.com>
Committed: Mon Sep 14 10:16:47 2015 +0200
----------------------------------------------------------------------
...DataXMLDeserializerActionParametersTest.java | 303 +++++++++
.../xml/ODataXmlDeserializerTest.java | 631 +++++++++++++++++++
...DataXMLDeserializerActionParametersTest.java | 303 ---------
.../xml/ODataXmlDeserializerTest.java | 631 -------------------
4 files changed, 934 insertions(+), 934 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/587795fb/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
new file mode 100644
index 0000000..a533820
--- /dev/null
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/xml/ODataXMLDeserializerActionParametersTest.java
@@ -0,0 +1,303 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * 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
+ *
+ * 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
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.server.core.deserializer.xml;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+
+import java.io.ByteArrayInputStream;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.olingo.commons.api.data.ComplexValue;
+import org.apache.olingo.commons.api.data.Parameter;
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmAction;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.provider.CsdlAction;
+import org.apache.olingo.commons.api.edm.provider.CsdlComplexType;
+import org.apache.olingo.commons.api.edm.provider.CsdlParameter;
+import org.apache.olingo.commons.api.edm.provider.CsdlProperty;
+import org.apache.olingo.commons.api.format.ContentType;
+import org.apache.olingo.commons.core.edm.EdmActionImpl;
+import org.apache.olingo.commons.core.edm.EdmComplexTypeImpl;
+import org.apache.olingo.commons.core.edm.EdmProviderImpl;
+import org.apache.olingo.server.api.OData;
+import org.apache.olingo.server.api.deserializer.DeserializerException;
+import org.apache.olingo.server.api.edmx.EdmxReference;
+import org.apache.olingo.server.tecsvc.provider.EdmTechProvider;
+import org.junit.Test;
+import org.mockito.Mockito;
+
+public class ODataXMLDeserializerActionParametersTest {
+
+ @Test
+ public void empty() throws Exception {
+ final String input = "";
+ final Map<String, Parameter> parameters = deserialize(input, "UART");
+ assertNotNull(parameters);
+ assertTrue(parameters.isEmpty());
+ }
+
+ @Test
+ public void primitive() throws Exception {
+ final String input = "<?xml version='1.0' encoding='UTF-8'?>"
+ +"<metadata:parameters xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\">"
+ +"<ParameterInt16>42</ParameterInt16>"
+ +"<ParameterDuration>P42DT11H22M33S</ParameterDuration>"
+ +"</metadata:parameters>";
+
+ final Map<String, Parameter> parameters = deserialize(input, "UARTTwoParam");
+ assertNotNull(parameters);
+ assertEquals(2, parameters.size());
+ Parameter parameter = parameters.get("ParameterInt16");
+ assertNotNull(parameter);
+ assertEquals((short) 42, parameter.getValue());
+ parameter = parameters.get("ParameterDuration");
+ assertNotNull(parameter);
+ assertEquals(BigDecimal.valueOf(3669753), parameter.getValue());
+ }
+
+ @Test
+ public void complex() throws Exception {
+ EdmProviderImpl provider = mock(EdmProviderImpl.class);
+ CsdlComplexType address = new CsdlComplexType();
+ address.setProperties(Arrays.asList(createProperty("Street", "Edm.String"),
+ createProperty("Zip", "Edm.Int32")));
+ address.setName("Address");
+ EdmComplexTypeImpl edmAddress = new EdmComplexTypeImpl(provider,
+ new FullQualifiedName("namespace.Address"), address);
+ Mockito.stub(provider.getComplexType(Mockito.any(FullQualifiedName.class))).toReturn(edmAddress);
+
+ List<CsdlParameter> parameters = new ArrayList<CsdlParameter>();
+ parameters.add(createParam("param1", "Edm.Int16"));
+ parameters.add(createParam("param2", "namespace.Address"));
+ parameters.add(createParam("param3", "Edm.Int32").setCollection(true));
+ parameters.add(createParam("param4", "Edm.String").setNullable(true));
+
+ FullQualifiedName actionName = new FullQualifiedName("namespace", "action");
+ CsdlAction csdlAction = new CsdlAction().setName("action1").setParameters(parameters);
+ EdmAction action = new EdmActionImpl(provider, actionName, csdlAction);
+
+ final String input = "<?xml version='1.0' encoding='UTF-8'?>" +
+ "<metadata:parameters xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\">\n" +
+ " <param1>42</param1>\n" +
+ " <param2 metadata:type=\"#namespace.Address\">\n" +
+ " <Street>One Microsoft Way</Street>\n" +
+ " <Zip>98052</Zip>\n" +
+ " </param2>\n" +
+ " <param3>\n" +
+ " <element>1</element>\n" +
+ " <element>42</element>\n" +
+ " <element>99</element>\n" +
+ " </param3>\n" +
+ " <param4 metadata:null=\"true\"/>\n" +
+ "</metadata:parameters>";
+ final Map<String, Parameter> response = OData.newInstance().createDeserializer(ContentType.APPLICATION_XML)
+ .actionParameters(new ByteArrayInputStream(input.getBytes()), action).getActionParameters();
+
+ assertNotNull(response);
+ assertEquals(4, response.size());
+ Parameter parameter = response.get("param1");
+ assertNotNull(response);
+ assertEquals((short) 42, parameter.getValue());
+ parameter = response.get("param2");
+ assertNotNull(parameter);
+ ComplexValue addressValue = (ComplexValue)parameter.getValue();
+ assertEquals("Street", addressValue.getValue().get(0).getName());
+ assertEquals("One Microsoft Way", addressValue.getValue().get(0).getValue());
+ assertEquals("Zip", addressValue.getValue().get(1).getName());
+ assertEquals(98052, addressValue.getValue().get(1).getValue());
+
+ parameter = response.get("param3");
+ assertNotNull(parameter);
+ assertEquals(Arrays.asList(1, 42, 99), parameter.getValue());
+
+ parameter = response.get("param4");
+ assertNull(parameter.getValue());
+ }
+
+ @Test
+ public void complexCollection() throws Exception {
+ EdmProviderImpl provider = mock(EdmProviderImpl.class);
+ CsdlComplexType address = new CsdlComplexType();
+ address.setProperties(Arrays.asList(createProperty("Street", "Edm.String"),
+ createProperty("Zip", "Edm.Int32")));
+ address.setName("Address");
+ EdmComplexTypeImpl edmAddress = new EdmComplexTypeImpl(provider,
+ new FullQualifiedName("namespace.Address"), address);
+ Mockito.stub(provider.getComplexType(Mockito.any(FullQualifiedName.class))).toReturn(edmAddress);
+
+ List<CsdlParameter> parameters = new ArrayList<CsdlParameter>();
+ parameters.add(createParam("param1", "Edm.Int16"));
+ parameters.add(createParam("param2", "namespace.Address").setCollection(true));
+ parameters.add(createParam("param3", "Edm.Int32").setCollection(true));
+ parameters.add(createParam("param4", "Edm.String").setNullable(true));
+
+ FullQualifiedName actionName = new FullQualifiedName("namespace", "action");
+ CsdlAction csdlAction = new CsdlAction().setName("action1").setParameters(parameters);
+ EdmAction action = new EdmActionImpl(provider, actionName, csdlAction);
+
+ final String input = "<?xml version='1.0' encoding='UTF-8'?>" +
+ "<metadata:parameters xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\">\n" +
+ " <param1>42</param1>\n" +
+ " <param2 metadata:type=\"#namespace.Address\">\n" +
+ " <element>" +
+ " <Street>One Microsoft Way</Street>\n" +
+ " <Zip>98052</Zip>\n" +
+ " </element>" +
+ " <element>" +
+ " <Street>Two Microsoft Way</Street>\n" +
+ " <Zip>98052</Zip>\n" +
+ " </element>" +
+ " </param2>\n" +
+ " <param3>\n" +
+ " <element>1</element>\n" +
+ " <element>42</element>\n" +
+ " <element>99</element>\n" +
+ " </param3>\n" +
+ " <param4 metadata:null=\"true\"/>\n" +
+ "</metadata:parameters>";
+ final Map<String, Parameter> response = OData.newInstance().createDeserializer(ContentType.APPLICATION_XML)
+ .actionParameters(new ByteArrayInputStream(input.getBytes()), action).getActionParameters();
+
+ assertNotNull(response);
+ assertEquals(4, response.size());
+ Parameter parameter = response.get("param1");
+ assertNotNull(response);
+ assertEquals((short) 42, parameter.getValue());
+ parameter = response.get("param2");
+ assertNotNull(parameter);
+ ComplexValue addressValue = (ComplexValue)((List<?>)parameter.getValue()).get(0);
+ assertEquals("One Microsoft Way", addressValue.getValue().get(0).getValue());
+ assertEquals(98052, addressValue.getValue().get(1).getValue());
+
+ addressValue = (ComplexValue)((List<?>)parameter.getValue()).get(1);
+ assertEquals("Two Microsoft Way", addressValue.getValue().get(0).getValue());
+ assertEquals(98052, addressValue.getValue().get(1).getValue());
+
+ parameter = response.get("param3");
+ assertNotNull(parameter);
+ assertEquals(Arrays.asList(1, 42, 99), parameter.getValue());
+
+ parameter = response.get("param4");
+ assertNull(parameter.getValue());
+ }
+
+ private CsdlParameter createParam(String name, String type) {
+ return new CsdlParameter().setName(name).setType(new FullQualifiedName(type));
+ }
+
+ private CsdlProperty createProperty(String name, String type) {
+ return new CsdlProperty().setName(name).setType(type);
+ }
+
+ @Test
+ public void boundEmpty() throws Exception {
+ final String input = "";
+ final Map<String, Parameter> parameters = deserialize(input, "BAETAllPrimRT", "ETAllPrim");
+ assertNotNull(parameters);
+ assertTrue(parameters.isEmpty());
+ }
+
+ @Test
+ public void testParameterWithNullLiteral() throws Exception {
+ final String input = "<?xml version='1.0' encoding='UTF-8'?>"
+ +"<metadata:parameters xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\">"
+ +"<ParameterInt16>1</ParameterInt16>"
+ +"</metadata:parameters>";
+
+ final Map<String, Parameter> parameters = deserialize(input,
+ "UARTCollStringTwoParam");
+ assertNotNull(parameters);
+ assertEquals(2, parameters.size());
+ Parameter parameter = parameters.get("ParameterInt16");
+ assertNotNull(parameter);
+ assertEquals((short) 1, parameter.getValue());
+ parameter = parameters.get("ParameterDuration");
+ assertNotNull(parameter);
+ assertEquals(null, parameter.getValue());
+ }
+
+ @Test
+ public void bindingParameter() throws Exception {
+ final String input = "<?xml version='1.0' encoding='UTF-8'?>"
+ +"<metadata:parameters xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\">"
+ +"<ParameterETAllPrim>1</ParameterETAllPrim>"
+ +"</metadata:parameters>";
+ deserialize(input, "BAETAllPrimRT", "ETAllPrim");
+ }
+
+ @Test(expected = DeserializerException.class)
+ public void wrongName() throws Exception {
+ final String input = "<?xml version='1.0' encoding='UTF-8'?>"
+ +"<metadata:parameters xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\">"
+ +"<ParameterWrong>1</ParameterWrong>"
+ +"</metadata:parameters>";
+ deserialize(input, "UARTParam");
+ }
+
+ @Test(expected = DeserializerException.class)
+ public void nullNotNullable() throws Exception {
+ final String input = "<?xml version='1.0' encoding='UTF-8'?>"
+ +"<metadata:parameters xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\">"
+ +"<ParameterInt16>null</ParameterInt16>"
+ +"</metadata:parameters>";
+ deserialize(input, "UARTCTTwoPrimParam");
+ }
+
+ @Test(expected = DeserializerException.class)
+ public void missingParameter() throws Exception {
+ deserialize("", "UARTCTTwoPrimParam");
+ }
+
+ @Test(expected = DeserializerException.class)
+ public void parameterTwice() throws Exception {
+ final String input = "<?xml version='1.0' encoding='UTF-8'?>"
+ +"<metadata:parameters xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\">"
+ +"<ParameterInt16>1</ParameterInt16>"
+ +"<ParameterInt16>2</ParameterInt16>"
+ +"</metadata:parameters>";
+ deserialize(input, "UARTParam");
+ }
+
+ protected static final Edm edm = OData.newInstance().createServiceMetadata(
+ new EdmTechProvider(), Collections.<EdmxReference> emptyList()).getEdm();
+
+ private Map<String, Parameter> deserialize(final String input, final String actionName) throws DeserializerException {
+ return OData.newInstance().createDeserializer(ContentType.APPLICATION_XML)
+ .actionParameters(new ByteArrayInputStream(input.getBytes()),
+ edm.getUnboundAction(new FullQualifiedName("Namespace1_Alias", actionName))).getActionParameters();
+ }
+
+ private Map<String, Parameter> deserialize(final String input, final String actionName, final String typeName)
+ throws DeserializerException {
+ return OData.newInstance().createDeserializer(ContentType.APPLICATION_XML)
+ .actionParameters(new ByteArrayInputStream(input.getBytes()),
+ edm.getBoundAction(new FullQualifiedName("Namespace1_Alias", actionName),
+ new FullQualifiedName("Namespace1_Alias", typeName), false)).getActionParameters();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/587795fb/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/xml/ODataXmlDeserializerTest.java
----------------------------------------------------------------------
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/xml/ODataXmlDeserializerTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/xml/ODataXmlDeserializerTest.java
new file mode 100644
index 0000000..497e8f5
--- /dev/null
+++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/xml/ODataXmlDeserializerTest.java
@@ -0,0 +1,631 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * 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
+ *
+ * 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
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.server.core.deserializer.xml;
+
+import java.io.ByteArrayInputStream;
+import java.net.URI;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.olingo.commons.api.data.ComplexValue;
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.Link;
+import org.apache.olingo.commons.api.data.Property;
+import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.EdmEntityContainer;
+import org.apache.olingo.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
+import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
+import org.apache.olingo.commons.api.edm.EdmProperty;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.provider.CsdlComplexType;
+import org.apache.olingo.commons.api.edm.provider.CsdlProperty;
+import org.apache.olingo.commons.core.edm.EdmComplexTypeImpl;
+import org.apache.olingo.commons.core.edm.EdmPropertyImpl;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmBinary;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmByte;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmDate;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmDateTimeOffset;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmDecimal;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmDouble;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmDuration;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmGuid;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmInt16;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmInt32;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmInt64;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmSByte;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmSingle;
+import org.apache.olingo.commons.core.edm.primitivetype.EdmTimeOfDay;
+import org.apache.olingo.server.api.ServiceMetadata;
+import org.apache.olingo.server.api.deserializer.ODataDeserializer;
+import org.apache.olingo.server.api.edmx.EdmxReference;
+import org.apache.olingo.server.core.ServiceMetadataImpl;
+import org.apache.olingo.server.core.deserializer.xml.ODataXmlDeserializer;
+import org.apache.olingo.server.tecsvc.MetadataETagSupport;
+import org.apache.olingo.server.tecsvc.provider.EdmTechProvider;
+import org.custommonkey.xmlunit.XMLUnit;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.mockito.Mockito;
+
+public class ODataXmlDeserializerTest {
+
+ private static final ServiceMetadata metadata = new ServiceMetadataImpl(
+ new EdmTechProvider(), Collections.<EdmxReference> emptyList(), new MetadataETagSupport("WmetadataETag"));
+ private static final EdmEntityContainer entityContainer = metadata.getEdm().getEntityContainer();
+ private final ODataDeserializer serializer = new ODataXmlDeserializer();
+
+ @BeforeClass
+ public static void setup() {
+ XMLUnit.setIgnoreComments(true);
+ XMLUnit.setIgnoreAttributeOrder(true);
+ XMLUnit.setIgnoreWhitespace(true);
+ XMLUnit.setNormalizeWhitespace(true);
+ XMLUnit.setCompareUnmatched(false);
+ }
+
+ protected Object edmInt16(String value) throws EdmPrimitiveTypeException {
+ return EdmInt16.getInstance().valueOfString(value, true, 10, 10, 10, true,
+ EdmInt16.getInstance().getDefaultType());
+ }
+ protected Object edmInt32(String value) throws EdmPrimitiveTypeException {
+ return EdmInt32.getInstance().valueOfString(value, true, 10, 10, 10, true,
+ EdmInt32.getInstance().getDefaultType());
+ }
+ protected Object edmInt64(String value) throws EdmPrimitiveTypeException {
+ return EdmInt64.getInstance().valueOfString(value, true, 10, 10, 10, true,
+ EdmInt64.getInstance().getDefaultType());
+ }
+ protected Object edmSingle(String value) throws EdmPrimitiveTypeException {
+ return EdmSingle.getInstance().valueOfString(value, true, 10, 10, 10, true,
+ EdmSingle.getInstance().getDefaultType());
+ }
+ protected Object edmDouble(String value) throws EdmPrimitiveTypeException {
+ return EdmDouble.getInstance().valueOfString(value, true, 10, 10, 10, true,
+ EdmDouble.getInstance().getDefaultType());
+ }
+ protected Object edmSByte(String value) throws EdmPrimitiveTypeException {
+ return EdmSByte.getInstance().valueOfString(value, true, 10, 10, 10, true,
+ EdmSByte.getInstance().getDefaultType());
+ }
+ protected Object edmByte(String value) throws EdmPrimitiveTypeException {
+ return EdmByte.getInstance().valueOfString(value, true, 10, 10, 10, true,
+ EdmByte.getInstance().getDefaultType());
+ }
+ protected Object edmDecimal(String value) throws EdmPrimitiveTypeException {
+ return EdmDecimal.getInstance().valueOfString(value, true, 10, 10, 10, true,
+ EdmDecimal.getInstance().getDefaultType());
+ }
+ protected Object edmBinary(String value) throws EdmPrimitiveTypeException {
+ return EdmBinary.getInstance().valueOfString(value, true, 10, 10, 10, true,
+ EdmBinary.getInstance().getDefaultType());
+ }
+ protected Object edmDate(String value) throws EdmPrimitiveTypeException {
+ return EdmDate.getInstance().valueOfString(value, true, 10, 10, 10, true,
+ EdmDate.getInstance().getDefaultType());
+ }
+ protected Object edmDateTimeOffset(String value) throws EdmPrimitiveTypeException {
+ return EdmDateTimeOffset.getInstance().valueOfString(value, true, 10, 10, 10, true,
+ EdmDateTimeOffset.getInstance().getDefaultType());
+ }
+ protected Object edmDuration(String value) throws EdmPrimitiveTypeException {
+ return EdmDuration.getInstance().valueOfString(value, true, 10, 10, 10, true,
+ EdmDuration.getInstance().getDefaultType());
+ }
+ protected Object edmGUID(String value) throws EdmPrimitiveTypeException {
+ return EdmGuid.getInstance().valueOfString(value, true, 10, 10, 10, true,
+ EdmGuid.getInstance().getDefaultType());
+ }
+ protected Object edmTimeOfDay(String value) throws EdmPrimitiveTypeException {
+ return EdmTimeOfDay.getInstance().valueOfString(value, true, 10, 10, 10, true,
+ EdmTimeOfDay.getInstance().getDefaultType());
+ }
+
+ @Test
+ public void entitySimple() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
+
+ String payload = "<?xml version='1.0' encoding='UTF-8'?>\n" +
+ "<atom:entry xmlns:atom=\"http://www.w3.org/2005/Atom\"\n" +
+ " xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
+ " xmlns:data=\"http://docs.oasis-open.org/odata/ns/data\"> " +
+ " <atom:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETTwoPrimMany\"\n" +
+ " type=\"application/atom+xml;type=feed\" title=\"NavPropertyETTwoPrimMany\"\n" +
+ " href=\"id\" />\n" +
+ " <atom:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETTwoPrimOne\"\n" +
+ " type=\"application/atom+xml;type=entry\" title=\"NavPropertyETTwoPrimOne\"\n" +
+ " href=\"id\" />\n" +
+ " <atom:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
+ " term=\"#olingo.odata.test1.ETAllPrim\" />\n" +
+ " <atom:content type=\"application/xml\">\n" +
+ " <metadata:properties>\n" +
+ " <data:PropertyInt16>32767</data:PropertyInt16>\n" +
+ " <data:PropertyString>First Resource - positive values</data:PropertyString>\n" +
+ " <data:PropertyBoolean>true</data:PropertyBoolean>\n" +
+ " <data:PropertyByte>255</data:PropertyByte>\n" +
+ " <data:PropertySByte>127</data:PropertySByte>\n" +
+ " <data:PropertyInt32>2147483647</data:PropertyInt32>\n" +
+ " <data:PropertyInt64>9223372036854775807</data:PropertyInt64>\n" +
+ " <data:PropertySingle>1.79E20</data:PropertySingle>\n" +
+ " <data:PropertyDouble>-1.79E19</data:PropertyDouble>\n" +
+ " <data:PropertyDecimal>34</data:PropertyDecimal>\n" +
+ " <data:PropertyBinary>ASNFZ4mrze8=</data:PropertyBinary>\n" +
+ " <data:PropertyDate>2012-12-03</data:PropertyDate>\n" +
+ " <data:PropertyDateTimeOffset>2012-12-03T07:16:23Z</data:PropertyDateTimeOffset>\n" +
+ " <data:PropertyDuration>PT6S</data:PropertyDuration>\n" +
+ " <data:PropertyGuid>01234567-89ab-cdef-0123-456789abcdef</data:PropertyGuid>\n" +
+ " <data:PropertyTimeOfDay>03:26:05</data:PropertyTimeOfDay>\n" +
+ " </metadata:properties>\n" +
+ " </atom:content>\n" +
+ "</atom:entry>\n";
+
+ Entity result = serializer.entity(new ByteArrayInputStream(payload.getBytes()),
+ edmEntitySet.getEntityType()).getEntity();
+
+ Assert.assertEquals(16, result.getProperties().size());
+ Assert.assertEquals(2, result.getNavigationBindings().size());
+
+ Assert.assertEquals(edmInt16("32767"), result.getProperty("PropertyInt16").asPrimitive());
+ Assert.assertEquals("First Resource - positive values", result.getProperty("PropertyString").asPrimitive());
+ Assert.assertEquals(edmByte("255"), result.getProperty("PropertyByte").asPrimitive());
+ Assert.assertEquals(edmSByte("127"), result.getProperty("PropertySByte").asPrimitive());
+ Assert.assertEquals(edmInt32("2147483647"), result.getProperty("PropertyInt32").asPrimitive());
+ Assert.assertEquals(edmInt64("9223372036854775807"), result.getProperty("PropertyInt64").asPrimitive());
+ Assert.assertEquals(edmSingle("1.79E20"), result.getProperty("PropertySingle").asPrimitive());
+ Assert.assertEquals(edmDouble("-1.79E19"), result.getProperty("PropertyDouble").asPrimitive());
+ Assert.assertEquals(edmDecimal("34"), result.getProperty("PropertyDecimal").asPrimitive());
+// Assert.assertEquals(edmBinary("ASNFZ4mrze8="), result.getProperty("PropertyBinary").asPrimitive());
+ Assert.assertEquals(edmDate("2012-12-03"), result.getProperty("PropertyDate").asPrimitive());
+ Assert.assertEquals(edmDateTimeOffset("2012-12-03T07:16:23Z"), result.getProperty("PropertyDateTimeOffset")
+ .asPrimitive());
+ Assert.assertEquals(edmDuration("PT6S"), result.getProperty("PropertyDuration")
+ .asPrimitive());
+ Assert.assertEquals(edmGUID("01234567-89ab-cdef-0123-456789abcdef"), result.getProperty("PropertyGuid")
+ .asPrimitive());
+ Assert.assertEquals(edmTimeOfDay("03:26:05"), result.getProperty("PropertyTimeOfDay").asPrimitive());
+ }
+
+ @Test
+ public void entitySimpleWithTypes() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
+
+ String payload = "<?xml version='1.0' encoding='UTF-8'?>\n" +
+ "<atom:entry xmlns:atom=\"http://www.w3.org/2005/Atom\"\n" +
+ " xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
+ " xmlns:data=\"http://docs.oasis-open.org/odata/ns/data\"> " +
+ " <atom:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETTwoPrimMany\"\n" +
+ " type=\"application/atom+xml;type=feed\" title=\"NavPropertyETTwoPrimMany\"\n" +
+ " href=\"id\" />\n" +
+ " <atom:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETTwoPrimOne\"\n" +
+ " type=\"application/atom+xml;type=entry\" title=\"NavPropertyETTwoPrimOne\"\n" +
+ " href=\"id\" />\n" +
+ " <atom:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
+ " term=\"#olingo.odata.test1.ETAllPrim\" />\n" +
+ " <atom:content type=\"application/xml\">\n" +
+ " <metadata:properties>\n" +
+ " <data:PropertyInt16 metadata:type=\"Int16\">32767</data:PropertyInt16>\n" +
+ " <data:PropertyString>First Resource - positive values</data:PropertyString>\n" +
+ " <data:PropertyBoolean metadata:type=\"Boolean\">true</data:PropertyBoolean>\n" +
+ " <data:PropertyByte metadata:type=\"Byte\">255</data:PropertyByte>\n" +
+ " <data:PropertySByte metadata:type=\"SByte\">127</data:PropertySByte>\n" +
+ " <data:PropertyInt32 metadata:type=\"Int32\">2147483647</data:PropertyInt32>\n" +
+ " <data:PropertyInt64 metadata:type=\"Int64\">9223372036854775807</data:PropertyInt64>\n" +
+ " <data:PropertySingle metadata:type=\"Single\">1.79E20</data:PropertySingle>\n" +
+ " <data:PropertyDouble metadata:type=\"Double\">-1.79E19</data:PropertyDouble>\n" +
+ " <data:PropertyDecimal metadata:type=\"Decimal\">34</data:PropertyDecimal>\n" +
+ " <data:PropertyBinary metadata:type=\"Binary\">ASNFZ4mrze8=</data:PropertyBinary>\n" +
+ " <data:PropertyDate metadata:type=\"Date\">2012-12-03</data:PropertyDate>\n" +
+ " <data:PropertyDateTimeOffset metadata:type=\"DateTimeOffset\">2012-12-03T07:16:23Z"
+ + "</data:PropertyDateTimeOffset>\n" +
+ " <data:PropertyDuration metadata:type=\"Duration\">PT6S</data:PropertyDuration>\n" +
+ " <data:PropertyGuid metadata:type=\"GUID\">01234567-89ab-cdef-0123-456789abcdef"
+ + "</data:PropertyGuid>\n" +
+ " <data:PropertyTimeOfDay metadata:type=\"TimeOfDay\">03:26:05</data:PropertyTimeOfDay>\n" +
+ " </metadata:properties>\n" +
+ " </atom:content>\n" +
+ "</atom:entry>\n";
+
+ Entity result = serializer.entity(new ByteArrayInputStream(payload.getBytes()),
+ edmEntitySet.getEntityType()).getEntity();
+
+ Assert.assertEquals(16, result.getProperties().size());
+ Assert.assertEquals(2, result.getNavigationBindings().size());
+
+ Assert.assertEquals(edmInt16("32767"), result.getProperty("PropertyInt16").asPrimitive());
+ Assert.assertEquals("First Resource - positive values", result.getProperty("PropertyString").asPrimitive());
+ Assert.assertEquals(edmByte("255"), result.getProperty("PropertyByte").asPrimitive());
+ Assert.assertEquals(edmSByte("127"), result.getProperty("PropertySByte").asPrimitive());
+ Assert.assertEquals(edmInt32("2147483647"), result.getProperty("PropertyInt32").asPrimitive());
+ Assert.assertEquals(edmInt64("9223372036854775807"), result.getProperty("PropertyInt64").asPrimitive());
+ Assert.assertEquals(edmSingle("1.79E20"), result.getProperty("PropertySingle").asPrimitive());
+ Assert.assertEquals(edmDouble("-1.79E19"), result.getProperty("PropertyDouble").asPrimitive());
+ Assert.assertEquals(edmDecimal("34"), result.getProperty("PropertyDecimal").asPrimitive());
+// Assert.assertEquals(edmBinary("ASNFZ4mrze8="), result.getProperty("PropertyBinary").asPrimitive());
+ Assert.assertEquals(edmDate("2012-12-03"), result.getProperty("PropertyDate").asPrimitive());
+ Assert.assertEquals(edmDateTimeOffset("2012-12-03T07:16:23Z"), result.getProperty("PropertyDateTimeOffset")
+ .asPrimitive());
+ Assert.assertEquals(edmDuration("PT6S"), result.getProperty("PropertyDuration")
+ .asPrimitive());
+ Assert.assertEquals(edmGUID("01234567-89ab-cdef-0123-456789abcdef"), result.getProperty("PropertyGuid")
+ .asPrimitive());
+ Assert.assertEquals(edmTimeOfDay("03:26:05"), result.getProperty("PropertyTimeOfDay").asPrimitive());
+ }
+
+ @Test
+ public void entityCompAllPrim() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESCompAllPrim");
+
+ String payload = "<?xml version='1.0' encoding='UTF-8'?>"
+ + "<atom:entry xmlns:atom=\"http://www.w3.org/2005/Atom\" "
+ + "xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\" "
+ + "xmlns:data=\"http://docs.oasis-open.org/odata/ns/data\" "
+ + "metadata:etag=\"W/"32767"\">"
+ + "<atom:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\" "
+ + "term=\"#olingo.odata.test1.ETCompAllPrim\"/>"
+ + "<atom:content type=\"application/xml\">"
+ + "<metadata:properties>"
+ + "<data:PropertyInt16>32767</data:PropertyInt16>"
+ + "<data:PropertyComp metadata:type=\"#olingo.odata.test1.CTAllPrim\">"
+ + "<data:PropertyString>First Resource - first</data:PropertyString>"
+ + "<data:PropertyBinary>ASNFZ4mrze8=</data:PropertyBinary>"
+ + "<data:PropertyBoolean>true</data:PropertyBoolean>"
+ + "<data:PropertyByte>255</data:PropertyByte>"
+ + "<data:PropertyDate>2012-10-03</data:PropertyDate>"
+ + "<data:PropertyDateTimeOffset>2012-10-03T07:16:23.1234567Z</data:PropertyDateTimeOffset>"
+ + "<data:PropertyDecimal>34.27</data:PropertyDecimal>"
+ + "<data:PropertySingle>1.79E20</data:PropertySingle>"
+ + "<data:PropertyDouble>-1.79E19</data:PropertyDouble>"
+ + "<data:PropertyDuration>PT6S</data:PropertyDuration>"
+ + "<data:PropertyGuid>01234567-89ab-cdef-0123-456789abcdef</data:PropertyGuid>"
+ + "<data:PropertyInt16>32767</data:PropertyInt16>"
+ + "<data:PropertyInt32>2147483647</data:PropertyInt32>"
+ + "<data:PropertyInt64>9223372036854775807</data:PropertyInt64>"
+ + "<data:PropertySByte>127</data:PropertySByte>"
+ + "<data:PropertyTimeOfDay>01:00:01</data:PropertyTimeOfDay>"
+ + "</data:PropertyComp>"
+ + "</metadata:properties>"
+ + "</atom:content>"
+ + "</atom:entry>";
+
+ Entity result = serializer.entity(new ByteArrayInputStream(payload.getBytes()),
+ edmEntitySet.getEntityType()).getEntity();
+
+ Assert.assertEquals("olingo.odata.test1.ETCompAllPrim",result.getType());
+
+ Assert.assertEquals(2, result.getProperties().size());
+ Assert.assertEquals(0, result.getNavigationLinks().size());
+
+ Assert.assertEquals(edmInt16("32767"), result.getProperty("PropertyInt16").asPrimitive());
+
+ Assert.assertNotNull(result.getProperty("PropertyComp"));
+ Property comp = result.getProperty("PropertyComp");
+ Assert.assertEquals("olingo.odata.test1.CTAllPrim", comp.getType());
+ ComplexValue cv = (ComplexValue)comp.getValue();
+
+ Assert.assertEquals(16, cv.getValue().size());
+
+ Assert.assertEquals(edmInt16("32767"), getCVProperty(cv, "PropertyInt16").asPrimitive());
+ Assert.assertEquals("First Resource - first", getCVProperty(cv, "PropertyString").asPrimitive());
+ Assert.assertEquals(edmByte("255"), getCVProperty(cv, "PropertyByte").asPrimitive());
+ Assert.assertEquals(edmSByte("127"), getCVProperty(cv, "PropertySByte").asPrimitive());
+ Assert.assertEquals(edmInt32("2147483647"), getCVProperty(cv, "PropertyInt32").asPrimitive());
+ Assert.assertEquals(edmInt64("9223372036854775807"), getCVProperty(cv, "PropertyInt64").asPrimitive());
+ }
+
+ private Property getCVProperty(ComplexValue cv, String name) {
+ for (Property p:cv.getValue()) {
+ if (p.getName().equals(name)) {
+ return p;
+ }
+ }
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void entityMixPrimCollComp() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESMixPrimCollComp");
+ final String payload = "<?xml version='1.0' encoding='UTF-8'?>\n" +
+ "<atom:entry xmlns:atom=\"http://www.w3.org/2005/Atom\"\n" +
+ " xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
+ " xmlns:data=\"http://docs.oasis-open.org/odata/ns/data\" \n" +
+ " metadata:metadata-etag=\"WmetadataETag\">\n" +
+ " <atom:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
+ " term=\"#olingo.odata.test1.ETMixPrimCollComp\" />\n" +
+ " <atom:content type=\"application/xml\">\n" +
+ " <metadata:properties>\n" +
+ " <data:PropertyInt16>32767</data:PropertyInt16>\n" +
+ " <data:CollPropertyString type=\"#Collection(String)\">\n" +
+ " <metadata:element>Employee1@company.example</metadata:element>\n" +
+ " <metadata:element>Employee2@company.example</metadata:element>\n" +
+ " <metadata:element>Employee3@company.example</metadata:element>\n" +
+ " </data:CollPropertyString>\n" +
+ " <data:PropertyComp metadata:type=\"#olingo.odata.test1.CTTwoPrim\">\n" +
+ " <data:PropertyInt16>111</data:PropertyInt16>\n" +
+ " <data:PropertyString>TEST A</data:PropertyString>\n" +
+ " </data:PropertyComp>\n" +
+ " <data:CollPropertyComp metadata:type=\"#Collection(olingo.odata.test1.CTTwoPrim)\">\n" +
+ " <metadata:element>\n" +
+ " <data:PropertyInt16>123</data:PropertyInt16>\n" +
+ " <data:PropertyString>TEST 1</data:PropertyString>\n" +
+ " </metadata:element>\n" +
+ " <metadata:element>\n" +
+ " <data:PropertyInt16>456</data:PropertyInt16>\n" +
+ " <data:PropertyString>TEST 2</data:PropertyString>\n" +
+ " </metadata:element>\n" +
+ " <metadata:element>\n" +
+ " <data:PropertyInt16>789</data:PropertyInt16>\n" +
+ " <data:PropertyString>TEST 3</data:PropertyString>\n" +
+ " </metadata:element>\n" +
+ " </data:CollPropertyComp>\n" +
+ " </metadata:properties>\n" +
+ " </atom:content>\n" +
+ "</atom:entry>\n";
+
+ Entity result = serializer.entity(new ByteArrayInputStream(payload.getBytes()),
+ edmEntitySet.getEntityType()).getEntity();
+
+ Assert.assertEquals(4, result.getProperties().size());
+ Assert.assertEquals(0, result.getNavigationLinks().size());
+
+ Assert.assertEquals(Arrays.asList("Employee1@company.example", "Employee2@company.example",
+ "Employee3@company.example"), result.getProperty("CollPropertyString").getValue());
+
+ Property comp = result.getProperty("PropertyComp");
+ Assert.assertEquals("olingo.odata.test1.CTTwoPrim", comp.getType());
+ ComplexValue cv = (ComplexValue)comp.getValue();
+
+ Assert.assertEquals(2, cv.getValue().size());
+ Assert.assertEquals(edmInt16("111"), getCVProperty(cv, "PropertyInt16").asPrimitive());
+ Assert.assertEquals("TEST A", getCVProperty(cv, "PropertyString").asPrimitive());
+
+ comp = result.getProperty("CollPropertyComp");
+ Assert.assertEquals("Collection(olingo.odata.test1.CTTwoPrim)", comp.getType());
+ List<ComplexValue> properties = (List<ComplexValue>)comp.getValue();
+
+ Assert.assertEquals(3, properties.size());
+
+ Assert.assertEquals(edmInt16("123"), getCVProperty(properties.get(0), "PropertyInt16")
+ .asPrimitive());
+ Assert.assertEquals("TEST 1", getCVProperty(properties.get(0), "PropertyString")
+ .asPrimitive());
+
+ Assert.assertEquals(edmInt16("789"), getCVProperty(properties.get(2), "PropertyInt16")
+ .asPrimitive());
+ Assert.assertEquals("TEST 3", getCVProperty(properties.get(2), "PropertyString")
+ .asPrimitive());
+ }
+
+ @Test
+ public void entityWithNavigation() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESTwoPrim");
+
+ final String payload = "<?xml version='1.0' encoding='UTF-8'?>\n" +
+ "<atom:entry xmlns:atom=\"http://www.w3.org/2005/Atom\"\n" +
+ " xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
+ " xmlns:data=\"http://docs.oasis-open.org/odata/ns/data\">" +
+ " <atom:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETAllPrimOne\"\n" +
+ " type=\"application/atom+xml;type=entry\" title=\"NavPropertyETAllPrimOne\"\n" +
+ " href=\"id\">\n" +
+ " <metadata:inline>\n" +
+ " <atom:entry>\n" +
+ " <atom:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETTwoPrimMany\"\n" +
+ " type=\"application/atom+xml;type=feed\" title=\"NavPropertyETTwoPrimMany\"\n" +
+ " href=\"id\" />\n" +
+ " <atom:link\n" +
+ " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETTwoPrimOne\"\n" +
+ " type=\"application/atom+xml;type=entry\" title=\"NavPropertyETTwoPrimOne\"\n" +
+ " href=\"id\" />\n" +
+ " <atom:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
+ " term=\"#olingo.odata.test1.ETAllPrim\" />\n" +
+ " <atom:content type=\"application/xml\">\n" +
+ " <metadata:properties>\n" +
+ " <data:PropertyDate>2012-12-03</data:PropertyDate>\n" +
+ " </metadata:properties>\n" +
+ " </atom:content>\n" +
+ " </atom:entry>\n" +
+ " </metadata:inline>\n" +
+ " </atom:link>\n" +
+ " <atom:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
+ " term=\"#olingo.odata.test1.ETTwoPrim\" />\n" +
+ " <atom:content type=\"application/xml\">\n" +
+ " <metadata:properties>\n" +
+ " <data:PropertyInt16>32767</data:PropertyInt16>\n" +
+ " <data:PropertyString>Test String4</data:PropertyString>\n" +
+ " </metadata:properties>\n" +
+ " </atom:content>\n" +
+ "</atom:entry>\n" +
+ "";
+
+ Entity result = serializer.entity(new ByteArrayInputStream(payload.getBytes()),
+ edmEntitySet.getEntityType()).getEntity();
+
+ Assert.assertEquals(2, result.getProperties().size());
+ Assert.assertEquals(1, result.getNavigationLinks().size());
+
+ Assert.assertEquals(edmInt16("32767"), result.getProperty("PropertyInt16").asPrimitive());
+ Assert.assertEquals("Test String4", result.getProperty("PropertyString").asPrimitive());
+
+ Assert.assertEquals(1, result.getNavigationLinks().size());
+ Link navLink = result.getNavigationLinks().get(0);
+ Assert.assertEquals("http://docs.oasis-open.org/odata/ns/related/NavPropertyETAllPrimOne", navLink.getRel());
+ Assert.assertEquals("id", navLink.getBindingLink());
+ Assert.assertEquals("NavPropertyETAllPrimOne", navLink.getTitle());
+
+ Entity inline = navLink.getInlineEntity();
+ Assert.assertEquals(1, inline.getProperties().size());
+ Assert.assertEquals(2, inline.getNavigationBindings().size());
+ Assert.assertEquals(edmDate("2012-12-03"), inline.getProperty("PropertyDate").asPrimitive());
+ }
+
+ @Test
+ public void primitiveProperty() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
+ final EdmProperty edmProperty = (EdmProperty) edmEntitySet.getEntityType().getProperty("PropertyInt16");
+
+ String payload = "<?xml version='1.0' encoding='UTF-8'?>"
+ + "<metadata:value xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\">"
+ + "234</metadata:value>";
+
+ Property result = serializer.property(new ByteArrayInputStream(payload.getBytes()), edmProperty).getProperty();
+ Assert.assertEquals(edmInt16("234"), result.getValue());
+ }
+
+ @Test
+ public void primitivePropertyNull() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
+ final EdmProperty edmProperty = (EdmProperty) edmEntitySet.getEntityType().getProperty("PropertyString");
+ String payload = "<?xml version='1.0' encoding='UTF-8'?>"
+ + "<metadata:value xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\" "
+ + "metadata:null=\"true\"/>";
+
+ Property result = serializer.property(new ByteArrayInputStream(payload.getBytes()), edmProperty).getProperty();
+ Assert.assertNull(result.getValue());
+ }
+
+ @Test
+ public void primitiveCollectionProperty() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESCollAllPrim");
+ final EdmProperty edmProperty = (EdmProperty) edmEntitySet.getEntityType().getProperty("CollPropertyString");
+ String payload = "<?xml version='1.0' encoding='UTF-8'?>"
+ + "<metadata:value xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\"> "
+ + "<metadata:element>Employee1@company.example</metadata:element>"
+ + "<metadata:element>Employee2@company.example</metadata:element>"
+ + "<metadata:element>Employee3@company.example</metadata:element>"
+ + "</metadata:value>";
+ Property result = serializer.property(new ByteArrayInputStream(payload.getBytes()), edmProperty).getProperty();
+ Assert.assertEquals(Arrays.asList("Employee1@company.example", "Employee2@company.example",
+ "Employee3@company.example"), result.getValue());
+
+ }
+
+ @Test
+ public void complexProperty() throws Exception {
+ Edm edm = Mockito.mock(Edm.class);
+
+ CsdlProperty street = new CsdlProperty().setName("Street")
+ .setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
+ CsdlProperty city = new CsdlProperty().setName("City")
+ .setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
+ CsdlProperty region = new CsdlProperty().setName("Region")
+ .setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
+ CsdlProperty postalcode = new CsdlProperty().setName("PostalCode")
+ .setType(EdmPrimitiveTypeKind.Int64.getFullQualifiedName());
+
+ CsdlComplexType ct = new CsdlComplexType()
+ .setName("Model.Address")
+ .setProperties(Arrays.asList(street, city, region, postalcode));
+ EdmComplexTypeImpl complexType = new EdmComplexTypeImpl(edm, new FullQualifiedName("Model.Address"), ct);
+
+ Mockito.stub(edm.getComplexType(new FullQualifiedName("Model.Address"))).toReturn(complexType);
+
+ CsdlProperty prop = new CsdlProperty();
+ prop.setName("ShipTo");
+ prop.setType(new FullQualifiedName("Model.Address"));
+ EdmPropertyImpl edmProperty = new EdmPropertyImpl(edm, null, prop);
+
+ String payload = "<data:ShipTo xmlns:data=\"http://docs.oasis-open.org/odata/ns/data\" " +
+ " xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
+ " metadata:type=\"#Model.Address\">\n" +
+ " <data:Street>Obere Str. 57</data:Street>\n" +
+ " <data:City>Berlin</data:City>\n" +
+ " <data:Region metadata:null=\"true\"/>\n" +
+ " <data:PostalCode>12209</data:PostalCode>\n" +
+ "</data:ShipTo>";
+
+ Property result = serializer.property(new ByteArrayInputStream(payload.getBytes()), edmProperty).getProperty();
+
+ Assert.assertEquals("ShipTo", result.getName());
+ Assert.assertTrue(result.getValue() instanceof ComplexValue);
+ ComplexValue cv = (ComplexValue)result.getValue();
+ Assert.assertEquals("Model.Address", result.getType());
+ Assert.assertEquals("Berlin", getCVProperty(cv, "City").asPrimitive());
+ Assert.assertEquals("Obere Str. 57", getCVProperty(cv, "Street").asPrimitive());
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void complexCollectionProperty() throws Exception {
+ final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESMixPrimCollComp");
+ final EdmProperty edmProperty = (EdmProperty) edmEntitySet.getEntityType().getProperty("CollPropertyComp");
+ String payload = "<metadata:value xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
+ "xmlns:data=\"http://docs.oasis-open.org/odata/ns/data\" "
+ + "metadata:type=\"#Collection(olingo.odata.test1.CTTwoPrim)\">\n"+
+ " <metadata:element>\n" +
+ " <data:PropertyInt16>123</data:PropertyInt16>\n" +
+ " <data:PropertyString>TEST 1</data:PropertyString>\n" +
+ " </metadata:element>\n" +
+ " <metadata:element>\n" +
+ " <data:PropertyInt16>456</data:PropertyInt16>\n" +
+ " <data:PropertyString>TEST 2</data:PropertyString>\n" +
+ " </metadata:element>\n" +
+ " <metadata:element>\n" +
+ " <data:PropertyInt16>789</data:PropertyInt16>\n" +
+ " <data:PropertyString>TEST 3</data:PropertyString>\n" +
+ " </metadata:element>\n" +
+ "</metadata:value>";
+ Property result = serializer.property(new ByteArrayInputStream(payload.getBytes()), edmProperty).getProperty();
+
+ List<ComplexValue> complex = (List<ComplexValue>)result.getValue();
+
+ Assert.assertEquals(3, complex.size());
+ Assert.assertEquals("Collection(olingo.odata.test1.CTTwoPrim)", result.getType());
+ Assert.assertEquals(edmInt16("123"), getCVProperty(complex.get(0), "PropertyInt16").asPrimitive());
+ Assert.assertEquals("TEST 1", getCVProperty(complex.get(0), "PropertyString").asPrimitive());
+ Assert.assertEquals(edmInt16("789"), getCVProperty(complex.get(2), "PropertyInt16").asPrimitive());
+ Assert.assertEquals("TEST 3", getCVProperty(complex.get(2), "PropertyString").asPrimitive());
+ }
+
+ @Test
+ public void entityReference() throws Exception {
+ String payload = "<metadata:ref xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
+ " metadata:context=\"http://host/service/$metadata#$ref\"\n" +
+ " xmlns=\"http://www.w3.org/2005/Atom\" "+
+ " id=\"http://host/service/Orders(10643)\" />";
+
+ List<URI> result = serializer.entityReferences(new ByteArrayInputStream(payload.getBytes()))
+ .getEntityReferences();
+ Assert.assertEquals(1, result.size());
+ Assert.assertEquals("http://host/service/Orders(10643)", result.get(0).toASCIIString());
+ }
+
+ @Test
+ public void entityReferences() throws Exception {
+ String payload = "<feed xmlns=\"http://www.w3.org/2005/Atom\"\n" +
+ " xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
+ " metadata:context=\"http://host/service/$metadata#Collection($ref)\" >\n" +
+ " <metadata:ref id=\"http://host/service/Orders(10643)\" />\n" +
+ " <metadata:ref id=\"http://host/service/Orders(10759)\" />\n" +
+ "</feed>";
+
+ List<URI> result = serializer.entityReferences(new ByteArrayInputStream(payload.getBytes()))
+ .getEntityReferences();
+ Assert.assertEquals(2, result.size());
+ Assert.assertEquals("http://host/service/Orders(10643)", result.get(0).toASCIIString());
+ Assert.assertEquals("http://host/service/Orders(10759)", result.get(1).toASCIIString());
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/587795fb/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/xml/ODataXMLDeserializerActionParametersTest.java
----------------------------------------------------------------------
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/xml/ODataXMLDeserializerActionParametersTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/xml/ODataXMLDeserializerActionParametersTest.java
deleted file mode 100644
index c63d036..0000000
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/xml/ODataXMLDeserializerActionParametersTest.java
+++ /dev/null
@@ -1,303 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * 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
- *
- * 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
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.server.core.serializer.xml;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.mock;
-
-import java.io.ByteArrayInputStream;
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.olingo.commons.api.data.ComplexValue;
-import org.apache.olingo.commons.api.data.Parameter;
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmAction;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.provider.CsdlAction;
-import org.apache.olingo.commons.api.edm.provider.CsdlComplexType;
-import org.apache.olingo.commons.api.edm.provider.CsdlParameter;
-import org.apache.olingo.commons.api.edm.provider.CsdlProperty;
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.core.edm.EdmActionImpl;
-import org.apache.olingo.commons.core.edm.EdmComplexTypeImpl;
-import org.apache.olingo.commons.core.edm.EdmProviderImpl;
-import org.apache.olingo.server.api.OData;
-import org.apache.olingo.server.api.deserializer.DeserializerException;
-import org.apache.olingo.server.api.edmx.EdmxReference;
-import org.apache.olingo.server.tecsvc.provider.EdmTechProvider;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-public class ODataXMLDeserializerActionParametersTest {
-
- @Test
- public void empty() throws Exception {
- final String input = "";
- final Map<String, Parameter> parameters = deserialize(input, "UART");
- assertNotNull(parameters);
- assertTrue(parameters.isEmpty());
- }
-
- @Test
- public void primitive() throws Exception {
- final String input = "<?xml version='1.0' encoding='UTF-8'?>"
- +"<metadata:parameters xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\">"
- +"<ParameterInt16>42</ParameterInt16>"
- +"<ParameterDuration>P42DT11H22M33S</ParameterDuration>"
- +"</metadata:parameters>";
-
- final Map<String, Parameter> parameters = deserialize(input, "UARTTwoParam");
- assertNotNull(parameters);
- assertEquals(2, parameters.size());
- Parameter parameter = parameters.get("ParameterInt16");
- assertNotNull(parameter);
- assertEquals((short) 42, parameter.getValue());
- parameter = parameters.get("ParameterDuration");
- assertNotNull(parameter);
- assertEquals(BigDecimal.valueOf(3669753), parameter.getValue());
- }
-
- @Test
- public void complex() throws Exception {
- EdmProviderImpl provider = mock(EdmProviderImpl.class);
- CsdlComplexType address = new CsdlComplexType();
- address.setProperties(Arrays.asList(createProperty("Street", "Edm.String"),
- createProperty("Zip", "Edm.Int32")));
- address.setName("Address");
- EdmComplexTypeImpl edmAddress = new EdmComplexTypeImpl(provider,
- new FullQualifiedName("namespace.Address"), address);
- Mockito.stub(provider.getComplexType(Mockito.any(FullQualifiedName.class))).toReturn(edmAddress);
-
- List<CsdlParameter> parameters = new ArrayList<CsdlParameter>();
- parameters.add(createParam("param1", "Edm.Int16"));
- parameters.add(createParam("param2", "namespace.Address"));
- parameters.add(createParam("param3", "Edm.Int32").setCollection(true));
- parameters.add(createParam("param4", "Edm.String").setNullable(true));
-
- FullQualifiedName actionName = new FullQualifiedName("namespace", "action");
- CsdlAction csdlAction = new CsdlAction().setName("action1").setParameters(parameters);
- EdmAction action = new EdmActionImpl(provider, actionName, csdlAction);
-
- final String input = "<?xml version='1.0' encoding='UTF-8'?>" +
- "<metadata:parameters xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\">\n" +
- " <param1>42</param1>\n" +
- " <param2 metadata:type=\"#namespace.Address\">\n" +
- " <Street>One Microsoft Way</Street>\n" +
- " <Zip>98052</Zip>\n" +
- " </param2>\n" +
- " <param3>\n" +
- " <element>1</element>\n" +
- " <element>42</element>\n" +
- " <element>99</element>\n" +
- " </param3>\n" +
- " <param4 metadata:null=\"true\"/>\n" +
- "</metadata:parameters>";
- final Map<String, Parameter> response = OData.newInstance().createDeserializer(ContentType.APPLICATION_XML)
- .actionParameters(new ByteArrayInputStream(input.getBytes()), action).getActionParameters();
-
- assertNotNull(response);
- assertEquals(4, response.size());
- Parameter parameter = response.get("param1");
- assertNotNull(response);
- assertEquals((short) 42, parameter.getValue());
- parameter = response.get("param2");
- assertNotNull(parameter);
- ComplexValue addressValue = (ComplexValue)parameter.getValue();
- assertEquals("Street", addressValue.getValue().get(0).getName());
- assertEquals("One Microsoft Way", addressValue.getValue().get(0).getValue());
- assertEquals("Zip", addressValue.getValue().get(1).getName());
- assertEquals(98052, addressValue.getValue().get(1).getValue());
-
- parameter = response.get("param3");
- assertNotNull(parameter);
- assertEquals(Arrays.asList(1, 42, 99), parameter.getValue());
-
- parameter = response.get("param4");
- assertNull(parameter.getValue());
- }
-
- @Test
- public void complexCollection() throws Exception {
- EdmProviderImpl provider = mock(EdmProviderImpl.class);
- CsdlComplexType address = new CsdlComplexType();
- address.setProperties(Arrays.asList(createProperty("Street", "Edm.String"),
- createProperty("Zip", "Edm.Int32")));
- address.setName("Address");
- EdmComplexTypeImpl edmAddress = new EdmComplexTypeImpl(provider,
- new FullQualifiedName("namespace.Address"), address);
- Mockito.stub(provider.getComplexType(Mockito.any(FullQualifiedName.class))).toReturn(edmAddress);
-
- List<CsdlParameter> parameters = new ArrayList<CsdlParameter>();
- parameters.add(createParam("param1", "Edm.Int16"));
- parameters.add(createParam("param2", "namespace.Address").setCollection(true));
- parameters.add(createParam("param3", "Edm.Int32").setCollection(true));
- parameters.add(createParam("param4", "Edm.String").setNullable(true));
-
- FullQualifiedName actionName = new FullQualifiedName("namespace", "action");
- CsdlAction csdlAction = new CsdlAction().setName("action1").setParameters(parameters);
- EdmAction action = new EdmActionImpl(provider, actionName, csdlAction);
-
- final String input = "<?xml version='1.0' encoding='UTF-8'?>" +
- "<metadata:parameters xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\">\n" +
- " <param1>42</param1>\n" +
- " <param2 metadata:type=\"#namespace.Address\">\n" +
- " <element>" +
- " <Street>One Microsoft Way</Street>\n" +
- " <Zip>98052</Zip>\n" +
- " </element>" +
- " <element>" +
- " <Street>Two Microsoft Way</Street>\n" +
- " <Zip>98052</Zip>\n" +
- " </element>" +
- " </param2>\n" +
- " <param3>\n" +
- " <element>1</element>\n" +
- " <element>42</element>\n" +
- " <element>99</element>\n" +
- " </param3>\n" +
- " <param4 metadata:null=\"true\"/>\n" +
- "</metadata:parameters>";
- final Map<String, Parameter> response = OData.newInstance().createDeserializer(ContentType.APPLICATION_XML)
- .actionParameters(new ByteArrayInputStream(input.getBytes()), action).getActionParameters();
-
- assertNotNull(response);
- assertEquals(4, response.size());
- Parameter parameter = response.get("param1");
- assertNotNull(response);
- assertEquals((short) 42, parameter.getValue());
- parameter = response.get("param2");
- assertNotNull(parameter);
- ComplexValue addressValue = (ComplexValue)((List<?>)parameter.getValue()).get(0);
- assertEquals("One Microsoft Way", addressValue.getValue().get(0).getValue());
- assertEquals(98052, addressValue.getValue().get(1).getValue());
-
- addressValue = (ComplexValue)((List<?>)parameter.getValue()).get(1);
- assertEquals("Two Microsoft Way", addressValue.getValue().get(0).getValue());
- assertEquals(98052, addressValue.getValue().get(1).getValue());
-
- parameter = response.get("param3");
- assertNotNull(parameter);
- assertEquals(Arrays.asList(1, 42, 99), parameter.getValue());
-
- parameter = response.get("param4");
- assertNull(parameter.getValue());
- }
-
- private CsdlParameter createParam(String name, String type) {
- return new CsdlParameter().setName(name).setType(new FullQualifiedName(type));
- }
-
- private CsdlProperty createProperty(String name, String type) {
- return new CsdlProperty().setName(name).setType(type);
- }
-
- @Test
- public void boundEmpty() throws Exception {
- final String input = "";
- final Map<String, Parameter> parameters = deserialize(input, "BAETAllPrimRT", "ETAllPrim");
- assertNotNull(parameters);
- assertTrue(parameters.isEmpty());
- }
-
- @Test
- public void testParameterWithNullLiteral() throws Exception {
- final String input = "<?xml version='1.0' encoding='UTF-8'?>"
- +"<metadata:parameters xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\">"
- +"<ParameterInt16>1</ParameterInt16>"
- +"</metadata:parameters>";
-
- final Map<String, Parameter> parameters = deserialize(input,
- "UARTCollStringTwoParam");
- assertNotNull(parameters);
- assertEquals(2, parameters.size());
- Parameter parameter = parameters.get("ParameterInt16");
- assertNotNull(parameter);
- assertEquals((short) 1, parameter.getValue());
- parameter = parameters.get("ParameterDuration");
- assertNotNull(parameter);
- assertEquals(null, parameter.getValue());
- }
-
- @Test
- public void bindingParameter() throws Exception {
- final String input = "<?xml version='1.0' encoding='UTF-8'?>"
- +"<metadata:parameters xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\">"
- +"<ParameterETAllPrim>1</ParameterETAllPrim>"
- +"</metadata:parameters>";
- deserialize(input, "BAETAllPrimRT", "ETAllPrim");
- }
-
- @Test(expected = DeserializerException.class)
- public void wrongName() throws Exception {
- final String input = "<?xml version='1.0' encoding='UTF-8'?>"
- +"<metadata:parameters xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\">"
- +"<ParameterWrong>1</ParameterWrong>"
- +"</metadata:parameters>";
- deserialize(input, "UARTParam");
- }
-
- @Test(expected = DeserializerException.class)
- public void nullNotNullable() throws Exception {
- final String input = "<?xml version='1.0' encoding='UTF-8'?>"
- +"<metadata:parameters xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\">"
- +"<ParameterInt16>null</ParameterInt16>"
- +"</metadata:parameters>";
- deserialize(input, "UARTCTTwoPrimParam");
- }
-
- @Test(expected = DeserializerException.class)
- public void missingParameter() throws Exception {
- deserialize("", "UARTCTTwoPrimParam");
- }
-
- @Test(expected = DeserializerException.class)
- public void parameterTwice() throws Exception {
- final String input = "<?xml version='1.0' encoding='UTF-8'?>"
- +"<metadata:parameters xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\">"
- +"<ParameterInt16>1</ParameterInt16>"
- +"<ParameterInt16>2</ParameterInt16>"
- +"</metadata:parameters>";
- deserialize(input, "UARTParam");
- }
-
- protected static final Edm edm = OData.newInstance().createServiceMetadata(
- new EdmTechProvider(), Collections.<EdmxReference> emptyList()).getEdm();
-
- private Map<String, Parameter> deserialize(final String input, final String actionName) throws DeserializerException {
- return OData.newInstance().createDeserializer(ContentType.APPLICATION_XML)
- .actionParameters(new ByteArrayInputStream(input.getBytes()),
- edm.getUnboundAction(new FullQualifiedName("Namespace1_Alias", actionName))).getActionParameters();
- }
-
- private Map<String, Parameter> deserialize(final String input, final String actionName, final String typeName)
- throws DeserializerException {
- return OData.newInstance().createDeserializer(ContentType.APPLICATION_XML)
- .actionParameters(new ByteArrayInputStream(input.getBytes()),
- edm.getBoundAction(new FullQualifiedName("Namespace1_Alias", actionName),
- new FullQualifiedName("Namespace1_Alias", typeName), false)).getActionParameters();
- }
-}
[3/5] olingo-odata4 git commit: [OLINGO-700] Moved test classes
Posted by mi...@apache.org.
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/587795fb/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/xml/ODataXmlDeserializerTest.java
----------------------------------------------------------------------
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/xml/ODataXmlDeserializerTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/xml/ODataXmlDeserializerTest.java
deleted file mode 100644
index ac24bad..0000000
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/xml/ODataXmlDeserializerTest.java
+++ /dev/null
@@ -1,631 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * 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
- *
- * 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
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.olingo.server.core.serializer.xml;
-
-import java.io.ByteArrayInputStream;
-import java.net.URI;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.olingo.commons.api.data.ComplexValue;
-import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.data.Link;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.EdmProperty;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.provider.CsdlComplexType;
-import org.apache.olingo.commons.api.edm.provider.CsdlProperty;
-import org.apache.olingo.commons.core.edm.EdmComplexTypeImpl;
-import org.apache.olingo.commons.core.edm.EdmPropertyImpl;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmBinary;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmByte;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmDate;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmDateTimeOffset;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmDecimal;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmDouble;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmDuration;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmGuid;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmInt16;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmInt32;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmInt64;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmSByte;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmSingle;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmTimeOfDay;
-import org.apache.olingo.server.api.ServiceMetadata;
-import org.apache.olingo.server.api.deserializer.ODataDeserializer;
-import org.apache.olingo.server.api.edmx.EdmxReference;
-import org.apache.olingo.server.core.ServiceMetadataImpl;
-import org.apache.olingo.server.core.deserializer.xml.ODataXmlDeserializer;
-import org.apache.olingo.server.tecsvc.MetadataETagSupport;
-import org.apache.olingo.server.tecsvc.provider.EdmTechProvider;
-import org.custommonkey.xmlunit.XMLUnit;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-public class ODataXmlDeserializerTest {
-
- private static final ServiceMetadata metadata = new ServiceMetadataImpl(
- new EdmTechProvider(), Collections.<EdmxReference> emptyList(), new MetadataETagSupport("WmetadataETag"));
- private static final EdmEntityContainer entityContainer = metadata.getEdm().getEntityContainer();
- private final ODataDeserializer serializer = new ODataXmlDeserializer();
-
- @BeforeClass
- public static void setup() {
- XMLUnit.setIgnoreComments(true);
- XMLUnit.setIgnoreAttributeOrder(true);
- XMLUnit.setIgnoreWhitespace(true);
- XMLUnit.setNormalizeWhitespace(true);
- XMLUnit.setCompareUnmatched(false);
- }
-
- protected Object edmInt16(String value) throws EdmPrimitiveTypeException {
- return EdmInt16.getInstance().valueOfString(value, true, 10, 10, 10, true,
- EdmInt16.getInstance().getDefaultType());
- }
- protected Object edmInt32(String value) throws EdmPrimitiveTypeException {
- return EdmInt32.getInstance().valueOfString(value, true, 10, 10, 10, true,
- EdmInt32.getInstance().getDefaultType());
- }
- protected Object edmInt64(String value) throws EdmPrimitiveTypeException {
- return EdmInt64.getInstance().valueOfString(value, true, 10, 10, 10, true,
- EdmInt64.getInstance().getDefaultType());
- }
- protected Object edmSingle(String value) throws EdmPrimitiveTypeException {
- return EdmSingle.getInstance().valueOfString(value, true, 10, 10, 10, true,
- EdmSingle.getInstance().getDefaultType());
- }
- protected Object edmDouble(String value) throws EdmPrimitiveTypeException {
- return EdmDouble.getInstance().valueOfString(value, true, 10, 10, 10, true,
- EdmDouble.getInstance().getDefaultType());
- }
- protected Object edmSByte(String value) throws EdmPrimitiveTypeException {
- return EdmSByte.getInstance().valueOfString(value, true, 10, 10, 10, true,
- EdmSByte.getInstance().getDefaultType());
- }
- protected Object edmByte(String value) throws EdmPrimitiveTypeException {
- return EdmByte.getInstance().valueOfString(value, true, 10, 10, 10, true,
- EdmByte.getInstance().getDefaultType());
- }
- protected Object edmDecimal(String value) throws EdmPrimitiveTypeException {
- return EdmDecimal.getInstance().valueOfString(value, true, 10, 10, 10, true,
- EdmDecimal.getInstance().getDefaultType());
- }
- protected Object edmBinary(String value) throws EdmPrimitiveTypeException {
- return EdmBinary.getInstance().valueOfString(value, true, 10, 10, 10, true,
- EdmBinary.getInstance().getDefaultType());
- }
- protected Object edmDate(String value) throws EdmPrimitiveTypeException {
- return EdmDate.getInstance().valueOfString(value, true, 10, 10, 10, true,
- EdmDate.getInstance().getDefaultType());
- }
- protected Object edmDateTimeOffset(String value) throws EdmPrimitiveTypeException {
- return EdmDateTimeOffset.getInstance().valueOfString(value, true, 10, 10, 10, true,
- EdmDateTimeOffset.getInstance().getDefaultType());
- }
- protected Object edmDuration(String value) throws EdmPrimitiveTypeException {
- return EdmDuration.getInstance().valueOfString(value, true, 10, 10, 10, true,
- EdmDuration.getInstance().getDefaultType());
- }
- protected Object edmGUID(String value) throws EdmPrimitiveTypeException {
- return EdmGuid.getInstance().valueOfString(value, true, 10, 10, 10, true,
- EdmGuid.getInstance().getDefaultType());
- }
- protected Object edmTimeOfDay(String value) throws EdmPrimitiveTypeException {
- return EdmTimeOfDay.getInstance().valueOfString(value, true, 10, 10, 10, true,
- EdmTimeOfDay.getInstance().getDefaultType());
- }
-
- @Test
- public void entitySimple() throws Exception {
- final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
-
- String payload = "<?xml version='1.0' encoding='UTF-8'?>\n" +
- "<atom:entry xmlns:atom=\"http://www.w3.org/2005/Atom\"\n" +
- " xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
- " xmlns:data=\"http://docs.oasis-open.org/odata/ns/data\"> " +
- " <atom:link\n" +
- " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETTwoPrimMany\"\n" +
- " type=\"application/atom+xml;type=feed\" title=\"NavPropertyETTwoPrimMany\"\n" +
- " href=\"id\" />\n" +
- " <atom:link\n" +
- " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETTwoPrimOne\"\n" +
- " type=\"application/atom+xml;type=entry\" title=\"NavPropertyETTwoPrimOne\"\n" +
- " href=\"id\" />\n" +
- " <atom:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
- " term=\"#olingo.odata.test1.ETAllPrim\" />\n" +
- " <atom:content type=\"application/xml\">\n" +
- " <metadata:properties>\n" +
- " <data:PropertyInt16>32767</data:PropertyInt16>\n" +
- " <data:PropertyString>First Resource - positive values</data:PropertyString>\n" +
- " <data:PropertyBoolean>true</data:PropertyBoolean>\n" +
- " <data:PropertyByte>255</data:PropertyByte>\n" +
- " <data:PropertySByte>127</data:PropertySByte>\n" +
- " <data:PropertyInt32>2147483647</data:PropertyInt32>\n" +
- " <data:PropertyInt64>9223372036854775807</data:PropertyInt64>\n" +
- " <data:PropertySingle>1.79E20</data:PropertySingle>\n" +
- " <data:PropertyDouble>-1.79E19</data:PropertyDouble>\n" +
- " <data:PropertyDecimal>34</data:PropertyDecimal>\n" +
- " <data:PropertyBinary>ASNFZ4mrze8=</data:PropertyBinary>\n" +
- " <data:PropertyDate>2012-12-03</data:PropertyDate>\n" +
- " <data:PropertyDateTimeOffset>2012-12-03T07:16:23Z</data:PropertyDateTimeOffset>\n" +
- " <data:PropertyDuration>PT6S</data:PropertyDuration>\n" +
- " <data:PropertyGuid>01234567-89ab-cdef-0123-456789abcdef</data:PropertyGuid>\n" +
- " <data:PropertyTimeOfDay>03:26:05</data:PropertyTimeOfDay>\n" +
- " </metadata:properties>\n" +
- " </atom:content>\n" +
- "</atom:entry>\n";
-
- Entity result = serializer.entity(new ByteArrayInputStream(payload.getBytes()),
- edmEntitySet.getEntityType()).getEntity();
-
- Assert.assertEquals(16, result.getProperties().size());
- Assert.assertEquals(2, result.getNavigationBindings().size());
-
- Assert.assertEquals(edmInt16("32767"), result.getProperty("PropertyInt16").asPrimitive());
- Assert.assertEquals("First Resource - positive values", result.getProperty("PropertyString").asPrimitive());
- Assert.assertEquals(edmByte("255"), result.getProperty("PropertyByte").asPrimitive());
- Assert.assertEquals(edmSByte("127"), result.getProperty("PropertySByte").asPrimitive());
- Assert.assertEquals(edmInt32("2147483647"), result.getProperty("PropertyInt32").asPrimitive());
- Assert.assertEquals(edmInt64("9223372036854775807"), result.getProperty("PropertyInt64").asPrimitive());
- Assert.assertEquals(edmSingle("1.79E20"), result.getProperty("PropertySingle").asPrimitive());
- Assert.assertEquals(edmDouble("-1.79E19"), result.getProperty("PropertyDouble").asPrimitive());
- Assert.assertEquals(edmDecimal("34"), result.getProperty("PropertyDecimal").asPrimitive());
-// Assert.assertEquals(edmBinary("ASNFZ4mrze8="), result.getProperty("PropertyBinary").asPrimitive());
- Assert.assertEquals(edmDate("2012-12-03"), result.getProperty("PropertyDate").asPrimitive());
- Assert.assertEquals(edmDateTimeOffset("2012-12-03T07:16:23Z"), result.getProperty("PropertyDateTimeOffset")
- .asPrimitive());
- Assert.assertEquals(edmDuration("PT6S"), result.getProperty("PropertyDuration")
- .asPrimitive());
- Assert.assertEquals(edmGUID("01234567-89ab-cdef-0123-456789abcdef"), result.getProperty("PropertyGuid")
- .asPrimitive());
- Assert.assertEquals(edmTimeOfDay("03:26:05"), result.getProperty("PropertyTimeOfDay").asPrimitive());
- }
-
- @Test
- public void entitySimpleWithTypes() throws Exception {
- final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
-
- String payload = "<?xml version='1.0' encoding='UTF-8'?>\n" +
- "<atom:entry xmlns:atom=\"http://www.w3.org/2005/Atom\"\n" +
- " xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
- " xmlns:data=\"http://docs.oasis-open.org/odata/ns/data\"> " +
- " <atom:link\n" +
- " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETTwoPrimMany\"\n" +
- " type=\"application/atom+xml;type=feed\" title=\"NavPropertyETTwoPrimMany\"\n" +
- " href=\"id\" />\n" +
- " <atom:link\n" +
- " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETTwoPrimOne\"\n" +
- " type=\"application/atom+xml;type=entry\" title=\"NavPropertyETTwoPrimOne\"\n" +
- " href=\"id\" />\n" +
- " <atom:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
- " term=\"#olingo.odata.test1.ETAllPrim\" />\n" +
- " <atom:content type=\"application/xml\">\n" +
- " <metadata:properties>\n" +
- " <data:PropertyInt16 metadata:type=\"Int16\">32767</data:PropertyInt16>\n" +
- " <data:PropertyString>First Resource - positive values</data:PropertyString>\n" +
- " <data:PropertyBoolean metadata:type=\"Boolean\">true</data:PropertyBoolean>\n" +
- " <data:PropertyByte metadata:type=\"Byte\">255</data:PropertyByte>\n" +
- " <data:PropertySByte metadata:type=\"SByte\">127</data:PropertySByte>\n" +
- " <data:PropertyInt32 metadata:type=\"Int32\">2147483647</data:PropertyInt32>\n" +
- " <data:PropertyInt64 metadata:type=\"Int64\">9223372036854775807</data:PropertyInt64>\n" +
- " <data:PropertySingle metadata:type=\"Single\">1.79E20</data:PropertySingle>\n" +
- " <data:PropertyDouble metadata:type=\"Double\">-1.79E19</data:PropertyDouble>\n" +
- " <data:PropertyDecimal metadata:type=\"Decimal\">34</data:PropertyDecimal>\n" +
- " <data:PropertyBinary metadata:type=\"Binary\">ASNFZ4mrze8=</data:PropertyBinary>\n" +
- " <data:PropertyDate metadata:type=\"Date\">2012-12-03</data:PropertyDate>\n" +
- " <data:PropertyDateTimeOffset metadata:type=\"DateTimeOffset\">2012-12-03T07:16:23Z"
- + "</data:PropertyDateTimeOffset>\n" +
- " <data:PropertyDuration metadata:type=\"Duration\">PT6S</data:PropertyDuration>\n" +
- " <data:PropertyGuid metadata:type=\"GUID\">01234567-89ab-cdef-0123-456789abcdef"
- + "</data:PropertyGuid>\n" +
- " <data:PropertyTimeOfDay metadata:type=\"TimeOfDay\">03:26:05</data:PropertyTimeOfDay>\n" +
- " </metadata:properties>\n" +
- " </atom:content>\n" +
- "</atom:entry>\n";
-
- Entity result = serializer.entity(new ByteArrayInputStream(payload.getBytes()),
- edmEntitySet.getEntityType()).getEntity();
-
- Assert.assertEquals(16, result.getProperties().size());
- Assert.assertEquals(2, result.getNavigationBindings().size());
-
- Assert.assertEquals(edmInt16("32767"), result.getProperty("PropertyInt16").asPrimitive());
- Assert.assertEquals("First Resource - positive values", result.getProperty("PropertyString").asPrimitive());
- Assert.assertEquals(edmByte("255"), result.getProperty("PropertyByte").asPrimitive());
- Assert.assertEquals(edmSByte("127"), result.getProperty("PropertySByte").asPrimitive());
- Assert.assertEquals(edmInt32("2147483647"), result.getProperty("PropertyInt32").asPrimitive());
- Assert.assertEquals(edmInt64("9223372036854775807"), result.getProperty("PropertyInt64").asPrimitive());
- Assert.assertEquals(edmSingle("1.79E20"), result.getProperty("PropertySingle").asPrimitive());
- Assert.assertEquals(edmDouble("-1.79E19"), result.getProperty("PropertyDouble").asPrimitive());
- Assert.assertEquals(edmDecimal("34"), result.getProperty("PropertyDecimal").asPrimitive());
-// Assert.assertEquals(edmBinary("ASNFZ4mrze8="), result.getProperty("PropertyBinary").asPrimitive());
- Assert.assertEquals(edmDate("2012-12-03"), result.getProperty("PropertyDate").asPrimitive());
- Assert.assertEquals(edmDateTimeOffset("2012-12-03T07:16:23Z"), result.getProperty("PropertyDateTimeOffset")
- .asPrimitive());
- Assert.assertEquals(edmDuration("PT6S"), result.getProperty("PropertyDuration")
- .asPrimitive());
- Assert.assertEquals(edmGUID("01234567-89ab-cdef-0123-456789abcdef"), result.getProperty("PropertyGuid")
- .asPrimitive());
- Assert.assertEquals(edmTimeOfDay("03:26:05"), result.getProperty("PropertyTimeOfDay").asPrimitive());
- }
-
- @Test
- public void entityCompAllPrim() throws Exception {
- final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESCompAllPrim");
-
- String payload = "<?xml version='1.0' encoding='UTF-8'?>"
- + "<atom:entry xmlns:atom=\"http://www.w3.org/2005/Atom\" "
- + "xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\" "
- + "xmlns:data=\"http://docs.oasis-open.org/odata/ns/data\" "
- + "metadata:etag=\"W/"32767"\">"
- + "<atom:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\" "
- + "term=\"#olingo.odata.test1.ETCompAllPrim\"/>"
- + "<atom:content type=\"application/xml\">"
- + "<metadata:properties>"
- + "<data:PropertyInt16>32767</data:PropertyInt16>"
- + "<data:PropertyComp metadata:type=\"#olingo.odata.test1.CTAllPrim\">"
- + "<data:PropertyString>First Resource - first</data:PropertyString>"
- + "<data:PropertyBinary>ASNFZ4mrze8=</data:PropertyBinary>"
- + "<data:PropertyBoolean>true</data:PropertyBoolean>"
- + "<data:PropertyByte>255</data:PropertyByte>"
- + "<data:PropertyDate>2012-10-03</data:PropertyDate>"
- + "<data:PropertyDateTimeOffset>2012-10-03T07:16:23.1234567Z</data:PropertyDateTimeOffset>"
- + "<data:PropertyDecimal>34.27</data:PropertyDecimal>"
- + "<data:PropertySingle>1.79E20</data:PropertySingle>"
- + "<data:PropertyDouble>-1.79E19</data:PropertyDouble>"
- + "<data:PropertyDuration>PT6S</data:PropertyDuration>"
- + "<data:PropertyGuid>01234567-89ab-cdef-0123-456789abcdef</data:PropertyGuid>"
- + "<data:PropertyInt16>32767</data:PropertyInt16>"
- + "<data:PropertyInt32>2147483647</data:PropertyInt32>"
- + "<data:PropertyInt64>9223372036854775807</data:PropertyInt64>"
- + "<data:PropertySByte>127</data:PropertySByte>"
- + "<data:PropertyTimeOfDay>01:00:01</data:PropertyTimeOfDay>"
- + "</data:PropertyComp>"
- + "</metadata:properties>"
- + "</atom:content>"
- + "</atom:entry>";
-
- Entity result = serializer.entity(new ByteArrayInputStream(payload.getBytes()),
- edmEntitySet.getEntityType()).getEntity();
-
- Assert.assertEquals("olingo.odata.test1.ETCompAllPrim",result.getType());
-
- Assert.assertEquals(2, result.getProperties().size());
- Assert.assertEquals(0, result.getNavigationLinks().size());
-
- Assert.assertEquals(edmInt16("32767"), result.getProperty("PropertyInt16").asPrimitive());
-
- Assert.assertNotNull(result.getProperty("PropertyComp"));
- Property comp = result.getProperty("PropertyComp");
- Assert.assertEquals("olingo.odata.test1.CTAllPrim", comp.getType());
- ComplexValue cv = (ComplexValue)comp.getValue();
-
- Assert.assertEquals(16, cv.getValue().size());
-
- Assert.assertEquals(edmInt16("32767"), getCVProperty(cv, "PropertyInt16").asPrimitive());
- Assert.assertEquals("First Resource - first", getCVProperty(cv, "PropertyString").asPrimitive());
- Assert.assertEquals(edmByte("255"), getCVProperty(cv, "PropertyByte").asPrimitive());
- Assert.assertEquals(edmSByte("127"), getCVProperty(cv, "PropertySByte").asPrimitive());
- Assert.assertEquals(edmInt32("2147483647"), getCVProperty(cv, "PropertyInt32").asPrimitive());
- Assert.assertEquals(edmInt64("9223372036854775807"), getCVProperty(cv, "PropertyInt64").asPrimitive());
- }
-
- private Property getCVProperty(ComplexValue cv, String name) {
- for (Property p:cv.getValue()) {
- if (p.getName().equals(name)) {
- return p;
- }
- }
- return null;
- }
-
- @SuppressWarnings("unchecked")
- @Test
- public void entityMixPrimCollComp() throws Exception {
- final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESMixPrimCollComp");
- final String payload = "<?xml version='1.0' encoding='UTF-8'?>\n" +
- "<atom:entry xmlns:atom=\"http://www.w3.org/2005/Atom\"\n" +
- " xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
- " xmlns:data=\"http://docs.oasis-open.org/odata/ns/data\" \n" +
- " metadata:metadata-etag=\"WmetadataETag\">\n" +
- " <atom:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
- " term=\"#olingo.odata.test1.ETMixPrimCollComp\" />\n" +
- " <atom:content type=\"application/xml\">\n" +
- " <metadata:properties>\n" +
- " <data:PropertyInt16>32767</data:PropertyInt16>\n" +
- " <data:CollPropertyString type=\"#Collection(String)\">\n" +
- " <metadata:element>Employee1@company.example</metadata:element>\n" +
- " <metadata:element>Employee2@company.example</metadata:element>\n" +
- " <metadata:element>Employee3@company.example</metadata:element>\n" +
- " </data:CollPropertyString>\n" +
- " <data:PropertyComp metadata:type=\"#olingo.odata.test1.CTTwoPrim\">\n" +
- " <data:PropertyInt16>111</data:PropertyInt16>\n" +
- " <data:PropertyString>TEST A</data:PropertyString>\n" +
- " </data:PropertyComp>\n" +
- " <data:CollPropertyComp metadata:type=\"#Collection(olingo.odata.test1.CTTwoPrim)\">\n" +
- " <metadata:element>\n" +
- " <data:PropertyInt16>123</data:PropertyInt16>\n" +
- " <data:PropertyString>TEST 1</data:PropertyString>\n" +
- " </metadata:element>\n" +
- " <metadata:element>\n" +
- " <data:PropertyInt16>456</data:PropertyInt16>\n" +
- " <data:PropertyString>TEST 2</data:PropertyString>\n" +
- " </metadata:element>\n" +
- " <metadata:element>\n" +
- " <data:PropertyInt16>789</data:PropertyInt16>\n" +
- " <data:PropertyString>TEST 3</data:PropertyString>\n" +
- " </metadata:element>\n" +
- " </data:CollPropertyComp>\n" +
- " </metadata:properties>\n" +
- " </atom:content>\n" +
- "</atom:entry>\n";
-
- Entity result = serializer.entity(new ByteArrayInputStream(payload.getBytes()),
- edmEntitySet.getEntityType()).getEntity();
-
- Assert.assertEquals(4, result.getProperties().size());
- Assert.assertEquals(0, result.getNavigationLinks().size());
-
- Assert.assertEquals(Arrays.asList("Employee1@company.example", "Employee2@company.example",
- "Employee3@company.example"), result.getProperty("CollPropertyString").getValue());
-
- Property comp = result.getProperty("PropertyComp");
- Assert.assertEquals("olingo.odata.test1.CTTwoPrim", comp.getType());
- ComplexValue cv = (ComplexValue)comp.getValue();
-
- Assert.assertEquals(2, cv.getValue().size());
- Assert.assertEquals(edmInt16("111"), getCVProperty(cv, "PropertyInt16").asPrimitive());
- Assert.assertEquals("TEST A", getCVProperty(cv, "PropertyString").asPrimitive());
-
- comp = result.getProperty("CollPropertyComp");
- Assert.assertEquals("Collection(olingo.odata.test1.CTTwoPrim)", comp.getType());
- List<ComplexValue> properties = (List<ComplexValue>)comp.getValue();
-
- Assert.assertEquals(3, properties.size());
-
- Assert.assertEquals(edmInt16("123"), getCVProperty(properties.get(0), "PropertyInt16")
- .asPrimitive());
- Assert.assertEquals("TEST 1", getCVProperty(properties.get(0), "PropertyString")
- .asPrimitive());
-
- Assert.assertEquals(edmInt16("789"), getCVProperty(properties.get(2), "PropertyInt16")
- .asPrimitive());
- Assert.assertEquals("TEST 3", getCVProperty(properties.get(2), "PropertyString")
- .asPrimitive());
- }
-
- @Test
- public void entityWithNavigation() throws Exception {
- final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESTwoPrim");
-
- final String payload = "<?xml version='1.0' encoding='UTF-8'?>\n" +
- "<atom:entry xmlns:atom=\"http://www.w3.org/2005/Atom\"\n" +
- " xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
- " xmlns:data=\"http://docs.oasis-open.org/odata/ns/data\">" +
- " <atom:link\n" +
- " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETAllPrimOne\"\n" +
- " type=\"application/atom+xml;type=entry\" title=\"NavPropertyETAllPrimOne\"\n" +
- " href=\"id\">\n" +
- " <metadata:inline>\n" +
- " <atom:entry>\n" +
- " <atom:link\n" +
- " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETTwoPrimMany\"\n" +
- " type=\"application/atom+xml;type=feed\" title=\"NavPropertyETTwoPrimMany\"\n" +
- " href=\"id\" />\n" +
- " <atom:link\n" +
- " rel=\"http://docs.oasis-open.org/odata/ns/related/NavPropertyETTwoPrimOne\"\n" +
- " type=\"application/atom+xml;type=entry\" title=\"NavPropertyETTwoPrimOne\"\n" +
- " href=\"id\" />\n" +
- " <atom:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
- " term=\"#olingo.odata.test1.ETAllPrim\" />\n" +
- " <atom:content type=\"application/xml\">\n" +
- " <metadata:properties>\n" +
- " <data:PropertyDate>2012-12-03</data:PropertyDate>\n" +
- " </metadata:properties>\n" +
- " </atom:content>\n" +
- " </atom:entry>\n" +
- " </metadata:inline>\n" +
- " </atom:link>\n" +
- " <atom:category scheme=\"http://docs.oasis-open.org/odata/ns/scheme\"\n" +
- " term=\"#olingo.odata.test1.ETTwoPrim\" />\n" +
- " <atom:content type=\"application/xml\">\n" +
- " <metadata:properties>\n" +
- " <data:PropertyInt16>32767</data:PropertyInt16>\n" +
- " <data:PropertyString>Test String4</data:PropertyString>\n" +
- " </metadata:properties>\n" +
- " </atom:content>\n" +
- "</atom:entry>\n" +
- "";
-
- Entity result = serializer.entity(new ByteArrayInputStream(payload.getBytes()),
- edmEntitySet.getEntityType()).getEntity();
-
- Assert.assertEquals(2, result.getProperties().size());
- Assert.assertEquals(1, result.getNavigationLinks().size());
-
- Assert.assertEquals(edmInt16("32767"), result.getProperty("PropertyInt16").asPrimitive());
- Assert.assertEquals("Test String4", result.getProperty("PropertyString").asPrimitive());
-
- Assert.assertEquals(1, result.getNavigationLinks().size());
- Link navLink = result.getNavigationLinks().get(0);
- Assert.assertEquals("http://docs.oasis-open.org/odata/ns/related/NavPropertyETAllPrimOne", navLink.getRel());
- Assert.assertEquals("id", navLink.getBindingLink());
- Assert.assertEquals("NavPropertyETAllPrimOne", navLink.getTitle());
-
- Entity inline = navLink.getInlineEntity();
- Assert.assertEquals(1, inline.getProperties().size());
- Assert.assertEquals(2, inline.getNavigationBindings().size());
- Assert.assertEquals(edmDate("2012-12-03"), inline.getProperty("PropertyDate").asPrimitive());
- }
-
- @Test
- public void primitiveProperty() throws Exception {
- final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
- final EdmProperty edmProperty = (EdmProperty) edmEntitySet.getEntityType().getProperty("PropertyInt16");
-
- String payload = "<?xml version='1.0' encoding='UTF-8'?>"
- + "<metadata:value xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\">"
- + "234</metadata:value>";
-
- Property result = serializer.property(new ByteArrayInputStream(payload.getBytes()), edmProperty).getProperty();
- Assert.assertEquals(edmInt16("234"), result.getValue());
- }
-
- @Test
- public void primitivePropertyNull() throws Exception {
- final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
- final EdmProperty edmProperty = (EdmProperty) edmEntitySet.getEntityType().getProperty("PropertyString");
- String payload = "<?xml version='1.0' encoding='UTF-8'?>"
- + "<metadata:value xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\" "
- + "metadata:null=\"true\"/>";
-
- Property result = serializer.property(new ByteArrayInputStream(payload.getBytes()), edmProperty).getProperty();
- Assert.assertNull(result.getValue());
- }
-
- @Test
- public void primitiveCollectionProperty() throws Exception {
- final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESCollAllPrim");
- final EdmProperty edmProperty = (EdmProperty) edmEntitySet.getEntityType().getProperty("CollPropertyString");
- String payload = "<?xml version='1.0' encoding='UTF-8'?>"
- + "<metadata:value xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\"> "
- + "<metadata:element>Employee1@company.example</metadata:element>"
- + "<metadata:element>Employee2@company.example</metadata:element>"
- + "<metadata:element>Employee3@company.example</metadata:element>"
- + "</metadata:value>";
- Property result = serializer.property(new ByteArrayInputStream(payload.getBytes()), edmProperty).getProperty();
- Assert.assertEquals(Arrays.asList("Employee1@company.example", "Employee2@company.example",
- "Employee3@company.example"), result.getValue());
-
- }
-
- @Test
- public void complexProperty() throws Exception {
- Edm edm = Mockito.mock(Edm.class);
-
- CsdlProperty street = new CsdlProperty().setName("Street")
- .setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
- CsdlProperty city = new CsdlProperty().setName("City")
- .setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
- CsdlProperty region = new CsdlProperty().setName("Region")
- .setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
- CsdlProperty postalcode = new CsdlProperty().setName("PostalCode")
- .setType(EdmPrimitiveTypeKind.Int64.getFullQualifiedName());
-
- CsdlComplexType ct = new CsdlComplexType()
- .setName("Model.Address")
- .setProperties(Arrays.asList(street, city, region, postalcode));
- EdmComplexTypeImpl complexType = new EdmComplexTypeImpl(edm, new FullQualifiedName("Model.Address"), ct);
-
- Mockito.stub(edm.getComplexType(new FullQualifiedName("Model.Address"))).toReturn(complexType);
-
- CsdlProperty prop = new CsdlProperty();
- prop.setName("ShipTo");
- prop.setType(new FullQualifiedName("Model.Address"));
- EdmPropertyImpl edmProperty = new EdmPropertyImpl(edm, null, prop);
-
- String payload = "<data:ShipTo xmlns:data=\"http://docs.oasis-open.org/odata/ns/data\" " +
- " xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
- " metadata:type=\"#Model.Address\">\n" +
- " <data:Street>Obere Str. 57</data:Street>\n" +
- " <data:City>Berlin</data:City>\n" +
- " <data:Region metadata:null=\"true\"/>\n" +
- " <data:PostalCode>12209</data:PostalCode>\n" +
- "</data:ShipTo>";
-
- Property result = serializer.property(new ByteArrayInputStream(payload.getBytes()), edmProperty).getProperty();
-
- Assert.assertEquals("ShipTo", result.getName());
- Assert.assertTrue(result.getValue() instanceof ComplexValue);
- ComplexValue cv = (ComplexValue)result.getValue();
- Assert.assertEquals("Model.Address", result.getType());
- Assert.assertEquals("Berlin", getCVProperty(cv, "City").asPrimitive());
- Assert.assertEquals("Obere Str. 57", getCVProperty(cv, "Street").asPrimitive());
- }
-
- @SuppressWarnings("unchecked")
- @Test
- public void complexCollectionProperty() throws Exception {
- final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESMixPrimCollComp");
- final EdmProperty edmProperty = (EdmProperty) edmEntitySet.getEntityType().getProperty("CollPropertyComp");
- String payload = "<metadata:value xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
- "xmlns:data=\"http://docs.oasis-open.org/odata/ns/data\" "
- + "metadata:type=\"#Collection(olingo.odata.test1.CTTwoPrim)\">\n"+
- " <metadata:element>\n" +
- " <data:PropertyInt16>123</data:PropertyInt16>\n" +
- " <data:PropertyString>TEST 1</data:PropertyString>\n" +
- " </metadata:element>\n" +
- " <metadata:element>\n" +
- " <data:PropertyInt16>456</data:PropertyInt16>\n" +
- " <data:PropertyString>TEST 2</data:PropertyString>\n" +
- " </metadata:element>\n" +
- " <metadata:element>\n" +
- " <data:PropertyInt16>789</data:PropertyInt16>\n" +
- " <data:PropertyString>TEST 3</data:PropertyString>\n" +
- " </metadata:element>\n" +
- "</metadata:value>";
- Property result = serializer.property(new ByteArrayInputStream(payload.getBytes()), edmProperty).getProperty();
-
- List<ComplexValue> complex = (List<ComplexValue>)result.getValue();
-
- Assert.assertEquals(3, complex.size());
- Assert.assertEquals("Collection(olingo.odata.test1.CTTwoPrim)", result.getType());
- Assert.assertEquals(edmInt16("123"), getCVProperty(complex.get(0), "PropertyInt16").asPrimitive());
- Assert.assertEquals("TEST 1", getCVProperty(complex.get(0), "PropertyString").asPrimitive());
- Assert.assertEquals(edmInt16("789"), getCVProperty(complex.get(2), "PropertyInt16").asPrimitive());
- Assert.assertEquals("TEST 3", getCVProperty(complex.get(2), "PropertyString").asPrimitive());
- }
-
- @Test
- public void entityReference() throws Exception {
- String payload = "<metadata:ref xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
- " metadata:context=\"http://host/service/$metadata#$ref\"\n" +
- " xmlns=\"http://www.w3.org/2005/Atom\" "+
- " id=\"http://host/service/Orders(10643)\" />";
-
- List<URI> result = serializer.entityReferences(new ByteArrayInputStream(payload.getBytes()))
- .getEntityReferences();
- Assert.assertEquals(1, result.size());
- Assert.assertEquals("http://host/service/Orders(10643)", result.get(0).toASCIIString());
- }
-
- @Test
- public void entityReferences() throws Exception {
- String payload = "<feed xmlns=\"http://www.w3.org/2005/Atom\"\n" +
- " xmlns:metadata=\"http://docs.oasis-open.org/odata/ns/metadata\"\n" +
- " metadata:context=\"http://host/service/$metadata#Collection($ref)\" >\n" +
- " <metadata:ref id=\"http://host/service/Orders(10643)\" />\n" +
- " <metadata:ref id=\"http://host/service/Orders(10759)\" />\n" +
- "</feed>";
-
- List<URI> result = serializer.entityReferences(new ByteArrayInputStream(payload.getBytes()))
- .getEntityReferences();
- Assert.assertEquals(2, result.size());
- Assert.assertEquals("http://host/service/Orders(10643)", result.get(0).toASCIIString());
- Assert.assertEquals("http://host/service/Orders(10759)", result.get(1).toASCIIString());
- }
-}
[5/5] olingo-odata4 git commit: [OLINGO-772] Change version to RC02
Posted by mi...@apache.org.
[OLINGO-772] Change version to RC02
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/9c3ca381
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/9c3ca381
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/9c3ca381
Branch: refs/heads/master
Commit: 9c3ca381e2230afa16427dc8df39631a555307d7
Parents: 587795f
Author: Michael Bolz <mi...@sap.com>
Authored: Mon Sep 14 10:37:04 2015 +0200
Committer: Michael Bolz <mi...@sap.com>
Committed: Mon Sep 14 10:37:04 2015 +0200
----------------------------------------------------------------------
dist/android-lib/pom.xml | 2 +-
dist/client-lib/pom.xml | 2 +-
dist/javadoc/pom.xml | 2 +-
dist/pom.xml | 2 +-
dist/server-lib/pom.xml | 2 +-
ext/client-android/pom.xml | 2 +-
ext/client-proxy/pom.xml | 2 +-
ext/karaf/karaf-features/pom.xml | 2 +-
ext/karaf/karaf-fit/pom.xml | 2 +-
.../apache/olingo/osgi/itests/server/CarServiceTest.java | 2 +-
ext/karaf/pom.xml | 2 +-
ext/pojogen-maven-plugin/pom.xml | 2 +-
ext/pom.xml | 2 +-
fit/pom.xml | 2 +-
lib/client-api/pom.xml | 2 +-
lib/client-core/pom.xml | 2 +-
lib/commons-api/pom.xml | 2 +-
lib/commons-core/pom.xml | 2 +-
lib/pom.xml | 2 +-
lib/server-api/pom.xml | 2 +-
lib/server-core-ext/pom.xml | 2 +-
lib/server-core/pom.xml | 2 +-
lib/server-tecsvc/pom.xml | 2 +-
lib/server-test/pom.xml | 2 +-
pom.xml | 2 +-
samples/client/pom.xml | 2 +-
samples/osgi/server/README.txt | 10 +++++-----
samples/osgi/server/pom.xml | 2 +-
samples/pom.xml | 2 +-
samples/server/pom.xml | 2 +-
samples/tutorials/p0_all/pom.xml | 2 +-
samples/tutorials/p1_read/pom.xml | 2 +-
samples/tutorials/p2_readep/pom.xml | 2 +-
samples/tutorials/p3_write/pom.xml | 2 +-
samples/tutorials/p4_navigation/pom.xml | 2 +-
samples/tutorials/p5_queryoptions-tcs/pom.xml | 2 +-
samples/tutorials/p6_queryoptions-es/pom.xml | 2 +-
samples/tutorials/p7_queryoptions-o/pom.xml | 2 +-
samples/tutorials/p8_queryoptions-f/pom.xml | 2 +-
samples/tutorials/pom.xml | 2 +-
40 files changed, 44 insertions(+), 44 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9c3ca381/dist/android-lib/pom.xml
----------------------------------------------------------------------
diff --git a/dist/android-lib/pom.xml b/dist/android-lib/pom.xml
index fd62c14..591ed7b 100644
--- a/dist/android-lib/pom.xml
+++ b/dist/android-lib/pom.xml
@@ -31,7 +31,7 @@
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-dist</artifactId>
- <version>4.0.0-RC01</version>
+ <version>4.0.0-RC02</version>
<relativePath>..</relativePath>
</parent>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9c3ca381/dist/client-lib/pom.xml
----------------------------------------------------------------------
diff --git a/dist/client-lib/pom.xml b/dist/client-lib/pom.xml
index 0655196..8a1b232 100644
--- a/dist/client-lib/pom.xml
+++ b/dist/client-lib/pom.xml
@@ -31,7 +31,7 @@
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-dist</artifactId>
- <version>4.0.0-RC01</version>
+ <version>4.0.0-RC02</version>
<relativePath>..</relativePath>
</parent>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9c3ca381/dist/javadoc/pom.xml
----------------------------------------------------------------------
diff --git a/dist/javadoc/pom.xml b/dist/javadoc/pom.xml
index a83da43..a475a58 100644
--- a/dist/javadoc/pom.xml
+++ b/dist/javadoc/pom.xml
@@ -31,7 +31,7 @@
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-dist</artifactId>
- <version>4.0.0-RC01</version>
+ <version>4.0.0-RC02</version>
<relativePath>..</relativePath>
</parent>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9c3ca381/dist/pom.xml
----------------------------------------------------------------------
diff --git a/dist/pom.xml b/dist/pom.xml
index 6404ee0..c1b58c5 100644
--- a/dist/pom.xml
+++ b/dist/pom.xml
@@ -31,7 +31,7 @@
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-parent</artifactId>
- <version>4.0.0-RC01</version>
+ <version>4.0.0-RC02</version>
<relativePath>..</relativePath>
</parent>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9c3ca381/dist/server-lib/pom.xml
----------------------------------------------------------------------
diff --git a/dist/server-lib/pom.xml b/dist/server-lib/pom.xml
index 0fa6216..c2705e2 100644
--- a/dist/server-lib/pom.xml
+++ b/dist/server-lib/pom.xml
@@ -31,7 +31,7 @@
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-dist</artifactId>
- <version>4.0.0-RC01</version>
+ <version>4.0.0-RC02</version>
<relativePath>..</relativePath>
</parent>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9c3ca381/ext/client-android/pom.xml
----------------------------------------------------------------------
diff --git a/ext/client-android/pom.xml b/ext/client-android/pom.xml
index 2bc76ec..fe2cf8f 100644
--- a/ext/client-android/pom.xml
+++ b/ext/client-android/pom.xml
@@ -30,7 +30,7 @@
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-ext</artifactId>
- <version>4.0.0-RC01</version>
+ <version>4.0.0-RC02</version>
<relativePath>..</relativePath>
</parent>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9c3ca381/ext/client-proxy/pom.xml
----------------------------------------------------------------------
diff --git a/ext/client-proxy/pom.xml b/ext/client-proxy/pom.xml
index 1961036..5224b01 100644
--- a/ext/client-proxy/pom.xml
+++ b/ext/client-proxy/pom.xml
@@ -31,7 +31,7 @@
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-ext</artifactId>
- <version>4.0.0-RC01</version>
+ <version>4.0.0-RC02</version>
<relativePath>..</relativePath>
</parent>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9c3ca381/ext/karaf/karaf-features/pom.xml
----------------------------------------------------------------------
diff --git a/ext/karaf/karaf-features/pom.xml b/ext/karaf/karaf-features/pom.xml
index 4bf62d0..d45819f 100644
--- a/ext/karaf/karaf-features/pom.xml
+++ b/ext/karaf/karaf-features/pom.xml
@@ -30,7 +30,7 @@
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-karaf</artifactId>
- <version>4.0.0-RC01</version>
+ <version>4.0.0-RC02</version>
<relativePath>..</relativePath>
</parent>
<build>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9c3ca381/ext/karaf/karaf-fit/pom.xml
----------------------------------------------------------------------
diff --git a/ext/karaf/karaf-fit/pom.xml b/ext/karaf/karaf-fit/pom.xml
index 6b809c8..95482e6 100644
--- a/ext/karaf/karaf-fit/pom.xml
+++ b/ext/karaf/karaf-fit/pom.xml
@@ -30,7 +30,7 @@
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-karaf</artifactId>
- <version>4.0.0-RC01</version>
+ <version>4.0.0-RC02</version>
<relativePath>..</relativePath>
</parent>
<dependencies>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9c3ca381/ext/karaf/karaf-fit/src/test/java/org/apache/olingo/osgi/itests/server/CarServiceTest.java
----------------------------------------------------------------------
diff --git a/ext/karaf/karaf-fit/src/test/java/org/apache/olingo/osgi/itests/server/CarServiceTest.java b/ext/karaf/karaf-fit/src/test/java/org/apache/olingo/osgi/itests/server/CarServiceTest.java
index b5b6cf6..68deac3 100644
--- a/ext/karaf/karaf-fit/src/test/java/org/apache/olingo/osgi/itests/server/CarServiceTest.java
+++ b/ext/karaf/karaf-fit/src/test/java/org/apache/olingo/osgi/itests/server/CarServiceTest.java
@@ -96,7 +96,7 @@ public class CarServiceTest extends OlingoOSGiTestSupport {
return new Option[] {
olingoBaseConfig(),
features(olingoUrl, "olingo-server", "olingo-client"),
- mavenBundle("org.apache.olingo", "odata-server-osgi-sample", "4.0.0-RC01"),
+ mavenBundle("org.apache.olingo", "odata-server-osgi-sample", "4.0.0-RC02"),
logLevel(LogLevel.INFO)
};
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9c3ca381/ext/karaf/pom.xml
----------------------------------------------------------------------
diff --git a/ext/karaf/pom.xml b/ext/karaf/pom.xml
index e328ac1..bf71c30 100644
--- a/ext/karaf/pom.xml
+++ b/ext/karaf/pom.xml
@@ -30,7 +30,7 @@
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-ext</artifactId>
- <version>4.0.0-RC01</version>
+ <version>4.0.0-RC02</version>
<relativePath>..</relativePath>
</parent>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9c3ca381/ext/pojogen-maven-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/ext/pojogen-maven-plugin/pom.xml b/ext/pojogen-maven-plugin/pom.xml
index c38077d..40d8476 100644
--- a/ext/pojogen-maven-plugin/pom.xml
+++ b/ext/pojogen-maven-plugin/pom.xml
@@ -31,7 +31,7 @@
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-ext</artifactId>
- <version>4.0.0-RC01</version>
+ <version>4.0.0-RC02</version>
<relativePath>..</relativePath>
</parent>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9c3ca381/ext/pom.xml
----------------------------------------------------------------------
diff --git a/ext/pom.xml b/ext/pom.xml
index 1698123..555b219 100644
--- a/ext/pom.xml
+++ b/ext/pom.xml
@@ -31,7 +31,7 @@
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-parent</artifactId>
- <version>4.0.0-RC01</version>
+ <version>4.0.0-RC02</version>
<relativePath>..</relativePath>
</parent>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9c3ca381/fit/pom.xml
----------------------------------------------------------------------
diff --git a/fit/pom.xml b/fit/pom.xml
index df3019b..338d047 100644
--- a/fit/pom.xml
+++ b/fit/pom.xml
@@ -30,7 +30,7 @@
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-parent</artifactId>
- <version>4.0.0-RC01</version>
+ <version>4.0.0-RC02</version>
<relativePath>..</relativePath>
</parent>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9c3ca381/lib/client-api/pom.xml
----------------------------------------------------------------------
diff --git a/lib/client-api/pom.xml b/lib/client-api/pom.xml
index 3e2c126..8b06408 100644
--- a/lib/client-api/pom.xml
+++ b/lib/client-api/pom.xml
@@ -30,7 +30,7 @@
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-lib</artifactId>
- <version>4.0.0-RC01</version>
+ <version>4.0.0-RC02</version>
<relativePath>..</relativePath>
</parent>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9c3ca381/lib/client-core/pom.xml
----------------------------------------------------------------------
diff --git a/lib/client-core/pom.xml b/lib/client-core/pom.xml
index 9749166..9a7b921 100644
--- a/lib/client-core/pom.xml
+++ b/lib/client-core/pom.xml
@@ -30,7 +30,7 @@
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-lib</artifactId>
- <version>4.0.0-RC01</version>
+ <version>4.0.0-RC02</version>
<relativePath>..</relativePath>
</parent>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9c3ca381/lib/commons-api/pom.xml
----------------------------------------------------------------------
diff --git a/lib/commons-api/pom.xml b/lib/commons-api/pom.xml
index 5b793a4..4f4ff2c 100644
--- a/lib/commons-api/pom.xml
+++ b/lib/commons-api/pom.xml
@@ -30,7 +30,7 @@
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-lib</artifactId>
- <version>4.0.0-RC01</version>
+ <version>4.0.0-RC02</version>
<relativePath>..</relativePath>
</parent>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9c3ca381/lib/commons-core/pom.xml
----------------------------------------------------------------------
diff --git a/lib/commons-core/pom.xml b/lib/commons-core/pom.xml
index 2eca18b..3715138 100644
--- a/lib/commons-core/pom.xml
+++ b/lib/commons-core/pom.xml
@@ -30,7 +30,7 @@
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-lib</artifactId>
- <version>4.0.0-RC01</version>
+ <version>4.0.0-RC02</version>
<relativePath>..</relativePath>
</parent>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9c3ca381/lib/pom.xml
----------------------------------------------------------------------
diff --git a/lib/pom.xml b/lib/pom.xml
index bff3dea..9182607 100644
--- a/lib/pom.xml
+++ b/lib/pom.xml
@@ -30,7 +30,7 @@
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-parent</artifactId>
- <version>4.0.0-RC01</version>
+ <version>4.0.0-RC02</version>
<relativePath>..</relativePath>
</parent>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9c3ca381/lib/server-api/pom.xml
----------------------------------------------------------------------
diff --git a/lib/server-api/pom.xml b/lib/server-api/pom.xml
index 1581426..c91283b 100644
--- a/lib/server-api/pom.xml
+++ b/lib/server-api/pom.xml
@@ -30,7 +30,7 @@
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-lib</artifactId>
- <version>4.0.0-RC01</version>
+ <version>4.0.0-RC02</version>
<relativePath>..</relativePath>
</parent>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9c3ca381/lib/server-core-ext/pom.xml
----------------------------------------------------------------------
diff --git a/lib/server-core-ext/pom.xml b/lib/server-core-ext/pom.xml
index 8f26b3b..cc0f3b1 100644
--- a/lib/server-core-ext/pom.xml
+++ b/lib/server-core-ext/pom.xml
@@ -30,7 +30,7 @@
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-lib</artifactId>
- <version>4.0.0-RC01</version>
+ <version>4.0.0-RC02</version>
<relativePath>..</relativePath>
</parent>
<dependencies>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9c3ca381/lib/server-core/pom.xml
----------------------------------------------------------------------
diff --git a/lib/server-core/pom.xml b/lib/server-core/pom.xml
index 3d3cadc..cb0ab31 100644
--- a/lib/server-core/pom.xml
+++ b/lib/server-core/pom.xml
@@ -30,7 +30,7 @@
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-lib</artifactId>
- <version>4.0.0-RC01</version>
+ <version>4.0.0-RC02</version>
<relativePath>..</relativePath>
</parent>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9c3ca381/lib/server-tecsvc/pom.xml
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/pom.xml b/lib/server-tecsvc/pom.xml
index e31176b..1b8b8cd 100644
--- a/lib/server-tecsvc/pom.xml
+++ b/lib/server-tecsvc/pom.xml
@@ -30,7 +30,7 @@
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-lib</artifactId>
- <version>4.0.0-RC01</version>
+ <version>4.0.0-RC02</version>
<relativePath>..</relativePath>
</parent>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9c3ca381/lib/server-test/pom.xml
----------------------------------------------------------------------
diff --git a/lib/server-test/pom.xml b/lib/server-test/pom.xml
index 8354133..9a32daf 100644
--- a/lib/server-test/pom.xml
+++ b/lib/server-test/pom.xml
@@ -30,7 +30,7 @@
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-lib</artifactId>
- <version>4.0.0-RC01</version>
+ <version>4.0.0-RC02</version>
<relativePath>..</relativePath>
</parent>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9c3ca381/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index b7596b7..62ad9e3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -25,7 +25,7 @@
<groupId>org.apache.olingo</groupId>
<artifactId>odata-parent</artifactId>
- <version>4.0.0-RC01</version>
+ <version>4.0.0-RC02</version>
<packaging>pom</packaging>
<name>Olingo-OData</name>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9c3ca381/samples/client/pom.xml
----------------------------------------------------------------------
diff --git a/samples/client/pom.xml b/samples/client/pom.xml
index ccdbd23..9997314 100644
--- a/samples/client/pom.xml
+++ b/samples/client/pom.xml
@@ -31,7 +31,7 @@
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-samples</artifactId>
- <version>4.0.0-RC01</version>
+ <version>4.0.0-RC02</version>
<relativePath>..</relativePath>
</parent>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9c3ca381/samples/osgi/server/README.txt
----------------------------------------------------------------------
diff --git a/samples/osgi/server/README.txt b/samples/osgi/server/README.txt
index 5e5be45..834208c 100644
--- a/samples/osgi/server/README.txt
+++ b/samples/osgi/server/README.txt
@@ -86,7 +86,7 @@ To install the required bundles, you can simply install the Karaf olingo-server
The following commands will install the olingo-server feature.
```
-feature:repo-add mvn:org.apache.olingo/odata-karaf-features/4.0.0-RC01/xml/features
+feature:repo-add mvn:org.apache.olingo/odata-karaf-features/4.0.0-RC02/xml/features
feature:install olingo-server
```
@@ -95,16 +95,16 @@ feature:install olingo-server
To install this sample bundle, run the karaf console command.
```
-bundle:install -s mvn:org.apache.olingo/odata-server-osgi-sample/4.0.0-RC01
+bundle:install -s mvn:org.apache.olingo/odata-server-osgi-sample/4.0.0-RC02
```
Shown below is the output from running the above Karaf console commands.
```
-karaf@root()> feature:repo-add mvn:org.apache.olingo/odata-karaf-features/4.0.0-RC01/xml/features
-Adding feature url mvn:org.apache.olingo/odata-karaf-features/4.0.0-RC01/xml/features
+karaf@root()> feature:repo-add mvn:org.apache.olingo/odata-karaf-features/4.0.0-RC02/xml/features
+Adding feature url mvn:org.apache.olingo/odata-karaf-features/4.0.0-RC02/xml/features
karaf@root()> feature:install olingo-server
-karaf@root()> bundle:install -s mvn:org.apache.olingo/odata-server-osgi-sample/4.0.0-RC01
+karaf@root()> bundle:install -s mvn:org.apache.olingo/odata-server-osgi-sample/4.0.0-RC02
Bundle ID: 109
```
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9c3ca381/samples/osgi/server/pom.xml
----------------------------------------------------------------------
diff --git a/samples/osgi/server/pom.xml b/samples/osgi/server/pom.xml
index 7ab3339..8c53746 100644
--- a/samples/osgi/server/pom.xml
+++ b/samples/osgi/server/pom.xml
@@ -30,7 +30,7 @@ under the License.
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-samples</artifactId>
- <version>4.0.0-RC01</version>
+ <version>4.0.0-RC02</version>
<relativePath>../..</relativePath>
</parent>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9c3ca381/samples/pom.xml
----------------------------------------------------------------------
diff --git a/samples/pom.xml b/samples/pom.xml
index 21c3f64..ae5be9c 100644
--- a/samples/pom.xml
+++ b/samples/pom.xml
@@ -30,7 +30,7 @@
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-parent</artifactId>
- <version>4.0.0-RC01</version>
+ <version>4.0.0-RC02</version>
<relativePath>..</relativePath>
</parent>
<modules>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9c3ca381/samples/server/pom.xml
----------------------------------------------------------------------
diff --git a/samples/server/pom.xml b/samples/server/pom.xml
index ade545a..4b9da24 100644
--- a/samples/server/pom.xml
+++ b/samples/server/pom.xml
@@ -30,7 +30,7 @@
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-samples</artifactId>
- <version>4.0.0-RC01</version>
+ <version>4.0.0-RC02</version>
<relativePath>..</relativePath>
</parent>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9c3ca381/samples/tutorials/p0_all/pom.xml
----------------------------------------------------------------------
diff --git a/samples/tutorials/p0_all/pom.xml b/samples/tutorials/p0_all/pom.xml
index a21bc39..9c4b212 100644
--- a/samples/tutorials/p0_all/pom.xml
+++ b/samples/tutorials/p0_all/pom.xml
@@ -35,7 +35,7 @@
<properties>
<javax.version>2.5</javax.version>
- <odata.version>4.0.0-RC01</odata.version>
+ <odata.version>4.0.0-RC02</odata.version>
<slf4j.version>1.7.7</slf4j.version>
</properties>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9c3ca381/samples/tutorials/p1_read/pom.xml
----------------------------------------------------------------------
diff --git a/samples/tutorials/p1_read/pom.xml b/samples/tutorials/p1_read/pom.xml
index 5867be4..c0ea43a 100755
--- a/samples/tutorials/p1_read/pom.xml
+++ b/samples/tutorials/p1_read/pom.xml
@@ -35,7 +35,7 @@
<properties>
<javax.version>2.5</javax.version>
- <odata.version>4.0.0-RC01</odata.version>
+ <odata.version>4.0.0-RC02</odata.version>
<slf4j.version>1.7.7</slf4j.version>
</properties>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9c3ca381/samples/tutorials/p2_readep/pom.xml
----------------------------------------------------------------------
diff --git a/samples/tutorials/p2_readep/pom.xml b/samples/tutorials/p2_readep/pom.xml
index ab96c4c..6bbb119 100755
--- a/samples/tutorials/p2_readep/pom.xml
+++ b/samples/tutorials/p2_readep/pom.xml
@@ -19,7 +19,7 @@
<properties>
<javax.version>2.5</javax.version>
- <odata.version>4.0.0-RC01</odata.version>
+ <odata.version>4.0.0-RC02</odata.version>
<slf4j.version>1.7.7</slf4j.version>
</properties>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9c3ca381/samples/tutorials/p3_write/pom.xml
----------------------------------------------------------------------
diff --git a/samples/tutorials/p3_write/pom.xml b/samples/tutorials/p3_write/pom.xml
index 895ab99..da25703 100755
--- a/samples/tutorials/p3_write/pom.xml
+++ b/samples/tutorials/p3_write/pom.xml
@@ -35,7 +35,7 @@
<properties>
<javax.version>2.5</javax.version>
- <odata.version>4.0.0-RC01</odata.version>
+ <odata.version>4.0.0-RC02</odata.version>
<slf4j.version>1.7.7</slf4j.version>
</properties>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9c3ca381/samples/tutorials/p4_navigation/pom.xml
----------------------------------------------------------------------
diff --git a/samples/tutorials/p4_navigation/pom.xml b/samples/tutorials/p4_navigation/pom.xml
index 1d3803b..b179be4 100755
--- a/samples/tutorials/p4_navigation/pom.xml
+++ b/samples/tutorials/p4_navigation/pom.xml
@@ -35,7 +35,7 @@
<properties>
<javax.version>2.5</javax.version>
- <odata.version>4.0.0-RC01</odata.version>
+ <odata.version>4.0.0-RC02</odata.version>
<slf4j.version>1.7.7</slf4j.version>
</properties>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9c3ca381/samples/tutorials/p5_queryoptions-tcs/pom.xml
----------------------------------------------------------------------
diff --git a/samples/tutorials/p5_queryoptions-tcs/pom.xml b/samples/tutorials/p5_queryoptions-tcs/pom.xml
index 5123fe5..ee09b0e 100755
--- a/samples/tutorials/p5_queryoptions-tcs/pom.xml
+++ b/samples/tutorials/p5_queryoptions-tcs/pom.xml
@@ -35,7 +35,7 @@
<properties>
<javax.version>2.5</javax.version>
- <odata.version>4.0.0-RC01</odata.version>
+ <odata.version>4.0.0-RC02</odata.version>
<slf4j.version>1.7.7</slf4j.version>
</properties>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9c3ca381/samples/tutorials/p6_queryoptions-es/pom.xml
----------------------------------------------------------------------
diff --git a/samples/tutorials/p6_queryoptions-es/pom.xml b/samples/tutorials/p6_queryoptions-es/pom.xml
index 536f8ed..4c99b6f 100755
--- a/samples/tutorials/p6_queryoptions-es/pom.xml
+++ b/samples/tutorials/p6_queryoptions-es/pom.xml
@@ -35,7 +35,7 @@
<properties>
<javax.version>2.5</javax.version>
- <odata.version>4.0.0-RC01</odata.version>
+ <odata.version>4.0.0-RC02</odata.version>
<slf4j.version>1.7.7</slf4j.version>
</properties>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9c3ca381/samples/tutorials/p7_queryoptions-o/pom.xml
----------------------------------------------------------------------
diff --git a/samples/tutorials/p7_queryoptions-o/pom.xml b/samples/tutorials/p7_queryoptions-o/pom.xml
index ce104ca..eed3bde 100644
--- a/samples/tutorials/p7_queryoptions-o/pom.xml
+++ b/samples/tutorials/p7_queryoptions-o/pom.xml
@@ -35,7 +35,7 @@
<properties>
<javax.version>2.5</javax.version>
- <odata.version>4.0.0-RC01</odata.version>
+ <odata.version>4.0.0-RC02</odata.version>
<slf4j.version>1.7.7</slf4j.version>
</properties>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9c3ca381/samples/tutorials/p8_queryoptions-f/pom.xml
----------------------------------------------------------------------
diff --git a/samples/tutorials/p8_queryoptions-f/pom.xml b/samples/tutorials/p8_queryoptions-f/pom.xml
index de3738d..3474098 100644
--- a/samples/tutorials/p8_queryoptions-f/pom.xml
+++ b/samples/tutorials/p8_queryoptions-f/pom.xml
@@ -35,7 +35,7 @@
<properties>
<javax.version>2.5</javax.version>
- <odata.version>4.0.0-RC01</odata.version>
+ <odata.version>4.0.0-RC02</odata.version>
<slf4j.version>1.7.7</slf4j.version>
</properties>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9c3ca381/samples/tutorials/pom.xml
----------------------------------------------------------------------
diff --git a/samples/tutorials/pom.xml b/samples/tutorials/pom.xml
index 2c1f642..9e60c17 100644
--- a/samples/tutorials/pom.xml
+++ b/samples/tutorials/pom.xml
@@ -30,7 +30,7 @@
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-samples</artifactId>
- <version>4.0.0-RC01</version>
+ <version>4.0.0-RC02</version>
<relativePath>..</relativePath>
</parent>
[2/5] olingo-odata4 git commit: [OLINGO-772] Change for parent pom
deploy
Posted by mi...@apache.org.
[OLINGO-772] Change for parent pom deploy
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/fdf5c020
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/fdf5c020
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/fdf5c020
Branch: refs/heads/master
Commit: fdf5c0204d2ad2af67f92d9a711889167f422998
Parents: 54f6947
Author: Michael Bolz <mi...@sap.com>
Authored: Mon Sep 14 10:03:22 2015 +0200
Committer: Michael Bolz <mi...@sap.com>
Committed: Mon Sep 14 10:03:22 2015 +0200
----------------------------------------------------------------------
lib/pom.xml | 12 ++++++++++++
pom.xml | 7 -------
2 files changed, 12 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fdf5c020/lib/pom.xml
----------------------------------------------------------------------
diff --git a/lib/pom.xml b/lib/pom.xml
index dc386ad..bff3dea 100644
--- a/lib/pom.xml
+++ b/lib/pom.xml
@@ -52,6 +52,18 @@
<exclude.regex>.*proxy.*</exclude.regex>
</properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <configuration>
+ <skip>${olingo.deploy.skip}</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
<profiles>
<profile>
<id>build.fast</id>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/fdf5c020/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index e6216d4..b7596b7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -398,13 +398,6 @@
</executions>
</plugin>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-deploy-plugin</artifactId>
- <configuration>
- <skip>${olingo.deploy.skip}</skip>
- </configuration>
- </plugin>
- <plugin>
<artifactId>maven-remote-resources-plugin</artifactId>
<version>1.5</version>
<dependencies>