git://wamblee.org
/
utils
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
copyright messages updated in all java filees.
[utils]
/
system
/
general
/
src
/
test
/
java
/
org
/
wamblee
/
system
/
adapters
/
DefaultContainerTest.java
diff --git
a/system/general/src/test/java/org/wamblee/system/adapters/DefaultContainerTest.java
b/system/general/src/test/java/org/wamblee/system/adapters/DefaultContainerTest.java
index 07143e3eeee14371cf7f5f31ff3e7aade2c288fc..8990d83b18a9968fdbf206e9de434453970bb5c1 100644
(file)
--- a/
system/general/src/test/java/org/wamblee/system/adapters/DefaultContainerTest.java
+++ b/
system/general/src/test/java/org/wamblee/system/adapters/DefaultContainerTest.java
@@
-1,5
+1,5
@@
/*
/*
- * Copyright 200
8
the original author or authors.
+ * Copyright 200
5-2010
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@
-12,61
+12,81
@@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */
+ */
package org.wamblee.system.adapters;
import org.wamblee.system.core.Scope;
package org.wamblee.system.adapters;
import org.wamblee.system.core.Scope;
+
import org.wamblee.test.AssertionUtils;
import org.wamblee.test.AssertionUtils;
+/**
+ *
+ * @author $author$
+ * @version $Revision$
+ */
public class DefaultContainerTest extends AdapterTestCase {
public class DefaultContainerTest extends AdapterTestCase {
-
public void testConstructorInjection() {
ClassConfiguration x1Config = new ClassConfiguration(X1.class);
x1Config.getConstructorConfig().getParameters().setValue(0, "hello");
public void testConstructorInjection() {
ClassConfiguration x1Config = new ClassConfiguration(X1.class);
x1Config.getConstructorConfig().getParameters().setValue(0, "hello");
+ x1Config.getObjectConfig().getSetterConfig().initAllSetters();
+
+ ClassConfiguration x4Config = new ClassConfiguration(X4.class);
+ x4Config.getObjectConfig().getSetterConfig().initAllSetters();
DefaultContainer container = new DefaultContainer("top").addComponent(
DefaultContainer container = new DefaultContainer("top").addComponent(
-
"x1", x1Config).addComponent("x4", X4.class
);
+
"x1", x1Config).addComponent("x4", x4Config
);
Scope scope = container.start();
AssertionUtils.assertEquals(new String[] { "x1(hello)", "x4(x1)" },
Scope scope = container.start();
AssertionUtils.assertEquals(new String[] { "x1(hello)", "x4(x1)" },
-
EVENT_TRACKER.getEvents(Thread.currentThread()).toArray());
+ EVENT_TRACKER.getEvents(Thread.currentThread()).toArray());
Object obj = scope.getRuntime("x1");
assertTrue(obj instanceof X1);
obj = scope.getRuntime("x4");
assertTrue(obj instanceof X4);
}
Object obj = scope.getRuntime("x1");
assertTrue(obj instanceof X1);
obj = scope.getRuntime("x4");
assertTrue(obj instanceof X4);
}
-
+
public void testConstructorInjectionAndSetterInjection() {
ClassConfiguration x1Config = new ClassConfiguration(X1.class);
x1Config.getConstructorConfig().getParameters().setValue(0, "hello");
public void testConstructorInjectionAndSetterInjection() {
ClassConfiguration x1Config = new ClassConfiguration(X1.class);
x1Config.getConstructorConfig().getParameters().setValue(0, "hello");
-
- X8 x8 = new X8(null);
+ x1Config.getObjectConfig().getSetterConfig().initAllSetters();
+
+ X8 x8 = new X8(null);
EVENT_TRACKER.clear();
EVENT_TRACKER.clear();
+ ClassConfiguration x4Config = new ClassConfiguration(X4.class);
+ x4Config.getObjectConfig().getSetterConfig().initAllSetters();
+
+ ObjectConfiguration x8Config = new ObjectConfiguration(X8.class);
+ x8Config.getSetterConfig().initAllSetters();
+
DefaultContainer container = new DefaultContainer("top").addComponent(
DefaultContainer container = new DefaultContainer("top").addComponent(
- "x1", x1Config).addComponent("x4", X4.class).addComponent("x8", x8);
+ "x1", x1Config).addComponent("x4", x4Config).addComponent("x8", x8,
+ x8Config);
Scope scope = container.start();
AssertionUtils.assertEquals(new String[] { "x1(hello)", "x4(x1)",
Scope scope = container.start();
AssertionUtils.assertEquals(new String[] { "x1(hello)", "x4(x1)",
- "x8.setX4(x4)"},
-
EVENT_TRACKER.getEvents(Thread.currentThread())
.toArray());
+ "x8.setX4(x4)" }, EVENT_TRACKER.getEvents(Thread.currentThread())
+ .toArray());
Object obj1 = scope.getRuntime("x1");
assertTrue(obj1 instanceof X1);
Object obj1 = scope.getRuntime("x1");
assertTrue(obj1 instanceof X1);
+
Object obj4 = scope.getRuntime("x4");
assertTrue(obj4 instanceof X4);
Object obj4 = scope.getRuntime("x4");
assertTrue(obj4 instanceof X4);
+
Object obj8 = scope.getRuntime("x8");
assertSame(x8, obj8);
assertSame(obj4, x8.getX4());
}
Object obj8 = scope.getRuntime("x8");
assertSame(x8, obj8);
assertSame(obj4, x8.getX4());
}
-
- public void testWrongObjectType() {
+
+ public void testWrongObjectType() {
final DefaultContainer container = new DefaultContainer("top");
AssertionUtils.assertException(new AssertionUtils.ErroneousCode() {
@Override
public void run() throws Exception {
final DefaultContainer container = new DefaultContainer("top");
AssertionUtils.assertException(new AssertionUtils.ErroneousCode() {
@Override
public void run() throws Exception {
- container.addComponent("x", "y", new ObjectConfiguration(Integer.class));
+ container.addComponent("x", "y", new ObjectConfiguration(
+ Integer.class));
}
}, IllegalArgumentException.class);
}
}
}, IllegalArgumentException.class);
}