diff --git a/build.gradle b/build.gradle index f3e08171652..1a84c7e8751 100644 --- a/build.gradle +++ b/build.gradle @@ -25,10 +25,6 @@ buildscript { maven { url "file://${gradle.mozconfig.topsrcdir}/mobile/android/gradle/m2repo" } - // For spoon SNAPSHOT releases. - maven { - url 'https://oss.sonatype.org/content/repositories/snapshots' - } } dependencies { diff --git a/mobile/android/app/base/build.gradle b/mobile/android/app/base/build.gradle index c38bc4661fa..67682485e79 100644 --- a/mobile/android/app/base/build.gradle +++ b/mobile/android/app/base/build.gradle @@ -122,7 +122,7 @@ dependencies { 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' } diff --git 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 index aaee3222e04..81313ff9fb7 100644 --- 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 @@ -114,7 +114,7 @@ public class TestGlobalSession { 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 @@ -245,7 +245,7 @@ public class TestGlobalSession { @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); } diff --git 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 index 8d987286256..0e6447c276e 100644 --- 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 @@ -23,6 +23,7 @@ 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; @@ -149,7 +150,7 @@ public class TestSyncStorageRequest { @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); } } @@ -185,7 +186,7 @@ public class TestSyncStorageRequest { 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); } } @@ -226,10 +227,10 @@ public class TestSyncStorageRequest { 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); } @@ -249,7 +250,7 @@ public class TestSyncStorageRequest { 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); } diff --git 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 index 65c3473e73f..1829bdd128c 100644 --- 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 @@ -6,6 +6,7 @@ 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; @@ -180,7 +181,7 @@ public class HTTPServerTestHelper { try { this.server = server; - connection = new SocketConnection(server); + connection = new SocketConnection(new ContainerSocketProcessor(server)); SocketAddress address = new InetSocketAddress(port); connection.connect(address); diff --git 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 index 0052c5fd46c..4c62212a8be 100644 --- 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 @@ -39,13 +39,13 @@ public class MockServer implements Container { 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; }