Repository: camel
Updated Branches:
  refs/heads/camel-2.14.x 3e71e5991 -> 488042168


CAMEL-8358: Refactored Olingo2 component to avoid using classes from Olingo2 
core package


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

Branch: refs/heads/camel-2.14.x
Commit: 4880421682076837d577ebba441f38400060cefb
Parents: 3e71e59
Author: Dhiraj Bokde <dhira...@yahoo.com>
Authored: Mon Feb 16 14:34:21 2015 -0800
Committer: Dhiraj Bokde <dhira...@yahoo.com>
Committed: Mon Feb 16 15:13:55 2015 -0800

----------------------------------------------------------------------
 .../camel-olingo2/camel-olingo2-api/pom.xml     |  23 +-
 .../api/impl/AbstractFutureCallback.java        |  14 +-
 .../olingo2/api/impl/ODataPathSegmentImpl.java  |  58 ++++
 .../olingo2/api/impl/Olingo2AppImpl.java        | 156 ++++++-----
 .../olingo2/api/impl/SystemQueryOption.java     |  24 ++
 .../olingo2/api/impl/UriInfoWithType.java       | 269 +++++++++++++++++++
 .../component/olingo2/api/impl/UriType.java     | 131 +++++++++
 .../olingo2/api/Olingo2AppIntegrationTest.java  |   8 +-
 .../camel-olingo2-component/pom.xml             |  12 +
 .../component/olingo2/Olingo2Configuration.java |   4 +-
 .../olingo2/Olingo2AppIntegrationTest.java      |   2 +-
 11 files changed, 607 insertions(+), 94 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/48804216/components/camel-olingo2/camel-olingo2-api/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-olingo2/camel-olingo2-api/pom.xml 
b/components/camel-olingo2/camel-olingo2-api/pom.xml
index 4d66bfb..b98bb7d 100644
--- a/components/camel-olingo2/camel-olingo2-api/pom.xml
+++ b/components/camel-olingo2/camel-olingo2-api/pom.xml
@@ -41,17 +41,6 @@
       <version>${olingo2-version}</version>
     </dependency>
     <dependency>
-      <groupId>org.apache.olingo</groupId>
-      <artifactId>olingo-odata2-core</artifactId>
-      <version>${olingo2-version}</version>
-      <exclusions>
-        <exclusion>
-          <groupId>javax.ws.rs</groupId>
-          <artifactId>javax.ws.rs-api</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
       <groupId>org.apache.httpcomponents</groupId>
       <artifactId>httpasyncclient</artifactId>
       <version>${httpasyncclient-version}</version>  
@@ -75,6 +64,18 @@
 
     <!-- testing -->
     <dependency>
+      <groupId>org.apache.olingo</groupId>
+      <artifactId>olingo-odata2-core</artifactId>
+      <version>${olingo2-version}</version>
+      <scope>test</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>javax.ws.rs</groupId>
+          <artifactId>javax.ws.rs-api</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
       <groupId>org.apache.camel</groupId>
       <artifactId>camel-test</artifactId>
       <scope>test</scope>

http://git-wip-us.apache.org/repos/asf/camel/blob/48804216/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/AbstractFutureCallback.java
----------------------------------------------------------------------
diff --git 
a/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/AbstractFutureCallback.java
 
b/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/AbstractFutureCallback.java
index 04be21a..0f90d64 100644
--- 
a/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/AbstractFutureCallback.java
+++ 
b/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/AbstractFutureCallback.java
@@ -17,19 +17,20 @@
 package org.apache.camel.component.olingo2.api.impl;
 
 import java.io.IOException;
+import java.util.regex.Pattern;
 
 import org.apache.camel.component.olingo2.api.Olingo2ResponseHandler;
 import org.apache.http.HttpHeaders;
 import org.apache.http.HttpResponse;
 import org.apache.http.StatusLine;
 import org.apache.http.concurrent.FutureCallback;
+import org.apache.http.entity.ContentType;
 import org.apache.olingo.odata2.api.commons.HttpStatusCodes;
 import org.apache.olingo.odata2.api.ep.EntityProvider;
 import org.apache.olingo.odata2.api.ep.EntityProviderException;
 import org.apache.olingo.odata2.api.exception.ODataApplicationException;
 import org.apache.olingo.odata2.api.exception.ODataException;
 import org.apache.olingo.odata2.api.processor.ODataErrorContext;
-import org.apache.olingo.odata2.core.commons.ContentType;
 
 /**
 * Helper implementation of {@link org.apache.http.concurrent.FutureCallback}
@@ -37,6 +38,7 @@ import org.apache.olingo.odata2.core.commons.ContentType;
 */
 public abstract class AbstractFutureCallback<T> implements 
