You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2018/05/20 21:57:56 UTC

[directory-studio] branch master updated: Add flag to wait or not for a node

This is an automated email from the ASF dual-hosted git repository.

seelmann pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/directory-studio.git


The following commit(s) were added to refs/heads/master by this push:
     new 790f6ac  Add flag to wait or not for a node
790f6ac is described below

commit 790f6acc1e0505582676abbf7ff780a1e3783285
Author: Stefan Seelmann <ma...@stefan-seelmann.de>
AuthorDate: Sun May 20 23:40:18 2018 +0200

    Add flag to wait or not for a node
---
 .../studio/test/integration/ui/BrowserTest.java    |  2 +-
 .../test/integration/ui/bots/BrowserViewBot.java   |  4 +-
 .../test/integration/ui/bots/BrowserWidgetBot.java | 52 ++++++++++++----------
 3 files changed, 31 insertions(+), 27 deletions(-)

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 ab8d9cb..22ebef5 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
@@ -162,7 +162,7 @@ public class BrowserTest extends AbstractLdapTestUnit
         String[] children = new String[]
             { "uid=user.1", "uid=user.2", "uid=user.3", "uid=user.4", "uid=user.5", "uid=user.6", "uid=user.7",
                 "uid=user.8" };
-        browserViewBot.selectChildrenOfEnty( children, "DIT", "Root DSE", "ou=system", "ou=users" );
+        browserViewBot.selectChildrenOfEntry( children, "DIT", "Root DSE", "ou=system", "ou=users" );
         DeleteDialogBot deleteDialog = browserViewBot.openDeleteDialog();
         deleteDialog.clickOkButton();
         browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
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 5b1746c..734cdb3 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
@@ -60,9 +60,9 @@ public class BrowserViewBot
     }
 
 
-    public void selectChildrenOfEnty( String[] children, String... path )
+    public void selectChildrenOfEntry( String[] children, String... path )
     {
-        browserBot.selectChildrenOfEnty( children, path );
+        browserBot.selectChildrenOfEntry( children, path );
     }
 
 
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserWidgetBot.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserWidgetBot.java
index d42bb9f..9b15328 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserWidgetBot.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserWidgetBot.java
@@ -55,12 +55,12 @@ class BrowserWidgetBot
         // ensure the parent exists
         String[] parentPath = new String[path.length - 1];
         System.arraycopy( path, 0, parentPath, 0, parentPath.length );
-        getEntry( parentPath );
+        getEntry( false, parentPath );
 
         // check if the child exists
         try
         {
-            getEntry( path );
+            getEntry( false, path );
             return true;
         }
         catch ( WidgetNotFoundException e )
@@ -72,21 +72,21 @@ class BrowserWidgetBot
 
     void selectEntry( String... path )
     {
-        SWTBotTreeItem entry = getEntry( path );
+        SWTBotTreeItem entry = getEntry( true, path );
         select( entry );
     }
 
 
-    void selectChildrenOfEnty( String[] children, String... path )
+    void selectChildrenOfEntry( String[] children, String... path )
     {
-        SWTBotTreeItem entry = getEntry( path );
+        SWTBotTreeItem entry = getEntry( true, path );
         entry.select( children );
     }
 
 
     ReferralDialogBot selectEntryExpectingReferralDialog( String... path )
     {
-        SWTBotTreeItem entry = getEntry( path );
+        SWTBotTreeItem entry = getEntry( true, path );
         select( entry );
         return new ReferralDialogBot();
     }
@@ -94,20 +94,20 @@ class BrowserWidgetBot
 
     void expandEntry( String... path )
     {
-        SWTBotTreeItem entry = getEntry( path );
+        SWTBotTreeItem entry = getEntry( true, path );
         expand( entry, true, null );
     }
 
 
     void waitForEntry( String... path )
     {
-        getEntry( path );
+        getEntry( true, path );
     }
 
 
     ReferralDialogBot expandEntryExpectingReferralDialog( String... path )
     {
-        SWTBotTreeItem entry = getEntry( path );
+        SWTBotTreeItem entry = getEntry( false, path );
         expand( entry, false, null );
         return new ReferralDialogBot();
     }
@@ -119,7 +119,7 @@ class BrowserWidgetBot
     }
 
 
-    private SWTBotTreeItem getEntry( String... path )
+    private SWTBotTreeItem getEntry( boolean wait, String... path )
     {
         SWTBotTree browserTree = bot.tree();
         List<String> pathList = new ArrayList<String>( Arrays.asList( path ) );
@@ -136,7 +136,7 @@ class BrowserWidgetBot
             }
             else
             {
-                entry = getChild(entry, node);
+                entry = getChild( entry, node, wait );
             }
 
             if ( !pathList.isEmpty() )
@@ -208,26 +208,30 @@ class BrowserWidgetBot
     }
 
 
-    private SWTBotTreeItem getChild( SWTBotTreeItem entry, String nodeName )
+    private SWTBotTreeItem getChild( SWTBotTreeItem entry, String nodeName, boolean wait )
     {
         // adjust current path, because the label is decorated with the number of children
-        bot.waitUntil( new DefaultCondition()
+        if ( wait )
         {
 
-            @Override
-            public boolean test() throws Exception
+            bot.waitUntil( new DefaultCondition()
             {
-                String adjustedNodeName = adjustNodeName( entry, nodeName );
-                return adjustedNodeName != null;
-            }
 
+                @Override
+                public boolean test() throws Exception
+                {
+                    String adjustedNodeName = adjustNodeName( entry, nodeName );
+                    return adjustedNodeName != null;
+                }
 
-            @Override
-            public String getFailureMessage()
-            {
-                return "Node " + nodeName + " not found";
-            }
-        } );
+
+                @Override
+                public String getFailureMessage()
+                {
+                    return "Node " + nodeName + " not found";
+                }
+            } );
+        }
 
         String adjustedNodeName = adjustNodeName( entry, nodeName );
         return entry.getNode( adjustedNodeName );

-- 
To stop receiving notification emails like this one, please contact
seelmann@apache.org.