提交 50e0f6b8 编写于 作者: J Jesse Wilson

Merge pull request #636 from square/jw/break-app-engine-out

Break AppEngine support out of the core.
......@@ -34,6 +34,7 @@
<modules>
<module>retrofit</module>
<module>retrofit-appengine</module>
<module>retrofit-converters</module>
<module>retrofit-mock</module>
<module>samples</module>
......
<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.squareup.retrofit</groupId>
<artifactId>parent</artifactId>
<version>2.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>retrofit-appengine</artifactId>
<name>Retrofit AppEngine</name>
<dependencies>
<dependency>
<groupId>com.squareup.retrofit</groupId>
<artifactId>retrofit</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-1.0-sdk</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
// Copyright 2013 Square, Inc.
package retrofit;
import java.io.IOException;
import java.util.Map;
import retrofit.mime.MimeHelper;
import retrofit.mime.MultipartTypedOutput;
import retrofit.mime.TypedOutput;
import static org.assertj.core.api.Assertions.assertThat;
public final class TestingUtils {
public static TypedOutput createMultipart(Map<String, TypedOutput> parts) {
MultipartTypedOutput typedOutput = MimeHelper.newMultipart("foobarbaz");
for (Map.Entry<String, TypedOutput> part : parts.entrySet()) {
typedOutput.addPart(part.getKey(), part.getValue());
}
return typedOutput;
}
public static void assertBytes(byte[] bytes, String expected) throws IOException {
assertThat(new String(bytes, "UTF-8")).isEqualTo(expected);
}
}
// Copyright 2013 Square, Inc.
package retrofit.mime;
import java.util.List;
public class MimeHelper {
public static List<byte[]> getParts(MultipartTypedOutput output) {
try {
return output.getParts();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
public static MultipartTypedOutput newMultipart(String boundary) {
return new MultipartTypedOutput(boundary);
}
}
......@@ -39,11 +39,6 @@
<artifactId>rxjava</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-1.0-sdk</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>junit</groupId>
......
......@@ -24,7 +24,6 @@ import java.util.concurrent.ThreadFactory;
import retrofit.android.AndroidApacheClient;
import retrofit.android.AndroidLog;
import retrofit.android.MainThreadExecutor;
import retrofit.appengine.UrlFetchClient;
import retrofit.client.Client;
import retrofit.client.OkClient;
import retrofit.client.UrlConnectionClient;
......@@ -52,10 +51,6 @@ abstract class Platform {
} catch (ClassNotFoundException ignored) {
}
if (System.getProperty("com.google.appengine.runtime.version") != null) {
return new AppEngine();
}
return new Base();
}
......@@ -142,12 +137,6 @@ abstract class Platform {
}
}
private static class AppEngine extends Base {
@Override Client defaultClient() {
return new UrlFetchClient();
}
}
/** Determine whether or not OkHttp 1.6 or newer is present on the runtime classpath. */
private static boolean hasOkHttpOnClasspath() {
boolean okUrlFactory = false;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册