Search in sources :

Example 6 with BootstrapContext

use of org.hibernate.boot.spi.BootstrapContext in project jbosstools-hibernate by jbosstools.

the class TypeFacadeTest method testIsComponentType.

@Test
public void testIsComponentType() {
    IType typeFacade = null;
    // first try type that is not a component type
    ClassType classType = new ClassType();
    typeFacade = FACADE_FACTORY.createType(classType);
    assertFalse(typeFacade.isComponentType());
    // next try a component type
    StandardServiceRegistryBuilder ssrb = new StandardServiceRegistryBuilder();
    ssrb.applySetting(AvailableSettings.DIALECT, MockDialect.class.getName());
    ssrb.applySetting(AvailableSettings.CONNECTION_PROVIDER, MockConnectionProvider.class.getName());
    StandardServiceRegistry ssr = ssrb.build();
    MetadataBuildingOptions mdbo = new MetadataBuilderImpl.MetadataBuildingOptionsImpl(ssr);
    BootstrapContext btc = new BootstrapContextImpl(ssr, mdbo);
    InFlightMetadataCollector ifmdc = new InFlightMetadataCollectorImpl(btc, mdbo);
    MetadataBuildingContext mdbc = new MetadataBuildingContextRootImpl(btc, mdbo, ifmdc);
    ComponentType componentType = new ComponentType(null, new ComponentMetamodel(new Component(mdbc, new RootClass(null)), btc));
    typeFacade = FACADE_FACTORY.createType(componentType);
    assertTrue(typeFacade.isComponentType());
}
Also used : MockConnectionProvider(org.jboss.tools.hibernate.runtime.v_5_6.internal.util.MockConnectionProvider) RootClass(org.hibernate.mapping.RootClass) ComponentType(org.hibernate.type.ComponentType) StandardServiceRegistryBuilder(org.hibernate.boot.registry.StandardServiceRegistryBuilder) ComponentMetamodel(org.hibernate.tuple.component.ComponentMetamodel) MockDialect(org.jboss.tools.hibernate.runtime.v_5_6.internal.util.MockDialect) MetadataBuildingContext(org.hibernate.boot.spi.MetadataBuildingContext) BootstrapContext(org.hibernate.boot.spi.BootstrapContext) BootstrapContextImpl(org.hibernate.boot.internal.BootstrapContextImpl) ClassType(org.hibernate.type.ClassType) IType(org.jboss.tools.hibernate.runtime.spi.IType) MetadataBuildingOptions(org.hibernate.boot.spi.MetadataBuildingOptions) InFlightMetadataCollector(org.hibernate.boot.spi.InFlightMetadataCollector) InFlightMetadataCollectorImpl(org.hibernate.boot.internal.InFlightMetadataCollectorImpl) MetadataBuildingContextRootImpl(org.hibernate.boot.internal.MetadataBuildingContextRootImpl) Component(org.hibernate.mapping.Component) StandardServiceRegistry(org.hibernate.boot.registry.StandardServiceRegistry) Test(org.junit.jupiter.api.Test)

Example 7 with BootstrapContext

use of org.hibernate.boot.spi.BootstrapContext in project jbosstools-hibernate by jbosstools.

the class TypeFacadeTest method testIsComponentType.

