use of org.jboss.tools.hibernate.runtime.spi.IProperty in project jbosstools-hibernate by jbosstools.
the class ComponentShape method initModel.
/**
* creates children of the shape,
*/
protected void initModel() {
Object ormElement = getOrmElement();
if (ormElement instanceof IProperty) {
IValue collection = ((IProperty) ormElement).getValue();
Shape bodyOrmShape = new Shape(collection.getKey(), getConsoleConfigName());
bodyOrmShape.setIndent(20);
addChild(bodyOrmShape);
bodyOrmShape = new Shape(collection.getElement(), getConsoleConfigName());
bodyOrmShape.setIndent(20);
addChild(bodyOrmShape);
}
}
use of org.jboss.tools.hibernate.runtime.spi.IProperty in project jbosstools-hibernate by jbosstools.
the class HbmExporterTest method testProperty.
public void testProperty() {
// $NON-NLS-1$
IConfiguration config = getConfigurationFor("pack.A");
// $NON-NLS-1$ //$NON-NLS-2$
checkClassesMaped(config, "pack.A", "pack.B");
// $NON-NLS-1$
IPersistentClass a = config.getClassMapping("pack.A");
// $NON-NLS-1$
IProperty prop = a.getProperty("prop");
assertNotNull(prop.getValue());
IValue value = prop.getValue();
// $NON-NLS-1$
assertTrue("Expected to get ManyToOne-type mapping", value.isManyToOne());
// $NON-NLS-1$
assertEquals("pack.B", value.getTypeName());
}
use of org.jboss.tools.hibernate.runtime.spi.IProperty in project jbosstools-hibernate by jbosstools.
the class HbmExporterTest method testSet.
public void testSet() {
// $NON-NLS-1$
IConfiguration config = getConfigurationFor("pack.A");
// $NON-NLS-1$ //$NON-NLS-2$
checkClassesMaped(config, "pack.A", "pack.B");
// $NON-NLS-1$
IPersistentClass a = config.getClassMapping("pack.A");
// $NON-NLS-1$
IPersistentClass b = config.getClassMapping("pack.B");
// $NON-NLS-1$
IProperty setProp = a.getProperty("set");
assertNotNull(setProp.getValue());
IValue value = setProp.getValue();
assertTrue("Expected to get Set-type mapping", value.isSet());
assertTrue(value.getCollectionElement().isOneToMany());
assertTrue(value.getCollectionTable().equals(b.getTable()));
assertNotNull(value.getKey());
}
use of org.jboss.tools.hibernate.runtime.spi.IProperty in project jbosstools-hibernate by jbosstools.
the class HbmExporterTest method testArray.
public void testArray() {
// $NON-NLS-1$
IConfiguration config = getConfigurationFor("pack.A");
// $NON-NLS-1$ //$NON-NLS-2$
checkClassesMaped(config, "pack.A", "pack.B");
// $NON-NLS-1$
IPersistentClass a = config.getClassMapping("pack.A");
// $NON-NLS-1$
IPersistentClass b = config.getClassMapping("pack.B");
// $NON-NLS-1$
IProperty bs = a.getProperty("bs");
assertNotNull(bs.getValue());
IValue value = bs.getValue();
assertTrue("Expected to get Array-type mapping", value.isArray());
// $NON-NLS-1$
assertEquals("pack.B", value.getElementClassName());
assertTrue(// $NON-NLS-1$
"Expected to get one-to-many array's element type", value.getCollectionElement().isOneToMany());
// $NON-NLS-1$
IProperty testIntArray = b.getProperty("testIntArray");
assertNotNull(testIntArray);
value = testIntArray.getValue();
assertNotNull(value);
assertTrue(// $NON-NLS-1$
"Expected to get PrimitiveArray-type mapping", value.isPrimitiveArray());
assertNotNull(value.getCollectionElement());
// $NON-NLS-1$
assertTrue("Expected to get int-type primitive array", value.getCollectionElement().getType().isIntegerType());
}
use of org.jboss.tools.hibernate.runtime.spi.IProperty in project jbosstools-hibernate by jbosstools.
the class OpenMappingFileTest method testOpenMappingFileTest.
public void testOpenMappingFileTest() {
final Object[] persClasses = getPersistenceClasses(false);
final ConsoleConfiguration consCFG = getConsoleConfig();
// $NON-NLS-1$
final String testClass = "class";
for (int i = 0; i < persClasses.length; i++) {
assertTrue(persClasses[i] instanceof IPersistentClass);
IPersistentClass persClass = (IPersistentClass) persClasses[i];
openTest(persClass, consCFG);
Object[] props = pcWorkbenchAdapter.getChildren(persClass);
for (int j = 0; j < props.length; j++) {
if (!(props[j] instanceof IProperty && ((IProperty) props[j]).classIsPropertyClass())) {
continue;
}
openTest(props[j], consCFG);
Object[] compProperties = propertyWorkbenchAdapter.getChildren(props[j]);
for (int k = 0; k < compProperties.length; k++) {
// test Composite properties
if (!(compProperties[k] instanceof IProperty && ((IProperty) props[j]).classIsPropertyClass())) {
continue;
}
final IProperty prop = (IProperty) compProperties[k];
if (testClass.equals(prop.getName()) || testClass.equals(prop.getName())) {
continue;
}
openPropertyTest((IProperty) compProperties[k], (IProperty) props[j], consCFG);
}
}
}
// close all editors
}
Aggregations