Skip to content

Commit 390ac7b

Browse files
committed
split tests for each cases
1 parent ee994b3 commit 390ac7b

File tree

1 file changed

+31
-5
lines changed

1 file changed

+31
-5
lines changed

framework/spring/module/src/test/java/org/apache/cloudstack/spring/module/factory/ModuleBasedContextFactoryTest.java

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,40 @@ public void testBeans() throws IOException {
9191
}
9292

9393
@Test
94-
public void testConfigResources() throws IOException {
94+
public void testEmptyNameConfigResources() throws IOException {
9595
ModuleDefinitionSet set = factory.loadModules(defs, "base");
96-
9796
testConfigResourcesArray(new String[] {}, set.getConfigResources(""));
97+
}
98+
99+
@Test
100+
public void testBaseConfigResources() throws IOException {
101+
ModuleDefinitionSet set = factory.loadModules(defs, "base");
98102
testConfigResourcesArray(new String[] {"base-context.xml", "base-context-inheritable.xml"}, set.getConfigResources("base"));
99-
testConfigResourcesArray(new String[] {"child1-context.xml", "child1-context-inheritable.xml", "base-context-inheritable.xml", "chil1-context-override.xml"}, set.getConfigResources("child1"));
100-
testConfigResourcesArray(new String[] {"child2-context.xml", "base-context-inheritable.xml"}, set.getConfigResources("child2"));
101-
testConfigResourcesArray(new String[] {"chil1-1-context.xml", "child1-context-inheritable.xml", "base-context-inheritable.xml"}, set.getConfigResources("child1-1"));
103+
}
104+
105+
@Test
106+
public void testChild1ConfigResources() throws IOException {
107+
ModuleDefinitionSet set = factory.loadModules(defs, "base");
108+
testConfigResourcesArray(new String[] {
109+
"child1-context.xml", "child1-context-inheritable.xml",
110+
"base-context-inheritable.xml", "chil1-context-override.xml"
111+
}, set.getConfigResources("child1"));
112+
}
113+
114+
@Test
115+
public void testChild2ConfigResources() throws IOException {
116+
ModuleDefinitionSet set = factory.loadModules(defs, "base");
117+
testConfigResourcesArray(new String[] {
118+
"child2-context.xml", "base-context-inheritable.xml"
119+
}, set.getConfigResources("child2"));
120+
}
121+
122+
@Test
123+
public void testChild11ConfigResources() throws IOException {
124+
ModuleDefinitionSet set = factory.loadModules(defs, "base");
125+
testConfigResourcesArray(new String[] {
126+
"chil1-1-context.xml", "child1-context-inheritable.xml", "base-context-inheritable.xml"
127+
}, set.getConfigResources("child1-1"));
102128
}
103129

104130
private void testConfigResourcesArray(String[] expected, Resource[] actual) {

0 commit comments

Comments
 (0)