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: spoon@google.com
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@8431 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/build.xml b/user/build.xml
index 19366da..964f1bb 100755
--- a/user/build.xml
+++ b/user/build.xml
@@ -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}">
diff --git a/user/src/com/google/gwt/validation/Validation.gwt.xml b/user/src/com/google/gwt/validation/Validation.gwt.xml
new file mode 100644
index 0000000..3daa6e3
--- /dev/null
+++ b/user/src/com/google/gwt/validation/Validation.gwt.xml
@@ -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>
diff --git a/user/src/javax/validation/Validation.gwt.xml b/user/src/javax/validation/Validation.gwt.xml
new file mode 100644
index 0000000..c232374
--- /dev/null
+++ b/user/src/javax/validation/Validation.gwt.xml
@@ -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>
\ No newline at end of file
diff --git a/user/test/com/google/gwt/validation/ValidationSuite.java b/user/test/com/google/gwt/validation/ValidationSuite.java
new file mode 100644
index 0000000..d706472
--- /dev/null
+++ b/user/test/com/google/gwt/validation/ValidationSuite.java
@@ -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;
+ }
+
+}
diff --git a/user/test/com/google/gwt/validation/client/SimpleSample.java b/user/test/com/google/gwt/validation/client/SimpleSample.java
new file mode 100644
index 0000000..d549186
--- /dev/null
+++ b/user/test/com/google/gwt/validation/client/SimpleSample.java
@@ -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;
+ }
+}
diff --git a/user/test/com/google/gwt/validation/client/SimpleSampleTest.java b/user/test/com/google/gwt/validation/client/SimpleSampleTest.java
new file mode 100644
index 0000000..34e6a16
--- /dev/null
+++ b/user/test/com/google/gwt/validation/client/SimpleSampleTest.java
@@ -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";
+ }
+}