Search in sources :

Example 21 with IProperty

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

the class ServiceImplTest method testNewSpecialRootClass.

@Test
public void testNewSpecialRootClass() {
    IProperty property = service.newProperty();
    IPersistentClass pc = service.newRootClass();
    property.setPersistentClass(pc);
    IPersistentClass specialRootClass = service.newSpecialRootClass(property);
    Assert.assertNotNull(specialRootClass);
    Object target = ((IFacade) specialRootClass).getTarget();
    Assert.assertNotNull(target);
    Assert.assertTrue(target instanceof RootClass);
    Assert.assertSame(property, specialRootClass.getProperty());
}
Also used : RootClass(org.hibernate.mapping.RootClass) IProperty(org.jboss.tools.hibernate.runtime.spi.IProperty) IFacade(org.jboss.tools.hibernate.runtime.common.IFacade) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) Test(org.junit.Test)

Example 22 with IProperty

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

the class FacadeFactoryTest method testCreateProperty.

@Test
public void testCreateProperty() {
    Property property = new Property();
    IProperty facade = facadeFactory.createProperty(property);
    Assert.assertSame(property, ((IFacade) facade).getTarget());
}
Also used : IProperty(org.jboss.tools.hibernate.runtime.spi.IProperty) Property(org.hibernate.mapping.Property) IProperty(org.jboss.tools.hibernate.runtime.spi.IProperty) Test(org.junit.Test)

Example 23 with IProperty

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

the class ValueFacadeTest method testGetPropertyIterator.

@Test
public void testGetPropertyIterator() {
    Component componentTarget = new Component(null, new RootClass(null));
    valueFacade = FACADE_FACTORY.createValue(componentTarget);
    Iterator<IProperty> iter = valueFacade.getPropertyIterator();
    Assert.assertFalse(iter.hasNext());
    Property propertyTarget = new Property();
    componentTarget.addProperty(propertyTarget);
    valueFacade = FACADE_FACTORY.createValue(componentTarget);
    iter = valueFacade.getPropertyIterator();
    Assert.assertTrue(iter.hasNext());
    IProperty propertyFacade = iter.next();
    Assert.assertSame(propertyTarget, ((IFacade) propertyFacade).getTarget());
}
Also used : RootClass(org.hibernate.mapping.RootClass) IProperty(org.jboss.tools.hibernate.runtime.spi.IProperty) Component(org.hibernate.mapping.Component) Property(org.hibernate.mapping.Property) IProperty(org.jboss.tools.hibernate.runtime.spi.IProperty) Test(org.junit.Test)

Example 24 with IProperty

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

the class ValueFacadeTest method testGetPropertyIterator.

@Test
public void testGetPropertyIterator() {
    Component componentTarget = new Component(null, new RootClass(null));
    valueFacade = FACADE_FACTORY.createValue(componentTarget);
    Iterator<IProperty> iter = valueFacade.getPropertyIterator();
    Assert.assertFalse(iter.hasNext());
    Property propertyTarget = new Property();
    componentTarget.addProperty(propertyTarget);
    valueFacade = FACADE_FACTORY.createValue(componentTarget);
    iter = valueFacade.getPropertyIterator();
    Assert.assertTrue(iter.hasNext());
    IProperty propertyFacade = iter.next();
    Assert.assertSame(propertyTarget, ((IFacade) propertyFacade).getTarget());
}
Also used : RootClass(org.hibernate.mapping.RootClass) IProperty(org.jboss.tools.hibernate.runtime.spi.IProperty) Component(org.hibernate.mapping.Component) Property(org.hibernate.mapping.Property) IProperty(org.jboss.tools.hibernate.runtime.spi.IProperty) Test(org.junit.Test)

Example 25 with IProperty

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

the class ServiceImplTest method testNewSpecialRootClass.

@Test
public void testNewSpecialRootClass() {
    IProperty property = service.newProperty();
    IPersistentClass pc = service.newRootClass();
    property.setPersistentClass(pc);
    IPersistentClass specialRootClass = service.newSpecialRootClass(property);
    Assert.assertNotNull(specialRootClass);
    Object target = ((IFacade) specialRootClass).getTarget();
    Assert.assertNotNull(target);
    Assert.assertTrue(target instanceof RootClass);
    Assert.assertSame(property, specialRootClass.getProperty());
}
Also used : RootClass(org.hibernate.mapping.RootClass) IProperty(org.jboss.tools.hibernate.runtime.spi.IProperty) IFacade(org.jboss.tools.hibernate.runtime.common.IFacade) IPersistentClass(org.jboss.tools.hibernate.runtime.spi.IPersistentClass) Test(org.junit.Test)

Aggregations

IProperty (org.jboss.tools.hibernate.runtime.spi.IProperty)93 IPersistentClass (org.jboss.tools.hibernate.runtime.spi.IPersistentClass)53 Property (org.hibernate.mapping.Property)40 Test (org.junit.Test)33 RootClass (org.hibernate.mapping.RootClass)27 IValue (org.jboss.tools.hibernate.runtime.spi.IValue)20 PersistentClass (org.hibernate.mapping.PersistentClass)18 ConsoleConfiguration (org.hibernate.console.ConsoleConfiguration)12 SimpleValue (org.hibernate.mapping.SimpleValue)12 AbstractPropertyFacade (org.jboss.tools.hibernate.runtime.common.AbstractPropertyFacade)12 IFacade (org.jboss.tools.hibernate.runtime.common.IFacade)12 FileNotFoundException (java.io.FileNotFoundException)9 IColumn (org.jboss.tools.hibernate.runtime.spi.IColumn)9 Component (org.hibernate.mapping.Component)8 IConfiguration (org.jboss.tools.hibernate.runtime.spi.IConfiguration)8 IEditorPart (org.eclipse.ui.IEditorPart)7 ITable (org.jboss.tools.hibernate.runtime.spi.ITable)7 JavaModelException (org.eclipse.jdt.core.JavaModelException)6 Mappings (org.hibernate.cfg.Mappings)6 PartInitException (org.eclipse.ui.PartInitException)5