Add Traversable Resolver and UnknownProviderBootstrapCompile tests [JSR 303 TCK Result] 154 of 257 (59.92%) Pass with 26 Failures and 7 Errors. Review at http://gwt-code-reviews.appspot.com/1510804 Review by: rchandia@google.com git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@10497 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/test/com/google/gwt/validation/tck/TraversableResolverGwtSuite.java b/user/test/com/google/gwt/validation/tck/TraversableResolverGwtSuite.java new file mode 100644 index 0000000..340d7bf --- /dev/null +++ b/user/test/com/google/gwt/validation/tck/TraversableResolverGwtSuite.java
@@ -0,0 +1,33 @@ +/* + * 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.tck; + +import junit.framework.Test; + +import org.hibernate.jsr303.tck.tests.traversableresolver.TraversableResolverGwtTest; +import org.hibernate.jsr303.tck.util.TckTestSuiteWrapper; + +/** + * Tck Tests for the {@code traversableresolver} package. + */ +public class TraversableResolverGwtSuite { + public static Test suite() { + TckTestSuiteWrapper suite = new TckTestSuiteWrapper( + "TCK for GWT Validation, traversableresolver package"); + suite.addTestSuite(TraversableResolverGwtTest.class); + return suite; + } +}
diff --git a/user/test/com/google/gwt/validation/tck/ValidationGwtSuite.java b/user/test/com/google/gwt/validation/tck/ValidationGwtSuite.java index 702b97d..8510661 100644 --- a/user/test/com/google/gwt/validation/tck/ValidationGwtSuite.java +++ b/user/test/com/google/gwt/validation/tck/ValidationGwtSuite.java
@@ -18,6 +18,7 @@ import junit.framework.Test; import org.hibernate.jsr303.tck.tests.validation.PropertyPathGwtTest; +import org.hibernate.jsr303.tck.tests.validation.UnknownProviderBootstrapCompileTest; import org.hibernate.jsr303.tck.tests.validation.ValidateCompileTest; import org.hibernate.jsr303.tck.tests.validation.ValidateGwtTest; import org.hibernate.jsr303.tck.tests.validation.ValidatePropertyGwtTest; @@ -33,6 +34,7 @@ TckTestSuiteWrapper suite = new TckTestSuiteWrapper( "TCK for GWT Validation, validation package"); suite.addTestSuite(PropertyPathGwtTest.class); + suite.addTestSuite(UnknownProviderBootstrapCompileTest.class); suite.addTestSuite(ValidateGwtTest.class); suite.addTestSuite(ValidateCompileTest.class); suite.addTestSuite(ValidatePropertyGwtTest.class);
diff --git a/user/test/org/hibernate/jsr303/tck/tests/traversableresolver/TckTest.gwt.xml b/user/test/org/hibernate/jsr303/tck/tests/traversableresolver/TckTest.gwt.xml new file mode 100644 index 0000000..a3273e7 --- /dev/null +++ b/user/test/org/hibernate/jsr303/tck/tests/traversableresolver/TckTest.gwt.xml
@@ -0,0 +1,26 @@ +<?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="org.hibernate.jsr303.tck.tests.ValidationTck" /> + <source path=""> + <include name="*.java" /> + </source> + <replace-with class="org.hibernate.jsr303.tck.tests.traversableresolver.TckTestValidatorFactory"> + <when-type-is class="javax.validation.ValidatorFactory"/> + </replace-with> +</module>
diff --git a/user/test/org/hibernate/jsr303/tck/tests/traversableresolver/TckTestValidatorFactory.java b/user/test/org/hibernate/jsr303/tck/tests/traversableresolver/TckTestValidatorFactory.java new file mode 100644 index 0000000..96b5e24 --- /dev/null +++ b/user/test/org/hibernate/jsr303/tck/tests/traversableresolver/TckTestValidatorFactory.java
@@ -0,0 +1,41 @@ +/* + * 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 org.hibernate.jsr303.tck.tests.traversableresolver; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.validation.client.AbstractGwtValidatorFactory; +import com.google.gwt.validation.client.GwtValidation; +import com.google.gwt.validation.client.impl.AbstractGwtValidator; + +import javax.validation.Validator; + +/** + * Test {@link AbstractGwtValidatorFactory} for {@link TraversableResolverTest}. + */ +public final class TckTestValidatorFactory extends AbstractGwtValidatorFactory { + /** + * Marker Interface to {@link GWT#create(Class)}. + */ + @GwtValidation(value = { + Jacket.class, Person.class, Suit.class, Trousers.class}) + public static interface GwtValidator extends Validator { + } + + @Override + public AbstractGwtValidator createValidator() { + return GWT.create(GwtValidator.class); + } +}
diff --git a/user/test/org/hibernate/jsr303/tck/tests/traversableresolver/TraversableResolverGwtTest.java b/user/test/org/hibernate/jsr303/tck/tests/traversableresolver/TraversableResolverGwtTest.java new file mode 100644 index 0000000..1fc39c4 --- /dev/null +++ b/user/test/org/hibernate/jsr303/tck/tests/traversableresolver/TraversableResolverGwtTest.java
@@ -0,0 +1,47 @@ +/* + * 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 org.hibernate.jsr303.tck.tests.traversableresolver; + +import com.google.gwt.junit.client.GWTTestCase; + +import org.hibernate.jsr303.tck.util.client.Failing; + +/** + * Test wrapper for {@link TraversableResolverTest}. + */ +public class TraversableResolverGwtTest extends GWTTestCase { + private final TraversableResolverTest delegate = new TraversableResolverTest(); + + @Override + public String getModuleName() { + return "org.hibernate.jsr303.tck.tests.traversableresolver.TckTest"; + } + + @Failing(issue = 6544) + public void testCorrectNumberOfCallsToIsReachableAndIsCascadable() { + delegate.testCorrectNumberOfCallsToIsReachableAndIsCascadable(); + } + + @Failing(issue = 6544) + public void testCustomTraversableResolverViaConfiguration() { + delegate.testCustomTraversableResolverViaConfiguration(); + } + + public void testResolverExceptionsGetWrappedInValidationException() { + delegate.testResolverExceptionsGetWrappedInValidationException(); + } + +}
diff --git a/user/test/org/hibernate/jsr303/tck/tests/validation/UnknownProviderBootstrapCompileTest.gwt.xml b/user/test/org/hibernate/jsr303/tck/tests/validation/UnknownProviderBootstrapCompileTest.gwt.xml new file mode 100644 index 0000000..87ee45e --- /dev/null +++ b/user/test/org/hibernate/jsr303/tck/tests/validation/UnknownProviderBootstrapCompileTest.gwt.xml
@@ -0,0 +1,29 @@ +<?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> + <!-- specifically don't inherit hibernate --> + <inherits name="com.google.gwt.user.User" /> + <inherits name="org.hibernate.jsr303.tck.Jsr303Tck" /> + <source path=""> + <include name="*.java" /> + <exclude name="*CompileTest.java" /> + </source> + <replace-with class="org.hibernate.jsr303.tck.tests.validation.TckTestValidatorFactory"> + <when-type-is class="javax.validation.ValidatorFactory"/> + </replace-with> +</module> \ No newline at end of file
diff --git a/user/test/org/hibernate/jsr303/tck/tests/validation/UnknownProviderBootstrapCompileTest.java b/user/test/org/hibernate/jsr303/tck/tests/validation/UnknownProviderBootstrapCompileTest.java new file mode 100644 index 0000000..2f2678f --- /dev/null +++ b/user/test/org/hibernate/jsr303/tck/tests/validation/UnknownProviderBootstrapCompileTest.java
@@ -0,0 +1,39 @@ +/* + * 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 org.hibernate.jsr303.tck.tests.validation; + +import org.hibernate.jsr303.tck.util.TckCompileTestCase; +import org.hibernate.jsr303.tck.util.client.Failing; +import org.hibernate.jsr303.tck.util.client.NonTckTest; + +import javax.validation.ValidationException; + +/** + * Test wrapper for {@link UnknownProviderBootstrapTest} methods that are + * suppose to fail to compile. + */ +public class UnknownProviderBootstrapCompileTest extends TckCompileTestCase { + + @NonTckTest + public void testThereMustBeOnePassingTest() {} + + @Failing(issue = 6573) + public void testUnknownProviderThrowsValidationException() { + assertValidatorFailsToCompile(TckTestValidatorFactory.GwtValidator.class, + ValidationException.class, + "TODO(nchalko): get this to actually fail in the test."); + } +} \ No newline at end of file