Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 16480 invoked from network); 27 Feb 2009 14:55:48 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 27 Feb 2009 14:55:48 -0000 Received: (qmail 9624 invoked by uid 500); 27 Feb 2009 14:55:48 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 9591 invoked by uid 500); 27 Feb 2009 14:55:47 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 9582 invoked by uid 99); 27 Feb 2009 14:55:47 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 Feb 2009 06:55:47 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 Feb 2009 14:55:47 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 0B0E723888F4; Fri, 27 Feb 2009 14:55:27 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@directory.apache.org From: seelmann@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090227145527.0B0E723888F4@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 Apache Directory Project + * @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