use of org.hibernate.mapping.Collection in project jbosstools-hibernate by jbosstools.
the class ValueFacadeTest method testSetLazy.
@Test
public void testSetLazy() {
Collection collectionTarget = new Bag(null, null);
valueFacade = FACADE_FACTORY.createValue(collectionTarget);
valueFacade.setLazy(true);
assertTrue(collectionTarget.isLazy());
valueFacade.setLazy(false);
assertFalse(collectionTarget.isLazy());
}
use of org.hibernate.mapping.Collection in project jbosstools-hibernate by jbosstools.
the class ValueFacadeTest method testIsInverse.
@Test
public void testIsInverse() {
Collection collectionTarget = new Bag(null, null);
valueFacade = FACADE_FACTORY.createValue(collectionTarget);
assertFalse(valueFacade.isInverse());
collectionTarget.setInverse(true);
assertTrue(valueFacade.isInverse());
}
use of org.hibernate.mapping.Collection in project jbosstools-hibernate by jbosstools.
the class ValueFacadeTest method testSetCollectionTable.
@Test
public void testSetCollectionTable() {
Table tableTarget = new Table();
ITable tableFacade = FACADE_FACTORY.createTable(tableTarget);
Collection valueTarget = new Set(DummyMetadataBuildingContext.INSTANCE, null);
valueFacade = FACADE_FACTORY.createValue(valueTarget);
assertNull(valueTarget.getCollectionTable());
valueFacade.setCollectionTable(tableFacade);
assertSame(tableTarget, valueTarget.getCollectionTable());
}
use of org.hibernate.mapping.Collection in project jbosstools-hibernate by jbosstools.
the class ValueFacadeTest method testSetKey.
@Test
public void testSetKey() {
KeyValue keyValueTarget = new SimpleValue(DummyMetadataBuildingContext.INSTANCE, null);
IValue keyValueFacade = FACADE_FACTORY.createValue(keyValueTarget);
Collection collectionTarget = new Bag(DummyMetadataBuildingContext.INSTANCE, null);
IValue collectionFacade = FACADE_FACTORY.createValue(collectionTarget);
assertNull(collectionTarget.getKey());
collectionFacade.setKey(keyValueFacade);
assertSame(keyValueTarget, collectionTarget.getKey());
}
use of org.hibernate.mapping.Collection in project jbosstools-hibernate by jbosstools.
the class ConfigurationFacadeTest method testBuildMappings.
@Test
public void testBuildMappings() throws Exception {
File fooFile = File.createTempFile("foo", "hbm.xml");
PrintWriter fooWriter = new PrintWriter(fooFile);
fooWriter.write(FOO_HBM_XML_STRING);
fooWriter.close();
configuration.addFile(fooFile);
File barFile = File.createTempFile("bar", "hbm.xml");
PrintWriter barWriter = new PrintWriter(barFile);
barWriter.write(BAR_HBM_XML_STRING);
barWriter.close();
configuration.addFile(barFile);
String collectionName = "org.jboss.tools.hibernate.runtime.v_4_0.internal.ConfigurationFacadeTest$Bar.fooSet";
assertNull(configuration.getCollectionMapping(collectionName));
configurationFacade.buildMappings();
Collection collection = configuration.getCollectionMapping(collectionName);
OneToMany element = (OneToMany) collection.getElement();
assertEquals("org.jboss.tools.hibernate.runtime.v_4_0.internal.ConfigurationFacadeTest$Foo", element.getAssociatedClass().getClassName());
}
Aggregations