Revision: 8431
Author: [email protected]
Date: Wed Jul 28 18:16:13 2010
Log: Make javax.validation available to gwt clients.

This is a first step towards supporting JSR-303 in the GWT client.

Review at http://gwt-code-reviews.appspot.com/711801

Review by: [email protected]
http://code.google.com/p/google-web-toolkit/source/detail?r=8431

Added:
 /trunk/user/src/com/google/gwt/validation
 /trunk/user/src/com/google/gwt/validation/Validation.gwt.xml
 /trunk/user/src/javax
 /trunk/user/src/javax/validation
 /trunk/user/src/javax/validation/Validation.gwt.xml
 /trunk/user/test/com/google/gwt/validation
 /trunk/user/test/com/google/gwt/validation/ValidationSuite.java
 /trunk/user/test/com/google/gwt/validation/client
 /trunk/user/test/com/google/gwt/validation/client/SimpleSample.java
 /trunk/user/test/com/google/gwt/validation/client/SimpleSampleTest.java
Modified:
 /trunk/user/build.xml

=======================================
--- /dev/null
+++ /trunk/user/src/com/google/gwt/validation/Validation.gwt.xml Wed Jul 28 18:16:13 2010
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.0.1//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.0.1/distro-source/core/src/gwt-module.dtd";>
+<!--
+  Copyright 2010 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.
+-->
+<module>
+   <inherits name="com.google.gwt.user.User"/>
+   <inherits name="javax.validation.Validation"/>
+   <source path="client"/>
+</module>
=======================================
--- /dev/null
+++ /trunk/user/src/javax/validation/Validation.gwt.xml Wed Jul 28 18:16:13 2010
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.0.1//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.0.1/distro-source/core/src/gwt-module.dtd";>
+<!--
+  Copyright 2010 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.
+-->
+<!-- Includes the javax.validation classes from the source jar  -->
+<module>
+  <source path=""/>
+</module>
=======================================
--- /dev/null
+++ /trunk/user/test/com/google/gwt/validation/ValidationSuite.java Wed Jul 28 18:16:13 2010
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2010 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.validation;
+
+import com.google.gwt.junit.tools.GWTTestSuite;
+import com.google.gwt.validation.client.SimpleSampleTest;
+
+import junit.framework.Test;
+
+/**
+ * All validation tests.
+ */
+public class ValidationSuite {
+
+  public static Test suite() {
+    GWTTestSuite suite = new GWTTestSuite(
+        "Test suite for all validation code.");
+    suite.addTestSuite(SimpleSampleTest.class);
+    return suite;
+  }
+
+}
=======================================
--- /dev/null
+++ /trunk/user/test/com/google/gwt/validation/client/SimpleSample.java Wed Jul 28 18:16:13 2010
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2010 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.validation.client;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * A simple sample class to test javax.validation
+ */
+public class SimpleSample {
+  @NotNull
+  private String name;
+
+  public String getName() {
+    return name;
+  }
+
+  public void setName(String name) {
+    this.name = name;
+  }
+}
=======================================
--- /dev/null
+++ /trunk/user/test/com/google/gwt/validation/client/SimpleSampleTest.java Wed Jul 28 18:16:13 2010
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2010 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.validation.client;
+
+import com.google.gwt.junit.client.GWTTestCase;
+
+/**
+ * Tests for {...@link SimpleSample}.
+ */
+public class SimpleSampleTest extends GWTTestCase {
+  SimpleSample sample;
+
+  @Override
+  protected void gwtSetUp() {
+    sample = new SimpleSample();
+  }
+
+  public void testAnnotatedClassCompiles() throws Exception {
+    // Only tests that validation annotated class compile
+    assertEquals(null, sample.getName());
+  }
+
+  @Override
+  public String getModuleName() {
+    return "com.google.gwt.validation.Validation";
+  }
+}
=======================================
--- /trunk/user/build.xml       Mon Jun 28 08:45:45 2010
+++ /trunk/user/build.xml       Wed Jul 28 18:16:13 2010
@@ -75,6 +75,8 @@
<pathelement location="${gwt.tools.lib}/w3c/flute/flute-1.3-gg1.jar" /> <pathelement location="${gwt.tools}/redist/json/r2_20080312/json-1.5.jar" /> <pathelement location="${gwt.tools.lib}/javax/validation/validation-api-1.0.0.GA.jar" /> + <!-- The source is included so validation is available from client code --> + <pathelement location="${gwt.tools.lib}/javax/validation/validation-api-1.0.0.GA-sources.jar" />
         <pathelement location="${gwt.dev.jar}" />
       </classpath>
     </gwt.javac>
@@ -484,7 +486,7 @@
     <!-- Prevent compilation for every target. -->
     <property name="compile.complete" value="true"/>
     <property name="compile.tests.complete" value="true"/>
-
+
     <property.ensure name="distro.built" location="${gwt.dev.staging.jar}"
message="GWT must be built before performing any tests. This can be fixed by running ant in the ${gwt.root} directory." />
     <limit failonerror="true" hours="${test.timeout}">

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to