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 2009/10/27 22:20:37 UTC
svn commit: r830344 - in
/directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui:
BrowserTest.java SWTBotUtils.java bots/ModificationLogsViewBot.java
bots/SearchLogsViewBot.java bots/StudioBot.java
Author: seelmann
Date: Tue Oct 27 21:20:35 2009
New Revision: 830344
URL: http://svn.apache.org/viewvc?rev=830344&view=rev
Log:
Refactoring
Added:
directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ModificationLogsViewBot.java
directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/SearchLogsViewBot.java
Modified:
directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/BrowserTest.java
directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/SWTBotUtils.java
directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/StudioBot.java
Modified: 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=830344&r1=830343&r2=830344&view=diff
==============================================================================
--- directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/BrowserTest.java (original)
+++ directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/BrowserTest.java Tue Oct 27 21:20:35 2009
@@ -42,9 +42,8 @@
import org.apache.directory.studio.test.integration.ui.bots.ConnectionsViewBot;
import org.apache.directory.studio.test.integration.ui.bots.DeleteDialogBot;
import org.apache.directory.studio.test.integration.ui.bots.EntryEditorBot;
+import org.apache.directory.studio.test.integration.ui.bots.SearchLogsViewBot;
import org.apache.directory.studio.test.integration.ui.bots.StudioBot;
-import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotStyledText;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -68,11 +67,10 @@
private StudioBot studioBot;
private ConnectionsViewBot connectionsViewBot;
private BrowserViewBot browserViewBot;
+ private SearchLogsViewBot searchLogsViewBot;
private Connection connection;
- private SWTWorkbenchBot eBot;
-
@Before
public void setUp() throws Exception
@@ -82,8 +80,7 @@
connectionsViewBot = studioBot.getConnectionView();
connection = connectionsViewBot.createTestConnection( "BrowserTest", ldapServer.getPort() );
browserViewBot = studioBot.getBrowserView();
-
- eBot = new SWTWorkbenchBot();
+ searchLogsViewBot = studioBot.getSearchLogsViewBot();
}
@@ -91,7 +88,6 @@
public void tearDown() throws Exception
{
connectionsViewBot.deleteTestConnections();
- eBot = null;
}
@@ -109,8 +105,7 @@
browserViewBot.selectEntry( "DIT", "Root DSE", "ou=system" );
// get number of search requests before expanding the entry
- SWTBotStyledText searchLogsText = SWTBotUtils.getSearchLogsText( eBot );
- String text = searchLogsText.getText();
+ String text = searchLogsViewBot.getSearchLogsText();
int countMatchesBefore = StringUtils.countMatches( text, "#!SEARCH REQUEST" );
// expand
@@ -118,8 +113,7 @@
browserViewBot.waitForEntry( "DIT", "Root DSE", "ou=system", "ou=users" );
// get number of search requests after expanding the entry
- searchLogsText = SWTBotUtils.getSearchLogsText( eBot );
- text = searchLogsText.getText();
+ text = searchLogsViewBot.getSearchLogsText();
int countMatchesAfter = StringUtils.countMatches( text, "#!SEARCH REQUEST" );
assertEquals( "Expected exactly 1 search request", 1, countMatchesAfter - countMatchesBefore );
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=830344&r1=830343&r2=830344&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 Tue Oct 27 21:20:35 2009
@@ -21,17 +21,12 @@
package org.apache.directory.studio.test.integration.ui;
-import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.allOf;
import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.widgetOfType;
-import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.withStyle;
-import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.withTooltip;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
@@ -42,12 +37,9 @@
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.SWTBotToolbarButton;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.eclipse.swtbot.swt.finder.widgets.TimeoutException;
-import org.hamcrest.Matcher;
/**
@@ -59,7 +51,6 @@
public class SWTBotUtils
{
-
/**
* Gets the connections tree.
*
@@ -102,56 +93,6 @@
/**
- * Gets the search logs text.
- *
- * @param bot
- * the bot
- *
- * @return the search logs text
- *
- * @throws Exception
- * the exception
- */
- public static SWTBotStyledText getSearchLogsText( SWTWorkbenchBot bot ) throws Exception
- {
- SWTBotView view = bot.viewByTitle( "Search Logs" );
- view.show();
- //view.toolbarButton( "Refresh" ).click();
- // just a workaround till view.toolbarButton() is fixed
- Matcher matcher = allOf( widgetOfType( ToolItem.class ), withTooltip( "Refresh" ), withStyle( SWT.PUSH,
- "SWT.PUSH" ) );
- SWTBotToolbarButton button = new SWTBotToolbarButton( ( ToolItem ) bot.widget( matcher, 0 ), matcher );
- button.click();
- return view.bot().styledText();
- }
-
-
- /**
- * Gets the modification logs text.
- *
- * @param bot
- * the bot
- *
- * @return the modification logs text
- *
- * @throws Exception
- * the exception
- */
- public static SWTBotStyledText getModificationLogsText( SWTWorkbenchBot bot ) throws Exception
- {
- SWTBotView view = bot.viewByTitle( "Modification Logs" );
- view.show();
- // view.toolbarButton( "Refresh" ).click();
- // just a workaround till view.toolbarButton() is fixed
- Matcher matcher = allOf( widgetOfType( ToolItem.class ), withTooltip( "Refresh" ), withStyle( SWT.PUSH,
- "SWT.PUSH" ) );
- SWTBotToolbarButton button = new SWTBotToolbarButton( ( ToolItem ) bot.widget( matcher, 0 ), matcher );
- button.click();
- return view.bot().styledText();
- }
-
-
- /**
* Gets the entry editor tree.
*
* @param bot
Added: directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ModificationLogsViewBot.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ModificationLogsViewBot.java?rev=830344&view=auto
==============================================================================
--- directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ModificationLogsViewBot.java (added)
+++ directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/ModificationLogsViewBot.java Tue Oct 27 21:20:35 2009
@@ -0,0 +1,63 @@
+/*
+ * 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.bots;
+
+
+import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.allOf;
+import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.widgetOfType;
+import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.withStyle;
+import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.withTooltip;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.ToolItem;
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton;
+import org.hamcrest.Matcher;
+
+
+public class ModificationLogsViewBot
+{
+
+ private SWTBotView view;
+
+
+ public ModificationLogsViewBot()
+ {
+ view = new SWTWorkbenchBot().viewByTitle( "Modification Logs" );
+ }
+
+
+ public String getSearchLogsText()
+ {
+ view.show();
+
+ //view.toolbarButton( "Refresh" ).click();
+ // just a workaround till view.toolbarButton() is fixed
+ Matcher matcher = allOf( widgetOfType( ToolItem.class ), withTooltip( "Refresh" ), withStyle( SWT.PUSH,
+ "SWT.PUSH" ) );
+ SWTBotToolbarButton button = new SWTBotToolbarButton( ( ToolItem ) new SWTWorkbenchBot().widget( matcher, 0 ),
+ matcher );
+ button.click();
+
+ return view.bot().styledText().getText();
+ }
+
+}
Added: directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/SearchLogsViewBot.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/SearchLogsViewBot.java?rev=830344&view=auto
==============================================================================
--- directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/SearchLogsViewBot.java (added)
+++ directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/SearchLogsViewBot.java Tue Oct 27 21:20:35 2009
@@ -0,0 +1,61 @@
+/*
+ * 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.bots;
+
+
+import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.allOf;
+import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.widgetOfType;
+import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.withStyle;
+import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.withTooltip;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.ToolItem;
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton;
+import org.hamcrest.Matcher;
+
+
+public class SearchLogsViewBot
+{
+
+ private SWTBotView view;
+
+
+ public SearchLogsViewBot()
+ {
+ view = new SWTWorkbenchBot().viewByTitle( "Search Logs" );
+ }
+
+
+ public String getSearchLogsText()
+ {
+ view.show();
+
+ //view.toolbarButton( "Refresh" ).click();
+ // just a workaround till view.toolbarButton() is fixed
+ Matcher matcher = allOf( widgetOfType( ToolItem.class ), withTooltip( "Refresh" ), withStyle( SWT.PUSH,
+ "SWT.PUSH" ) );
+ SWTBotToolbarButton button = new SWTBotToolbarButton( ( ToolItem ) new SWTWorkbenchBot().widget( matcher, 0 ), matcher );
+ button.click();
+
+ return view.bot().styledText().getText();
+ }
+}
Modified: directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/StudioBot.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/StudioBot.java?rev=830344&r1=830343&r2=830344&view=diff
==============================================================================
--- directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/StudioBot.java (original)
+++ directory/studio/trunk/test-integration-ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/StudioBot.java Tue Oct 27 21:20:35 2009
@@ -46,6 +46,18 @@
}
+ public SearchLogsViewBot getSearchLogsViewBot()
+ {
+ return new SearchLogsViewBot();
+ }
+
+
+ public ModificationLogsViewBot getModificationLogsViewBot()
+ {
+ return new ModificationLogsViewBot();
+ }
+
+
public EntryEditorBot getEntryEditorBot( String title )
{
return new EntryEditorBot( title );