Skip to content

Commit 31e14c9

Browse files
authored
Merge pull request #8137 from andymc12/fatWaitForAppStop
Clean FAT test to better wait for app stop
2 parents d02fd1b + c95f08f commit 31e14c9

File tree

1 file changed

+1
-21
lines changed

1 file changed

+1
-21
lines changed

dev/com.ibm.ws.jaxrs.2.0.cdi.1.2_fat/fat/src/com/ibm/ws/jaxrs20/cdi12/fat/test/LifeCycle12Test.java

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ public void testLifeCycleMethod() throws Exception {
6363
runGetMethod("/rest/lifecycle1", 200, "Resource: LifeCycleResource1", true);
6464
runGetMethod("/rest/lifecycle1", 200, "Resource: LifeCycleResource1", true);
6565
runGetMethod("/rest/lifecycle1", 200, "Resource: LifeCycleResource1", true);
66-
Thread.currentThread();
6766
Thread.sleep(1500);
6867

6968
assertLibertyMessage("postConstruct method is called on com.ibm.ws.jaxrs20.cdi12.fat.lifecyclemethod.LifeCycleResource1", 3, "equal");
@@ -74,30 +73,11 @@ public void testLifeCycleMethod() throws Exception {
7473
assertLibertyMessage("preDestory method is called on com.ibm.ws.jaxrs20.cdi12.fat.lifecyclemethod.LifeCycleResource2", 0, "equal");
7574

7675
Thread.sleep(1500);
77-
uninstallApplication();
78-
Thread.currentThread();
76+
assertTrue("Failed to remove app from dropins dir", server.removeAndStopDropinsApplications(LIFECYCLEWAR));
7977
Thread.sleep(1500);
8078

8179
assertLibertyMessage("preDestory method is called on com.ibm.ws.jaxrs20.cdi12.fat.lifecyclemethod.LifeCycleApplication", 1, "equal");
8280
assertLibertyMessage("preDestory method is called on com.ibm.ws.jaxrs20.cdi12.fat.lifecyclemethod.LifeCycleResource2", 1, "equal");
8381

8482
}
85-
86-
/*
87-
* "remove the dropins app the way LibertyServer does (or just use the LibertyServer method)...
88-
* Instead of deleting the file itself, move it to a path outside of dropins.
89-
* That is more of an atomic operation and guarantees that for expanded applications
90-
* we don't get one event with some file deletes, and then another with the rest."
91-
*/
92-
protected void uninstallApplication() throws Exception {
93-
boolean success = false;
94-
try {
95-
String dropinsFilePath = server.getServerRoot() + "/dropins/" + LIFECYCLEWAR;
96-
String nonDropinsFilePath = server.getServerRoot() + "/" + LIFECYCLEWAR;
97-
success = LibertyFileManager.renameLibertyFile(server.getMachine(), dropinsFilePath, nonDropinsFilePath);
98-
} catch (Exception e) {
99-
Log.warning(this.getClass(), e.getMessage());
100-
}
101-
assertTrue("Application lifecyclemethod does not appear to have removed.", success);
102-
}
10383
}

0 commit comments

Comments
 (0)