// TODO JBIDE-28154: Investigate failure
@Disabled
@Test
public void testIsComponentType() {
    IType typeFacade = null;
    // first try type that is not a component type
    ClassType classType = new ClassType();
    typeFacade = new TypeFacadeImpl(FACADE_FACTORY, classType) {
    };
    assertFalse(typeFacade.isComponentType());
    // next try a component type
    StandardServiceRegistryBuilder ssrb = new StandardServiceRegistryBuilder();
    ssrb.applySetting(AvailableSettings.DIALECT, MockDialect.class.getName());
    ssrb.applySetting(AvailableSettings.CONNECTION_PROVIDER, MockConnectionProvider.class.getName());
    StandardServiceRegistry ssr = ssrb.build();
    MetadataBuildingOptions mdbo = new MetadataBuilderImpl.MetadataBuildingOptionsImpl(ssr);
    BootstrapContext btc = new BootstrapContextImpl(ssr, mdbo);
    InFlightMetadataCollector ifmdc = new InFlightMetadataCollectorImpl(btc, mdbo);
    MetadataBuildingContext mdbc = new MetadataBuildingContextRootImpl("JBoss Tools", btc, mdbo, ifmdc);
    ComponentType componentType = new ComponentType(new Component(mdbc, new RootClass(mdbc)), new int[] {}, mdbc);
    typeFacade = new TypeFacadeImpl(FACADE_FACTORY, componentType) {
    };
    assertTrue(typeFacade.isComponentType());
}
Also used : MockConnectionProvider(org.jboss.tools.hibernate.runtime.v_6_0.internal.util.MockConnectionProvider) RootClass(org.hibernate.mapping.RootClass) ComponentType(org.hibernate.type.ComponentType) StandardServiceRegistryBuilder(org.hibernate.boot.registry.StandardServiceRegistryBuilder) MockDialect(org.jboss.tools.hibernate.runtime.v_6_0.internal.util.MockDialect) MetadataBuildingContext(org.hibernate.boot.spi.MetadataBuildingContext) BootstrapContext(org.hibernate.boot.spi.BootstrapContext) BootstrapContextImpl(org.hibernate.boot.internal.BootstrapContextImpl) ClassType(org.jboss.tools.hibernate.runtime.v_6_0.internal.legacy.ClassType) IType(org.jboss.tools.hibernate.runtime.spi.IType) MetadataBuildingOptions(org.hibernate.boot.spi.MetadataBuildingOptions) InFlightMetadataCollector(org.hibernate.boot.spi.InFlightMetadataCollector) InFlightMetadataCollectorImpl(org.hibernate.boot.internal.InFlightMetadataCollectorImpl) MetadataBuildingContextRootImpl(org.hibernate.boot.internal.MetadataBuildingContextRootImpl) Component(org.hibernate.mapping.Component) StandardServiceRegistry(org.hibernate.boot.registry.StandardServiceRegistry) Test(org.junit.jupiter.api.Test) Disabled(org.junit.jupiter.api.Disabled)

Example 8 with BootstrapContext

use of org.hibernate.boot.spi.BootstrapContext in project jbosstools-hibernate by jbosstools.

the class DummyMetadataBuildingContext method createInstance.

private static MetadataBuildingContext createInstance() {
    StandardServiceRegistryBuilder ssrb = new StandardServiceRegistryBuilder();
    ssrb.applySetting(AvailableSettings.DIALECT, MockDialect.class.getName());
    ssrb.applySetting(AvailableSettings.CONNECTION_PROVIDER, MockConnectionProvider.class.getName());
    StandardServiceRegistry serviceRegistry = ssrb.build();
    MetadataBuildingOptions metadataBuildingOptions = new MetadataBuilderImpl.MetadataBuildingOptionsImpl(serviceRegistry);
    BootstrapContext bootstrapContext = new BootstrapContextImpl(serviceRegistry, metadataBuildingOptions);
    InFlightMetadataCollector inflightMetadataCollector = new InFlightMetadataCollectorImpl(bootstrapContext, metadataBuildingOptions);
    return new MetadataBuildingContextRootImpl(bootstrapContext, metadataBuildingOptions, inflightMetadataCollector);
}
Also used : InFlightMetadataCollector(org.hibernate.boot.spi.InFlightMetadataCollector) StandardServiceRegistryBuilder(org.hibernate.boot.registry.StandardServiceRegistryBuilder) InFlightMetadataCollectorImpl(org.hibernate.boot.internal.InFlightMetadataCollectorImpl) BootstrapContext(org.hibernate.boot.spi.BootstrapContext) BootstrapContextImpl(org.hibernate.boot.internal.BootstrapContextImpl) MetadataBuildingContextRootImpl(org.hibernate.boot.internal.MetadataBuildingContextRootImpl) StandardServiceRegistry(org.hibernate.boot.registry.StandardServiceRegistry) MetadataBuildingOptions(org.hibernate.boot.spi.MetadataBuildingOptions)

Example 9 with BootstrapContext

use of org.hibernate.boot.spi.BootstrapContext in project jbosstools-hibernate by jbosstools.

the class DummyMetadataBuildingContext method createInstance.

