Search in sources :

Example 1 with JournalingSchemaToolingTarget

use of org.hibernate.test.hbm.index.JournalingSchemaToolingTarget in project hibernate-orm by hibernate.

the class UniqueDelegateTest method testUniqueDelegateConsulted.

@Test
@TestForIssue(jiraKey = "HHH-10203")
public void testUniqueDelegateConsulted() {
    final Metadata metadata = new MetadataSources(ssr).addResource("org/hibernate/test/hbm/uk/person_unique.hbm.xml").buildMetadata();
    final JournalingSchemaToolingTarget target = new JournalingSchemaToolingTarget();
    new SchemaCreatorImpl(ssr).doCreation(metadata, false, target);
    assertThat(getAlterTableToAddUniqueKeyCommandCallCount, equalTo(1));
    assertThat(getColumnDefinitionUniquenessFragmentCallCount, equalTo(1));
    assertThat(getTableCreationUniqueConstraintsFragmentCallCount, equalTo(1));
    new SchemaDropperImpl(ssr).doDrop(metadata, false, target);
    // unique keys are not dropped explicitly
    assertThat(getAlterTableToAddUniqueKeyCommandCallCount, equalTo(1));
    assertThat(getColumnDefinitionUniquenessFragmentCallCount, equalTo(1));
    assertThat(getTableCreationUniqueConstraintsFragmentCallCount, equalTo(1));
}
Also used : SchemaCreatorImpl(org.hibernate.tool.schema.internal.SchemaCreatorImpl) SchemaDropperImpl(org.hibernate.tool.schema.internal.SchemaDropperImpl) Metadata(org.hibernate.boot.Metadata) MetadataSources(org.hibernate.boot.MetadataSources) JournalingSchemaToolingTarget(org.hibernate.test.hbm.index.JournalingSchemaToolingTarget) Test(org.junit.Test) TestForIssue(org.hibernate.testing.TestForIssue)

Example 2 with JournalingSchemaToolingTarget

use of org.hibernate.test.hbm.index.JournalingSchemaToolingTarget in project hibernate-orm by hibernate.

the class CollectionPkTest method verifyPkNameUsed.

private void verifyPkNameUsed(String mappingResource, String expectedName) {
    final Metadata metadata = new MetadataSources(ssr).addResource(mappingResource).buildMetadata();
    final JournalingSchemaToolingTarget target = new JournalingSchemaToolingTarget();
    new SchemaCreatorImpl(ssr).doCreation(metadata, false, target);
    assertTrue("Expected foreign-key name [" + expectedName + "] not seen in schema creation output", target.containedText(expectedName));
}
Also used : SchemaCreatorImpl(org.hibernate.tool.schema.internal.SchemaCreatorImpl) Metadata(org.hibernate.boot.Metadata) MetadataSources(org.hibernate.boot.MetadataSources) JournalingSchemaToolingTarget(org.hibernate.test.hbm.index.JournalingSchemaToolingTarget)

Example 3 with JournalingSchemaToolingTarget

use of org.hibernate.test.hbm.index.JournalingSchemaToolingTarget in project hibernate-orm by hibernate.

the class CollectionKeyFkNameTest method verifyFkNameUsed.

private void verifyFkNameUsed(String mappingResource, String expectedName) {
    final Metadata metadata = new MetadataSources(ssr).addResource(mappingResource).buildMetadata();
    final JournalingSchemaToolingTarget target = new JournalingSchemaToolingTarget();
    new SchemaCreatorImpl(ssr).doCreation(metadata, ssr, ssr.getService(ConfigurationService.class).getSettings(), false, target);
    assertTrue("Expected foreign-key name [" + expectedName + "] not seen in schema creation output", target.containedText(expectedName));
}
Also used : SchemaCreatorImpl(org.hibernate.tool.schema.internal.SchemaCreatorImpl) Metadata(org.hibernate.boot.Metadata) MetadataSources(org.hibernate.boot.MetadataSources) JournalingSchemaToolingTarget(org.hibernate.test.hbm.index.JournalingSchemaToolingTarget)

Aggregations

Metadata (org.hibernate.boot.Metadata)3 MetadataSources (org.hibernate.boot.MetadataSources)3 JournalingSchemaToolingTarget (org.hibernate.test.hbm.index.JournalingSchemaToolingTarget)3 SchemaCreatorImpl (org.hibernate.tool.schema.internal.SchemaCreatorImpl)3 TestForIssue (org.hibernate.testing.TestForIssue)1 SchemaDropperImpl (org.hibernate.tool.schema.internal.SchemaDropperImpl)1 Test (org.junit.Test)1