Skip to content

Commit

Permalink
Ensuring that modules are stopped in the correct order - TRUNK-4134
Browse files Browse the repository at this point in the history
  • Loading branch information
dkayiwa committed Nov 18, 2013
1 parent bbbd572 commit a477802
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions api/src/test/java/org/openmrs/module/ModuleActivatorTest.java
Expand Up @@ -67,8 +67,8 @@ public void shouldNotCallContextRefreshedOnStartup() throws Exception {

@Test
public void shouldStartModulesInOrder() throws Exception {
//module2 depends on module1
//while module3 depends on module2
//module2 depends on module1 while module3 depends on module2
//so startup order should be module1, module2, module3
assertTrue(moduleTestData.getWillStartCallTime(MODULE1_ID) <= moduleTestData.getWillStartCallTime(MODULE2_ID));
assertTrue(moduleTestData.getWillStartCallTime(MODULE2_ID) <= moduleTestData.getWillStartCallTime(MODULE3_ID));
}
Expand Down Expand Up @@ -103,6 +103,14 @@ public void shouldStopDependantModulesOnStopModule() throws Exception {
assertTrue(moduleTestData.getStoppedCallCount(MODULE1_ID) == 1);
assertTrue(moduleTestData.getStoppedCallCount(MODULE2_ID) == 1);
assertTrue(moduleTestData.getStoppedCallCount(MODULE3_ID) == 1);

//willStop() and stopped() should have been called in the right order
//which is the reverse of the startup. that is module3, module2, module1
assertTrue(moduleTestData.getWillStopCallTime(MODULE3_ID) <= moduleTestData.getWillStopCallTime(MODULE2_ID));
assertTrue(moduleTestData.getWillStopCallTime(MODULE2_ID) <= moduleTestData.getWillStopCallTime(MODULE1_ID));

assertTrue(moduleTestData.getStoppedCallTime(MODULE3_ID) <= moduleTestData.getStoppedCallTime(MODULE2_ID));
assertTrue(moduleTestData.getStoppedCallTime(MODULE2_ID) <= moduleTestData.getStoppedCallTime(MODULE1_ID));
}

@Test
Expand Down

0 comments on commit a477802

Please sign in to comment.