use of org.hibernate.mapping.BasicValue in project jbosstools-hibernate by jbosstools.
the class ValueFacadeTest method testSetTypeName.
@Test
public void testSetTypeName() {
SimpleValue valueTarget = new BasicValue(DummyMetadataBuildingContext.INSTANCE);
valueFacade = new AbstractValueFacade(FACADE_FACTORY, valueTarget) {
};
assertNull(valueTarget.getTypeName());
valueFacade.setTypeName("java.lang.Integer");
assertEquals("java.lang.Integer", valueTarget.getTypeName());
}
use of org.hibernate.mapping.BasicValue in project jbosstools-hibernate by jbosstools.
the class ClassMetadataFacadeTest method createPersistentClass.
private PersistentClass createPersistentClass(MetadataBuildingContext metadataBuildingContext) {
RootClass rc = new RootClass(metadataBuildingContext);
Table t = new Table("tools", "foobar");
rc.setTable(t);
Column c = new Column("foo");
t.addColumn(c);
ArrayList<Column> keyList = new ArrayList<>();
keyList.add(c);
t.createUniqueKey(keyList);
BasicValue sv = new BasicValue(metadataBuildingContext, t);
sv.setNullValue("null");
sv.setTypeName(Integer.class.getName());
sv.addColumn(c);
rc.setEntityName("foobar");
rc.setIdentifier(sv);
rc.setClassName(FooBar.class.getName());
rc.setOptimisticLockStyle(OptimisticLockStyle.NONE);
return rc;
}
use of org.hibernate.mapping.BasicValue in project jbosstools-hibernate by jbosstools.
the class Cfg2HbmToolFacadeTest method testGetTagProperty.
@Test
public void testGetTagProperty() throws Exception {
RootClass rc = new RootClass(DummyMetadataBuildingContext.INSTANCE);
Property p = new Property();
BasicValue basicValue = new BasicValue(DummyMetadataBuildingContext.INSTANCE);
basicValue.setTypeName("foobar");
p.setValue(basicValue);
p.setPersistentClass(rc);
rc.setVersion(p);
IProperty property = new AbstractPropertyFacade(FACADE_FACTORY, p) {
};
assertEquals("version", cfg2HbmToolFacade.getTag(property));
}
use of org.hibernate.mapping.BasicValue in project jbosstools-hibernate by jbosstools.
the class ColumnFacadeTest method testGetSqlType.
@Test
public void testGetSqlType() {
assertNull(columnFacade.getSqlType());
column.setSqlType("foobar");
assertEquals("foobar", columnFacade.getSqlType());
Configuration configuration = new Configuration();
configuration.setProperty(AvailableSettings.DIALECT, MockDialect.class.getName());
configuration.setProperty(AvailableSettings.CONNECTION_PROVIDER, MockConnectionProvider.class.getName());
BasicValue value = new BasicValue(createMetadataBuildingContext());
value.setTypeName("int");
column.setValue(value);
IConfiguration configurationFacade = FACADE_FACTORY.createConfiguration(configuration);
column.setSqlType(null);
assertEquals("integer", columnFacade.getSqlType(configurationFacade));
}
use of org.hibernate.mapping.BasicValue in project jbosstools-hibernate by jbosstools.
the class ValueFacadeTest method testGetIndex.
@Test
public void testGetIndex() {
List valueTarget = new List(DummyMetadataBuildingContext.INSTANCE, null);
valueFacade = new AbstractValueFacade(FACADE_FACTORY, valueTarget) {
};
assertNull(valueFacade.getIndex());
SimpleValue indexValue = new BasicValue(DummyMetadataBuildingContext.INSTANCE);
valueTarget.setIndex(indexValue);
assertSame(indexValue, ((IFacade) valueFacade.getIndex()).getTarget());
}
Aggregations