Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Gorovoy2011-06-24 22:50:15 +0000
committerMichael Gorovoy2011-06-24 22:50:15 +0000
commitdbd782dfbcf27dabda6d14e3ce67c3e1fd625544 (patch)
treeb906d5bd6c36c9f86dcd8d7a65c62276f2acbb8e /jetty-deploy/src/test
parent47e199af79942041f430c17e0a40c890e0919bd6 (diff)
downloadorg.eclipse.jetty.project-dbd782dfbcf27dabda6d14e3ce67c3e1fd625544.tar.gz
org.eclipse.jetty.project-dbd782dfbcf27dabda6d14e3ce67c3e1fd625544.tar.xz
org.eclipse.jetty.project-dbd782dfbcf27dabda6d14e3ce67c3e1fd625544.zip
350287 ScanningAppProviderRuntimeUpdatesTest fails on Windows
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@3426 7e9141cc-0065-0410-87d8-b60c137991c4
Diffstat (limited to 'jetty-deploy/src/test')
-rw-r--r--jetty-deploy/src/test/java/org/eclipse/jetty/deploy/providers/ScanningAppProviderRuntimeUpdatesTest.java55
1 files changed, 49 insertions, 6 deletions
diff --git a/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/providers/ScanningAppProviderRuntimeUpdatesTest.java b/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/providers/ScanningAppProviderRuntimeUpdatesTest.java
index 7741259f07..a7ceef18de 100644
--- a/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/providers/ScanningAppProviderRuntimeUpdatesTest.java
+++ b/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/providers/ScanningAppProviderRuntimeUpdatesTest.java
@@ -16,11 +16,14 @@
package org.eclipse.jetty.deploy.providers;
import java.io.IOException;
+import java.util.Collection;
import java.util.concurrent.atomic.AtomicInteger;
import org.eclipse.jetty.deploy.AppProvider;
import org.eclipse.jetty.deploy.DeploymentManager;
+import org.eclipse.jetty.deploy.DeploymentManager.AppEntry;
import org.eclipse.jetty.deploy.test.XmlConfiguredJetty;
+import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.toolchain.test.TestingDir;
import org.eclipse.jetty.util.Scanner;
import org.eclipse.jetty.util.log.Log;
@@ -83,18 +86,53 @@ public class ScanningAppProviderRuntimeUpdatesTest
public void waitForDirectoryScan()
{
int scan=_scans.get()+2*_providers;
- do
+ try
{
- try
+ do
{
Thread.sleep(200);
}
- catch(InterruptedException e)
+ while(_scans.get()<scan);
+
+ Thread.sleep(200);
+ }
+ catch(InterruptedException e)
+ {
+ Log.ignore(e);
+ }
+ }
+
+ public void waitForDeployment()
+ {
+ DeploymentManager dm = jetty.getServer().getBeans(DeploymentManager.class).get(0);
+
+ long count = 10;
+ boolean ready;
+ Collection<AppEntry> entries = dm.getAppEntries();
+ try
+ {
+ do
{
- Log.warn(e);
- }
+ Thread.sleep(200);
+
+ ready = true;
+ for(AppEntry entry: entries)
+ {
+ if(!entry.getLifecyleNode().getName().equals("deployed"))
+ {
+ ready = false;
+ }
+ }
+ } while (!ready && --count > 0);
+ }
+ catch (InterruptedException e)
+ {
+ Log.ignore(e);
+ }
+ catch (Exception e)
+ {
+ Log.warn(e);
}
- while(_scans.get()<scan);
}
/**
@@ -144,6 +182,8 @@ public class ScanningAppProviderRuntimeUpdatesTest
jetty.assertWebAppContextsExists("/foo");
+ waitForDeployment();
+
// Test that webapp response contains "-1"
jetty.assertResponseContains("/foo/info","FooServlet-1");
@@ -154,8 +194,11 @@ public class ScanningAppProviderRuntimeUpdatesTest
// This should result in the existing foo.war being replaced with the new foo.war
waitForDirectoryScan();
+
jetty.assertWebAppContextsExists("/foo");
+ waitForDeployment();
+
// Test that webapp response contains "-2"
jetty.assertResponseContains("/foo/info","FooServlet-2");
}

Back to the top