Search in sources :

Example 36 with IPersistentClass

use of org.jboss.tools.hibernate.runtime.spi.IPersistentClass in project jbosstools-hibernate by jbosstools.

the class ConfigurationFacadeTest method testAddClass.

@Test
public void testAddClass() {
    PersistentClass persistentClass = new RootClass(null);
    persistentClass.setEntityName("Foo");
    IPersistentClass persistentClassFacade = FACADE_FACTORY.createPersistentClass(persistentClass);
    Assert.assertNull(configurationFacade.getClassMapping("Foo"));
    configurationFacade = FACADE_FACTORY.createConfiguration(configuration);
    configurationFacade.addClass(persistentClassFacade);
    Assert.assertEquals(persistentClassFacade, configurationFacade.getClassMapping("Foo"));
}
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.Test)

Example 37 with IPersistentClass

use of org.jboss.tools.hibernate.runtime.spi.IPersistentClass in project jbosstools-hibernate by jbosstools.

the class ConfigurationFacadeTest method testGetClassMappings.

@Test
public void testGetClassMappings() {
    configurationFacade = FACADE_FACTORY.createConfiguration(configuration);
    Iterator<IPersistentClass> iterator = configurationFacade.getClassMappings();
    Assert.assertFalse(iterator.hasNext());
    configuration.configure();
    configurationFacade = FACADE_FACTORY.createConfiguration(configuration);
    iterator = configurationFacade.getClassMappings();
    IPersistentClass persistentClassFacade = iterator.next();
    Assert.assertEquals("org.jboss.tools.hibernate.runtime.v_5_0.internal.test.Foo", persistentClassFacade.getClassName());
}
Also used : IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) Test(org.junit.Test)

Example 38 with IPersistentClass

use of org.jboss.tools.hibernate.runtime.spi.IPersistentClass in project jbosstools-hibernate by jbosstools.

the class ConfigurationFacadeTest method testGetClassMappings.

@Test
public void testGetClassMappings() {
    configurationFacade = FACADE_FACTORY.createConfiguration(configuration);
    Iterator<IPersistentClass> iterator = configurationFacade.getClassMappings();
    Assert.assertFalse(iterator.hasNext());
    configuration.configure();
    configuration.buildMappings();
    configurationFacade = FACADE_FACTORY.createConfiguration(configuration);
    iterator = configurationFacade.getClassMappings();
    IPersistentClass persistentClassFacade = iterator.next();
    Assert.assertEquals("org.jboss.tools.hibernate.runtime.v_4_3.internal.test.Foo", persistentClassFacade.getClassName());
}
Also used : IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) Test(org.junit.Test)

Example 39 with IPersistentClass

use of org.jboss.tools.hibernate.runtime.spi.IPersistentClass in project jbosstools-hibernate by jbosstools.

the class ServiceImplTest method testNewSet.

@Test
public void testNewSet() {
    IPersistentClass persistentClass = service.newRootClass();
    IValue set = service.newSet(persistentClass);
    Assert.assertNotNull(set);
    Object target = ((IFacade) set).getTarget();
    Assert.assertNotNull(target);
    Assert.assertTrue(target instanceof Set);
}
Also used : IValue(org.jboss.tools.hibernate.runtime.spi.IValue) Set(org.hibernate.mapping.Set) IFacade(org.jboss.tools.hibernate.runtime.common.IFacade) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) Test(org.junit.Test)

Example 40 with IPersistentClass

use of org.jboss.tools.hibernate.runtime.spi.IPersistentClass in project jbosstools-hibernate by jbosstools.

the class ServiceImplTest method testNewJoinedSubclass.

@Test
public void testNewJoinedSubclass() {
    IPersistentClass persistentClass = service.newRootClass();
    IPersistentClass joinedSubclass = service.newJoinedSubclass(persistentClass);
    Assert.assertNotNull(joinedSubclass);
    Object target = ((IFacade) joinedSubclass).getTarget();
    Assert.assertNotNull(target);
    Assert.assertTrue(target instanceof JoinedSubclass);
    Assert.assertSame(persistentClass, joinedSubclass.getSuperclass());
    Assert.assertSame(((IFacade) persistentClass).getTarget(), ((JoinedSubclass) target).getSuperclass());
}
Also used : IFacade(org.jboss.tools.hibernate.runtime.common.IFacade) JoinedSubclass(org.hibernate.mapping.JoinedSubclass) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) Test(org.junit.Test)

Aggregations

IPersistentClass (org.jboss.tools.hibernate.runtime.spi.IPersistentClass)175 Test (org.junit.Test)97 IFacade (org.jboss.tools.hibernate.runtime.common.IFacade)60 IValue (org.jboss.tools.hibernate.runtime.spi.IValue)51 RootClass (org.hibernate.mapping.RootClass)47 IProperty (org.jboss.tools.hibernate.runtime.spi.IProperty)46 PersistentClass (org.hibernate.mapping.PersistentClass)43 ConsoleConfiguration (org.hibernate.console.ConsoleConfiguration)19 AbstractPersistentClassFacade (org.jboss.tools.hibernate.runtime.common.AbstractPersistentClassFacade)16 IConfiguration (org.jboss.tools.hibernate.runtime.spi.IConfiguration)16 ITable (org.jboss.tools.hibernate.runtime.spi.ITable)14 OneToMany (org.hibernate.mapping.OneToMany)12 HashMap (java.util.HashMap)8 Iterator (java.util.Iterator)8 JoinedSubclass (org.hibernate.mapping.JoinedSubclass)8 PrimitiveArray (org.hibernate.mapping.PrimitiveArray)8 Property (org.hibernate.mapping.Property)8 SingleTableSubclass (org.hibernate.mapping.SingleTableSubclass)8 IEditorPart (org.eclipse.ui.IEditorPart)7 PartInitException (org.eclipse.ui.PartInitException)7