Increasing the timeouts of RPC tests and making it easier to do so in the future.
Patch by: jlabanca
Review by: fabbott
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@6666 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/test/com/google/gwt/user/client/rpc/CollectionsTest.java b/user/test/com/google/gwt/user/client/rpc/CollectionsTest.java
index 6cfb9e5..fae04be 100644
--- a/user/test/com/google/gwt/user/client/rpc/CollectionsTest.java
+++ b/user/test/com/google/gwt/user/client/rpc/CollectionsTest.java
@@ -16,7 +16,6 @@
package com.google.gwt.user.client.rpc;
import com.google.gwt.core.client.GWT;
-import com.google.gwt.junit.client.GWTTestCase;
import com.google.gwt.user.client.rpc.TestSetFactory.MarkerTypeArrayList;
import com.google.gwt.user.client.rpc.TestSetFactory.MarkerTypeArraysAsList;
import com.google.gwt.user.client.rpc.TestSetFactory.MarkerTypeHashMap;
@@ -42,12 +41,7 @@
/**
* Tests collections across RPC.
*/
-public class CollectionsTest extends GWTTestCase {
- /**
- * Used by testVeryLargeArray() because the serialization takes a while.
- */
- private static final int LONG_TEST_DELAY = 120000;
- private static final int TEST_DELAY = 10000;
+public class CollectionsTest extends RpcTestBase {
private CollectionsTestServiceAsync collectionsTestService;
@@ -55,10 +49,9 @@
* TODO: Why is this disabled???
*/
public void disabledTestDateArray() {
- delayTestFinish(TEST_DELAY);
-
CollectionsTestServiceAsync service = getServiceAsync();
final Date[] expected = TestSetFactory.createDateArray();
+ delayTestFinishForRpc();
service.echo(expected, new AsyncCallback<Date[]>() {
public void onFailure(Throwable caught) {
TestSetValidator.rethrowException(caught);
@@ -78,10 +71,9 @@
* due to SSW.
*/
public void disabledTestVeryLargeArray() {
- delayTestFinish(LONG_TEST_DELAY);
-
CollectionsTestServiceAsync service = getServiceAsync();
final int[] expected = TestSetFactory.createVeryLargeArray();
+ delayTestFinishForRpc();
service.echo(expected, new AsyncCallback<int[]>() {
public void onFailure(Throwable caught) {
TestSetValidator.rethrowException(caught);
@@ -95,14 +87,9 @@
});
}
- public String getModuleName() {
- return "com.google.gwt.user.RPCSuite";
- }
-
public void testArrayList() {
- delayTestFinish(TEST_DELAY);
-
CollectionsTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo(TestSetFactory.createArrayList(),
new AsyncCallback<ArrayList<MarkerTypeArrayList>>() {
public void onFailure(Throwable caught) {
@@ -118,11 +105,10 @@
}
public void testArraysAsList() {
- delayTestFinish(TEST_DELAY);
-
CollectionsTestServiceAsync service = getServiceAsync();
final List<MarkerTypeArraysAsList> expected = TestSetFactory.createArraysAsList();
+ delayTestFinishForRpc();
service.echoArraysAsList(expected,
new AsyncCallback<List<MarkerTypeArraysAsList>>() {
public void onFailure(Throwable caught) {
@@ -138,10 +124,9 @@
}
public void testBooleanArray() {
- delayTestFinish(TEST_DELAY);
-
CollectionsTestServiceAsync service = getServiceAsync();
final Boolean[] expected = TestSetFactory.createBooleanArray();
+ delayTestFinishForRpc();
service.echo(expected, new AsyncCallback<Boolean[]>() {
public void onFailure(Throwable caught) {
TestSetValidator.rethrowException(caught);
@@ -156,10 +141,9 @@
}
public void testByteArray() {
- delayTestFinish(TEST_DELAY);
-
CollectionsTestServiceAsync service = getServiceAsync();
final Byte[] expected = TestSetFactory.createByteArray();
+ delayTestFinishForRpc();
service.echo(expected, new AsyncCallback<Byte[]>() {
public void onFailure(Throwable caught) {
TestSetValidator.rethrowException(caught);
@@ -174,10 +158,9 @@
}
public void testCharArray() {
- delayTestFinish(TEST_DELAY);
-
CollectionsTestServiceAsync service = getServiceAsync();
final Character[] expected = TestSetFactory.createCharArray();
+ delayTestFinishForRpc();
service.echo(expected, new AsyncCallback<Character[]>() {
public void onFailure(Throwable caught) {
TestSetValidator.rethrowException(caught);
@@ -192,10 +175,9 @@
}
public void testDoubleArray() {
- delayTestFinish(TEST_DELAY);
-
CollectionsTestServiceAsync service = getServiceAsync();
final Double[] expected = TestSetFactory.createDoubleArray();
+ delayTestFinishForRpc();
service.echo(expected, new AsyncCallback<Double[]>() {
public void onFailure(Throwable caught) {
TestSetValidator.rethrowException(caught);
@@ -210,10 +192,9 @@
}
public void testEnumArray() {
- delayTestFinish(TEST_DELAY);
-
CollectionsTestServiceAsync service = getServiceAsync();
final Enum<?>[] expected = TestSetFactory.createEnumArray();
+ delayTestFinishForRpc();
service.echo(expected, new AsyncCallback<Enum<?>[]>() {
public void onFailure(Throwable caught) {
TestSetValidator.rethrowException(caught);
@@ -228,10 +209,9 @@
}
public void testFloatArray() {
- delayTestFinish(TEST_DELAY);
-
CollectionsTestServiceAsync service = getServiceAsync();
final Float[] expected = TestSetFactory.createFloatArray();
+ delayTestFinishForRpc();
service.echo(expected, new AsyncCallback<Float[]>() {
public void onFailure(Throwable caught) {
TestSetValidator.rethrowException(caught);
@@ -246,10 +226,9 @@
}
public void testHashMap() {
- delayTestFinish(TEST_DELAY);
-
CollectionsTestServiceAsync service = getServiceAsync();
final HashMap<String, MarkerTypeHashMap> expected = TestSetFactory.createHashMap();
+ delayTestFinishForRpc();
service.echo(expected,
new AsyncCallback<HashMap<String, MarkerTypeHashMap>>() {
public void onFailure(Throwable caught) {
@@ -265,10 +244,9 @@
}
public void testHashSet() {
- delayTestFinish(TEST_DELAY);
-
CollectionsTestServiceAsync service = getServiceAsync();
final HashSet<MarkerTypeHashSet> expected = TestSetFactory.createHashSet();
+ delayTestFinishForRpc();
service.echo(expected, new AsyncCallback<HashSet<MarkerTypeHashSet>>() {
public void onFailure(Throwable caught) {
TestSetValidator.rethrowException(caught);
@@ -283,10 +261,9 @@
}
public void testIntegerArray() {
- delayTestFinish(TEST_DELAY);
-
CollectionsTestServiceAsync service = getServiceAsync();
final Integer[] expected = TestSetFactory.createIntegerArray();
+ delayTestFinishForRpc();
service.echo(expected, new AsyncCallback<Integer[]>() {
public void onFailure(Throwable caught) {
TestSetValidator.rethrowException(caught);
@@ -301,12 +278,12 @@
}
public void testLinkedHashMap() {
- delayTestFinish(TEST_DELAY);
CollectionsTestServiceAsync service = getServiceAsync();
final LinkedHashMap<String, MarkerTypeLinkedHashMap> expected = TestSetFactory.createLinkedHashMap();
assertFalse(LinkedHashMap_CustomFieldSerializer.getAccessOrderNoReflection(expected));
+ delayTestFinishForRpc();
service.echo(expected,
new AsyncCallback<LinkedHashMap<String, MarkerTypeLinkedHashMap>>() {
public void onFailure(Throwable caught) {
@@ -325,12 +302,12 @@
}
public void testLinkedHashMapLRU() {
- delayTestFinish(TEST_DELAY);
CollectionsTestServiceAsync service = getServiceAsync();
final LinkedHashMap<String, MarkerTypeLinkedHashMap> expected = TestSetFactory.createLRULinkedHashMap();
assertTrue(LinkedHashMap_CustomFieldSerializer.getAccessOrderNoReflection(expected));
+ delayTestFinishForRpc();
service.echo(expected,
new AsyncCallback<LinkedHashMap<String, MarkerTypeLinkedHashMap>>() {
public void onFailure(Throwable caught) {
@@ -349,10 +326,9 @@
}
public void testLongArray() {
- delayTestFinish(TEST_DELAY);
-
CollectionsTestServiceAsync service = getServiceAsync();
final Long[] expected = TestSetFactory.createLongArray();
+ delayTestFinishForRpc();
service.echo(expected, new AsyncCallback<Long[]>() {
public void onFailure(Throwable caught) {
TestSetValidator.rethrowException(caught);
@@ -367,10 +343,9 @@
}
public void testPrimitiveBooleanArray() {
- delayTestFinish(TEST_DELAY);
-
final boolean[] expected = TestSetFactory.createPrimitiveBooleanArray();
CollectionsTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo(expected, new AsyncCallback<boolean[]>() {
public void onFailure(Throwable caught) {
TestSetValidator.rethrowException(caught);
@@ -384,10 +359,9 @@
}
public void testPrimitiveByteArray() {
- delayTestFinish(TEST_DELAY);
-
final byte[] expected = TestSetFactory.createPrimitiveByteArray();
CollectionsTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo(expected, new AsyncCallback<byte[]>() {
public void onFailure(Throwable caught) {
TestSetValidator.rethrowException(caught);
@@ -401,10 +375,9 @@
}
public void testPrimitiveCharArray() {
- delayTestFinish(TEST_DELAY);
-
CollectionsTestServiceAsync service = getServiceAsync();
final char[] expected = TestSetFactory.createPrimitiveCharArray();
+ delayTestFinishForRpc();
service.echo(expected, new AsyncCallback<char[]>() {
public void onFailure(Throwable caught) {
TestSetValidator.rethrowException(caught);
@@ -419,10 +392,9 @@
}
public void testPrimitiveDoubleArray() {
- delayTestFinish(TEST_DELAY);
-
CollectionsTestServiceAsync service = getServiceAsync();
final double[] expected = TestSetFactory.createPrimitiveDoubleArray();
+ delayTestFinishForRpc();
service.echo(expected, new AsyncCallback<double[]>() {
public void onFailure(Throwable caught) {
TestSetValidator.rethrowException(caught);
@@ -437,10 +409,9 @@
}
public void testPrimitiveFloatArray() {
- delayTestFinish(TEST_DELAY);
-
CollectionsTestServiceAsync service = getServiceAsync();
final float[] expected = TestSetFactory.createPrimitiveFloatArray();
+ delayTestFinishForRpc();
service.echo(expected, new AsyncCallback<float[]>() {
public void onFailure(Throwable caught) {
TestSetValidator.rethrowException(caught);
@@ -455,10 +426,9 @@
}
public void testPrimitiveIntegerArray() {
- delayTestFinish(TEST_DELAY);
-
CollectionsTestServiceAsync service = getServiceAsync();
final int[] expected = TestSetFactory.createPrimitiveIntegerArray();
+ delayTestFinishForRpc();
service.echo(expected, new AsyncCallback<int[]>() {
public void onFailure(Throwable caught) {
TestSetValidator.rethrowException(caught);
@@ -473,10 +443,9 @@
}
public void testPrimitiveLongArray() {
- delayTestFinish(TEST_DELAY);
-
CollectionsTestServiceAsync service = getServiceAsync();
final long[] expected = TestSetFactory.createPrimitiveLongArray();
+ delayTestFinishForRpc();
service.echo(expected, new AsyncCallback<long[]>() {
public void onFailure(Throwable caught) {
TestSetValidator.rethrowException(caught);
@@ -491,10 +460,9 @@
}
public void testPrimitiveShortArray() {
- delayTestFinish(TEST_DELAY);
-
CollectionsTestServiceAsync service = getServiceAsync();
final short[] expected = TestSetFactory.createPrimitiveShortArray();
+ delayTestFinishForRpc();
service.echo(expected, new AsyncCallback<short[]>() {
public void onFailure(Throwable caught) {
TestSetValidator.rethrowException(caught);
@@ -509,10 +477,9 @@
}
public void testShortArray() {
- delayTestFinish(TEST_DELAY);
-
CollectionsTestServiceAsync service = getServiceAsync();
final Short[] expected = TestSetFactory.createShortArray();
+ delayTestFinishForRpc();
service.echo(expected, new AsyncCallback<Short[]>() {
public void onFailure(Throwable caught) {
TestSetValidator.rethrowException(caught);
@@ -527,10 +494,9 @@
}
public void testSqlDateArray() {
- delayTestFinish(TEST_DELAY);
-
CollectionsTestServiceAsync service = getServiceAsync();
final java.sql.Date[] expected = TestSetFactory.createSqlDateArray();
+ delayTestFinishForRpc();
service.echo(expected, new AsyncCallback<java.sql.Date[]>() {
public void onFailure(Throwable caught) {
TestSetValidator.rethrowException(caught);
@@ -545,10 +511,9 @@
}
public void testSqlTimeArray() {
- delayTestFinish(TEST_DELAY);
-
CollectionsTestServiceAsync service = getServiceAsync();
final Time[] expected = TestSetFactory.createSqlTimeArray();
+ delayTestFinishForRpc();
service.echo(expected, new AsyncCallback<Time[]>() {
public void onFailure(Throwable caught) {
TestSetValidator.rethrowException(caught);
@@ -563,10 +528,9 @@
}
public void testSqlTimestampArray() {
- delayTestFinish(TEST_DELAY);
-
CollectionsTestServiceAsync service = getServiceAsync();
final Timestamp[] expected = TestSetFactory.createSqlTimestampArray();
+ delayTestFinishForRpc();
service.echo(expected, new AsyncCallback<Timestamp[]>() {
public void onFailure(Throwable caught) {
TestSetValidator.rethrowException(caught);
@@ -581,10 +545,9 @@
}
public void testStringArray() {
- delayTestFinish(TEST_DELAY);
-
CollectionsTestServiceAsync service = getServiceAsync();
final String[] expected = TestSetFactory.createStringArray();
+ delayTestFinishForRpc();
service.echo(expected, new AsyncCallback<String[]>() {
public void onFailure(Throwable caught) {
TestSetValidator.rethrowException(caught);
@@ -599,11 +562,10 @@
}
public void testStringArrayArray() {
- delayTestFinish(TEST_DELAY);
-
CollectionsTestServiceAsync service = getServiceAsync();
final String[][] expected = new String[][] {
new String[] {"hello"}, new String[] {"bye"}};
+ delayTestFinishForRpc();
service.echo(expected, new AsyncCallback<String[][]>() {
public void onFailure(Throwable caught) {
TestSetValidator.rethrowException(caught);
@@ -617,9 +579,8 @@
}
public void testTreeMap() {
- delayTestFinish(TEST_DELAY);
-
CollectionsTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
for (boolean option : new boolean[] {true, false}) {
final TreeMap<String, MarkerTypeTreeMap> expected = TestSetFactory.createTreeMap(option);
service.echo(expected, option,
@@ -638,9 +599,8 @@
}
public void testTreeSet() {
- delayTestFinish(TEST_DELAY);
-
CollectionsTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
for (boolean option : new boolean[] {true, false}) {
final TreeSet<MarkerTypeTreeSet> expected = TestSetFactory.createTreeSet(option);
service.echo(expected, option,
@@ -659,10 +619,9 @@
}
public void testVector() {
- delayTestFinish(TEST_DELAY);
-
CollectionsTestServiceAsync service = getServiceAsync();
final Vector<MarkerTypeVector> expected = TestSetFactory.createVector();
+ delayTestFinishForRpc();
service.echo(expected, new AsyncCallback<Vector<MarkerTypeVector>>() {
public void onFailure(Throwable caught) {
TestSetValidator.rethrowException(caught);
diff --git a/user/test/com/google/gwt/user/client/rpc/CustomFieldSerializerTest.java b/user/test/com/google/gwt/user/client/rpc/CustomFieldSerializerTest.java
index fbdfaf3..4c67fdd 100644
--- a/user/test/com/google/gwt/user/client/rpc/CustomFieldSerializerTest.java
+++ b/user/test/com/google/gwt/user/client/rpc/CustomFieldSerializerTest.java
@@ -16,7 +16,6 @@
package com.google.gwt.user.client.rpc;
import com.google.gwt.core.client.GWT;
-import com.google.gwt.junit.client.GWTTestCase;
import com.google.gwt.user.client.rpc.CustomFieldSerializerTestSetFactory.SerializableSubclass;
import junit.framework.AssertionFailedError;
@@ -31,23 +30,17 @@
* serialized</li>
* </ul>
*/
-public class CustomFieldSerializerTest extends GWTTestCase {
- private static final int TEST_DELAY = 5000;
+public class CustomFieldSerializerTest extends RpcTestBase {
private CustomFieldSerializerTestServiceAsync customFieldSerializerTestService;
- public String getModuleName() {
- return "com.google.gwt.user.RPCSuite";
- }
-
/**
* Test that custom field serializers do not make their subclasses
* serializable.
*/
public void testCustomFieldSerializabilityInheritance() {
- delayTestFinish(TEST_DELAY);
-
CustomFieldSerializerTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo(
CustomFieldSerializerTestSetFactory.createUnserializableSubclass(),
new AsyncCallback() {
@@ -67,9 +60,8 @@
* Tests that the custom field serializers are actually called.
*/
public void testCustomFieldSerialization() {
- delayTestFinish(TEST_DELAY);
-
CustomFieldSerializerTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo(
CustomFieldSerializerTestSetFactory.createUnserializableClass(),
new AsyncCallback() {
@@ -93,9 +85,8 @@
* is required for most immutable classes) work.
*/
public void testSerializableImmutables() {
- delayTestFinish(TEST_DELAY);
-
CustomFieldSerializerTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo(
CustomFieldSerializerTestSetFactory.createSerializableImmutablesArray(),
new AsyncCallback() {
@@ -119,9 +110,8 @@
* serializers serialize and deserialize correctly.
*/
public void testSerializableSubclasses() {
- delayTestFinish(TEST_DELAY);
-
CustomFieldSerializerTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo(
CustomFieldSerializerTestSetFactory.createSerializableSubclass(),
new AsyncCallback() {
diff --git a/user/test/com/google/gwt/user/client/rpc/EnumsTest.java b/user/test/com/google/gwt/user/client/rpc/EnumsTest.java
index 0c431e8..704b656 100644
--- a/user/test/com/google/gwt/user/client/rpc/EnumsTest.java
+++ b/user/test/com/google/gwt/user/client/rpc/EnumsTest.java
@@ -16,7 +16,6 @@
package com.google.gwt.user.client.rpc;
import com.google.gwt.core.client.GWT;
-import com.google.gwt.junit.client.GWTTestCase;
import com.google.gwt.user.client.rpc.EnumsTestService.Basic;
import com.google.gwt.user.client.rpc.EnumsTestService.Complex;
import com.google.gwt.user.client.rpc.EnumsTestService.Subclassing;
@@ -24,8 +23,7 @@
/**
* Tests enums over RPC.
*/
-public class EnumsTest extends GWTTestCase {
- private static final int TEST_DELAY = 5000;
+public class EnumsTest extends RpcTestBase {
private static EnumsTestServiceAsync getService() {
EnumsTestServiceAsync service = GWT.create(EnumsTestService.class);
@@ -42,16 +40,11 @@
}
}
- @Override
- public String getModuleName() {
- return "com.google.gwt.user.RPCSuite";
- }
-
/**
* Test that basic enums can be used over RPC.
*/
public void testBasicEnums() {
- delayTestFinish(TEST_DELAY);
+ delayTestFinishForRpc();
getService().echo(Basic.A, new AsyncCallback<Basic>() {
public void onFailure(Throwable caught) {
rethrowException(caught);
@@ -70,11 +63,10 @@
* over RPC and that the client state does not change.
*/
public void testComplexEnums() {
- delayTestFinish(TEST_DELAY);
-
Complex a = Complex.A;
a.value = "client";
+ delayTestFinishForRpc();
getService().echo(Complex.A, new AsyncCallback<Complex>() {
public void onFailure(Throwable caught) {
rethrowException(caught);
@@ -96,7 +88,7 @@
* Test that null can be used as an enumeration.
*/
public void testNull() {
- delayTestFinish(TEST_DELAY);
+ delayTestFinishForRpc();
getService().echo((Basic) null, new AsyncCallback<Basic>() {
public void onFailure(Throwable caught) {
@@ -114,7 +106,7 @@
* Test that enums with subclasses can be passed over RPC.
*/
public void testSubclassingEnums() {
- delayTestFinish(TEST_DELAY);
+ delayTestFinishForRpc();
getService().echo(Subclassing.A, new AsyncCallback<Subclassing>() {
public void onFailure(Throwable caught) {
diff --git a/user/test/com/google/gwt/user/client/rpc/InheritanceTest.java b/user/test/com/google/gwt/user/client/rpc/InheritanceTest.java
index 6544b75..eb4a87c 100644
--- a/user/test/com/google/gwt/user/client/rpc/InheritanceTest.java
+++ b/user/test/com/google/gwt/user/client/rpc/InheritanceTest.java
@@ -16,7 +16,6 @@
package com.google.gwt.user.client.rpc;
import com.google.gwt.core.client.GWT;
-import com.google.gwt.junit.client.GWTTestCase;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.rpc.InheritanceTestSetFactory.AnonymousClassInterface;
import com.google.gwt.user.client.rpc.InheritanceTestSetFactory.Circle;
@@ -27,22 +26,16 @@
/**
* TODO: document me.
*/
-public class InheritanceTest extends GWTTestCase {
- private static final int TEST_DELAY = 5000;
+public class InheritanceTest extends RpcTestBase {
private InheritanceTestServiceAsync inheritanceTestService;
- public String getModuleName() {
- return "com.google.gwt.user.RPCSuite";
- }
-
/**
* Test that anonymous classes are not serializable.
*/
public void testAnonymousClasses() {
- delayTestFinish(TEST_DELAY);
-
InheritanceTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo(new AnonymousClassInterface() {
public void foo() {
// purposely empty
@@ -66,9 +59,8 @@
* 161</a>
*/
public void testFieldShadowing() {
- delayTestFinish(TEST_DELAY);
-
InheritanceTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo(InheritanceTestSetFactory.createCircle(),
new AsyncCallback<Object>() {
public void onFailure(Throwable caught) {
@@ -87,9 +79,8 @@
* Tests that transient fields do not prevent serializability.
*/
public void testJavaSerializableClass() {
- delayTestFinish(TEST_DELAY);
-
InheritanceTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo(new InheritanceTestSetFactory.JavaSerializableClass(3),
new AsyncCallback<Object>() {
public void onFailure(Throwable caught) {
@@ -107,9 +98,8 @@
* Test that non-static inner classes are not serializable.
*/
public void testNonStaticInnerClass() {
- delayTestFinish(TEST_DELAY);
-
InheritanceTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo(InheritanceTestSetFactory.createNonStaticInnerClass(),
new AsyncCallback<Object>() {
public void onFailure(Throwable caught) {
@@ -123,9 +113,8 @@
}
public void testReturnOfUnserializableClassFromServer() {
- delayTestFinish(TEST_DELAY);
-
InheritanceTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.getUnserializableClass(new AsyncCallback<Object>() {
public void onFailure(Throwable caught) {
finishTest();
@@ -141,9 +130,8 @@
* Test that a valid serializable class can be serialized.
*/
public void testSerializableClass() {
- delayTestFinish(TEST_DELAY);
-
InheritanceTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo(InheritanceTestSetFactory.createSerializableClass(),
new AsyncCallback<Object>() {
public void onFailure(Throwable caught) {
@@ -162,9 +150,8 @@
* Test that IsSerializable is inherited, also test static inner classes.
*/
public void testSerializableSubclass() {
- delayTestFinish(TEST_DELAY);
-
InheritanceTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo(InheritanceTestSetFactory.createSerializableSubclass(),
new AsyncCallback<Object>() {
public void onFailure(Throwable caught) {
@@ -180,7 +167,7 @@
}
public void testSerializationExceptionPreventsCall() {
- delayTestFinish(TEST_DELAY);
+ delayTestFinishForRpc();
final boolean serializationExceptionCaught[] = new boolean[1];
new Timer() {
@Override
@@ -189,7 +176,7 @@
serializationExceptionCaught[0]);
finishTest();
}
- }.schedule(TEST_DELAY / 2);
+ }.schedule(RPC_TIMEOUT / 2);
InheritanceTestServiceAsync service = getServiceAsync();
service.echo(new AnonymousClassInterface() {
@@ -215,9 +202,8 @@
* Tests that transient fields do not prevent serializability.
*/
public void testTransientFieldExclusion() {
- delayTestFinish(TEST_DELAY);
-
InheritanceTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo(
InheritanceTestSetFactory.createSerializableClassWithTransientField(),
new AsyncCallback<Object>() {
diff --git a/user/test/com/google/gwt/user/client/rpc/ObjectGraphTest.java b/user/test/com/google/gwt/user/client/rpc/ObjectGraphTest.java
index 291605b..aea2587 100644
--- a/user/test/com/google/gwt/user/client/rpc/ObjectGraphTest.java
+++ b/user/test/com/google/gwt/user/client/rpc/ObjectGraphTest.java
@@ -16,7 +16,6 @@
package com.google.gwt.user.client.rpc;
import com.google.gwt.core.client.GWT;
-import com.google.gwt.junit.client.GWTTestCase;
import com.google.gwt.user.client.rpc.TestSetFactory.SerializableDoublyLinkedNode;
import com.google.gwt.user.client.rpc.TestSetFactory.SerializableGraphWithCFS;
import com.google.gwt.user.client.rpc.TestSetFactory.SerializablePrivateNoArg;
@@ -26,17 +25,11 @@
/**
* TODO: document me.
*/
-public class ObjectGraphTest extends GWTTestCase {
- private static final int TEST_DELAY = 5000;
-
- public String getModuleName() {
- return "com.google.gwt.user.RPCSuite";
- }
+public class ObjectGraphTest extends RpcTestBase {
public void testAcyclicGraph() {
- delayTestFinish(TEST_DELAY);
-
ObjectGraphTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo_AcyclicGraph(TestSetFactory.createAcyclicGraph(),
new AsyncCallback() {
public void onFailure(Throwable caught) {
@@ -52,9 +45,8 @@
}
public void testComplexCyclicGraph() {
- delayTestFinish(TEST_DELAY);
-
ObjectGraphTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo_ComplexCyclicGraph(TestSetFactory.createComplexCyclicGraph(),
new AsyncCallback() {
public void onFailure(Throwable caught) {
@@ -70,9 +62,8 @@
}
public void testComplexCyclicGraphWithCFS() {
- delayTestFinish(TEST_DELAY);
-
ObjectGraphTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo_ComplexCyclicGraphWithCFS(
TestSetFactory.createComplexCyclicGraphWithCFS(),
new AsyncCallback<SerializableGraphWithCFS>() {
@@ -89,10 +80,9 @@
}
public void testComplexCyclicGraph2() {
- delayTestFinish(TEST_DELAY);
-
ObjectGraphTestServiceAsync service = getServiceAsync();
final SerializableDoublyLinkedNode node = TestSetFactory.createComplexCyclicGraph();
+ delayTestFinishForRpc();
service.echo_ComplexCyclicGraph(node, node, new AsyncCallback() {
public void onFailure(Throwable caught) {
TestSetValidator.rethrowException(caught);
@@ -107,10 +97,9 @@
}
public void testDoublyReferencedArray() {
- delayTestFinish(TEST_DELAY);
-
ObjectGraphTestServiceAsync service = getServiceAsync();
final SerializableWithTwoArrays node = TestSetFactory.createDoublyReferencedArray();
+ delayTestFinishForRpc();
service.echo_SerializableWithTwoArrays(node, new AsyncCallback() {
public void onFailure(Throwable caught) {
TestSetValidator.rethrowException(caught);
@@ -142,10 +131,9 @@
}
public void testPrivateNoArg() {
- delayTestFinish(TEST_DELAY);
-
ObjectGraphTestServiceAsync service = getServiceAsync();
final SerializablePrivateNoArg node = TestSetFactory.createPrivateNoArg();
+ delayTestFinishForRpc();
service.echo_PrivateNoArg(node, new AsyncCallback() {
public void onFailure(Throwable caught) {
TestSetValidator.rethrowException(caught);
@@ -160,9 +148,8 @@
}
public void testTrivialCyclicGraph() {
- delayTestFinish(TEST_DELAY);
-
ObjectGraphTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo_TrivialCyclicGraph(TestSetFactory.createTrivialCyclicGraph(),
new AsyncCallback() {
public void onFailure(Throwable caught) {
diff --git a/user/test/com/google/gwt/user/client/rpc/RemoteServiceServletTest.java b/user/test/com/google/gwt/user/client/rpc/RemoteServiceServletTest.java
index 5811de7..d57bfa9 100644
--- a/user/test/com/google/gwt/user/client/rpc/RemoteServiceServletTest.java
+++ b/user/test/com/google/gwt/user/client/rpc/RemoteServiceServletTest.java
@@ -21,7 +21,6 @@
import com.google.gwt.http.client.RequestCallback;
import com.google.gwt.http.client.RequestException;
import com.google.gwt.http.client.Response;
-import com.google.gwt.junit.client.GWTTestCase;
/**
* This test case is used to check that the RemoteServiceServlet walks the class
@@ -36,7 +35,7 @@
* {@link com.google.gwt.user.server.rpc.RemoteServiceServletTestServiceImpl}.
* </p>
*/
-public class RemoteServiceServletTest extends GWTTestCase {
+public class RemoteServiceServletTest extends RpcTestBase {
private static class MyRpcRequestBuilder extends RpcRequestBuilder {
private boolean doCreate;
private boolean doFinish;
@@ -91,8 +90,6 @@
}
}
- private static final int TEST_DELAY = 10000;
-
protected static RemoteServiceServletTestServiceAsync getAsyncService() {
RemoteServiceServletTestServiceAsync service = (RemoteServiceServletTestServiceAsync) GWT.create(RemoteServiceServletTestService.class);
@@ -104,16 +101,12 @@
private Request req;
- public String getModuleName() {
- return "com.google.gwt.user.RPCSuite";
- }
-
public void testAlternateStatusCode() {
RemoteServiceServletTestServiceAsync service = getAsyncService();
((ServiceDefTarget) service).setServiceEntryPoint(GWT.getModuleBaseURL()
+ "servlettest/404");
- delayTestFinish(TEST_DELAY);
+ delayTestFinishForRpc();
service.test(new AsyncCallback<Void>() {
@@ -136,7 +129,7 @@
public void testManualSend() throws RequestException {
RemoteServiceServletTestServiceAsync service = getAsyncService();
- delayTestFinish(TEST_DELAY);
+ delayTestFinishForRpc();
RequestBuilder builder = service.testExpectCustomHeader(new AsyncCallback<Void>() {
@@ -158,7 +151,7 @@
public void testPermutationStrongName() {
RemoteServiceServletTestServiceAsync service = getAsyncService();
- delayTestFinish(TEST_DELAY);
+ delayTestFinishForRpc();
assertNotNull(GWT.getPermutationStrongName());
service.testExpectPermutationStrongName(GWT.getPermutationStrongName(),
@@ -172,7 +165,7 @@
finishTest();
}
});
- };
+ }
/**
* Ensure that each doFoo method is called.
@@ -182,7 +175,7 @@
RemoteServiceServletTestServiceAsync service = getAsyncService();
((ServiceDefTarget) service).setRpcRequestBuilder(builder);
- delayTestFinish(TEST_DELAY);
+ delayTestFinishForRpc();
service.test(new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
TestSetValidator.rethrowException(caught);
@@ -198,7 +191,7 @@
public void testServiceInterfaceLocation() {
RemoteServiceServletTestServiceAsync service = getAsyncService();
- delayTestFinish(TEST_DELAY);
+ delayTestFinishForRpc();
req = service.test(new AsyncCallback<Void>() {
diff --git a/user/test/com/google/gwt/user/client/rpc/RpcTestBase.java b/user/test/com/google/gwt/user/client/rpc/RpcTestBase.java
new file mode 100644
index 0000000..15dcbdb
--- /dev/null
+++ b/user/test/com/google/gwt/user/client/rpc/RpcTestBase.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2009 Google Inc.
+ *
+ * Licensed 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.
+ */
+package com.google.gwt.user.client.rpc;
+
+import com.google.gwt.junit.client.GWTTestCase;
+
+/**
+ * Base class for RPC tests.
+ */
+public class RpcTestBase extends GWTTestCase {
+
+ /**
+ * The timeout for RPC tests.
+ */
+ protected static final int RPC_TIMEOUT = 15000;
+
+ @Override
+ public String getModuleName() {
+ return "com.google.gwt.user.RPCSuite";
+ }
+
+ /**
+ * Delay finishing a test while we wait for an RPC response. This method
+ * should be used instead of {@link #delayTestFinish(int)} so we can adjust
+ * timeouts for all Rpc tests at once.
+ *
+ * @see #delayTestFinish(int)
+ */
+ protected final void delayTestFinishForRpc() {
+ delayTestFinish(RPC_TIMEOUT);
+ }
+}
diff --git a/user/test/com/google/gwt/user/client/rpc/RunTimeSerializationErrorsTest.java b/user/test/com/google/gwt/user/client/rpc/RunTimeSerializationErrorsTest.java
index 33e6adb..4d8220e 100644
--- a/user/test/com/google/gwt/user/client/rpc/RunTimeSerializationErrorsTest.java
+++ b/user/test/com/google/gwt/user/client/rpc/RunTimeSerializationErrorsTest.java
@@ -19,13 +19,11 @@
import com.google.gwt.http.client.Request;
import com.google.gwt.http.client.RequestBuilder;
import com.google.gwt.http.client.RequestException;
-import com.google.gwt.junit.client.GWTTestCase;
/**
* Tests run-time serialization errors for GWT RPC.
*/
-public class RunTimeSerializationErrorsTest extends GWTTestCase {
- private static final int TIMEOUT = 20000;
+public class RunTimeSerializationErrorsTest extends RpcTestBase {
public static MixedSerializableEchoServiceAsync getService() {
MixedSerializableEchoServiceAsync service = GWT.create(MixedSerializableEchoService.class);
@@ -36,13 +34,8 @@
return service;
}
- @Override
- public String getModuleName() {
- return "com.google.gwt.user.RPCSuite";
- }
-
public void testBadSerialization1() {
- delayTestFinish(TIMEOUT);
+ delayTestFinishForRpc();
getService().echoVoid(new MixedSerializable.NonSerializableSub(),
new AsyncCallback<MixedSerializable>() {
public void onFailure(Throwable caught) {
@@ -97,7 +90,7 @@
}
public void testGoodSerialization1() {
- delayTestFinish(TIMEOUT);
+ delayTestFinishForRpc();
getService().echoVoid(new MixedSerializable.SerializableSub(),
new AsyncCallback<MixedSerializable>() {
public void onFailure(Throwable caught) {
@@ -111,7 +104,7 @@
}
public void testGoodSerialization2() {
- delayTestFinish(TIMEOUT);
+ delayTestFinishForRpc();
getService().echoRequest(new MixedSerializable.SerializableSub(),
new AsyncCallback<MixedSerializable>() {
public void onFailure(Throwable caught) {
@@ -125,7 +118,7 @@
}
public void testGoodSerialization3() {
- delayTestFinish(TIMEOUT);
+ delayTestFinishForRpc();
getService().echoVoid(new MixedSerializable.SerializableSub(),
new AsyncCallback<MixedSerializable>() {
public void onFailure(Throwable caught) {
diff --git a/user/test/com/google/gwt/user/client/rpc/ValueTypesTest.java b/user/test/com/google/gwt/user/client/rpc/ValueTypesTest.java
index bdc5f4b..aad328b 100644
--- a/user/test/com/google/gwt/user/client/rpc/ValueTypesTest.java
+++ b/user/test/com/google/gwt/user/client/rpc/ValueTypesTest.java
@@ -16,24 +16,17 @@
package com.google.gwt.user.client.rpc;
import com.google.gwt.core.client.GWT;
-import com.google.gwt.junit.client.GWTTestCase;
/**
* TODO: document me.
*/
-public class ValueTypesTest extends GWTTestCase {
-
- private static final int TEST_DELAY = 5000;
+public class ValueTypesTest extends RpcTestBase {
private ValueTypesTestServiceAsync primitiveTypeTestService;
- public String getModuleName() {
- return "com.google.gwt.user.RPCSuite";
- }
-
public void testBoolean_FALSE() {
- delayTestFinish(TEST_DELAY);
ValueTypesTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo_FALSE(false, new AsyncCallback() {
public void onFailure(Throwable caught) {
@@ -49,8 +42,8 @@
}
public void testBoolean_TRUE() {
- delayTestFinish(TEST_DELAY);
ValueTypesTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo_TRUE(true, new AsyncCallback() {
public void onFailure(Throwable caught) {
@@ -66,8 +59,8 @@
}
public void testByte() {
- delayTestFinish(TEST_DELAY);
ValueTypesTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo((byte) (Byte.MAX_VALUE / (byte) 2), new AsyncCallback() {
public void onFailure(Throwable caught) {
@@ -83,8 +76,8 @@
}
public void testByte_MAX_VALUE() {
- delayTestFinish(TEST_DELAY);
ValueTypesTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo_MAX_VALUE(Byte.MAX_VALUE, new AsyncCallback() {
public void onFailure(Throwable caught) {
@@ -100,8 +93,8 @@
}
public void testByte_MIN_VALUE() {
- delayTestFinish(TEST_DELAY);
ValueTypesTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo_MIN_VALUE(Byte.MIN_VALUE, new AsyncCallback() {
public void onFailure(Throwable caught) {
@@ -117,8 +110,8 @@
}
public void testChar() {
- delayTestFinish(TEST_DELAY);
ValueTypesTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo((char) (Character.MAX_VALUE / (char) 2), new AsyncCallback() {
public void onFailure(Throwable caught) {
@@ -135,8 +128,8 @@
}
public void testChar_MAX_VALUE() {
- delayTestFinish(TEST_DELAY);
ValueTypesTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo_MAX_VALUE(Character.MAX_VALUE, new AsyncCallback() {
public void onFailure(Throwable caught) {
@@ -152,8 +145,8 @@
}
public void testChar_MIN_VALUE() {
- delayTestFinish(TEST_DELAY);
ValueTypesTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo_MIN_VALUE(Character.MIN_VALUE, new AsyncCallback() {
public void onFailure(Throwable caught) {
@@ -169,8 +162,8 @@
}
public void testDouble() {
- delayTestFinish(TEST_DELAY);
ValueTypesTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo(Double.MAX_VALUE / 2, new AsyncCallback() {
public void onFailure(Throwable caught) {
@@ -186,8 +179,8 @@
}
public void testDouble_MAX_VALUE() {
- delayTestFinish(TEST_DELAY);
ValueTypesTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo_MAX_VALUE(Double.MAX_VALUE, new AsyncCallback() {
public void onFailure(Throwable caught) {
@@ -203,8 +196,8 @@
}
public void testDouble_MIN_VALUE() {
- delayTestFinish(TEST_DELAY);
ValueTypesTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo_MIN_VALUE(Double.MIN_VALUE, new AsyncCallback() {
public void onFailure(Throwable caught) {
@@ -223,8 +216,8 @@
* Validate that NaNs (not-a-number, such as 0/0) propagate properly via RPC.
*/
public void testDouble_NaN() {
- delayTestFinish(TEST_DELAY);
ValueTypesTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo(Double.NaN, new AsyncCallback() {
public void onFailure(Throwable caught) {
@@ -243,8 +236,8 @@
* Validate that negative infinity propagates properly via RPC.
*/
public void testDouble_NegInfinity() {
- delayTestFinish(TEST_DELAY);
ValueTypesTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo(Double.NEGATIVE_INFINITY, new AsyncCallback() {
public void onFailure(Throwable caught) {
@@ -264,8 +257,8 @@
* Validate that positive infinity propagates properly via RPC.
*/
public void testDouble_PosInfinity() {
- delayTestFinish(TEST_DELAY);
ValueTypesTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo(Double.POSITIVE_INFINITY, new AsyncCallback() {
public void onFailure(Throwable caught) {
@@ -282,8 +275,8 @@
}
public void testFloat() {
- delayTestFinish(TEST_DELAY);
ValueTypesTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo(Float.MAX_VALUE / 2, new AsyncCallback() {
public void onFailure(Throwable caught) {
@@ -299,8 +292,8 @@
}
public void testFloat_MAX_VALUE() {
- delayTestFinish(TEST_DELAY);
ValueTypesTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo_MAX_VALUE(Float.MAX_VALUE, new AsyncCallback() {
public void onFailure(Throwable caught) {
@@ -316,8 +309,8 @@
}
public void testFloat_MIN_VALUE() {
- delayTestFinish(TEST_DELAY);
ValueTypesTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo_MIN_VALUE(Float.MIN_VALUE, new AsyncCallback() {
public void onFailure(Throwable caught) {
@@ -336,8 +329,8 @@
* Validate that NaNs (not-a-number, such as 0/0) propagate properly via RPC.
*/
public void testFloat_NaN() {
- delayTestFinish(TEST_DELAY);
ValueTypesTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo(Float.NaN, new AsyncCallback() {
public void onFailure(Throwable caught) {
@@ -356,8 +349,8 @@
* Validate that negative infinity propagates properly via RPC.
*/
public void testFloat_NegInfinity() {
- delayTestFinish(TEST_DELAY);
ValueTypesTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo(Float.NEGATIVE_INFINITY, new AsyncCallback() {
public void onFailure(Throwable caught) {
@@ -377,8 +370,8 @@
* Validate that positive infinity propagates properly via RPC.
*/
public void testFloat_PosInfinity() {
- delayTestFinish(TEST_DELAY);
ValueTypesTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo(Float.POSITIVE_INFINITY, new AsyncCallback() {
public void onFailure(Throwable caught) {
@@ -395,8 +388,8 @@
}
public void testInteger() {
- delayTestFinish(TEST_DELAY);
ValueTypesTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo(Integer.MAX_VALUE / 2, new AsyncCallback() {
public void onFailure(Throwable caught) {
@@ -412,8 +405,8 @@
}
public void testInteger_MAX_VALUE() {
- delayTestFinish(TEST_DELAY);
ValueTypesTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo_MAX_VALUE(Integer.MAX_VALUE, new AsyncCallback() {
public void onFailure(Throwable caught) {
@@ -429,8 +422,8 @@
}
public void testInteger_MIN_VALUE() {
- delayTestFinish(TEST_DELAY);
ValueTypesTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo_MIN_VALUE(Integer.MIN_VALUE, new AsyncCallback() {
public void onFailure(Throwable caught) {
@@ -446,8 +439,8 @@
}
public void testLong() {
- delayTestFinish(TEST_DELAY);
ValueTypesTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo(Long.MAX_VALUE / 2, new AsyncCallback() {
public void onFailure(Throwable caught) {
@@ -464,8 +457,8 @@
}
public void testLong_MAX_VALUE() {
- delayTestFinish(TEST_DELAY);
ValueTypesTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo_MAX_VALUE(Long.MAX_VALUE, new AsyncCallback() {
public void onFailure(Throwable caught) {
@@ -481,8 +474,8 @@
}
public void testLong_MIN_VALUE() {
- delayTestFinish(TEST_DELAY);
ValueTypesTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo_MIN_VALUE(Long.MIN_VALUE, new AsyncCallback() {
public void onFailure(Throwable caught) {
@@ -498,8 +491,8 @@
}
public void testShort() {
- delayTestFinish(TEST_DELAY);
ValueTypesTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo((short) (Short.MAX_VALUE / (short) 2), new AsyncCallback() {
public void onFailure(Throwable caught) {
@@ -515,8 +508,8 @@
}
public void testShort_MAX_VALUE() {
- delayTestFinish(TEST_DELAY);
ValueTypesTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo_MAX_VALUE(Short.MAX_VALUE, new AsyncCallback() {
public void onFailure(Throwable caught) {
@@ -532,8 +525,8 @@
}
public void testShort_MIN_VALUE() {
- delayTestFinish(TEST_DELAY);
ValueTypesTestServiceAsync service = getServiceAsync();
+ delayTestFinishForRpc();
service.echo_MIN_VALUE(Short.MIN_VALUE, new AsyncCallback() {
public void onFailure(Throwable caught) {