HV-361 Changing existing tests to use @RequiresDialect(DialectChecks.SupportColumnCheck)

This commit is contained in:
Hardy Ferentschik 2010-11-10 18:00:40 +01:00
parent d24a06ee8d
commit c22a6be533
3 changed files with 11 additions and 7 deletions

View File

@ -33,11 +33,15 @@ import org.hibernate.cfg.Configuration;
import org.hibernate.mapping.Column; import org.hibernate.mapping.Column;
import org.hibernate.mapping.PersistentClass; import org.hibernate.mapping.PersistentClass;
import org.hibernate.test.annotations.TestCase; import org.hibernate.test.annotations.TestCase;
import org.hibernate.testing.junit.DialectChecks;
import org.hibernate.testing.junit.RequiresDialectFeature;
/** /**
* @author Vladimir Klyushnikov * @author Vladimir Klyushnikov
*/ */
public class DDLWithoutCallbackTest extends TestCase { public class DDLWithoutCallbackTest extends TestCase {
@RequiresDialectFeature(value = DialectChecks.SupportsColumnCheck.class,
comment = "Not all databases support column checks")
public void testListeners() { public void testListeners() {
CupHolder ch = new CupHolder(); CupHolder ch = new CupHolder();
ch.setRadius( new BigDecimal( "12" ) ); ch.setRadius( new BigDecimal( "12" ) );
@ -46,9 +50,7 @@ public class DDLWithoutCallbackTest extends TestCase {
try { try {
s.persist( ch ); s.persist( ch );
s.flush(); s.flush();
if ( getDialect().supportsColumnCheck() ) { fail( "expecting SQL constraint violation" );
fail( "expecting SQL constraint violation" );
}
} }
catch ( ConstraintViolationException e ) { catch ( ConstraintViolationException e ) {
fail( "invalid object should not be validated" ); fail( "invalid object should not be validated" );

View File

@ -22,8 +22,6 @@
* Boston, MA 02110-1301 USA * Boston, MA 02110-1301 USA
*/ */
// $Id$
package org.hibernate.testing.junit; package org.hibernate.testing.junit;
import org.hibernate.dialect.Dialect; import org.hibernate.dialect.Dialect;
@ -55,7 +53,11 @@ abstract public class DialectChecks {
} }
} }
public static class SupportsColumnCheck extends DialectChecks {
public boolean include(Dialect dialect) {
return dialect.supportsColumnCheck();
}
}
} }

View File

@ -32,7 +32,7 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
/** /**
* Annotation used to indicate that a test should be run only when the current dialect suppports the * Annotation used to indicate that a test should be run only when the current dialect supports the
* specified feature. * specified feature.
* *
* @author Hardy Ferentschik * @author Hardy Ferentschik