[OLINGO-260] Adding Android support for proxy

This commit is contained in:
Francesco Chicchiriccò 2014-05-20 14:06:24 +02:00
parent 62dad25095
commit 7d6c587c7b
5 changed files with 109 additions and 18 deletions

View File

@ -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>

View File

@ -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");
}

View File

@ -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>

View File

@ -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");

View File

@ -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;
}