directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r748543 - in /directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui: AutomatedSuite.java BrowserTest.java SWTBotUtils.java
Date Fri, 27 Feb 2009 14:55:26 GMT
Author: seelmann
Date: Fri Feb 27 14:55:26 2009
New Revision: 748543

URL: http://svn.apache.org/viewvc?rev=748543&view=rev
Log:
DIRSTUDIO-463: Added test to ensure that only one search request is sent when expanding an
entry

Added:
    directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/BrowserTest.java
Modified:
    directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/AutomatedSuite.java
    directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/SWTBotUtils.java

Modified: directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/AutomatedSuite.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/AutomatedSuite.java?rev=748543&r1=748542&r2=748543&view=diff
==============================================================================
--- directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/AutomatedSuite.java
(original)
+++ directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/AutomatedSuite.java
Fri Feb 27 14:55:26 2009
@@ -61,6 +61,7 @@
         addTest( new TestSuite( ImportExportTest.class ) );
 
         // Test Browser view
+        addTest( new TestSuite( BrowserTest.class ) );
         addTest( new TestSuite( NewEntryWizardTest.class ) );
         addTest( new TestSuite( RenameEntryDialogTest.class ) );
         addTest( new TestSuite( ReferralDialogTest.class ) );

Added: directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/BrowserTest.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/BrowserTest.java?rev=748543&view=auto
==============================================================================
--- directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/BrowserTest.java
(added)
+++ directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/BrowserTest.java
Fri Feb 27 14:55:26 2009
@@ -0,0 +1,90 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.studio.test.integration.ui;
+
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.directory.server.unit.AbstractServerTest;
+import org.eclipse.swtbot.eclipse.finder.SWTEclipseBot;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotStyledText;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+
+
+/**
+ * Tests the LDAP browser.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class BrowserTest extends AbstractServerTest
+{
+    private SWTEclipseBot bot;
+
+
+    protected void setUp() throws Exception
+    {
+        super.setUp();
+        bot = new SWTEclipseBot();
+        SWTBotUtils.openLdapPerspective( bot );
+        SWTBotUtils.createTestConnection( bot, "BrowserTest", ldapService.getPort() );
+    }
+
+
+    protected void tearDown() throws Exception
+    {
+        SWTBotUtils.deleteTestConnections();
+        bot = null;
+        super.tearDown();
+    }
+
+
+    /**
+     * Test for DIRSTUDIO-463.
+     * 
+     * When expanding an entry in the browser only one search request 
+     * should be send to the server
+     *
+     * @throws Exception
+     */
+    public void testOnlyOneSearchRequestWhenExpandingEntry() throws Exception
+    {
+        SWTBotTree browserTree = SWTBotUtils.getLdapBrowserTree( bot );
+        SWTBotUtils.selectEntry( bot, browserTree, false, "DIT", "Root DSE", "ou=system"
);
+
+        // get number of search requests before expanding the entry
+        SWTBotStyledText searchLogsText = SWTBotUtils.getSearchLogsText( bot );
+        String text = searchLogsText.getText();
+        int countMatchesBefore = StringUtils.countMatches( text, "#!SEARCH REQUEST" );
+
+        // expand
+        browserTree = SWTBotUtils.getLdapBrowserTree( bot );
+        SWTBotUtils.selectEntry( bot, browserTree, true, "DIT", "Root DSE", "ou=system" );
+
+        // get number of search requests after expanding the entry
+        searchLogsText = SWTBotUtils.getSearchLogsText( bot );
+        text = searchLogsText.getText();
+        int countMatchesAfter = StringUtils.countMatches( text, "#!SEARCH REQUEST" );
+
+        assertEquals( "Expected exactly 1 search request", 1, countMatchesAfter - countMatchesBefore
);
+
+        Thread.sleep( 10000 );
+    }
+}

Modified: directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/SWTBotUtils.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/SWTBotUtils.java?rev=748543&r1=748542&r2=748543&view=diff
==============================================================================
--- directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/SWTBotUtils.java
(original)
+++ directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/SWTBotUtils.java
Fri Feb 27 14:55:26 2009
@@ -37,6 +37,7 @@
 import org.apache.directory.studio.connection.core.ConnectionParameter;
 import org.apache.directory.studio.connection.core.ConnectionParameter.AuthenticationMethod;
 import org.apache.directory.studio.connection.core.ConnectionParameter.EncryptionMethod;
+import org.eclipse.swt.custom.StyledText;
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Tree;
 import org.eclipse.swt.widgets.Widget;
@@ -51,6 +52,7 @@
 import org.eclipse.swtbot.swt.finder.waits.ICondition;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotStyledText;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
@@ -231,13 +233,54 @@
     {
         SWTBotView view = bot.view( "LDAP Browser" );
         view.show();
-
         Tree tree = ( Tree ) bot.widget( widgetOfType( Tree.class ), view.getWidget() );
         return new SWTBotTree( tree );
     }
 
 
     /**
+     * Gets the search logs text.
+     * 
+     * @param bot
+     *            the bot
+     * 
+     * @return the search logs text
+     * 
+     * @throws Exception
+     *             the exception
+     */
+    public static SWTBotStyledText getSearchLogsText( SWTEclipseBot bot ) throws Exception
+    {
+        SWTBotView view = bot.view( "Search Logs" );
+        view.show();
+        view.toolbarButton( "Refresh" ).click();
+        StyledText styledText = ( StyledText ) bot.widget( widgetOfType( StyledText.class
), view.getWidget() );
+        return new SWTBotStyledText( styledText );
+    }
+
+
+    /**
+     * Gets the modification logs text.
+     * 
+     * @param bot
+     *            the bot
+     * 
+     * @return the modification logs text
+     * 
+     * @throws Exception
+     *             the exception
+     */
+    public static SWTBotStyledText getModificationLogsText( SWTEclipseBot bot ) throws Exception
+    {
+        SWTBotView view = bot.view( "Modification Logs" );
+        view.show();
+        view.toolbarButton( "Refresh" ).click();
+        StyledText styledText = ( StyledText ) bot.widget( widgetOfType( StyledText.class
), view.getWidget() );
+        return new SWTBotStyledText( styledText );
+    }
+
+
+    /**
      * Gets the entry editor tree.
      * 
      * @param bot



Mime
View raw message