зеркало из https://github.com/mozilla/gecko-dev.git
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. --HG-- extra : commitid : ET5J8Paj76Q extra : rebase_source : a8273537366b042338274037bd3ac1ad8e8f9cfe
This commit is contained in:
Родитель
00bae8be00
Коммит
b3f4d4d9e6
|
@ -25,10 +25,6 @@ buildscript {
|
||||||
maven {
|
maven {
|
||||||
url "file://${gradle.mozconfig.topsrcdir}/mobile/android/gradle/m2repo"
|
url "file://${gradle.mozconfig.topsrcdir}/mobile/android/gradle/m2repo"
|
||||||
}
|
}
|
||||||
// For spoon SNAPSHOT releases.
|
|
||||||
maven {
|
|
||||||
url 'https://oss.sonatype.org/content/repositories/snapshots'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
|
@ -122,7 +122,7 @@ dependencies {
|
||||||
|
|
||||||
testCompile 'junit:junit:4.12'
|
testCompile 'junit:junit:4.12'
|
||||||
testCompile 'org.robolectric:robolectric:3.0'
|
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'
|
testCompile 'org.mockito:mockito-core:1.10.19'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@ public class TestGlobalSession {
|
||||||
|
|
||||||
final HttpResponse response = new BasicHttpResponse(
|
final HttpResponse response = new BasicHttpResponse(
|
||||||
new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 503, "Illegal method/protocol"));
|
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() {
|
getTestWaiter().performWait(WaitHelper.onThreadRunnable(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -245,7 +245,7 @@ public class TestGlobalSession {
|
||||||
@Override
|
@Override
|
||||||
public void handle(Request request, Response response) {
|
public void handle(Request request, Response response) {
|
||||||
if (stageShouldBackoff) {
|
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);
|
super.handle(request, response);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
|
@ -149,7 +150,7 @@ public class TestSyncStorageRequest {
|
||||||
@Override
|
@Override
|
||||||
public void handle(Request request, Response response) {
|
public void handle(Request request, Response response) {
|
||||||
String errorBody = EXPECTED_RETRY_AFTER_ERROR_MESSAGE;
|
String errorBody = EXPECTED_RETRY_AFTER_ERROR_MESSAGE;
|
||||||
response.set("Retry-After", "3001");
|
response.setValue("Retry-After", "3001");
|
||||||
super.handle(request, response, 503, errorBody);
|
super.handle(request, response, 503, errorBody);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -185,7 +186,7 @@ public class TestSyncStorageRequest {
|
||||||
public class WeaveBackoffMockServer extends MockServer {
|
public class WeaveBackoffMockServer extends MockServer {
|
||||||
@Override
|
@Override
|
||||||
public void handle(Request request, Response response) {
|
public void handle(Request request, Response response) {
|
||||||
response.set("X-Weave-Backoff", "1801");
|
response.setValue("X-Weave-Backoff", "1801");
|
||||||
super.handle(request, response);
|
super.handle(request, response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -226,10 +227,10 @@ public class TestSyncStorageRequest {
|
||||||
public class HeadersMockServer extends MockServer {
|
public class HeadersMockServer extends MockServer {
|
||||||
@Override
|
@Override
|
||||||
public void handle(Request request, Response response) {
|
public void handle(Request request, Response response) {
|
||||||
response.set("X-Weave-Quota-Remaining", "65536");
|
response.setValue("X-Weave-Quota-Remaining", "65536");
|
||||||
response.set("X-Weave-Alert", "First weave alert string");
|
response.setValue("X-Weave-Alert", "First weave alert string");
|
||||||
response.add("X-Weave-Alert", "Second weave alert string");
|
response.addValue("X-Weave-Alert", "Second weave alert string");
|
||||||
response.set("X-Weave-Records", "50");
|
response.setValue("X-Weave-Records", "50");
|
||||||
|
|
||||||
super.handle(request, response);
|
super.handle(request, response);
|
||||||
}
|
}
|
||||||
|
@ -249,7 +250,7 @@ public class TestSyncStorageRequest {
|
||||||
public class DeleteMockServer extends MockServer {
|
public class DeleteMockServer extends MockServer {
|
||||||
@Override
|
@Override
|
||||||
public void handle(Request request, Response response) {
|
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"));
|
assertEquals("1", request.getValue("x-confirm-delete"));
|
||||||
super.handle(request, response);
|
super.handle(request, response);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ package org.mozilla.android.sync.test.helpers;
|
||||||
import org.mozilla.gecko.background.common.log.Logger;
|
import org.mozilla.gecko.background.common.log.Logger;
|
||||||
import org.mozilla.gecko.sync.net.BaseResource;
|
import org.mozilla.gecko.sync.net.BaseResource;
|
||||||
import org.mozilla.gecko.sync.net.BaseResourceDelegate;
|
import org.mozilla.gecko.sync.net.BaseResourceDelegate;
|
||||||
|
import org.simpleframework.http.core.ContainerSocketProcessor;
|
||||||
import org.simpleframework.transport.connect.Connection;
|
import org.simpleframework.transport.connect.Connection;
|
||||||
import org.simpleframework.transport.connect.SocketConnection;
|
import org.simpleframework.transport.connect.SocketConnection;
|
||||||
|
|
||||||
|
@ -180,7 +181,7 @@ public class HTTPServerTestHelper {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.server = server;
|
this.server = server;
|
||||||
connection = new SocketConnection(server);
|
connection = new SocketConnection(new ContainerSocketProcessor(server));
|
||||||
SocketAddress address = new InetSocketAddress(port);
|
SocketAddress address = new InetSocketAddress(port);
|
||||||
connection.connect(address);
|
connection.connect(address);
|
||||||
|
|
||||||
|
|
|
@ -39,13 +39,13 @@ public class MockServer implements Container {
|
||||||
|
|
||||||
PrintStream bodyStream = response.getPrintStream();
|
PrintStream bodyStream = response.getPrintStream();
|
||||||
response.setCode(code);
|
response.setCode(code);
|
||||||
response.set("Content-Type", contentType);
|
response.setValue("Content-Type", contentType);
|
||||||
response.set("Server", "HelloWorld/1.0 (Simple 4.0)");
|
response.setValue("Server", "HelloWorld/1.0 (Simple 4.0)");
|
||||||
response.setDate("Date", time);
|
response.setDate("Date", time);
|
||||||
response.setDate("Last-Modified", time);
|
response.setDate("Last-Modified", time);
|
||||||
|
|
||||||
final String timestampHeader = Utils.millisecondsToDecimalSecondsString(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);
|
Logger.debug(LOG_TAG, "> X-Weave-Timestamp header: " + timestampHeader);
|
||||||
return bodyStream;
|
return bodyStream;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче