Search in sources :

Example 21 with ConfigurationFacadeImpl

use of org.jboss.tools.hibernate.runtime.v_6_0.internal.ConfigurationFacadeImpl in project jbosstools-hibernate by jbosstools.

the class ConfigurationFacadeTest method testGetClassMappings.

@Test
public void testGetClassMappings() {
    configurationFacade = new ConfigurationFacadeImpl(FACADE_FACTORY, configuration);
    assertFalse(configurationFacade.getClassMappings().hasNext());
    PersistentClass persistentClass = new RootClass(DummyMetadataBuildingContext.INSTANCE);
    persistentClass.setEntityName("Foo");
    IPersistentClass persistentClassFacade = FACADE_FACTORY.createPersistentClass(persistentClass);
    configurationFacade = new ConfigurationFacadeImpl(FACADE_FACTORY, configuration);
    ((ConfigurationFacadeImpl) configurationFacade).addedClasses.add(persistentClassFacade);
    Iterator<IPersistentClass> iterator = configurationFacade.getClassMappings();
    assertTrue(iterator.hasNext());
    assertSame(iterator.next(), persistentClassFacade);
}
Also used : RootClass(org.hibernate.mapping.RootClass) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) PersistentClass(org.hibernate.mapping.PersistentClass) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) Test(org.junit.jupiter.api.Test) MetadataHelperTest(org.jboss.tools.hibernate.runtime.v_6_0.internal.util.MetadataHelperTest)

Example 22 with ConfigurationFacadeImpl

use of org.jboss.tools.hibernate.runtime.v_6_0.internal.ConfigurationFacadeImpl in project jbosstools-hibernate by jbosstools.

the class ConfigurationFacadeTest method testGetEntityResolver.

@Test
public void testGetEntityResolver() {
    EntityResolver testResolver = new DefaultHandler();
    ConfigurationFacadeImpl facade = (ConfigurationFacadeImpl) configurationFacade;
    assertNotSame(testResolver, configurationFacade.getEntityResolver());
    facade.entityResolver = testResolver;
    assertSame(testResolver, configurationFacade.getEntityResolver());
}
Also used : EntityResolver(org.xml.sax.EntityResolver) DefaultHandler(org.xml.sax.helpers.DefaultHandler) Test(org.junit.jupiter.api.Test) MetadataHelperTest(org.jboss.tools.hibernate.runtime.v_6_0.internal.util.MetadataHelperTest)

Example 23 with ConfigurationFacadeImpl

use of org.jboss.tools.hibernate.runtime.v_6_0.internal.ConfigurationFacadeImpl in project jbosstools-hibernate by jbosstools.

the class ConfigurationFacadeTest method testSetReverseEngineeringStrategy.

@Test
public void testSetReverseEngineeringStrategy() {
    JdbcMetadataConfiguration configuration = new JdbcMetadataConfiguration();
    configurationFacade = new ConfigurationFacadeImpl(FACADE_FACTORY, configuration);
    RevengStrategy reverseEngineeringStrategy = new DefaultStrategy();
    IReverseEngineeringStrategy strategyFacade = FACADE_FACTORY.createReverseEngineeringStrategy(reverseEngineeringStrategy);
    assertNotSame(reverseEngineeringStrategy, configuration.getReverseEngineeringStrategy());
    configurationFacade.setReverseEngineeringStrategy(strategyFacade);
    assertSame(reverseEngineeringStrategy, configuration.getReverseEngineeringStrategy());
}
Also used : RevengStrategy(org.hibernate.tool.api.reveng.RevengStrategy) IReverseEngineeringStrategy(org.jboss.tools.hibernate.runtime.spi.IReverseEngineeringStrategy) JdbcMetadataConfiguration(org.jboss.tools.hibernate.runtime.v_6_0.internal.util.JdbcMetadataConfiguration) DefaultStrategy(org.hibernate.tool.internal.reveng.strategy.DefaultStrategy) Test(org.junit.jupiter.api.Test) MetadataHelperTest(org.jboss.tools.hibernate.runtime.v_6_0.internal.util.MetadataHelperTest)

Example 24 with ConfigurationFacadeImpl

use of org.jboss.tools.hibernate.runtime.v_6_0.internal.ConfigurationFacadeImpl in project jbosstools-hibernate by jbosstools.

the class ConfigurationFacadeTest method beforeEach.

@BeforeEach
public void beforeEach() {
    configuration = new Configuration();
    configuration.setProperty(AvailableSettings.DIALECT, MockDialect.class.getName());
    configuration.setProperty(AvailableSettings.CONNECTION_PROVIDER, MockConnectionProvider.class.getName());
    configurationFacade = new ConfigurationFacadeImpl(FACADE_FACTORY, configuration);
}
Also used : MockConnectionProvider(org.jboss.tools.hibernate.runtime.v_6_0.internal.util.MockConnectionProvider) Configuration(org.hibernate.cfg.Configuration) JdbcMetadataConfiguration(org.jboss.tools.hibernate.runtime.v_6_0.internal.util.JdbcMetadataConfiguration) IConfiguration(org.jboss.tools.hibernate.runtime.spi.IConfiguration) MockDialect(org.jboss.tools.hibernate.runtime.v_6_0.internal.util.MockDialect) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 25 with ConfigurationFacadeImpl

use of org.jboss.tools.hibernate.runtime.v_6_0.internal.ConfigurationFacadeImpl in project jbosstools-hibernate by jbosstools.

the class ConfigurationFacadeTest method testGetNamingStrategy.

@Test
public void testGetNamingStrategy() {
    INamingStrategy strategy = FACADE_FACTORY.createNamingStrategy(new DefaultNamingStrategy());
    ConfigurationFacadeImpl facade = (ConfigurationFacadeImpl) configurationFacade;
    assertNull(facade.getNamingStrategy());
    facade.namingStrategy = strategy;
    assertSame(strategy, facade.getNamingStrategy());
}
Also used : INamingStrategy(org.jboss.tools.hibernate.runtime.spi.INamingStrategy) DefaultNamingStrategy(org.hibernate.cfg.DefaultNamingStrategy) Test(org.junit.jupiter.api.Test) MetadataHelperTest(org.jboss.tools.hibernate.runtime.v_6_0.internal.util.MetadataHelperTest)

Aggregations

Test (org.junit.jupiter.api.Test)20 Configuration (org.hibernate.cfg.Configuration)13 PersistentClass (org.hibernate.mapping.PersistentClass)13 IPersistentClass (org.jboss.tools.hibernate.runtime.spi.IPersistentClass)13 MetadataHelperTest (org.jboss.tools.hibernate.runtime.v_6_0.internal.util.MetadataHelperTest)12 Metadata (org.hibernate.boot.Metadata)8 RootClass (org.hibernate.mapping.RootClass)8 BeforeEach (org.junit.jupiter.api.BeforeEach)6 ByteArrayInputStream (java.io.ByteArrayInputStream)5 Field (java.lang.reflect.Field)5 MetadataSources (org.hibernate.boot.MetadataSources)5 JdbcMetadataConfiguration (org.jboss.tools.hibernate.runtime.v_6_0.internal.util.JdbcMetadataConfiguration)5 HashMap (java.util.HashMap)4 MetadataImpl (org.hibernate.boot.internal.MetadataImpl)4 ConfigurationFacadeImpl (org.jboss.tools.hibernate.runtime.v_5_3.internal.ConfigurationFacadeImpl)3 ConfigurationFacadeImpl (org.jboss.tools.hibernate.runtime.v_5_4.internal.ConfigurationFacadeImpl)3 ConfigurationFacadeImpl (org.jboss.tools.hibernate.runtime.v_5_5.internal.ConfigurationFacadeImpl)3 ConfigurationFacadeImpl (org.jboss.tools.hibernate.runtime.v_5_6.internal.ConfigurationFacadeImpl)3 MockConnectionProvider (org.jboss.tools.hibernate.runtime.v_6_0.internal.util.MockConnectionProvider)3 MockDialect (org.jboss.tools.hibernate.runtime.v_6_0.internal.util.MockDialect)3