MentaContainer

Compare Revisions

Ignore whitespace Rev 94 → Rev 95

/trunk/src/test/java/org/mentacontainer/impl/GenericFactoryTest.java
19,7 → 19,7
}
@Test
public void testGenericComponent() throws Exception {
public void testGenericFactory() throws Exception {
// in real life this will be a SessionFactory, a ConnectionPool or any factory...
SomeFactory factory = new SomeFactory();
/trunk/src/test/java/org/mentacontainer/impl/MentaContainerTest.java
137,7 → 137,7
// if you don't provide a scope the Scope is NONE
// meaning a new instance is created on every
// request for the component
// request for the bean
c.ioc("myString", String.class).addInitValue("saoj");
274,7 → 274,7
"connection" /* the source inside the container */);
c.autowireBySetter("myDep" /* notice this is the setter of the Connection class */,
"aDependency" /* again this is the name of the bean/component inside the container */);
"aDependency" /* again this is the name of the factory inside the container */);
return c;
}
354,7 → 354,7
public boolean isCleared() { return cleared; }
}
private static class SomeComponent implements Factory, Interceptable<SomeObject> {
private static class SomeFactory implements Factory, Interceptable<SomeObject> {
@Override
public <T> T getInstance() {
386,7 → 386,7
Container c = new MentaContainer();
c.ioc("o", new SomeComponent(), Scope.SINGLETON);
c.ioc("o", new SomeFactory(), Scope.SINGLETON);
SomeObject o = c.get("o");
394,7 → 394,7
Assert.assertEquals(true, o.isCleared());
c.ioc("o", new SomeComponent(), Scope.THREAD);
c.ioc("o", new SomeFactory(), Scope.THREAD);
o = c.get("o");
406,7 → 406,7
Assert.assertEquals(true, o.isCleared());
c.ioc("o", new SomeComponent(), Scope.NONE);
c.ioc("o", new SomeFactory(), Scope.NONE);
o = c.get("o");
414,7 → 414,7
Assert.assertNull(o);
c.ioc("o", new SomeComponent(), Scope.THREAD);
c.ioc("o", new SomeFactory(), Scope.THREAD);
o = c.clear("o");
/trunk/src/test/java/org/mentacontainer/impl/WrapperFactoryTest.java
9,7 → 9,7
public class WrapperFactoryTest {
@Test
public void testInstanceComponent() throws Exception {
public void testInstanceFactory() throws Exception {
String s = new String("saoj");