Revision: 8709
Author: j...@google.com
Date: Thu Sep 2 14:24:35 2010
Log: Rolling back the following due to test failures:
Added tests for constraint violations.
Patch by: amitmanjhi
Review by: robertvawter,fabbott
http://code.google.com/p/google-web-toolkit/source/detail?r=8709
Modified:
/trunk/user/build.xml
/trunk/user/test/com/google/gwt/requestfactory/client/RequestFactoryTest.java
/trunk/user/test/com/google/gwt/requestfactory/server/SimpleFoo.java
=======================================
--- /trunk/user/build.xml Thu Sep 2 10:56:13 2010
+++ /trunk/user/build.xml Thu Sep 2 14:24:35 2010
@@ -61,10 +61,6 @@
<pathelement location="${gwt.tools.lib}/objectweb/asm-3.1.jar"/>
<pathelement
location="${gwt.tools.lib}/javax/validation/validation-api-1.0.0.GA.jar" />
<pathelement
location="${gwt.tools.lib}/javax/validation/validation-api-1.0.0.GA-sources.jar"
/>
- <pathelement location="${gwt.tools.lib}/apache/log4j/log4j-1.2.16.jar"
/>
- <pathelement
location="${gwt.tools.lib}/hibernate/validator/hibernate-validator-4.1.0.Final.jar"
/>
- <pathelement
location="${gwt.tools.lib}/slf4j/slf4j-api/slf4j-api-1.6.1.jar" />
- <pathelement
location="${gwt.tools.lib}/slf4j/slf4j-log4j12/slf4j-log4j12-1.6.1.jar" />
<pathelement
location="${gwt.tools}/redist/json/r2_20080312/json-1.5.jar" />
<pathelement location="${gwt.dev.jar}" />
</path>
=======================================
---
/trunk/user/test/com/google/gwt/requestfactory/client/RequestFactoryTest.java
Thu Sep 2 10:56:13 2010
+++
/trunk/user/test/com/google/gwt/requestfactory/client/RequestFactoryTest.java
Thu Sep 2 14:24:35 2010
@@ -26,7 +26,6 @@
import com.google.gwt.requestfactory.shared.SimpleRequestFactory;
import com.google.gwt.requestfactory.shared.SyncResult;
-import java.util.Map;
import java.util.Set;
/**
@@ -34,53 +33,6 @@
*/
public class RequestFactoryTest extends GWTTestCase {
- public void testViolationPresent() {
- final SimpleRequestFactory req =
GWT.create(SimpleRequestFactory.class);
- HandlerManager hm = new HandlerManager(null);
- req.init(hm);
- delayTestFinish(5000);
-
- SimpleFooRecord newFoo = (SimpleFooRecord)
req.create(SimpleFooRecord.class);
- final RequestObject<Void> fooReq =
req.simpleFooRequest().persist(newFoo);
-
- newFoo = fooReq.edit(newFoo);
- newFoo.setUserName("A"); // will cause constraint violation
-
- fooReq.fire(new Receiver<Void>() {
- public void onSuccess(Void ignore, Set<SyncResult> syncResults) {
- assertEquals(1, syncResults.size());
- SyncResult syncResult = syncResults.iterator().next();
- assertTrue(syncResult.hasViolations());
- Map<String, String> violations = syncResult.getViolations();
- assertEquals(1, violations.size());
- assertEquals("size must be between 3 and 30",
violations.get("userName"));
- finishTest();
- }
- });
- }
-
- public void testViolationAbsent() {
- final SimpleRequestFactory req =
GWT.create(SimpleRequestFactory.class);
- HandlerManager hm = new HandlerManager(null);
- req.init(hm);
- delayTestFinish(5000);
-
- SimpleFooRecord newFoo = (SimpleFooRecord)
req.create(SimpleFooRecord.class);
- final RequestObject<Void> fooReq =
req.simpleFooRequest().persist(newFoo);
-
- newFoo = fooReq.edit(newFoo);
- newFoo.setUserName("Amit"); // will not cause violation.
-
- fooReq.fire(new Receiver<Void>() {
- public void onSuccess(Void ignore, Set<SyncResult> syncResults) {
- assertEquals(1, syncResults.size());
- SyncResult syncResult = syncResults.iterator().next();
- assertFalse(syncResult.hasViolations());
- finishTest();
- }
- });
- }
-
/*
* TODO: all these tests should check the final values. It will be easy
when
* we have better persistence than the singleton pattern.
@@ -186,8 +138,7 @@
new Receiver<SimpleFooRecord>() {
public void onSuccess(SimpleFooRecord finalFooRecord,
Set<SyncResult> syncResults) {
- // newFoo hasn't been persisted, so userName is
the old
- // value.
+ // newFoo hasn't been persisted, so userName is
the old value.
assertEquals("GWT", finalFooRecord.getUserName());
finishTest();
}
@@ -253,7 +204,7 @@
});
}
- public void testPersistRecursiveRelation() {
+ public void testPersistRecursiveRelation() {
final SimpleRequestFactory req =
GWT.create(SimpleRequestFactory.class);
HandlerManager hm = new HandlerManager(null);
req.init(hm);
@@ -373,12 +324,12 @@
public void onSuccess(SimpleFooRecord response,
Set<SyncResult> syncResult) {
SimpleBarRecord bar = req.create(SimpleBarRecord.class);
- RequestObject<String> helloReq = req.simpleFooRequest().hello(
- response, bar);
+ RequestObject<String> helloReq =
req.simpleFooRequest().hello(response, bar);
bar = helloReq.edit(bar);
bar.setUserName("BAR");
helloReq.fire(new Receiver<String>() {
- public void onSuccess(String response, Set<SyncResult>
syncResults) {
+ public void onSuccess(String response,
+ Set<SyncResult> syncResults) {
assertEquals("Greetings BAR from GWT", response);
finishTest();
}
@@ -388,8 +339,8 @@
}
/*
- * tests that (a) any method can have a side effect that is handled
correctly.
- * (b) instance methods are handled correctly.
+ * tests that (a) any method can have a side effect that is handled
correctly. (b)
+ * instance methods are handled correctly.
*/
public void testMethodWithSideEffects() {
final SimpleRequestFactory req =
GWT.create(SimpleRequestFactory.class);
@@ -416,8 +367,7 @@
assertNull(syncResultArray[0].getFutureId());
Record record = syncResultArray[0].getRecord();
assertEquals(new Long(999L), record.getId());
- // confirm that the instance method did have the desired
- // sideEffect.
+ // confirm that the instance method did have the desired
sideEffect.
req.simpleFooRequest().findSimpleFooById(999L).fire(
new Receiver<SimpleFooRecord>() {
public void onSuccess(SimpleFooRecord finalFoo,
=======================================
--- /trunk/user/test/com/google/gwt/requestfactory/server/SimpleFoo.java
Thu Sep 2 10:56:13 2010
+++ /trunk/user/test/com/google/gwt/requestfactory/server/SimpleFoo.java
Thu Sep 2 14:24:35 2010
@@ -24,8 +24,6 @@
import java.util.Date;
import java.util.List;
-import javax.validation.constraints.Size;
-
/**
* Domain object for SimpleFooRequest.
*/
@@ -70,7 +68,6 @@
Integer version = 1;
- @Size(min = 3, max = 30)
private String userName;
private String password;
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors