You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by sk...@apache.org on 2014/05/22 12:35:45 UTC

[02/19] git commit: [OLINGO-260] Adding Android support for proxy

[OLINGO-260] Adding Android support for proxy


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

Branch: refs/heads/olingo-266-tecsvc
Commit: 7d6c587c7bc45303ef1ceaa67565ae7767220904
Parents: 62dad25
Author: Francesco Chicchiriccò <--global>
Authored: Tue May 20 14:06:24 2014 +0200
Committer: Francesco Chicchiriccò <--global>
Committed: Tue May 20 14:06:24 2014 +0200

----------------------------------------------------------------------
 ext/client-proxy-android/pom.xml                | 96 ++++++++++++++++++++
 .../olingo/ext/proxy/commons/ContainerImpl.java |  5 +-
 ext/pom.xml                                     |  1 +
 .../fit/proxy/v4/EntityCreateTestITCase.java    |  2 +-
 .../apache/olingo/fit/v4/BatchTestITCase.java   | 23 ++---
 5 files changed, 109 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/7d6c587c/ext/client-proxy-android/pom.xml
----------------------------------------------------------------------
diff --git a/ext/client-proxy-android/pom.xml b/ext/client-proxy-android/pom.xml
new file mode 100644
index 0000000..dc484ae
--- /dev/null
+++ b/ext/client-proxy-android/pom.xml
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <artifactId>olingo-client-proxy-android</artifactId>
+  <packaging>jar</packaging>
+  <name>${project.artifactId}</name>
+
+  <parent>
+    <groupId>org.apache.olingo</groupId>
+    <artifactId>olingo-ext</artifactId>
+    <version>0.1.0-SNAPSHOT</version>
+    <relativePath>..</relativePath>
+  </parent>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.olingo</groupId>
+      <artifactId>olingo-client-proxy</artifactId>
+      <version>${project.version}</version>
+      <optional>true</optional>
+    </dependency>
+  </dependencies>
+  
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.sonatype.plugins</groupId>
+        <artifactId>jarjar-maven-plugin</artifactId>
+        <inherited>true</inherited>
+        <executions>
+          <execution>
+            <phase>package</phase>
+            <goals>
+              <goal>jarjar</goal>
+            </goals>
+            <configuration>
+              <includes>
+                <include>org.apache.olingo:olingo-client-proxy-android</include>
+                <include>org.apache.olingo:olingo-client-proxy</include>
+                <include>org.apache.olingo:olingo-client-core-android</include>
+                <include>org.apache.olingo:olingo-client-core</include>
+                <include>org.apache.olingo:olingo-client-api</include>
+                <include>org.apache.olingo:olingo-commons-api</include>
+                <include>org.apache.commons:commons-lang3</include>
+                <include>org.slf4j:slf4j-api</include>
+                <include>commons-io:commons-io</include>
+                <include>commons-beanutils:commons-beanutils-core</include>
+                <include>org.apache.httpcomponents:httpclient</include>
+                <include>org.apache.httpcomponents:httpcore</include>
+                <include>commons-logging:commons-logging</include>
+                <include>org.apache.olingo:olingo-commons-core</include>
+                <include>commons-codec:commons-codec</include>
+                <include>com.fasterxml.jackson.core:jackson-core</include>
+                <include>com.fasterxml.jackson.core:jackson-databind</include>
+                <include>com.fasterxml.jackson.core:jackson-annotations</include>
+                <include>com.fasterxml.jackson.dataformat:jackson-dataformat-xml</include>
+                <include>com.fasterxml.jackson.module:jackson-module-jaxb-annotations</include>
+                <include>org.codehaus.woodstox:stax2-api</include>
+                <include>javax.xml.stream:stax-api</include>
+                <include>com.fasterxml:aalto-xml</include>
+              </includes>
+              <rules>
+                <rule>
+                  <pattern>javax.xml.stream.**</pattern>
+                  <result>org.apache.olingo.javax.xml.stream.@1</result>
+                </rule>
+              </rules>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/7d6c587c/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ContainerImpl.java
----------------------------------------------------------------------
diff --git a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ContainerImpl.java b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ContainerImpl.java
index a5aa6b3..675e104 100644
--- a/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ContainerImpl.java
+++ b/ext/client-proxy/src/main/java/org/apache/olingo/ext/proxy/commons/ContainerImpl.java
@@ -113,8 +113,9 @@ class ContainerImpl implements Container {
 
     final ODataBatchResponse response = streamManager.getResponse();
 
-    if ((client.getServiceVersion().compareTo(ODataServiceVersion.V30) <= 0 && response.getStatusCode() != 202)
-            || (client.getServiceVersion().compareTo(ODataServiceVersion.V30) > 0 && response.getStatusCode() != 200)) {
+    // This should be 202 for service version <= 3.0 and 200 for service version >= 4.0 but it seems that
+    // many service implementations are not fully compliant with this respect.
+    if (response.getStatusCode() != 202 && response.getStatusCode() != 200) {
       throw new IllegalStateException("Operation failed");
     }
 

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/7d6c587c/ext/pom.xml
----------------------------------------------------------------------
diff --git a/ext/pom.xml b/ext/pom.xml
index c2667ae..991a936 100644
--- a/ext/pom.xml
+++ b/ext/pom.xml
@@ -39,5 +39,6 @@
     <module>client-core-android</module>
     <module>pojogen-maven-plugin</module>
     <module>client-proxy</module>
+    <module>client-proxy-android</module>
   </modules>
 </project>

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/7d6c587c/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntityCreateTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntityCreateTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntityCreateTestITCase.java
index aee3127..52cbe51 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntityCreateTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/EntityCreateTestITCase.java
@@ -71,7 +71,7 @@ public class EntityCreateTestITCase extends AbstractTestITCase {
     date.clear();
     date.set(2011, 3, 4, 9, 0, 0);
     employee.setDateHired(date);
-    Address homeAddress = employee.factory().newHomeAddress();
+    final Address homeAddress = employee.factory().newHomeAddress();
     homeAddress.setCity("Pescara");
     homeAddress.setPostalCode("65100");
     homeAddress.setStreet("viale Gabriele D'Annunzio 256");

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/7d6c587c/fit/src/test/java/org/apache/olingo/fit/v4/BatchTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/BatchTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/BatchTestITCase.java
index 0cf694c..e4dc769 100644
--- a/fit/src/test/java/org/apache/olingo/fit/v4/BatchTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/v4/BatchTestITCase.java
@@ -79,13 +79,6 @@ public class BatchTestITCase extends AbstractTestITCase {
 
   private static final int MAX = 10000;
 
-  // ------------------------
-  // Uncomment to check externally ...
-  // ------------------------
-  // private final static String testStaticServiceRootURL= 
-  //                  "http://odatae2etest.azurewebsites.net/javatest/DefaultService/";
-  // private final static String ACCEPT = ContentType.MULTIPART_MIXED;
-  // ------------------------
   private final static String ACCEPT = ContentType.APPLICATION_OCTET_STREAM;
 
   @Test
@@ -274,13 +267,13 @@ public class BatchTestITCase extends AbstractTestITCase {
             "OrderDetails",
             client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("OrderDetails").
             appendKeySegment(new HashMap<String, Object>() {
-      private static final long serialVersionUID = 3109256773218160485L;
+              private static final long serialVersionUID = 3109256773218160485L;
 
-      {
-        put("OrderID", 7);
-        put("ProductID", 5);
-      }
-    }).build()));
+              {
+                put("OrderID", 7);
+                put("ProductID", 5);
+              }
+            }).build()));
 
     final ODataEntityUpdateRequest<ODataEntity> updateReq = client.getCUDRequestFactory().getEntityUpdateRequest(
             URI.create("$" + createRequestRef), UpdateType.PATCH, customerChanges);
@@ -702,8 +695,8 @@ public class BatchTestITCase extends AbstractTestITCase {
             setType(EdmPrimitiveTypeKind.Duration).setText("PT0.0000002S").build()));
     order.getProperties().add(getClient().getObjectFactory().newCollectionProperty("OrderShelfLifes",
             getClient().getObjectFactory().newCollectionValue(EdmPrimitiveTypeKind.Duration.name()).add(
-            getClient().getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Duration).
-            setText("PT0.0000002S").build())));
+                    getClient().getObjectFactory().newPrimitiveValueBuilder().setType(EdmPrimitiveTypeKind.Duration).
+                    setText("PT0.0000002S").build())));
 
     return order;
   }