private static MetadataBuildingContext createInstance() {
    StandardServiceRegistryBuilder ssrb = new StandardServiceRegistryBuilder();
    ssrb.applySetting(AvailableSettings.DIALECT, MockDialect.class.getName());
    ssrb.applySetting(AvailableSettings.CONNECTION_PROVIDER, MockConnectionProvider.class.getName());
    StandardServiceRegistry serviceRegistry = ssrb.build();
    MetadataBuildingOptions metadataBuildingOptions = new MetadataBuilderImpl.MetadataBuildingOptionsImpl(serviceRegistry);
    BootstrapContext bootstrapContext = new BootstrapContextImpl(serviceRegistry, metadataBuildingOptions);
    InFlightMetadataCollector inflightMetadataCollector = new InFlightMetadataCollectorImpl(bootstrapContext, metadataBuildingOptions);
    return new MetadataBuildingContextRootImpl(bootstrapContext, metadataBuildingOptions, inflightMetadataCollector);
}
Also used : InFlightMetadataCollector(org.hibernate.boot.spi.InFlightMetadataCollector) StandardServiceRegistryBuilder(org.hibernate.boot.registry.StandardServiceRegistryBuilder) InFlightMetadataCollectorImpl(org.hibernate.boot.internal.InFlightMetadataCollectorImpl) BootstrapContext(org.hibernate.boot.spi.BootstrapContext) BootstrapContextImpl(org.hibernate.boot.internal.BootstrapContextImpl) MetadataBuildingContextRootImpl(org.hibernate.boot.internal.MetadataBuildingContextRootImpl) StandardServiceRegistry(org.hibernate.boot.registry.StandardServiceRegistry) MetadataBuildingOptions(org.hibernate.boot.spi.MetadataBuildingOptions)

Example 10 with BootstrapContext

use of org.hibernate.boot.spi.BootstrapContext in project jbosstools-hibernate by jbosstools.

the class DummyMetadataBuildingContext method createInstance.

private static MetadataBuildingContext createInstance() {
    StandardServiceRegistryBuilder ssrb = new StandardServiceRegistryBuilder();
    ssrb.applySetting(AvailableSettings.DIALECT, MockDialect.class.getName());
    ssrb.applySetting(AvailableSettings.CONNECTION_PROVIDER, MockConnectionProvider.class.getName());
    StandardServiceRegistry serviceRegistry = ssrb.build();
    MetadataBuildingOptions metadataBuildingOptions = new MetadataBuilderImpl.MetadataBuildingOptionsImpl(serviceRegistry);
    BootstrapContext bootstrapContext = new BootstrapContextImpl(serviceRegistry, metadataBuildingOptions);
    InFlightMetadataCollector inflightMetadataCollector = new InFlightMetadataCollectorImpl(bootstrapContext, metadataBuildingOptions);
    return new MetadataBuildingContextRootImpl(bootstrapContext, metadataBuildingOptions, inflightMetadataCollector);
}
Also used : InFlightMetadataCollector(org.hibernate.boot.spi.InFlightMetadataCollector) StandardServiceRegistryBuilder(org.hibernate.boot.registry.StandardServiceRegistryBuilder) InFlightMetadataCollectorImpl(org.hibernate.boot.internal.InFlightMetadataCollectorImpl) BootstrapContext(org.hibernate.boot.spi.BootstrapContext) BootstrapContextImpl(org.hibernate.boot.internal.BootstrapContextImpl) MetadataBuildingContextRootImpl(org.hibernate.boot.internal.MetadataBuildingContextRootImpl) StandardServiceRegistry(org.hibernate.boot.registry.StandardServiceRegistry) MetadataBuildingOptions(org.hibernate.boot.spi.MetadataBuildingOptions)

Aggregations

BootstrapContextImpl (org.hibernate.boot.internal.BootstrapContextImpl)14 StandardServiceRegistry (org.hibernate.boot.registry.StandardServiceRegistry)14 StandardServiceRegistryBuilder (org.hibernate.boot.registry.StandardServiceRegistryBuilder)14 BootstrapContext (org.hibernate.boot.spi.BootstrapContext)14 MetadataBuildingOptions (org.hibernate.boot.spi.MetadataBuildingOptions)13 InFlightMetadataCollectorImpl (org.hibernate.boot.internal.InFlightMetadataCollectorImpl)9 MetadataBuildingContextRootImpl (org.hibernate.boot.internal.MetadataBuildingContextRootImpl)9 InFlightMetadataCollector (org.hibernate.boot.spi.InFlightMetadataCollector)9 RootClass (org.hibernate.mapping.RootClass)9 Test (org.junit.jupiter.api.Test)9 MetadataSources (org.hibernate.boot.MetadataSources)5 MetadataImplementor (org.hibernate.boot.spi.MetadataImplementor)5 Component (org.hibernate.mapping.Component)5 ComponentType (org.hibernate.type.ComponentType)5 IType (org.jboss.tools.hibernate.runtime.spi.IType)5 InvocationHandler (java.lang.reflect.InvocationHandler)4 Method (java.lang.reflect.Method)4 ArrayList (java.util.ArrayList)4 Filter (org.hibernate.Filter)4 SessionFactoryOptionsBuilder (org.hibernate.boot.internal.SessionFactoryOptionsBuilder)4