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);
valueFacade = FACADE_FACTORY.createValue(collectionTarget);
Assert.assertFalse(valueFacade.isInverse());
collectionTarget.setInverse(true);
Assert.assertTrue(valueFacade.isInverse());
}
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);
valueFacade = FACADE_FACTORY.createValue(collectionTarget);
valueFacade.setLazy(true);
Assert.assertTrue(collectionTarget.isLazy());
valueFacade.setLazy(false);
Assert.assertFalse(collectionTarget.isLazy());
}
use of org.hibernate.mapping.Collection in project jbosstools-hibernate by jbosstools.
the class ConfigurationFacadeTest method testBuildMappings.
@Ignore
@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);
Collection collection = configuration.getCollectionMapping("org.jboss.tools.hibernate.runtime.v_3_5.internal.ConfigurationFacadeTest$Bar.fooSet");
OneToMany element = (OneToMany) collection.getElement();
Assert.assertNull(element.getAssociatedClass());
configurationFacade.buildMappings();
Assert.assertEquals("org.jboss.tools.hibernate.runtime.v_3_5.internal.ConfigurationFacadeTest$Foo", element.getAssociatedClass().getClassName());
}
use of org.hibernate.mapping.Collection in project jbosstools-hibernate by jbosstools.
the class ValueFacadeTest method testSetRole.
@Test
public void testSetRole() {
Collection collectionTarget = new Bag(DummyMetadataBuildingContext.INSTANCE, null);
valueFacade = FACADE_FACTORY.createValue(collectionTarget);
assertNull(collectionTarget.getRole());
valueFacade.setRole("foobar");
assertEquals("foobar", collectionTarget.getRole());
}
use of org.hibernate.mapping.Collection in project jbosstools-hibernate by jbosstools.
the class ValueFacadeTest method testSetFetchModeJoin.
@Test
public void testSetFetchModeJoin() {
SimpleValue simpleValueTarget = new SimpleValue(DummyMetadataBuildingContext.INSTANCE, null);
assertNotEquals(FetchMode.JOIN, simpleValueTarget.getFetchMode());
valueFacade = FACADE_FACTORY.createValue(simpleValueTarget);
valueFacade.setFetchModeJoin();
assertNotEquals(FetchMode.JOIN, simpleValueTarget.getFetchMode());
Collection collectionTarget = new Bag(DummyMetadataBuildingContext.INSTANCE, null);
assertNotEquals(FetchMode.JOIN, collectionTarget.getFetchMode());
valueFacade = FACADE_FACTORY.createValue(collectionTarget);
valueFacade.setFetchModeJoin();
assertEquals(FetchMode.JOIN, collectionTarget.getFetchMode());
ManyToOne manyToOneTarget = new ManyToOne(DummyMetadataBuildingContext.INSTANCE, null);
assertNotEquals(FetchMode.JOIN, manyToOneTarget.getFetchMode());
valueFacade = FACADE_FACTORY.createValue(manyToOneTarget);
valueFacade.setFetchModeJoin();
assertEquals(FetchMode.JOIN, manyToOneTarget.getFetchMode());
}
Aggregations