MentaContainer

Compare Revisions

Ignore whitespace Rev 100 → Rev 101

/trunk/src/test/java/org/mentacontainer/impl/MentaContainerTest.java
241,9 → 241,9
private Connection conn;
public void setConn(Connection conn) { this.conn = conn; }
public void setConnection(Connection conn) { this.conn = conn; }
public Connection getConn() { return conn; }
public Connection getConnection() { return conn; }
@Override
public Object getSomething() {
270,11 → 270,9
c.ioc("connection", Connection.class).addInitValue("A super JDBC connection!");
c.autowireBySetter("conn" /* the property name that will receive the dependency */,
"connection" /* the source inside the container */);
c.autowire("connection");
c.autowireBySetter("myDep" /* notice this is the setter of the Connection class */,
"aDependency" /* again this is the name of the factory inside the container */);
c.autowire("aDependency", "myDep");
return c;
}
292,7 → 290,7
// check dependency...
Connection conn = ((JdbcMyDAO) myDAO).getConn();
Connection conn = ((JdbcMyDAO) myDAO).getConnection();
Assert.assertNotNull(conn);
336,7 → 334,7
// also check if myDAO was corrected wired...
Connection conn = ((JdbcMyDAO) a.getMyDAO()).getConn();
Connection conn = ((JdbcMyDAO) a.getMyDAO()).getConnection();
Assert.assertNotNull(conn);
/trunk/src/test/java/org/mentacontainer/example/CoreExamplesTest.java
106,7 → 106,7
 
c.ioc("myString", String.class);
c.autowireByConstructor("username");
c.autowire("username");
String myString = c.get("myString");
120,7 → 120,7
c.ioc("myBirthday", Date.class).addPropertyValue("month", 0).addPropertyValue("date", 20);
c.autowireBySetter("year", "myBirthdayYear");
c.autowire("myBirthdayYear", "year");
Date myBirthday = c.get("myBirthday");
139,8 → 139,8
c.ioc("myBirthday", Date.class).addPropertyValue("date", 20);
c.autowireByConstructor("timeInMillis");
c.autowireBySetter("month", "myBirthdayMonth");
c.autowire("timeInMillis");
c.autowire("myBirthdayMonth", "month");
myBirthday = c.get("myBirthday");
163,8 → 163,8
c.ioc("myBirthday", Date.class).addPropertyValue("date", 20).addInitDependency("timeInMillis2");
c.autowireByConstructor("timeInMillis");
c.autowireBySetter("month", "myBirthdayMonth");
c.autowire("timeInMillis");
c.autowire("myBirthdayMonth", "month");
myBirthday = c.get("myBirthday");
187,8 → 187,8
c.ioc("myBirthday", Date.class).addPropertyValue("date", 20).useZeroArgumentConstructor();
c.autowireByConstructor("timeInMillis");
c.autowireBySetter("month", "myBirthdayMonth");
c.autowire("timeInMillis");
c.autowire("myBirthdayMonth", "month");
myBirthday = c.get("myBirthday");