FutureCallback<HttpResponse> {
 
+    public static final Pattern ODATA_MIME_TYPE = 
Pattern.compile("application/((atom)|(json)|(xml)).*");
     private final Olingo2ResponseHandler<T> responseHandler;
 
     AbstractFutureCallback(Olingo2ResponseHandler<T> responseHandler) {
@@ -49,21 +51,17 @@ public abstract class AbstractFutureCallback<T> implements 
FutureCallback<HttpRe
         if (400 <= httpStatusCode.getStatusCode() && 
httpStatusCode.getStatusCode() <= 599) {
             if (response.getEntity() != null) {
                 try {
-                    final ContentType responseContentType = ContentType.create(
+                    final ContentType responseContentType = ContentType.parse(
                         
response.getFirstHeader(HttpHeaders.CONTENT_TYPE).getValue());
 
-                    switch (responseContentType.getODataFormat()) {
-                    case ATOM:
-                    case XML:
-                    case JSON:
+                    final String mimeType = responseContentType.getMimeType();
+                    if (ODATA_MIME_TYPE.matcher(mimeType).matches()) {
                         final ODataErrorContext errorContext = 
EntityProvider.readErrorDocument(
                             response.getEntity().getContent(),
                             responseContentType.toString());
                         throw new 
ODataApplicationException(errorContext.getMessage(),
                             errorContext.getLocale(), httpStatusCode, 
errorContext.getErrorCode(),
                             errorContext.getException());
-                    default:
-                        // fall through to default exception with status line 
information
                     }
                 } catch (EntityProviderException e) {
                     throw new ODataApplicationException(e.getMessage(), 
response.getLocale(), httpStatusCode, e);

http://git-wip-us.apache.org/repos/asf/camel/blob/48804216/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/ODataPathSegmentImpl.java
----------------------------------------------------------------------
diff --git 
a/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/ODataPathSegmentImpl.java
 
b/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/ODataPathSegmentImpl.java
new file mode 100644
index 0000000..f00b969
--- /dev/null
+++ 
b/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/ODataPathSegmentImpl.java
@@ -0,0 +1,58 @@
+/**
+ * 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.camel.component.olingo2.api.impl;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.olingo.odata2.api.uri.PathSegment;
+
+/**
+ * Copied from Olingo2 library, since URI parsing wasn't made a part of it's 
public API.
+ */
+public class ODataPathSegmentImpl implements PathSegment {
+
+    private String path;
+    private Map<String, List<String>> matrixParameter;
+
+    public ODataPathSegmentImpl(final String path, final Map<String, 
List<String>> matrixParameters) {
+        this.path = path;
+
+        Map<String, List<String>> unmodifiableMap = new HashMap<String, 
List<String>>();
+        if (matrixParameters != null) {
+            for (String key : matrixParameters.keySet()) {
+                List<String> values = 
Collections.unmodifiableList(matrixParameters.get(key));
+                unmodifiableMap.put(key, values);
+            }
+        }
+
+        matrixParameter = Collections.unmodifiableMap(unmodifiableMap);
+    }
+
+    @Override
+    public String getPath() {
+        return path;
+    }
+
+    @Override
+    public Map<String, List<String>> getMatrixParameters() {
+        return matrixParameter;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/48804216/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/Olingo2AppImpl.java
----------------------------------------------------------------------
diff --git 
a/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/Olingo2AppImpl.java
 
b/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/Olingo2AppImpl.java
index 78ce007..b4e7bb7 100644
--- 
a/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/Olingo2AppImpl.java
+++ 
b/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/Olingo2AppImpl.java
@@ -22,6 +22,7 @@ import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
 import java.net.URI;
 import java.net.URISyntaxException;
+import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -39,6 +40,8 @@ import 
org.apache.camel.component.olingo2.api.batch.Olingo2BatchQueryRequest;
 import org.apache.camel.component.olingo2.api.batch.Olingo2BatchRequest;
 import org.apache.camel.component.olingo2.api.batch.Olingo2BatchResponse;
 import org.apache.camel.component.olingo2.api.batch.Operation;
+import org.apache.http.Consts;
+import org.apache.http.Header;
 import org.apache.http.HttpHeaders;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpVersion;
@@ -51,6 +54,7 @@ import org.apache.http.client.methods.HttpPost;
 import org.apache.http.client.methods.HttpPut;
 import org.apache.http.client.methods.HttpUriRequest;
 import org.apache.http.concurrent.FutureCallback;
+import org.apache.http.entity.ContentType;
 import org.apache.http.entity.InputStreamEntity;
 import org.apache.http.entity.StringEntity;
 import org.apache.http.impl.nio.client.CloseableHttpAsyncClient;
@@ -82,30 +86,30 @@ import 
org.apache.olingo.odata2.api.exception.ODataException;
 import org.apache.olingo.odata2.api.processor.ODataResponse;
 import org.apache.olingo.odata2.api.uri.PathSegment;
 import org.apache.olingo.odata2.api.uri.UriParser;
-import org.apache.olingo.odata2.core.ODataPathSegmentImpl;
-import org.apache.olingo.odata2.core.commons.ContentType;
-import org.apache.olingo.odata2.core.uri.UriInfoImpl;
 
 /**
  * Application API used by Olingo2 Component.
  */
 public final class Olingo2AppImpl implements Olingo2App {
 
-    public static final ContentType APPLICATION_FORM_URL_ENCODED = 
ContentType.create("application", "x-www-form-urlencoded");
-
     public static final String METADATA = "$metadata";
 
     private static final String SEPARATOR = "/";
 
     private static final String BOUNDARY_PREFIX = "batch_";
-    private static final String BOUNDARY_PARAMETER = "boundary";
+    private static final String BOUNDARY_PARAMETER = "; boundary=";
+
+    private static final ContentType METADATA_CONTENT_TYPE =
+        ContentType.create("application/xml", Consts.UTF_8);
+    private static final ContentType SERVICE_DOCUMENT_CONTENT_TYPE =
+        ContentType.create("application/atomsvc+xml", Consts.UTF_8);
+    private static final String BATCH_CONTENT_TYPE =
+        ContentType.create("multipart/mixed").toString();
 
-    private static final ContentType METADATA_CONTENT_TYPE = 
ContentType.APPLICATION_XML_CS_UTF_8;
-    private static final ContentType SERVICE_DOCUMENT_CONTENT_TYPE = 
ContentType.APPLICATION_ATOM_SVC_CS_UTF_8;
-    private static final ContentType BATCH_CONTENT_TYPE =
-        
ContentType.MULTIPART_MIXED.receiveWithCharsetParameter(ContentType.CHARSET_UTF_8);
     private static final String BATCH = "$batch";
     private static final String MAX_DATA_SERVICE_VERSION = "Max" + 
ODataHttpHeaders.DATASERVICEVERSION;
+    private static final String MULTIPART_MIME_TYPE = "multipart/";
+    private static final ContentType TEXT_PLAIN_WITH_CS_UTF_8 = 
ContentType.TEXT_PLAIN.withCharset(Consts.UTF_8);
 
     private final CloseableHttpAsyncClient client;
 
@@ -135,7 +139,7 @@ public final class Olingo2AppImpl implements Olingo2App {
             this.client = builder.build();
         }
         this.client.start();
-        this.contentType = ContentType.APPLICATION_JSON_CS_UTF_8;
+        this.contentType = ContentType.create("application/json", 
Consts.UTF_8);
     }
 
     @Override
@@ -181,7 +185,7 @@ public final class Olingo2AppImpl implements Olingo2App {
     public <T> void read(final Edm edm, final String resourcePath, final 
Map<String, String> queryParams,
                          final Olingo2ResponseHandler<T> responseHandler) {
 
-        final UriInfoImpl uriInfo = parseUri(edm, resourcePath, queryParams);
+        final UriInfoWithType uriInfo = parseUri(edm, resourcePath, 
queryParams);
 
         execute(new HttpGet(createUri(resourcePath, queryParams)), 
getResourceContentType(uriInfo),
             new AbstractFutureCallback<T>(responseHandler) {
@@ -197,7 +201,7 @@ public final class Olingo2AppImpl implements Olingo2App {
             });
     }
 
-    private ContentType getResourceContentType(UriInfoImpl uriInfo) {
+    private ContentType getResourceContentType(UriInfoWithType uriInfo) {
         ContentType resourceContentType;
         switch (uriInfo.getUriType()) {
         case URI0:
@@ -213,7 +217,7 @@ public final class Olingo2AppImpl implements Olingo2App {
             // is it a $value URI??
             if (uriInfo.isValue()) {
                 // property value and $count
-                resourceContentType = ContentType.TEXT_PLAIN_CS_UTF_8;
+                resourceContentType = TEXT_PLAIN_WITH_CS_UTF_8;
             } else {
                 resourceContentType = contentType;
             }
@@ -223,7 +227,7 @@ public final class Olingo2AppImpl implements Olingo2App {
         case URI50A:
         case URI50B:
             // $count
-            resourceContentType = ContentType.TEXT_PLAIN_CS_UTF_8;
+            resourceContentType = TEXT_PLAIN_WITH_CS_UTF_8;
             break;
         default:
             resourceContentType = contentType;
@@ -233,35 +237,35 @@ public final class Olingo2AppImpl implements Olingo2App {
 
     @Override
     public <T> void create(Edm edm, String resourcePath, Object data, 
Olingo2ResponseHandler<T> responseHandler) {
-        final UriInfoImpl uriInfo = parseUri(edm, resourcePath, null);
+        final UriInfoWithType uriInfo = parseUri(edm, resourcePath, null);
 
         writeContent(edm, new HttpPost(createUri(resourcePath, null)), 
uriInfo, data, responseHandler);
     }
 
     @Override
     public <T> void update(Edm edm, String resourcePath, Object data, 
Olingo2ResponseHandler<T> responseHandler) {
-        final UriInfoImpl uriInfo = parseUri(edm, resourcePath, null);
+        final UriInfoWithType uriInfo = parseUri(edm, resourcePath, null);
 
         writeContent(edm, new HttpPut(createUri(resourcePath, null)), uriInfo, 
data, responseHandler);
     }
 
     @Override
     public <T> void patch(Edm edm, String resourcePath, Object data, 
Olingo2ResponseHandler<T> responseHandler) {
-        final UriInfoImpl uriInfo = parseUri(edm, resourcePath, null);
+        final UriInfoWithType uriInfo = parseUri(edm, resourcePath, null);
 
         writeContent(edm, new HttpPatch(createUri(resourcePath, null)), 
uriInfo, data, responseHandler);
     }
 
     @Override
     public <T> void merge(Edm edm, String resourcePath, Object data, 
Olingo2ResponseHandler<T> responseHandler) {
-        final UriInfoImpl uriInfo = parseUri(edm, resourcePath, null);
+        final UriInfoWithType uriInfo = parseUri(edm, resourcePath, null);
 
         writeContent(edm, new HttpMerge(createUri(resourcePath, null)), 
uriInfo, data, responseHandler);
     }
 
     @Override
     public void batch(Edm edm, Object data, 
Olingo2ResponseHandler<List<Olingo2BatchResponse>> responseHandler) {
-        final UriInfoImpl uriInfo = parseUri(edm, BATCH, null);
+        final UriInfoWithType uriInfo = parseUri(edm, BATCH, null);
 
         writeContent(edm, new HttpPost(createUri(BATCH, null)), uriInfo, data, 
responseHandler);
     }
@@ -279,7 +283,7 @@ public final class Olingo2AppImpl implements Olingo2App {
             });
     }
 
-    private <T> void readContent(UriInfoImpl uriInfo, InputStream content, 
Olingo2ResponseHandler<T> responseHandler) {
+    private <T> void readContent(UriInfoWithType uriInfo, InputStream content, 
Olingo2ResponseHandler<T> responseHandler) {
         try {
             responseHandler.onResponse(this.<T>readContent(uriInfo, content));
         } catch (EntityProviderException e) {
@@ -290,7 +294,7 @@ public final class Olingo2AppImpl implements Olingo2App {
     }
 
     @SuppressWarnings("unchecked")
-    private <T> T readContent(UriInfoImpl uriInfo, InputStream content)
+    private <T> T readContent(UriInfoWithType uriInfo, InputStream content)
         throws EntityProviderException, ODataApplicationException {
         T response;
         switch (uriInfo.getUriType()) {
@@ -340,12 +344,8 @@ public final class Olingo2AppImpl implements Olingo2App {
         case URI50A:
         case URI50B:
             // $count
-            try {
-                final String stringCount = new 
String(EntityProvider.readBinary(content), ContentType.CHARSET_UTF_8);
-                response = (T) Long.valueOf(stringCount);
-            } catch (UnsupportedEncodingException e) {
-                throw new 
EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED, e);
-            }
+            final String stringCount = new 
String(EntityProvider.readBinary(content), Consts.UTF_8);
+            response = (T) Long.valueOf(stringCount);
             break;
 
         case URI1:
@@ -383,7 +383,7 @@ public final class Olingo2AppImpl implements Olingo2App {
     }
 
     private <T> void writeContent(final Edm edm, 
HttpEntityEnclosingRequestBase httpEntityRequest,
-                                  final UriInfoImpl uriInfo, final Object 
content,
+                                  final UriInfoWithType uriInfo, final Object 
content,
                                   final Olingo2ResponseHandler<T> 
responseHandler) {
 
         try {
@@ -407,7 +407,10 @@ public final class Olingo2AppImpl implements Olingo2App {
             }
 
             // execute HTTP request
-            execute(httpEntityRequest, contentType, new 
AbstractFutureCallback<T>(responseHandler) {
+            final Header requestContentTypeHeader = 
httpEntityRequest.getFirstHeader(HttpHeaders.CONTENT_TYPE);
+            final ContentType requestContentType = requestContentTypeHeader != 
null
+                ? ContentType.parse(requestContentTypeHeader.getValue()) : 
contentType;
+            execute(httpEntityRequest, requestContentType, new 
AbstractFutureCallback<T>(responseHandler) {
                 @SuppressWarnings("unchecked")
                 @Override
                 public void onCompleted(HttpResponse result)
@@ -441,9 +444,9 @@ public final class Olingo2AppImpl implements Olingo2App {
                                 final Olingo2BatchRequest request = 
iterator.next();
 
                                 if (request instanceof 
Olingo2BatchChangeRequest
-                                    && 
((Olingo2BatchChangeRequest)request).getContentId() != null) {
+                                    && ((Olingo2BatchChangeRequest) 
request).getContentId() != null) {
 
-                                    contentIdLocationMap.put("$" + 
((Olingo2BatchChangeRequest)request).getContentId(),
+                                    contentIdLocationMap.put("$" + 
((Olingo2BatchChangeRequest) request).getContentId(),
                                         
response.getHeader(HttpHeaders.LOCATION));
                                 }
 
@@ -485,32 +488,32 @@ public final class Olingo2AppImpl implements Olingo2App {
                             // get the response content as Map<String, Object>
                             final List<EdmProperty> complexPropertyPath = 
uriInfo.getPropertyPath();
                             final EdmProperty complexProperty = 
complexPropertyPath.get(complexPropertyPath.size() - 1);
-                            
responseHandler.onResponse((T)EntityProvider.readProperty(getContentType(),
-                                                                               
       complexProperty, result
-                                                                               
           .getEntity()
-                                                                               
           .getContent(),
-                                                                               
       EntityProviderReadProperties
-                                                                               
           .init().build()));
+                            responseHandler.onResponse((T) 
EntityProvider.readProperty(getContentType(),
+                                complexProperty, result
+                                    .getEntity()
+                                    .getContent(),
+                                EntityProviderReadProperties
+                                    .init().build()));
                             break;
 
                         case URI7A:
                             // $links with 0..1 cardinality property
                             // get the response content as String
                             final EdmEntitySet targetLinkEntitySet = 
uriInfo.getTargetEntitySet();
-                            
responseHandler.onResponse((T)EntityProvider.readLink(getContentType(),
-                                                                               
   targetLinkEntitySet, result
-                                                                               
       .getEntity()
-                                                                               
       .getContent()));
+                            responseHandler.onResponse((T) 
EntityProvider.readLink(getContentType(),
+                                targetLinkEntitySet, result
+                                    .getEntity()
+                                    .getContent()));
                             break;
 
                         case URI7B:
                             // $links with * cardinality property
                             // get the response content as 
java.util.List<String>
                             final EdmEntitySet targetLinksEntitySet = 
uriInfo.getTargetEntitySet();
-                            
responseHandler.onResponse((T)EntityProvider.readLinks(getContentType(),
-                                                                               
    targetLinksEntitySet,
-                                                                               
    result.getEntity()
-                                                                               
        .getContent()));
+                            responseHandler.onResponse((T) 
EntityProvider.readLinks(getContentType(),
+                                targetLinksEntitySet,
+                                result.getEntity()
+                                    .getContent()));
                             break;
 
                         case URI1:
@@ -544,7 +547,7 @@ public final class Olingo2AppImpl implements Olingo2App {
         }
     }
 
-    private ODataResponse writeContent(Edm edm, UriInfoImpl uriInfo, Object 
content)
+    private ODataResponse writeContent(Edm edm, UriInfoWithType uriInfo, 
Object content)
         throws ODataApplicationException, EdmException, 
EntityProviderException, URISyntaxException, IOException {
 
         String responseContentType = getContentType();
@@ -559,7 +562,7 @@ public final class Olingo2AppImpl implements Olingo2App {
             responseContentType = simpleProperty.getMimeType();
             if (uriInfo.isValue()) {
                 response = EntityProvider.writePropertyValue(simpleProperty, 
content);
-                responseContentType = 
ContentType.TEXT_PLAIN_CS_UTF_8.toString();
+                responseContentType = TEXT_PLAIN_WITH_CS_UTF_8.toString();
             } else {
                 response = EntityProvider.writeProperty(getContentType(), 
simpleProperty, content);
             }
@@ -643,7 +646,7 @@ public final class Olingo2AppImpl implements Olingo2App {
                 }
 
                 // add to request parts
-                final UriInfoImpl uriInfo = parseUri(edm, 
batchPart.getResourcePath(), null);
+                final UriInfoWithType uriInfo = parseUri(edm, 
batchPart.getResourcePath(), null);
                 parts.add(createBatchQueryPart(uriInfo, 
(Olingo2BatchQueryRequest) batchPart));
 
             } else {
@@ -665,11 +668,11 @@ public final class Olingo2AppImpl implements Olingo2App {
         // add two blank lines before all --batch boundaries
         // otherwise Olingo2 EntityProvider parser barfs in the server!!!
         final byte[] bytes = EntityProvider.readBinary(batchRequest);
-        final String batchRequestBody = new String(bytes, 
ContentType.CHARSET_UTF_8);
+        final String batchRequestBody = new String(bytes, Consts.UTF_8);
         batchRequest = new ByteArrayInputStream(batchRequestBody.replaceAll(
-            "--(batch_)", "\r\n\r\n--$1").getBytes(ContentType.CHARSET_UTF_8));
+            "--(batch_)", "\r\n\r\n--$1").getBytes(Consts.UTF_8));
 
-        final String contentHeader = ContentType.create(BATCH_CONTENT_TYPE, 
BOUNDARY_PARAMETER, boundary).toString();
+        final String contentHeader = BATCH_CONTENT_TYPE + BOUNDARY_PARAMETER + 
boundary;
         return 
ODataResponse.entity(batchRequest).contentHeader(contentHeader).build();
     }
 
@@ -692,7 +695,7 @@ public final class Olingo2AppImpl implements Olingo2App {
             resourcePath = replaceContentId(edm, resourcePath, contentIdMap);
         }
 
-        final UriInfoImpl uriInfo = parseUri(edm, resourcePath, null);
+        final UriInfoWithType uriInfo = parseUri(edm, resourcePath, null);
 
         // serialize data into ODataResponse object, if set in request and 
this is not a DELETE request
         final Map<String, String> headers = new HashMap<String, String>();
@@ -715,7 +718,8 @@ public final class Olingo2AppImpl implements Olingo2App {
             }
         }
 
-        headers.put(HttpHeaders.ACCEPT, 
getResourceContentType(uriInfo).toString());
+        // Olingo is sensitive to batch part charset case!!
+        headers.put(HttpHeaders.ACCEPT, 
getResourceContentType(uriInfo).toString().toLowerCase());
         if (!headers.containsKey(HttpHeaders.CONTENT_TYPE)) {
             headers.put(HttpHeaders.CONTENT_TYPE, getContentType());
         }
@@ -731,14 +735,15 @@ public final class Olingo2AppImpl implements Olingo2App {
             .method(batchRequest.getOperation().getHttpMethod())
             .contentId(contentId)
             .headers(headers)
-            .body(body == null ? null : new String(body, 
ContentType.CHARSET_UTF_8)).build();
+            .body(body == null ? null : new String(body, 
Consts.UTF_8)).build();
     }
 
-    private BatchQueryPart createBatchQueryPart(UriInfoImpl uriInfo, 
Olingo2BatchQueryRequest batchRequest) {
+    private BatchQueryPart createBatchQueryPart(UriInfoWithType uriInfo, 
Olingo2BatchQueryRequest batchRequest) {
 
         final Map<String, String> headers = new HashMap<String, 
String>(batchRequest.getHeaders());
         if (!headers.containsKey(HttpHeaders.ACCEPT)) {
-            headers.put(HttpHeaders.ACCEPT, 
getResourceContentType(uriInfo).toString());
+            // Olingo is sensitive to batch part charset case!!
+            headers.put(HttpHeaders.ACCEPT, 
getResourceContentType(uriInfo).toString().toLowerCase());
         }
 
         return BatchQueryPart.method("GET")
@@ -811,9 +816,9 @@ public final class Olingo2AppImpl implements Olingo2App {
         ByteArrayInputStream content = null;
         try {
             if (response.getBody() != null) {
-                final ContentType partContentType = ContentType.create(
-                    
headers.get(HttpHeaders.CONTENT_TYPE)).receiveWithCharsetParameter(ContentType.CHARSET_UTF_8);
-                final String charset = 
partContentType.getParameters().get(ContentType.PARAMETER_CHARSET);
+                final ContentType partContentType = 
receiveWithCharsetParameter(ContentType.parse(
+                    headers.get(HttpHeaders.CONTENT_TYPE)), Consts.UTF_8);
+                final String charset = partContentType.getCharset().toString();
 
                 final String body = response.getBody();
                 content = body != null ? new 
ByteArrayInputStream(body.getBytes(charset)) : null;
@@ -844,7 +849,7 @@ public final class Olingo2AppImpl implements Olingo2App {
         }
         final Map<String, String> resolvedQueryParams = request instanceof 
Olingo2BatchQueryRequest
             ? ((Olingo2BatchQueryRequest) request).getQueryParams() : null;
-        final UriInfoImpl uriInfo = parseUri(edm, resolvedResourcePath, 
resolvedQueryParams);
+        final UriInfoWithType uriInfo = parseUri(edm, resolvedResourcePath, 
resolvedQueryParams);
 
         // resolve response content
         final Object resolvedContent = content != null ? readContent(uriInfo, 
content) : null;
@@ -853,6 +858,18 @@ public final class Olingo2AppImpl implements Olingo2App {
             resolvedContent);
     }
 
+    private ContentType receiveWithCharsetParameter(ContentType contentType, 
Charset charset) {
+        if (contentType.getCharset() != null) {
+            return contentType;
+        }
+        final String mimeType = contentType.getMimeType();
+        if (mimeType.equals(ContentType.TEXT_PLAIN.getMimeType())
+            || 
AbstractFutureCallback.ODATA_MIME_TYPE.matcher(mimeType).matches()) {
+            return contentType.withCharset(charset);
+        }
+        return contentType;
+    }
+
     private String findLocation(String resourcePath, Map<String, String> 
contentIdLocationMap) {
         final int pathSeparator = resourcePath.indexOf('/');
         if (pathSeparator == -1) {
@@ -897,8 +914,8 @@ public final class Olingo2AppImpl implements Olingo2App {
         return absolutUri.toString();
     }
 
-    private static UriInfoImpl parseUri(Edm edm, String resourcePath, 
Map<String, String> queryParams) {
-        UriInfoImpl result;
+    private static UriInfoWithType parseUri(Edm edm, String resourcePath, 
Map<String, String> queryParams) {
+        UriInfoWithType result;
         try {
             final List<PathSegment> pathSegments = new 
ArrayList<PathSegment>();
             final String[] segments = new 
URI(resourcePath).getPath().split(SEPARATOR);
@@ -932,7 +949,7 @@ public final class Olingo2AppImpl implements Olingo2App {
                     pathSegments.add(new ODataPathSegmentImpl(segment, 
matrixParams));
                 }
             }
-            result = (UriInfoImpl) UriParser.parse(edm, pathSegments, 
queryParams);
+            result = new UriInfoWithType(UriParser.parse(edm, pathSegments, 
queryParams), resourcePath);
         } catch (URISyntaxException e) {
             throw new IllegalArgumentException("resourcePath: " + 
e.getMessage(), e);
         } catch (ODataException e) {
@@ -942,19 +959,22 @@ public final class Olingo2AppImpl implements Olingo2App {
         return result;
     }
 
-    // public for unit test, not to be used otherwise
+    /**
+     * public for unit test, not to be used otherwise
+     */
     public void execute(HttpUriRequest httpUriRequest, ContentType contentType,
                         FutureCallback<HttpResponse> callback) {
 
         // add accept header when its not a form or multipart
         final String contentTypeString = contentType.toString();
-        if (!APPLICATION_FORM_URL_ENCODED.equals(contentType)
-            && 
!contentType.getType().equals(ContentType.MULTIPART_MIXED.getType())) {
+        if 
(!ContentType.APPLICATION_FORM_URLENCODED.getMimeType().equals(contentType.getMimeType())
+            && !contentType.getMimeType().startsWith(MULTIPART_MIME_TYPE)) {
             // otherwise accept what is being sent
             httpUriRequest.addHeader(HttpHeaders.ACCEPT, contentTypeString);
         }
         // is something being sent?
-        if (httpUriRequest instanceof HttpEntityEnclosingRequestBase) {
+        if (httpUriRequest instanceof HttpEntityEnclosingRequestBase
+            && httpUriRequest.getFirstHeader(HttpHeaders.CONTENT_TYPE) == 
null) {
             httpUriRequest.addHeader(HttpHeaders.CONTENT_TYPE, 
contentTypeString);
         }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/48804216/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/SystemQueryOption.java
----------------------------------------------------------------------
diff --git 
a/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/SystemQueryOption.java
 
b/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/SystemQueryOption.java
new file mode 100644
index 0000000..6b6c1ac
--- /dev/null
+++ 
b/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/SystemQueryOption.java
@@ -0,0 +1,24 @@
+/**
+ * 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.camel.component.olingo2.api.impl;
+
+/**
+ * Copied from Olingo2 core package.
+ */
+public enum SystemQueryOption {
+  $format, $filter, $inlinecount, $orderby, $skiptoken, $skip, $top, $expand, 
$select;
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/48804216/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/UriInfoWithType.java
----------------------------------------------------------------------
diff --git 
a/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/UriInfoWithType.java
 
b/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/UriInfoWithType.java
new file mode 100644
index 0000000..64a74f6
--- /dev/null
+++ 
b/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/UriInfoWithType.java
@@ -0,0 +1,269 @@
+/**
+ * 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.camel.component.olingo2.api.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import org.apache.olingo.odata2.api.commons.InlineCount;
+import org.apache.olingo.odata2.api.edm.EdmEntityContainer;
+import org.apache.olingo.odata2.api.edm.EdmEntitySet;
+import org.apache.olingo.odata2.api.edm.EdmException;
+import org.apache.olingo.odata2.api.edm.EdmFunctionImport;
+import org.apache.olingo.odata2.api.edm.EdmLiteral;
+import org.apache.olingo.odata2.api.edm.EdmMultiplicity;
+import org.apache.olingo.odata2.api.edm.EdmProperty;
+import org.apache.olingo.odata2.api.edm.EdmType;
+import org.apache.olingo.odata2.api.edm.EdmTypeKind;
+import org.apache.olingo.odata2.api.exception.ODataApplicationException;
+import org.apache.olingo.odata2.api.uri.KeyPredicate;
+import org.apache.olingo.odata2.api.uri.NavigationPropertySegment;
+import org.apache.olingo.odata2.api.uri.NavigationSegment;
+import org.apache.olingo.odata2.api.uri.SelectItem;
+import org.apache.olingo.odata2.api.uri.UriInfo;
+import org.apache.olingo.odata2.api.uri.expression.FilterExpression;
+import org.apache.olingo.odata2.api.uri.expression.OrderByExpression;
+
+/**
+ * UriInfo with UriType information, determined in constructor.
+ */
+public class UriInfoWithType implements UriInfo {
+
+    private final UriInfo uriInfo;
+    private final UriType uriType;
+
+    public UriInfoWithType(UriInfo uriInfo, String resourcePath) throws 
ODataApplicationException, EdmException {
+        this.uriInfo = uriInfo;
+
+        // determine Uri Type
+        UriType uriType;
+        final List<NavigationSegment> segments = 
uriInfo.getNavigationSegments();
+        final boolean isLinks = uriInfo.isLinks();
+        if (segments.isEmpty() && uriInfo.getTargetType() == null) {
+            uriType = UriType.URI0;
+            if (resourcePath.endsWith("$metadata")) {
+                uriType = UriType.URI8;
+            } else if (resourcePath.endsWith("$batch")) {
+                uriType = UriType.URI9;
+            }
+        } else {
+            final EdmEntitySet targetEntitySet = uriInfo.getTargetEntitySet();
+            if (targetEntitySet != null) {
+                final boolean isCount = uriInfo.isCount();
+                final List<KeyPredicate> keyPredicates = 
uriInfo.getKeyPredicates();
+                if (keyPredicates.isEmpty()) {
+                    if (!isCount) {
+                        uriType = UriType.URI1;
+                    } else {
+                        uriType = UriType.URI15;
+                    }
+                } else {
+                    uriType = UriType.URI2;
+                    if (isCount) {
+                        uriType = UriType.URI16;
+                    } else if (uriInfo.isValue()) {
+                        uriType = UriType.URI17;
+                    }
+                    final EdmTypeKind targetKind = 
uriInfo.getTargetType().getKind();
+                    switch (targetKind) {
+                    case SIMPLE:
+                        if (segments.isEmpty()) {
+                            uriType = UriType.URI5;
+                        } else {
+                            uriType = UriType.URI4;
+                        }
+                        break;
+                    case COMPLEX:
+                        uriType = UriType.URI3;
+                        break;
+                    case ENTITY:
+                        final List<EdmProperty> propertyPath = 
uriInfo.getPropertyPath();
+                        if (!segments.isEmpty() || !propertyPath.isEmpty()) {
+                            boolean many = false;
+                            if (!propertyPath.isEmpty()) {
+                                final EdmProperty lastProperty = 
propertyPath.get(propertyPath.size() - 1);
+                                many = lastProperty.getMultiplicity() == 
EdmMultiplicity.MANY;
+                            } else {
+                                final NavigationSegment lastSegment = 
segments.get(segments.size() - 1);
+                                many = lastSegment.getKeyPredicates().isEmpty()
+                                    && 
lastSegment.getNavigationProperty().getMultiplicity() == EdmMultiplicity.MANY;
+                            }
+                            if (isCount) {
+                                if (many) {
+                                    uriType = isLinks ? UriType.URI50B : 
UriType.URI15;
+                                } else {
+                                    uriType = UriType.URI50A;
+                                }
+                            } else {
+                                if (many) {
+                                    uriType = isLinks ? UriType.URI7B : 
UriType.URI6B;
+                                } else {
+                                    uriType = isLinks ? UriType.URI7A : 
UriType.URI6A;
+                                }
+                            }
+                        }
+                        break;
+                    default:
+                        throw new ODataApplicationException("Unexpected 
property type " + targetKind,
+                            Locale.ENGLISH);
+                    }
+                }
+            } else {
+                final EdmFunctionImport functionImport = 
uriInfo.getFunctionImport();
+                final EdmType targetType = uriInfo.getTargetType();
+
+                final boolean isCollection = 
functionImport.getReturnType().getMultiplicity() == EdmMultiplicity.MANY;
+                switch (targetType.getKind()) {
+                case SIMPLE:
+                    uriType = isCollection ? UriType.URI13 : UriType.URI14;
+                    break;
+                case COMPLEX:
+                    uriType = isCollection ? UriType.URI11 : UriType.URI12;
+                    break;
+                case ENTITY:
+                    uriType = UriType.URI10;
+                    break;
+                default:
+                    throw new ODataApplicationException("Invalid function 
return type " + targetType,
+                        Locale.ENGLISH);
+                }
+            }
+        }
+        this.uriType = uriType;
+    }
+
+    public UriType getUriType() {
+        return uriType;
+    }
+
+    @Override
+    public EdmEntityContainer getEntityContainer() {
+        return uriInfo.getEntityContainer();
+    }
+
+    @Override
+    public EdmEntitySet getStartEntitySet() {
+        return uriInfo.getStartEntitySet();
+    }
+
+    @Override
+    public EdmEntitySet getTargetEntitySet() {
+        return uriInfo.getTargetEntitySet();
+    }
+
+    @Override
+    public EdmFunctionImport getFunctionImport() {
+        return uriInfo.getFunctionImport();
+    }
+
+    @Override
+    public EdmType getTargetType() {
+        return uriInfo.getTargetType();
+    }
+
+    @Override
+    public List<KeyPredicate> getKeyPredicates() {
+        return uriInfo.getKeyPredicates();
+    }
+
+    @Override
+    public List<KeyPredicate> getTargetKeyPredicates() {
+        return uriInfo.getTargetKeyPredicates();
+    }
+
+    @Override
+    public List<NavigationSegment> getNavigationSegments() {
+        return uriInfo.getNavigationSegments();
+    }
+
+    @Override
+    public List<EdmProperty> getPropertyPath() {
+        return uriInfo.getPropertyPath();
+    }
+
+    @Override
+    public boolean isCount() {
+        return uriInfo.isCount();
+    }
+
+    @Override
+    public boolean isValue() {
+        return uriInfo.isValue();
+    }
+
+    @Override
+    public boolean isLinks() {
+        return uriInfo.isLinks();
+    }
+
+    @Override
+    public String getFormat() {
+        return uriInfo.getFormat();
+    }
+
+    @Override
+    public FilterExpression getFilter() {
+        return uriInfo.getFilter();
+    }
+
+    @Override
+    public InlineCount getInlineCount() {
+        return uriInfo.getInlineCount();
+    }
+
+    @Override
+    public OrderByExpression getOrderBy() {
+        return uriInfo.getOrderBy();
+    }
+
+    @Override
+    public String getSkipToken() {
+        return uriInfo.getSkipToken();
+    }
+
+    @Override
+    public Integer getSkip() {
+        return uriInfo.getSkip();
+    }
+
+    @Override
+    public Integer getTop() {
+        return uriInfo.getTop();
+    }
+
+    @Override
+    public List<ArrayList<NavigationPropertySegment>> getExpand() {
+        return uriInfo.getExpand();
+    }
+
+    @Override
+    public List<SelectItem> getSelect() {
+        return uriInfo.getSelect();
+    }
+
+    @Override
+    public Map<String, EdmLiteral> getFunctionImportParameters() {
+        return uriInfo.getFunctionImportParameters();
+    }
+
+    @Override
+    public Map<String, String> getCustomQueryOptions() {
+        return uriInfo.getCustomQueryOptions();
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/48804216/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/UriType.java
----------------------------------------------------------------------
diff --git 
a/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/UriType.java
 
b/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/UriType.java
new file mode 100644
index 0000000..f2468a3
--- /dev/null
+++ 
b/components/camel-olingo2/camel-olingo2-api/src/main/java/org/apache/camel/component/olingo2/api/impl/UriType.java
@@ -0,0 +1,131 @@
+/**
+ * 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.camel.component.olingo2.api.impl;
+
+import java.util.ArrayList;
+
+/**
+ * Copied from Olingo2 core package.
+ */
+public enum UriType {
+    /**
+     * Service document
+     */
+    URI0(SystemQueryOption.$format),
+    /**
+     * Entity set
+     */
+    URI1(SystemQueryOption.$format, SystemQueryOption.$filter, 
SystemQueryOption.$inlinecount,
+        SystemQueryOption.$orderby, SystemQueryOption.$skiptoken, 
SystemQueryOption.$skip, SystemQueryOption.$top,
+        SystemQueryOption.$expand, SystemQueryOption.$select),
+    /**
+     * Entity set with key predicate
+     */
+    URI2(SystemQueryOption.$format, SystemQueryOption.$filter, 
SystemQueryOption.$expand, SystemQueryOption.$select),
+    /**
+     * Complex property of an entity
+     */
+    URI3(SystemQueryOption.$format),
+    /**
+     * Simple property of a complex property of an entity
+     */
+    URI4(SystemQueryOption.$format),
+    /**
+     * Simple property of an entity
+     */
+    URI5(SystemQueryOption.$format),
+    /**
+     * Navigation property of an entity with target multiplicity '1' or '0..1'
+     */
+    URI6A(SystemQueryOption.$format, SystemQueryOption.$filter, 
SystemQueryOption.$expand, SystemQueryOption.$select),
+    /**
+     * Navigation property of an entity with target multiplicity '*'
+     */
+    URI6B(SystemQueryOption.$format, SystemQueryOption.$filter, 
SystemQueryOption.$inlinecount,
+        SystemQueryOption.$orderby, SystemQueryOption.$skiptoken, 
SystemQueryOption.$skip, SystemQueryOption.$top,
+        SystemQueryOption.$expand, SystemQueryOption.$select),
+    /**
+     * Link to a single entity
+     */
+    URI7A(SystemQueryOption.$format, SystemQueryOption.$filter),
+    /**
+     * Link to multiple entities
+     */
+    URI7B(SystemQueryOption.$format, SystemQueryOption.$filter, 
SystemQueryOption.$inlinecount,
+        SystemQueryOption.$orderby, SystemQueryOption.$skiptoken, 
SystemQueryOption.$skip, SystemQueryOption.$top),
+    /**
+     * Metadata document
+     */
+    URI8(),
+    /**
+     * Batch request
+     */
+    URI9(),
+    /**
+     * Function import returning a single instance of an entity type
+     */
+    URI10(SystemQueryOption.$format),
+    /**
+     * Function import returning a collection of complex-type instances
+     */
+    URI11(SystemQueryOption.$format),
+    /**
+     * Function import returning a single instance of a complex type
+     */
+    URI12(SystemQueryOption.$format),
+    /**
+     * Function import returning a collection of primitive-type instances
+     */
+    URI13(SystemQueryOption.$format),
+    /**
+     * Function import returning a single instance of a primitive type
+     */
+    URI14(SystemQueryOption.$format),
+    /**
+     * Count of an entity set
+     */
+    URI15(SystemQueryOption.$filter, SystemQueryOption.$orderby, 
SystemQueryOption.$skip, SystemQueryOption.$top),
+    /**
+     * Count of a single entity
+     */
+    URI16(SystemQueryOption.$filter),
+    /**
+     * Media resource of an entity
+     */
+    URI17(SystemQueryOption.$format, SystemQueryOption.$filter),
+    /**
+     * Count of link to a single entity
+     */
+    URI50A(SystemQueryOption.$filter),
+    /**
+     * Count of links to multiple entities
+     */
+    URI50B(SystemQueryOption.$filter, SystemQueryOption.$orderby, 
SystemQueryOption.$skip, SystemQueryOption.$top);
+
+    private ArrayList<SystemQueryOption> whiteList = new 
ArrayList<SystemQueryOption>();
+
+    private UriType(final SystemQueryOption... compatibleQueryOptions) {
+        for (SystemQueryOption queryOption : compatibleQueryOptions) {
+            whiteList.add(queryOption);
+        }
+    }
+
+    public boolean isCompatible(final SystemQueryOption queryOption) {
+        return whiteList.contains(queryOption);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/48804216/components/camel-olingo2/camel-olingo2-api/src/test/java/org/apache/camel/component/olingo2/api/Olingo2AppIntegrationTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-olingo2/camel-olingo2-api/src/test/java/org/apache/camel/component/olingo2/api/Olingo2AppIntegrationTest.java
 
b/components/camel-olingo2/camel-olingo2-api/src/test/java/org/apache/camel/component/olingo2/api/Olingo2AppIntegrationTest.java
index f67e0b5..9c361ef 100644
--- 
a/components/camel-olingo2/camel-olingo2-api/src/test/java/org/apache/camel/component/olingo2/api/Olingo2AppIntegrationTest.java
+++ 
b/components/camel-olingo2/camel-olingo2-api/src/test/java/org/apache/camel/component/olingo2/api/Olingo2AppIntegrationTest.java
@@ -36,10 +36,12 @@ import 
org.apache.camel.component.olingo2.api.batch.Olingo2BatchResponse;
 import org.apache.camel.component.olingo2.api.batch.Operation;
 import org.apache.camel.component.olingo2.api.impl.AbstractFutureCallback;
 import org.apache.camel.component.olingo2.api.impl.Olingo2AppImpl;
+import org.apache.camel.component.olingo2.api.impl.SystemQueryOption;
 import org.apache.http.HttpResponse;
 import org.apache.http.client.methods.HttpPost;
 import org.apache.http.concurrent.FutureCallback;
 import org.apache.http.entity.ByteArrayEntity;
+import org.apache.http.entity.ContentType;
 import org.apache.olingo.odata2.api.commons.HttpStatusCodes;
 import org.apache.olingo.odata2.api.edm.Edm;
 import org.apache.olingo.odata2.api.edm.EdmEntitySetInfo;
@@ -49,8 +51,6 @@ import org.apache.olingo.odata2.api.ep.feed.ODataFeed;
 import org.apache.olingo.odata2.api.exception.ODataApplicationException;
 import org.apache.olingo.odata2.api.servicedocument.Collection;
 import org.apache.olingo.odata2.api.servicedocument.ServiceDocument;
-import org.apache.olingo.odata2.core.commons.ContentType;
-import org.apache.olingo.odata2.core.uri.SystemQueryOption;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -99,7 +99,7 @@ public class Olingo2AppIntegrationTest {
     private static final String TEST_SERVICE_URL = 
"http://localhost:8080/MyFormula.svc";;
     //    private static final String TEST_SERVICE_URL = 
"http://localhost:8080/cars-annotations-sample/MyFormula.svc";;
 //    private static final ContentType TEST_FORMAT = 
ContentType.APPLICATION_XML_CS_UTF_8;
-    private static final ContentType TEST_FORMAT = 
ContentType.APPLICATION_JSON_CS_UTF_8;
+    private static final ContentType TEST_FORMAT = 
ContentType.APPLICATION_JSON;
     private static final String INDEX = "/index.jsp";
     private static final Pattern LINK_PATTERN = 
Pattern.compile("[^(]+\\('([^']+)'\\)");
     private static final String ID_PROPERTY = "Id";
@@ -535,7 +535,7 @@ public class Olingo2AppIntegrationTest {
     private static void generateSampleData(String serviceUrl) throws 
IOException {
         final HttpPost httpUriRequest = new HttpPost(serviceUrl.substring(0, 
serviceUrl.lastIndexOf('/')) + INDEX);
         httpUriRequest.setEntity(new 
ByteArrayEntity(GEN_SAMPLE_DATA.getBytes()));
-        ((Olingo2AppImpl)olingoApp).execute(httpUriRequest, 
Olingo2AppImpl.APPLICATION_FORM_URL_ENCODED,
+        ((Olingo2AppImpl)olingoApp).execute(httpUriRequest, 
ContentType.APPLICATION_FORM_URLENCODED,
             new FutureCallback<HttpResponse>() {
                 @Override
                 public void completed(HttpResponse result) {

http://git-wip-us.apache.org/repos/asf/camel/blob/48804216/components/camel-olingo2/camel-olingo2-component/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-olingo2/camel-olingo2-component/pom.xml 
b/components/camel-olingo2/camel-olingo2-component/pom.xml
index f71ec2b..932bbfb 100644
--- a/components/camel-olingo2/camel-olingo2-component/pom.xml
+++ b/components/camel-olingo2/camel-olingo2-component/pom.xml
@@ -92,6 +92,18 @@
 
     <!-- testing -->
     <dependency>
+      <groupId>org.apache.olingo</groupId>
+      <artifactId>olingo-odata2-core</artifactId>
+      <version>${olingo2-version}</version>
+      <scope>test</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>javax.ws.rs</groupId>
+          <artifactId>javax.ws.rs-api</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
       <groupId>org.apache.camel</groupId>
       <artifactId>camel-test</artifactId>
       <scope>test</scope>

http://git-wip-us.apache.org/repos/asf/camel/blob/48804216/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Configuration.java
----------------------------------------------------------------------
diff --git 
a/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Configuration.java
 
b/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Configuration.java
index 2e2771f..80e1bcf 100644
--- 
a/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Configuration.java
+++ 
b/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Configuration.java
@@ -23,8 +23,8 @@ import org.apache.camel.spi.UriParams;
 import org.apache.camel.util.jsse.SSLContextParameters;
 import org.apache.commons.lang.builder.HashCodeBuilder;
 import org.apache.http.HttpHost;
+import org.apache.http.entity.ContentType;
 import org.apache.http.impl.nio.client.HttpAsyncClientBuilder;
-import org.apache.olingo.odata2.core.commons.ContentType;
 
 /**
  * Component configuration for Olingo2 component.
@@ -32,7 +32,7 @@ import org.apache.olingo.odata2.core.commons.ContentType;
 @UriParams
 public class Olingo2Configuration {
 
-    private static final String DEFAULT_CONTENT_TYPE = 
ContentType.APPLICATION_JSON_CS_UTF_8.toString();
+    private static final String DEFAULT_CONTENT_TYPE = 
ContentType.APPLICATION_JSON.toString();
     private static final int DEFAULT_TIMEOUT = 30 * 1000;
 
     @UriParam

http://git-wip-us.apache.org/repos/asf/camel/blob/48804216/components/camel-olingo2/camel-olingo2-component/src/test/java/org/apache/camel/component/olingo2/Olingo2AppIntegrationTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-olingo2/camel-olingo2-component/src/test/java/org/apache/camel/component/olingo2/Olingo2AppIntegrationTest.java
 
b/components/camel-olingo2/camel-olingo2-component/src/test/java/org/apache/camel/component/olingo2/Olingo2AppIntegrationTest.java
index 2b67d44..9015807 100644
--- 
a/components/camel-olingo2/camel-olingo2-component/src/test/java/org/apache/camel/component/olingo2/Olingo2AppIntegrationTest.java
+++ 
b/components/camel-olingo2/camel-olingo2-component/src/test/java/org/apache/camel/component/olingo2/Olingo2AppIntegrationTest.java
@@ -29,13 +29,13 @@ import 
org.apache.camel.component.olingo2.api.batch.Olingo2BatchRequest;
 import org.apache.camel.component.olingo2.api.batch.Olingo2BatchResponse;
 import org.apache.camel.component.olingo2.api.batch.Operation;
 import org.apache.camel.component.olingo2.api.impl.Olingo2AppImpl;
+import org.apache.camel.component.olingo2.api.impl.SystemQueryOption;
 import org.apache.camel.component.olingo2.internal.Olingo2Constants;
 import org.apache.olingo.odata2.api.commons.HttpStatusCodes;
 import org.apache.olingo.odata2.api.edm.Edm;
 import org.apache.olingo.odata2.api.ep.entry.ODataEntry;
 import org.apache.olingo.odata2.api.ep.feed.ODataFeed;
 import org.apache.olingo.odata2.api.servicedocument.ServiceDocument;
-import org.apache.olingo.odata2.core.uri.SystemQueryOption;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

Reply via email to