Bug 1242284 - Pre: Remove no longer required Maven repository; bump test-only dependency. r=me
authorNick Alexander <nalexander@mozilla.com>
Wed, 16 Dec 2015 20:00:16 -0800
changeset 281431 db7cf2a8fd1107919d7b1affd4e4caea62789ba9
parent 281426 c2256ee8ae9a8ee0bf7ab49a8b1924720d846cc7
child 281432 cf715a2893acb9a07d74974868301c502f0b5c9d
push id29939
push usercbook@mozilla.com
push dateMon, 25 Jan 2016 10:49:15 +0000
treeherderautoland@ba9f38e1af50 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs1242284
milestone46.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1242284 - Pre: Remove no longer required Maven repository; bump test-only dependency. r=me jcenter() now contains both com.squareup.spoon:spoon-runner:1.1.10 and org.simpleframework:simple-http:6.0.1 so we can get rid of some outdated listings.
build.gradle
mobile/android/app/base/build.gradle
mobile/android/tests/background/junit4/src/org/mozilla/android/sync/net/test/TestGlobalSession.java
mobile/android/tests/background/junit4/src/org/mozilla/android/sync/net/test/TestSyncStorageRequest.java
mobile/android/tests/background/junit4/src/org/mozilla/android/sync/test/helpers/HTTPServerTestHelper.java
mobile/android/tests/background/junit4/src/org/mozilla/android/sync/test/helpers/MockServer.java
--- a/build.gradle
+++ b/build.gradle
@@ -20,20 +20,16 @@ buildscript {
         jcenter()
 
         // For spoon-gradle-plugin SNAPSHOT release.  This needs to go before
         // the snapshots repository, otherwise we find a remote 1.0.3-SNAPSHOT
         // that doesn't include nalexander's local changes.
         maven {
             url "file://${gradle.mozconfig.topsrcdir}/mobile/android/gradle/m2repo"
         }
-        // For spoon SNAPSHOT releases.
-        maven {
-            url 'https://oss.sonatype.org/content/repositories/snapshots'
-        }
     }
 
     dependencies {
         // Unit testing support was added in 1.1.0. IntelliJ 14.1.4 and Android
         // Studio 1.2.1.1 appear to work fine with plugin version 1.3.0.
         classpath 'com.android.tools.build:gradle:1.3.0'
         classpath('com.stanfy.spoon:spoon-gradle-plugin:1.0.3-SNAPSHOT') {
             // Without these, we get errors linting.
--- a/mobile/android/app/base/build.gradle
+++ b/mobile/android/app/base/build.gradle
@@ -117,17 +117,17 @@ dependencies {
         compile 'com.google.android.gms:play-services-base:8.1.0'
         compile 'com.google.android.gms:play-services-gcm:8.1.0'
     }
 
     compile project(':thirdparty')
 
     testCompile 'junit:junit:4.12'
     testCompile 'org.robolectric:robolectric:3.0'
-    testCompile 'org.simpleframework:simple-http:4.1.13'
+    testCompile 'org.simpleframework:simple-http:6.0.1'
     testCompile 'org.mockito:mockito-core:1.10.19'
 }
 
 apply plugin: 'idea'
 
 idea {
     module {
     }
--- a/mobile/android/tests/background/junit4/src/org/mozilla/android/sync/net/test/TestGlobalSession.java
+++ b/mobile/android/tests/background/junit4/src/org/mozilla/android/sync/net/test/TestGlobalSession.java
@@ -109,17 +109,17 @@ public class TestGlobalSession {
   public void testBackoffCalledByHandleHTTPError() {
     try {
       final MockGlobalSessionCallback callback = new MockGlobalSessionCallback();
       SyncConfiguration config = new SyncConfiguration(TEST_USERNAME, new BasicAuthHeaderProvider(TEST_USERNAME, TEST_PASSWORD), new MockSharedPreferences(), new KeyBundle(TEST_USERNAME, TEST_SYNC_KEY));
       final GlobalSession session = new MockGlobalSession(config, callback);
 
       final HttpResponse response = new BasicHttpResponse(
         new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 503, "Illegal method/protocol"));
-      response.addHeader("X-Weave-Backoff", Long.toString(TEST_BACKOFF_IN_SECONDS)); // Backoff given in seconds.
+      response.setHeader("X-Weave-Backoff", Long.toString(TEST_BACKOFF_IN_SECONDS)); // Backoff given in seconds.
 
       getTestWaiter().performWait(WaitHelper.onThreadRunnable(new Runnable() {
         @Override
         public void run() {
           session.handleHTTPError(new SyncStorageResponse(response), "Illegal method/protocol");
         }
       }));
 
@@ -240,17 +240,17 @@ public class TestGlobalSession {
     });
   }
 
   public MockGlobalSessionCallback doTestSuccess(final boolean stageShouldBackoff, final boolean stageShouldAdvance) throws SyncConfigurationException, IllegalArgumentException, NonObjectJSONException, IOException, ParseException, CryptoException {
     MockServer server = new MockServer() {
       @Override
       public void handle(Request request, Response response) {
         if (stageShouldBackoff) {
-          response.set("X-Weave-Backoff", Long.toString(TEST_BACKOFF_IN_SECONDS));
+          response.addValue("X-Weave-Backoff", Long.toString(TEST_BACKOFF_IN_SECONDS));
         }
         super.handle(request, response);
       }
     };
 
     final MockServerSyncStage stage = new MockServerSyncStage() {
       @Override
       public void execute() {
--- a/mobile/android/tests/background/junit4/src/org/mozilla/android/sync/net/test/TestSyncStorageRequest.java
+++ b/mobile/android/tests/background/junit4/src/org/mozilla/android/sync/net/test/TestSyncStorageRequest.java
@@ -18,16 +18,17 @@ import org.mozilla.gecko.sync.net.SyncSt
 import org.simpleframework.http.Request;
 import org.simpleframework.http.Response;
 
 import java.io.IOException;
 import java.net.URI;
 import java.net.URISyntaxException;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 @RunWith(TestRunner.class)
 public class TestSyncStorageRequest {
   private static final int    TEST_PORT   = HTTPServerTestHelper.getTestPort();
   private static final String TEST_SERVER = "http://localhost:" + TEST_PORT;
 
@@ -144,17 +145,17 @@ public class TestSyncStorageRequest {
       data.stopHTTPServer();
     }
   }
 
   public class RetryAfterMockServer extends MockServer {
     @Override
     public void handle(Request request, Response response) {
       String errorBody = EXPECTED_RETRY_AFTER_ERROR_MESSAGE;
-      response.set("Retry-After", "3001");
+      response.setValue("Retry-After", "3001");
       super.handle(request, response, 503, errorBody);
     }
   }
 
   @Test
   public void testRetryAfterResponse() throws URISyntaxException {
     BaseResource.rewriteLocalhost = false;
     data.startHTTPServer(new RetryAfterMockServer());
@@ -180,17 +181,17 @@ public class TestSyncStorageRequest {
       assertEquals(res.weaveBackoffInSeconds(), 1801);
       super.handleRequestSuccess(res);
     }
   }
   
   public class WeaveBackoffMockServer extends MockServer {
     @Override
     public void handle(Request request, Response response) {
-      response.set("X-Weave-Backoff", "1801");
+      response.setValue("X-Weave-Backoff", "1801");
       super.handle(request, response);
     }
   }
 
   @Test
   public void testWeaveBackoffResponse() throws URISyntaxException {
     BaseResource.rewriteLocalhost = false;
     data.startHTTPServer(new WeaveBackoffMockServer());
@@ -221,20 +222,20 @@ public class TestSyncStorageRequest {
 
       super.handleRequestSuccess(res);
     }
   }
 
   public class HeadersMockServer extends MockServer {
     @Override
     public void handle(Request request, Response response) {
-      response.set("X-Weave-Quota-Remaining", "65536");
-      response.set("X-Weave-Alert", "First weave alert string");
-      response.add("X-Weave-Alert", "Second weave alert string");
-      response.set("X-Weave-Records", "50");
+      response.setValue("X-Weave-Quota-Remaining", "65536");
+      response.setValue("X-Weave-Alert", "First weave alert string");
+      response.addValue("X-Weave-Alert", "Second weave alert string");
+      response.setValue("X-Weave-Records", "50");
 
       super.handle(request, response);
     }
   }
 
   @Test
   public void testHeadersResponse() throws URISyntaxException {
     BaseResource.rewriteLocalhost = false;
@@ -244,17 +245,17 @@ public class TestSyncStorageRequest {
     r.delegate = delegate;
     r.post(new JSONObject());
     // Server is stopped in the callback.
   }
 
   public class DeleteMockServer extends MockServer {
     @Override
     public void handle(Request request, Response response) {
-      assertTrue(request.contains("x-confirm-delete"));
+      assertNotNull(request.getValue("x-confirm-delete"));
       assertEquals("1", request.getValue("x-confirm-delete"));
       super.handle(request, response);
     }
   }
 
   @Test
   public void testDelete() throws URISyntaxException {
     BaseResource.rewriteLocalhost = false;
--- a/mobile/android/tests/background/junit4/src/org/mozilla/android/sync/test/helpers/HTTPServerTestHelper.java
+++ b/mobile/android/tests/background/junit4/src/org/mozilla/android/sync/test/helpers/HTTPServerTestHelper.java
@@ -1,16 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 package org.mozilla.android.sync.test.helpers;
 
 import org.mozilla.gecko.background.common.log.Logger;
 import org.mozilla.gecko.sync.net.BaseResource;
 import org.mozilla.gecko.sync.net.BaseResourceDelegate;
+import org.simpleframework.http.core.ContainerSocketProcessor;
 import org.simpleframework.transport.connect.Connection;
 import org.simpleframework.transport.connect.SocketConnection;
 
 import java.io.IOException;
 import java.net.InetSocketAddress;
 import java.net.SocketAddress;
 import java.util.IdentityHashMap;
 import java.util.Map;
@@ -175,17 +176,17 @@ public class HTTPServerTestHelper {
     BaseResourceDelegate.connectionTimeoutInMillis = 1000; // No sense waiting a long time for a local connection.
 
     if (!allowMultipleServers) {
       throwIfServerAlreadyRunning();
     }
 
     try {
       this.server = server;
-      connection = new SocketConnection(server);
+      connection = new SocketConnection(new ContainerSocketProcessor(server));
       SocketAddress address = new InetSocketAddress(port);
       connection.connect(address);
 
       registerServerAsRunning(this);
 
       Logger.info(LOG_TAG, "Started HTTP server on port " + port + ".");
     } catch (IOException ex) {
       Logger.error(LOG_TAG, "Error starting HTTP server on port " + port + ".", ex);
--- a/mobile/android/tests/background/junit4/src/org/mozilla/android/sync/test/helpers/MockServer.java
+++ b/mobile/android/tests/background/junit4/src/org/mozilla/android/sync/test/helpers/MockServer.java
@@ -34,23 +34,23 @@ public class MockServer implements Conta
     return this.handleBasicHeaders(request, response, code, contentType, System.currentTimeMillis());
   }
 
   protected PrintStream handleBasicHeaders(Request request, Response response, int code, String contentType, long time) throws IOException {
     Logger.debug(LOG_TAG, "< Auth header: " + request.getValue("Authorization"));
 
     PrintStream bodyStream = response.getPrintStream();
     response.setCode(code);
-    response.set("Content-Type", contentType);
-    response.set("Server", "HelloWorld/1.0 (Simple 4.0)");
+    response.setValue("Content-Type", contentType);
+    response.setValue("Server", "HelloWorld/1.0 (Simple 4.0)");
     response.setDate("Date", time);
     response.setDate("Last-Modified", time);
 
     final String timestampHeader = Utils.millisecondsToDecimalSecondsString(time);
-    response.set("X-Weave-Timestamp", timestampHeader);
+    response.setValue("X-Weave-Timestamp", timestampHeader);
     Logger.debug(LOG_TAG, "> X-Weave-Timestamp header: " + timestampHeader);
     return bodyStream;
   }
 
   protected void handle(Request request, Response response, int code, String body) {
     try {
       Logger.debug(LOG_TAG, "Handling request...");
       PrintStream bodyStream = this.handleBasicHeaders(request, response, code, "application/json");