Search in sources :

Example 11 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 testGetName.

@Test
public void testGetName() {
    IType typeFacade = null;
    ClassType classType = new ClassType();
    typeFacade = new TypeFacadeImpl(FACADE_FACTORY, classType) {
    };
    assertEquals("class", typeFacade.getName());
    ArrayType arrayType = new ArrayType("foo", "bar", String.class);
    typeFacade = new TypeFacadeImpl(FACADE_FACTORY, arrayType) {
    };
    assertEquals("[Ljava.lang.String;(foo)", typeFacade.getName());
}
Also used : ArrayType(org.hibernate.type.ArrayType) 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 12 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 testIsEntityType.

@Test
public void testIsEntityType() {
    IType typeFacade = null;
    // first try type that is not an entity type
    ClassType classType = new ClassType();
    typeFacade = new TypeFacadeImpl(FACADE_FACTORY, classType) {
    };
    assertFalse(typeFacade.isEntityType());
    // next try type that is an entity type
    EntityType entityType = new ManyToOneType((TypeConfiguration) null, null);
    typeFacade = new TypeFacadeImpl(FACADE_FACTORY, entityType) {
    };
    assertTrue(entityType.isEntityType());
}
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 13 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 testIsCollectionType.

@Test
public void testIsCollectionType() {
    IType typeFacade = null;
    // first try type that is not a collection type
    ClassType classType = new ClassType();
    typeFacade = new TypeFacadeImpl(FACADE_FACTORY, classType) {
    };
    assertFalse(typeFacade.isCollectionType());
    // next try a collection type
    ArrayType arrayType = new ArrayType(null, null, String.class);
    typeFacade = new TypeFacadeImpl(FACADE_FACTORY, arrayType) {
    };
    assertTrue(typeFacade.isCollectionType());
}
Also used : ArrayType(org.hibernate.type.ArrayType) 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 14 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 testFromStringValue.

// TODO JBIDE-28154: Investigate failure
@Disabled
@Test
public void testFromStringValue() {
    IType typeFacade = null;
    // first try type that is string representable
    ClassType classType = new ClassType();
    typeFacade = new TypeFacadeImpl(FACADE_FACTORY, classType) {
    };
    assertEquals(TypeFacadeTest.class, typeFacade.fromStringValue(TypeFacadeTest.class.getName()));
    // next try type that is not string representable
    ArrayType arrayType = new ArrayType("foo", "bar", String.class);
    typeFacade = new TypeFacadeImpl(FACADE_FACTORY, arrayType) {
    };
    assertNull(typeFacade.fromStringValue("just a random string"));
}
Also used : ArrayType(org.hibernate.type.ArrayType) 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) Disabled(org.junit.jupiter.api.Disabled)

Example 15 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 testIsIntegerType.

@Test
public void testIsIntegerType() {
    IType typeFacade = null;
    ClassType classType = new ClassType();
    typeFacade = new TypeFacadeImpl(FACADE_FACTORY, classType) {
    };
    assertFalse(typeFacade.isIntegerType());
    IntegerType integerType = new IntegerType();
    typeFacade = new TypeFacadeImpl(FACADE_FACTORY, integerType) {
    };
    assertTrue(typeFacade.isIntegerType());
}
Also used : IntegerType(org.jboss.tools.hibernate.runtime.v_6_0.internal.legacy.IntegerType) 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