Search in sources :

Example 6 with ClassType

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

the class TypeFacadeTest method testIsAnyType.

@Test
public void testIsAnyType() {
    IType typeFacade = null;
    // first try type that is not a any type
    ClassType classType = new ClassType();
    typeFacade = new TypeFacadeImpl(FACADE_FACTORY, classType) {
    };
    assertFalse(typeFacade.isAnyType());
    // next try a any type
    AnyType anyType = new AnyType(null, null, null, true);
    typeFacade = new TypeFacadeImpl(FACADE_FACTORY, anyType) {
    };
    assertTrue(typeFacade.isAnyType());
}
Also used : ClassType(org.jboss.tools.hibernate.runtime.v_6_0.internal.legacy.ClassType) AnyType(org.hibernate.type.AnyType) IType(org.jboss.tools.hibernate.runtime.spi.IType) Test(org.junit.jupiter.api.Test)

Example 7 with ClassType

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

the class TypeFacadeTest method testGetAssociatedEntityName.

@Test
public void testGetAssociatedEntityName() {
    IType typeFacade = null;
    ClassType classType = new ClassType();
    typeFacade = new TypeFacadeImpl(FACADE_FACTORY, classType) {
    };
    assertNull(typeFacade.getAssociatedEntityName());
    EntityType entityType = new ManyToOneType((TypeConfiguration) null, "foo");
    typeFacade = new TypeFacadeImpl(FACADE_FACTORY, entityType) {
    };
    assertEquals("foo", typeFacade.getAssociatedEntityName());
}
Also used : EntityType(org.hibernate.type.EntityType) ManyToOneType(org.hibernate.type.ManyToOneType) ClassType(org.jboss.tools.hibernate.runtime.v_6_0.internal.legacy.ClassType) IType(org.jboss.tools.hibernate.runtime.spi.IType) Test(org.junit.jupiter.api.Test)

Example 8 with ClassType

use of org.jboss.tools.hibernate.runtime.v_6_0.internal.legacy.ClassType 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 9 with ClassType

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

the class TypeFacadeTest method testIsOneToOne.

@Test
public void testIsOneToOne() {
    IType typeFacade = null;
    // first try type that is not a one to one type
    ClassType classType = new ClassType();
    typeFacade = new TypeFacadeImpl(FACADE_FACTORY, classType) {
    };
    assertFalse(typeFacade.isOneToOne());
    // next try another type that is not a one to one type
    EntityType entityType = new ManyToOneType((TypeConfiguration) null, null);
    typeFacade = new TypeFacadeImpl(FACADE_FACTORY, entityType) {
    };
    assertFalse(entityType.isOneToOne());
    // finally try a type that is a one to one type
    OneToOneType oneToOneType = new OneToOneType(null, null, null, false, null, false, false, null, null, false);
    typeFacade = new TypeFacadeImpl(FACADE_FACTORY, oneToOneType) {
    };
    assertTrue(oneToOneType.isOneToOne());
}
Also used : EntityType(org.hibernate.type.EntityType) ManyToOneType(org.hibernate.type.ManyToOneType) ClassType(org.jboss.tools.hibernate.runtime.v_6_0.internal.legacy.ClassType) IType(org.jboss.tools.hibernate.runtime.spi.IType) OneToOneType(org.hibernate.type.OneToOneType) Test(org.junit.jupiter.api.Test)

Example 10 with ClassType

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

the class TypeFacadeTest method testIsArrayType.

@Test
public void testIsArrayType() {
    IType typeFacade = null;
    ClassType classType = new ClassType();
    typeFacade = new TypeFacadeImpl(FACADE_FACTORY, classType) {
    };
    assertFalse(typeFacade.isArrayType());
    BagType bagType = new BagType(null, null);
    typeFacade = new TypeFacadeImpl(FACADE_FACTORY, bagType) {
    };
    assertFalse(typeFacade.isArrayType());
    ArrayType arrayType = new ArrayType(null, null, String.class);
    typeFacade = new TypeFacadeImpl(FACADE_FACTORY, arrayType) {
    };
    assertTrue(typeFacade.isArrayType());
}
Also used : ArrayType(org.hibernate.type.ArrayType) BagType(org.hibernate.type.BagType) ClassType(org.jboss.tools.hibernate.runtime.v_6_0.internal.legacy.ClassType) IType(org.jboss.tools.hibernate.runtime.spi.IType) Test(org.junit.jupiter.api.Test)

Aggregations

IType (org.jboss.tools.hibernate.runtime.spi.IType)15 ClassType (org.jboss.tools.hibernate.runtime.v_6_0.internal.legacy.ClassType)15 Test (org.junit.jupiter.api.Test)15 ArrayType (org.hibernate.type.ArrayType)7 EntityType (org.hibernate.type.EntityType)4 ManyToOneType (org.hibernate.type.ManyToOneType)4 Disabled (org.junit.jupiter.api.Disabled)4 IntegerType (org.jboss.tools.hibernate.runtime.v_6_0.internal.legacy.IntegerType)3 RootClass (org.hibernate.mapping.RootClass)2 BootstrapContextImpl (org.hibernate.boot.internal.BootstrapContextImpl)1 InFlightMetadataCollectorImpl (org.hibernate.boot.internal.InFlightMetadataCollectorImpl)1 MetadataBuildingContextRootImpl (org.hibernate.boot.internal.MetadataBuildingContextRootImpl)1 StandardServiceRegistry (org.hibernate.boot.registry.StandardServiceRegistry)1 StandardServiceRegistryBuilder (org.hibernate.boot.registry.StandardServiceRegistryBuilder)1 BootstrapContext (org.hibernate.boot.spi.BootstrapContext)1 InFlightMetadataCollector (org.hibernate.boot.spi.InFlightMetadataCollector)1 MetadataBuildingContext (org.hibernate.boot.spi.MetadataBuildingContext)1 MetadataBuildingOptions (org.hibernate.boot.spi.MetadataBuildingOptions)1 Component (org.hibernate.mapping.Component)1 AnyType (org.hibernate.type.AnyType)1