Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/apache/directory-studio.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Seelmann <mail@stefan-seelmann.de>2021-05-05 09:36:29 +0300
committerStefan Seelmann <mail@stefan-seelmann.de>2021-05-05 09:36:29 +0300
commit4430e9211c3d286228f133ab541571948041f5e7 (patch)
treebe406fd04d84f80ab11e2d8468ad560f46f18a84
parent46686e54c64f67c646e806b6de9c747c3253eb34 (diff)
Fix some NPEs and stabilize UI tests
-rw-r--r--plugins/common.core/src/main/java/org/apache/directory/studio/common/core/jobs/CommonCorePlugin.java1
-rw-r--r--plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/event/ConnectionEventRegistry.java2
-rw-r--r--plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/PasswordModifyExtendedOperationAction.java1
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/CopyEntryTest.java14
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ReferralDialogTest.java29
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/SwtResourcesTest.java3
-rw-r--r--tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserViewBot.java8
7 files changed, 35 insertions, 23 deletions
diff --git a/plugins/common.core/src/main/java/org/apache/directory/studio/common/core/jobs/CommonCorePlugin.java b/plugins/common.core/src/main/java/org/apache/directory/studio/common/core/jobs/CommonCorePlugin.java
index 8c22d06aa..f6508c017 100644
--- a/plugins/common.core/src/main/java/org/apache/directory/studio/common/core/jobs/CommonCorePlugin.java
+++ b/plugins/common.core/src/main/java/org/apache/directory/studio/common/core/jobs/CommonCorePlugin.java
@@ -70,7 +70,6 @@ public class CommonCorePlugin extends Plugin
plugin = null;
studioProgressMonitorWatcherJob.stop();
- studioProgressMonitorWatcherJob.join();
studioProgressMonitorWatcherJob = null;
super.stop( context );
diff --git a/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/event/ConnectionEventRegistry.java b/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/event/ConnectionEventRegistry.java
index 39e759bb4..c0e9ab7a5 100644
--- a/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/event/ConnectionEventRegistry.java
+++ b/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/event/ConnectionEventRegistry.java
@@ -92,7 +92,7 @@ public class ConnectionEventRegistry
fireTimeStamps.add( now );
- if ( fireTimeStamps.size() > 5 )
+ if ( fireTimeStamps.size() > 10 )
{
String message = "Warning: More then " + fireTimeStamps.size() + " events were fired per second!"; //$NON-NLS-1$ //$NON-NLS-2$
ConnectionCorePlugin.getDefault().getLog().log(
diff --git a/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/PasswordModifyExtendedOperationAction.java b/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/PasswordModifyExtendedOperationAction.java
index 1d31660fb..216ecabf9 100644
--- a/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/PasswordModifyExtendedOperationAction.java
+++ b/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/PasswordModifyExtendedOperationAction.java
@@ -124,6 +124,7 @@ public class PasswordModifyExtendedOperationAction extends BrowserAction
{
return getConnectionAndEntry() != null
&& getConnectionAndEntry().connection != null
+ && getConnectionAndEntry().connection.getRootDSE() != null
&& getConnectionAndEntry().connection.getRootDSE()
.isExtensionSupported( PasswordModifyRequest.EXTENSION_OID );
}
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/CopyEntryTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/CopyEntryTest.java
index 73b56793e..5b2763a8b 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/CopyEntryTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/CopyEntryTest.java
@@ -44,6 +44,8 @@ import org.apache.directory.studio.test.integration.junit5.LdapServersSource;
import org.apache.directory.studio.test.integration.junit5.TestLdapServer;
import org.apache.directory.studio.test.integration.ui.bots.SelectCopyDepthDialogBot;
import org.apache.directory.studio.test.integration.ui.bots.SelectCopyStrategyBot;
+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
+import org.eclipse.swtbot.swt.finder.results.VoidResult;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.params.ParameterizedTest;
@@ -61,8 +63,10 @@ public class CopyEntryTest extends AbstractTestBase
public void resetPreferences()
{
// DIRSERVER-2133: reset check for children preference
- BrowserCorePlugin.getDefault()
- .getPluginPreferences().setValue( BrowserCoreConstants.PREFERENCE_CHECK_FOR_CHILDREN, true );
+ UIThreadRunnable.syncExec( () -> {
+ BrowserCorePlugin.getDefault()
+ .getPluginPreferences().setValue( BrowserCoreConstants.PREFERENCE_CHECK_FOR_CHILDREN, true );
+ } );
}
@@ -101,8 +105,10 @@ public class CopyEntryTest extends AbstractTestBase
public void testCopyPasteMultipleEntriesWithCopyDepthDialogObjectOnly( TestLdapServer server ) throws Exception
{
// DIRSERVER-2133: disable check for children for this test
- BrowserCorePlugin.getDefault()
- .getPluginPreferences().setValue( BrowserCoreConstants.PREFERENCE_CHECK_FOR_CHILDREN, false );
+ UIThreadRunnable.syncExec( () -> {
+ BrowserCorePlugin.getDefault()
+ .getPluginPreferences().setValue( BrowserCoreConstants.PREFERENCE_CHECK_FOR_CHILDREN, false );
+ } );
// select and copy multiple entries
connectionsViewBot.createTestConnection( server );
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ReferralDialogTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ReferralDialogTest.java
index 65dcee372..1be45d0e0 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ReferralDialogTest.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/ReferralDialogTest.java
@@ -40,6 +40,7 @@ import org.apache.directory.studio.connection.core.Connection;
import org.apache.directory.studio.connection.core.Connection.ReferralHandlingMethod;
import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
import org.apache.directory.studio.test.integration.junit5.LdapServersSource;
+import org.apache.directory.studio.test.integration.junit5.LdapServersSource.Mode;
import org.apache.directory.studio.test.integration.junit5.TestLdapServer;
import org.apache.directory.studio.test.integration.ui.bots.ReferralDialogBot;
import org.junit.jupiter.params.ParameterizedTest;
@@ -82,11 +83,11 @@ public class ReferralDialogTest extends AbstractTestBase
assertReferralEntriesAreNotVisible();
assertTrue( browserViewBot.existsEntry( pathWithRefLdapUrl( server, USER1_DN ) ) );
assertTrue( browserViewBot.existsEntry( pathWithRefLdapUrl( server, USERS_DN ) ) );
- browserViewBot.expandEntry( pathWithRefLdapUrl( server, USERS_DN ) );
+ browserViewBot.selectAndExpandEntry( pathWithRefLdapUrl( server, USERS_DN ) );
assertTrue( browserViewBot.existsEntry( pathWithRefLdapUrl( server, REFERRALS_DN ) ) );
- browserViewBot.expandEntry( pathWithRefLdapUrl( server, REFERRALS_DN ) );
+ browserViewBot.selectAndExpandEntry( pathWithRefLdapUrl( server, REFERRALS_DN ) );
assertTrue( browserViewBot.existsEntry( pathWithRefLdapUrl( server, MISC_DN ) ) );
- browserViewBot.expandEntry( pathWithRefLdapUrl( server, MISC_DN ) );
+ browserViewBot.selectAndExpandEntry( pathWithRefLdapUrl( server, MISC_DN ) );
}
@@ -138,7 +139,7 @@ public class ReferralDialogTest extends AbstractTestBase
assertEquals( ReferralHandlingMethod.IGNORE.ordinal(), referralsHandlingMethodOrdinal );
// expand ou=referrals, no referral dialog expected
- browserViewBot.expandEntry( path( REFERRALS_DN ) );
+ browserViewBot.selectAndExpandEntry( path( REFERRALS_DN ) );
// ensure that neither the continuation URLs, nor the referral entries are visible
assertReferralEntriesAreNotVisible();
@@ -168,7 +169,7 @@ public class ReferralDialogTest extends AbstractTestBase
assertTrue( manageDsaIT );
// expand ou=referrals, that reads the referral object
- browserViewBot.expandEntry( path( REFERRALS_DN ) );
+ browserViewBot.selectAndExpandEntry( path( REFERRALS_DN ) );
// ensure that the referral entries are visible, but not the continuation URLs
assertRefLdapUrlsAreNotVisible( server );
@@ -186,7 +187,7 @@ public class ReferralDialogTest extends AbstractTestBase
* Tests manual referral following.
*/
@ParameterizedTest
- @LdapServersSource
+ @LdapServersSource(mode = Mode.All)
public void testBrowseAndFollowManuallyContinuationReference( TestLdapServer server ) throws Exception
{
// ensure that referrals handling method is FOLLOW_MANUALLY
@@ -199,7 +200,7 @@ public class ReferralDialogTest extends AbstractTestBase
assertEquals( ReferralHandlingMethod.FOLLOW_MANUALLY.ordinal(), referralsHandlingMethodOrdinal );
// expand ou=referrals, no referral dialog expected yet
- browserViewBot.expandEntry( path( REFERRALS_DN ) );
+ browserViewBot.selectAndExpandEntry( path( REFERRALS_DN ) );
// ensure that only the referral targets are visible, not the referrals
assertReferralEntriesAreNotVisible();
@@ -219,13 +220,13 @@ public class ReferralDialogTest extends AbstractTestBase
referralDialogBot.clickOkButton();
// now all ref URLs can be expanded, no additional referral dialog is expected
- browserViewBot.expandEntry( pathWithRefLdapUrl( server, USER1_DN ) );
- browserViewBot.expandEntry( pathWithRefLdapUrl( server, USERS_DN ) );
- browserViewBot.expandEntry( pathWithRefLdapUrl( server, REFERRAL_TO_USERS_DN ) );
- browserViewBot.expandEntry( pathWithRefLdapUrl( server, REFERRALS_DN ) );
- browserViewBot.expandEntry( pathWithRefLdapUrl( server, REFERRAL_LOOP_1_DN ) );
- browserViewBot.expandEntry( pathWithRefLdapUrl( server, REFERRAL_LOOP_2_DN ) );
- browserViewBot.expandEntry( pathWithRefLdapUrl( server, MISC_DN ) );
+ browserViewBot.selectAndExpandEntry( pathWithRefLdapUrl( server, USER1_DN ) );
+ browserViewBot.selectAndExpandEntry( pathWithRefLdapUrl( server, USERS_DN ) );
+ browserViewBot.selectAndExpandEntry( pathWithRefLdapUrl( server, REFERRAL_TO_USERS_DN ) );
+ browserViewBot.selectAndExpandEntry( pathWithRefLdapUrl( server, REFERRALS_DN ) );
+ browserViewBot.selectAndExpandEntry( pathWithRefLdapUrl( server, REFERRAL_LOOP_1_DN ) );
+ browserViewBot.selectAndExpandEntry( pathWithRefLdapUrl( server, REFERRAL_LOOP_2_DN ) );
+ browserViewBot.selectAndExpandEntry( pathWithRefLdapUrl( server, MISC_DN ) );
}
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 b4162a121..5a76bec72 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
@@ -115,8 +115,7 @@ public class SwtResourcesTest extends AbstractTestBase
private void createAndDeleteEntry( final String name ) throws Exception
{
- browserViewBot.selectEntry( path( MISC_DN ) );
- browserViewBot.expandEntry( path( MISC_DN ) );
+ browserViewBot.selectAndExpandEntry( path( MISC_DN ) );
NewEntryWizardBot wizardBot = browserViewBot.openNewEntryWizard();
wizardBot.selectCreateEntryFromScratch();
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserViewBot.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserViewBot.java
index de48835cc..ac9ebbad2 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserViewBot.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserViewBot.java
@@ -32,7 +32,6 @@ public class BrowserViewBot
private SWTWorkbenchBot bot;
private BrowserWidgetBot browserBot;
-
public BrowserViewBot()
{
bot = new SWTWorkbenchBot();
@@ -76,6 +75,13 @@ public class BrowserViewBot
}
+ public void selectAndExpandEntry( String... path )
+ {
+ selectEntry( path );
+ expandEntry( path );
+ }
+
+
public void expandEntry( String... path )
{
browserBot.expandEntry( path );