You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2009/09/10 16:58:33 UTC
svn commit: r813466 - in
/sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it:
BundleInstallStressTest.java OsgiInstallerTestBase.java
Author: bdelacretaz
Date: Thu Sep 10 14:58:33 2009
New Revision: 813466
URL: http://svn.apache.org/viewvc?rev=813466&view=rev
Log:
SLING-1078 - use same timeout to wait for actions and bundle count
Modified:
sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/BundleInstallStressTest.java
sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/OsgiInstallerTestBase.java
Modified: sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/BundleInstallStressTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/BundleInstallStressTest.java?rev=813466&r1=813465&r2=813466&view=diff
==============================================================================
--- sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/BundleInstallStressTest.java (original)
+++ sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/BundleInstallStressTest.java Thu Sep 10 14:58:33 2009
@@ -131,7 +131,8 @@
// Start by installing all bundles
log(LogService.LOG_INFO,"Registering all test bundles, " + testBundles.size() + " resources");
install(testBundles);
- waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1);
+ waitForInstallerAction("After registering all bundles", OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER,
+ 1, expectBundlesTimeoutMsec);
expectBundleCount("After installing all test bundles", initialBundleCount + testBundles.size());
for(int i=0; i < cycleCount; i++) {
@@ -140,7 +141,8 @@
final List<File> toInstall = selectRandomBundles();
log(LogService.LOG_INFO,"Re-registering " + toInstall.size() + " randomly selected resources (other test bundles should be uninstalled)");
install(toInstall);
- waitForInstallerAction(OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER, 1);
+ waitForInstallerAction("At cycle " + i, OsgiInstaller.WORKER_THREAD_BECOMES_IDLE_COUNTER,
+ 1, expectBundlesTimeoutMsec);
// TODO this sleep shouldn't be needed, probably hides a bug in OsgiInstallerImpl
sleep(2500L);
expectBundleCount("At cycle " + i, initialBundleCount + toInstall.size());
Modified: sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/OsgiInstallerTestBase.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/OsgiInstallerTestBase.java?rev=813466&r1=813465&r2=813466&view=diff
==============================================================================
--- sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/OsgiInstallerTestBase.java (original)
+++ sling/trunk/installer/osgi/it/src/test/java/org/apache/sling/osgi/installer/it/OsgiInstallerTestBase.java Thu Sep 10 14:58:33 2009
@@ -320,8 +320,12 @@
waitForInstallerAction(null, counterType, howMany);
}
- /** @param howMany negative values means absolute, instead of relative to current value */
protected void waitForInstallerAction(String info, int counterType, long howMany) {
+ waitForInstallerAction(info, counterType, howMany, 0);
+ }
+
+ /** @param howMany negative values means absolute, instead of relative to current value */
+ protected void waitForInstallerAction(String info, int counterType, long howMany, long timeoutMsec) {
if(info == null) {
info = "";
} else {
@@ -338,7 +342,8 @@
targetValue = installer.getCounters()[counterType] + howMany;
}
- final long endTime = System.currentTimeMillis() + WAIT_FOR_ACTION_TIMEOUT_MSEC;
+ final long timeout = timeoutMsec > 0 ? timeoutMsec : WAIT_FOR_ACTION_TIMEOUT_MSEC;
+ final long endTime = System.currentTimeMillis() + timeout;
long lastValue = 0;
while(System.currentTimeMillis() < endTime) {
lastValue = installer.getCounters()[counterType];