diff --git a/hibernate-core/src/test/java/org/hibernate/test/id/Car.hbm.xml b/hibernate-core/src/test/java/org/hibernate/test/id/Car.hbm.xml index 6ffe723da7..3de3c9262e 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/id/Car.hbm.xml +++ b/hibernate-core/src/test/java/org/hibernate/test/id/Car.hbm.xml @@ -21,7 +21,7 @@ - + 0 diff --git a/hibernate-core/src/test/java/org/hibernate/test/schemavalidation/LongVarcharValidationTest.java b/hibernate-core/src/test/java/org/hibernate/test/schemavalidation/LongVarcharValidationTest.java index 6c52bda034..1d6d27d2dd 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/schemavalidation/LongVarcharValidationTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/schemavalidation/LongVarcharValidationTest.java @@ -6,8 +6,6 @@ */ package org.hibernate.test.schemavalidation; -import java.util.EnumSet; -import java.util.Map; import javax.persistence.Entity; import javax.persistence.Id; @@ -16,19 +14,10 @@ import org.hibernate.boot.MetadataSources; import org.hibernate.boot.registry.StandardServiceRegistry; import org.hibernate.boot.registry.StandardServiceRegistryBuilder; import org.hibernate.boot.spi.MetadataImplementor; -import org.hibernate.engine.config.spi.ConfigurationService; -import org.hibernate.tool.schema.SourceType; -import org.hibernate.tool.schema.TargetType; -import org.hibernate.tool.schema.internal.ExceptionHandlerLoggedImpl; -import org.hibernate.tool.schema.spi.ExceptionHandler; -import org.hibernate.tool.schema.spi.ExecutionOptions; -import org.hibernate.tool.schema.spi.SchemaManagementTool; -import org.hibernate.tool.schema.spi.ScriptSourceInput; -import org.hibernate.tool.schema.spi.ScriptTargetOutput; -import org.hibernate.tool.schema.spi.SourceDescriptor; -import org.hibernate.tool.schema.spi.TargetDescriptor; +import org.hibernate.tool.hbm2ddl.SchemaExport; +import org.hibernate.tool.hbm2ddl.SchemaValidator; +import org.hibernate.tool.hbm2ddl.Target; -import org.hibernate.testing.FailureExpected; import org.hibernate.testing.TestForIssue; import org.hibernate.testing.junit4.BaseUnitTestCase; import org.junit.After; @@ -39,7 +28,7 @@ import org.junit.Test; * @author Steve Ebersole */ @TestForIssue( jiraKey = "HHH-9693" ) -public class LongVarcharValidationTest extends BaseUnitTestCase implements ExecutionOptions { +public class LongVarcharValidationTest extends BaseUnitTestCase { private StandardServiceRegistry ssr; @Before @@ -63,81 +52,16 @@ public class LongVarcharValidationTest extends BaseUnitTestCase implements Execu // create the schema - createSchema( metadata ); + new SchemaExport( metadata ).create( Target.EXPORT ); try { - doValidation( metadata ); + new SchemaValidator( metadata ).validate(); } finally { - dropSchema( metadata ); + new SchemaExport( metadata ).drop( Target.EXPORT ); } } - private void doValidation(MetadataImplementor metadata) { - ssr.getService( SchemaManagementTool.class ).getSchemaValidator( null ).doValidation( - metadata, - this - ); - } - - private void createSchema(MetadataImplementor metadata) { - ssr.getService( SchemaManagementTool.class ).getSchemaCreator( null ).doCreation( - metadata, - this, - new SourceDescriptor() { - @Override - public SourceType getSourceType() { - return SourceType.METADATA; - } - - @Override - public ScriptSourceInput getScriptSourceInput() { - return null; - } - }, - new TargetDescriptor() { - @Override - public EnumSet getTargetTypes() { - return EnumSet.of( TargetType.DATABASE ); - } - - @Override - public ScriptTargetOutput getScriptTargetOutput() { - return null; - } - } - ); - } - - private void dropSchema(MetadataImplementor metadata) { - ssr.getService( SchemaManagementTool.class ).getSchemaDropper( null ).doDrop( - metadata, - this, - new SourceDescriptor() { - @Override - public SourceType getSourceType() { - return SourceType.METADATA; - } - - @Override - public ScriptSourceInput getScriptSourceInput() { - return null; - } - }, - new TargetDescriptor() { - @Override - public EnumSet getTargetTypes() { - return EnumSet.of( TargetType.DATABASE ); - } - - @Override - public ScriptTargetOutput getScriptTargetOutput() { - return null; - } - } - ); - } - @Entity public static class Translation { @Id @@ -146,18 +70,4 @@ public class LongVarcharValidationTest extends BaseUnitTestCase implements Execu String text; } - @Override - public Map getConfigurationValues() { - return ssr.getService( ConfigurationService.class ).getSettings(); - } - - @Override - public boolean shouldManageNamespaces() { - return false; - } - - @Override - public ExceptionHandler getExceptionHandler() { - return ExceptionHandlerLoggedImpl.INSTANCE; - } }