Re-enable tests on windows server. Improve some flaky tests.
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/BrowserTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/BrowserTest.java
index 4209215..44234b0 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/BrowserTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/BrowserTest.java
@@ -608,7 +608,7 @@
/*
* This test fails on Jenkins Windows Server, to be investigated...
*/
- Assume.assumeFalse( StudioSystemUtils.IS_OS_WINDOWS_SERVER );
+ // Assume.assumeFalse( StudioSystemUtils.IS_OS_WINDOWS_SERVER );
browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
browserViewBot.expandEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ImportExportTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ImportExportTest.java
index 6fcad73..a395207 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ImportExportTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ImportExportTest.java
@@ -30,6 +30,7 @@
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.List;
+import java.util.function.Supplier;
import org.apache.directory.api.ldap.model.message.SearchScope;
import org.apache.directory.api.ldap.model.name.Dn;
@@ -275,10 +276,9 @@
DeleteDialogBot dialogBot = browserViewBot.openDeleteDialog();
assertTrue( dialogBot.isVisible() );
dialogBot.clickOkButton();
- BotUtils.sleep( 5000L ); // TODO: wait until all entries are deleted and UI is updated
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=alias" ) );
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=referral" ) );
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=subentry" ) );
+ waitAndAssert(false, () -> browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=alias" ));
+ waitAndAssert(false, () -> browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=referral" ));
+ waitAndAssert(false, () -> browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=subentry" ));
// import LDIFs
ImportWizardBot importWizardBot = browserViewBot.openImportLdifWizard();
@@ -364,10 +364,9 @@
DeleteDialogBot dialogBot = browserViewBot.openDeleteDialog();
assertTrue( dialogBot.isVisible() );
dialogBot.clickOkButton();
- BotUtils.sleep( 5000L ); // TODO: wait until all entries are deleted and UI is updated
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=alias" ) );
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=referral" ) );
- assertFalse( browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=subentry" ) );
+ waitAndAssert(false, () -> browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=alias" ));
+ waitAndAssert(false, () -> browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=referral" ));
+ waitAndAssert(false, () -> browserViewBot.existsEntry( "DIT", "Root DSE", "ou=system", "ou=special", "cn=subentry" ));
// import DSML
ImportWizardBot importWizardBot = browserViewBot.openImportDsmlWizard();
@@ -385,6 +384,27 @@
}
+ private void waitAndAssert( boolean expectedResult, Supplier<Boolean> fn )
+ {
+ for ( int i = 0; i < 30; i++ )
+ {
+ if ( fn.get() == expectedResult )
+ {
+ break;
+ }
+ BotUtils.sleep( 1000L );
+ }
+ if ( expectedResult == true )
+ {
+ assertTrue( fn.get() );
+ }
+ else
+ {
+ assertFalse( fn.get() );
+ }
+ }
+
+
@Test
public void testExportWithPagedResultControl() throws Exception
{
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/LdifEditorTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/LdifEditorTest.java
index 284158f..d591c0d 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/LdifEditorTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/LdifEditorTest.java
@@ -76,7 +76,7 @@
/*
* This test fails on Jenkins Windows Server, to be investigated...
*/
- Assume.assumeFalse( StudioSystemUtils.IS_OS_WINDOWS_SERVER );
+ // Assume.assumeFalse( StudioSystemUtils.IS_OS_WINDOWS_SERVER );
NewWizardBot newWizard = studioBot.openNewWizard();
newWizard.selectLdifFile();
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SchemaEditorTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SchemaEditorTest.java
index 38d363e..c83e14a 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SchemaEditorTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SchemaEditorTest.java
@@ -99,7 +99,7 @@
/*
* This test fails on Jenkins Windows Server, to be investigated...
*/
- Assume.assumeFalse( StudioSystemUtils.IS_OS_WINDOWS_SERVER );
+ // Assume.assumeFalse( StudioSystemUtils.IS_OS_WINDOWS_SERVER );
createProject( "Project Search For Aliases" );
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SearchTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SearchTest.java
index 2c525f2..ec23c64 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SearchTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SearchTest.java
@@ -38,7 +38,6 @@
import org.apache.directory.studio.ldapbrowser.core.BrowserCorePlugin;
import org.apache.directory.studio.ldapbrowser.core.events.EventRegistry;
import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
-import org.apache.directory.studio.test.integration.ui.bots.BotUtils;
import org.apache.directory.studio.test.integration.ui.bots.BrowserViewBot;
import org.apache.directory.studio.test.integration.ui.bots.ConnectionsViewBot;
import org.apache.directory.studio.test.integration.ui.bots.SearchDialogBot;
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SwtResourcesTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SwtResourcesTest.java
index 404235a..75167ed 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SwtResourcesTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SwtResourcesTest.java
@@ -98,7 +98,7 @@
int beforeObjectCount = getSwtObjectCount();
// now lets run the new entry wizard it several times
- for ( int i = 1; i < 25; i++ )
+ for ( int i = 1; i <= 8; i++ )
{
createAndDeleteEntry( "testSwtResourcesDelta" + i );
}
@@ -106,9 +106,9 @@
// get the SWT objects after the run
int afterObjectCount = getSwtObjectCount();
- // we expect not more than 10 additional SWT objects
+ // we expect none or only very few additional SWT objects
assertTrue( "Too many SWT resources were allocated in testSwtResourcesDelta: before=" + beforeObjectCount
- + ", after=" + afterObjectCount, afterObjectCount - beforeObjectCount < 10 );
+ + ", after=" + afterObjectCount, afterObjectCount - beforeObjectCount < 5 );
}