geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bjr...@apache.org
Subject svn commit: r693553 - in /geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins: org.apache.geronimo.testsuite.common/src/main/java/org/apache/geronimo/testsuite/common/ui/ org.apache.geronimo.testsuite.v21/ org.apache.geronimo.testsuite.v21/src/mai...
Date Tue, 09 Sep 2008 18:42:05 GMT
Author: bjreed
Date: Tue Sep  9 11:42:04 2008
New Revision: 693553

URL: http://svn.apache.org/viewvc?rev=693553&view=rev
Log:
GERONIMODEVTOOLS-485 new Abbot testcase added. Thanks to Ashish Jain for the patch

Added:
    geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/java/org/apache/geronimo/testsuite/v21/ui/EclipseUITest.java
  (with props)
Modified:
    geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.common/src/main/java/org/apache/geronimo/testsuite/common/ui/AbbotHelper.java
    geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/java/org/apache/geronimo/testsuite/v21/ui/NewServerTest.java
    geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.v21/test.xml

Modified: geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.common/src/main/java/org/apache/geronimo/testsuite/common/ui/AbbotHelper.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.common/src/main/java/org/apache/geronimo/testsuite/common/ui/AbbotHelper.java?rev=693553&r1=693552&r2=693553&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.common/src/main/java/org/apache/geronimo/testsuite/common/ui/AbbotHelper.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.common/src/main/java/org/apache/geronimo/testsuite/common/ui/AbbotHelper.java
Tue Sep  9 11:42:04 2008
@@ -1,255 +1,315 @@
-/*
- * 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.geronimo.testsuite.common.ui;
-
-import java.util.List;
-
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Item;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.ToolItem;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.swt.widgets.Widget;
-
-import abbot.swt.finder.WidgetFinder;
-import abbot.swt.finder.WidgetFinderImpl;
-import abbot.swt.finder.generic.MultipleFoundException;
-import abbot.swt.finder.generic.NotFoundException;
-import abbot.swt.finder.matchers.TextMultiMatcher;
-import abbot.swt.finder.matchers.WidgetClassMatcher;
-import abbot.swt.finder.matchers.WidgetTextMatcher;
-import abbot.swt.tester.ButtonTester;
-import abbot.swt.tester.ComboTester;
-import abbot.swt.tester.ItemPath;
-import abbot.swt.tester.ItemTester;
-import abbot.swt.tester.MenuTester;
-import abbot.swt.tester.ShellTester;
-import abbot.swt.tester.TextTester;
-import abbot.swt.tester.ToolItemTester;
-import abbot.swt.tester.TreeItemTester;
-import abbot.swt.tester.TreeTester;
-
-/**
- * @version $Rev: 679174 $ $Date: 2008-07-23 12:52:55 -0700 (Wed, 23 Jul 2008) $
- */
-public class AbbotHelper {
-    Shell workbenchShell;
-    WidgetFinder finder;
-
-    public AbbotHelper (Shell aShell) {
-        finder = WidgetFinderImpl.getDefault();
-        workbenchShell = aShell;
-    }
-    
-    // helper method
-    public void clickButton (Shell aShell, String buttonText) throws MultipleFoundException,
NotFoundException {
-        Button button = (Button) finder.find (aShell, new WidgetTextMatcher (buttonText,
Button.class, true));
-        ButtonTester.getButtonTester().actionClick (button);        
-        waitTime( 1500 );
-    }
-
-    // helper method
-    public Shell clickButton (Shell aShell, String buttonText, String newDialogName) throws
MultipleFoundException, NotFoundException {
-        Button button = (Button) finder.find (aShell, new WidgetTextMatcher (buttonText,
Button.class));
-        ButtonTester.getButtonTester().actionClick (button);  
-        waitTime( 1500 );
-        return ShellTester.waitVisible (newDialogName);
-    }
-
-    // helper method
-    public Shell clickEnabledButton (Shell aShell, String buttonText, String newDialogName)
throws MultipleFoundException, NotFoundException {
-        Button button = (Button) finder.find (aShell, new ButtonMultiMatcher (buttonText,
Button.class, true));
-        ButtonTester.getButtonTester().actionClick (button);  
-        waitTime( 1500 );
-        return ShellTester.waitVisible (newDialogName);
-    }
-
-    // helper method
-    public void doubleClickItem (Shell aShell, String itemText) throws MultipleFoundException,
NotFoundException {
-        Item item = (Item) finder.find (aShell, new WidgetTextMatcher (itemText, Item.class,
true));
-        ItemTester.getItemTester().actionDoubleClick(item);       
-        waitTime( 1500 );
-    }
-
-    // helper method
-    public void clickItem (Shell aShell, String itemText) throws MultipleFoundException,
NotFoundException {
-        Item item = (Item) finder.find (aShell, new WidgetTextMatcher (itemText, Item.class,
true));
-        ItemTester.getItemTester().actionClick (item, 3, 3);       
-        waitTime( 1500 );
-    }
-
-    // helper method    
-    public Shell rightClickItem (Shell aShell, String itemText, String[] menuList, String
newDialogName) throws MultipleFoundException, NotFoundException {
-        Item item = (Item) finder.find (workbenchShell, new WidgetTextMatcher (itemText,
Item.class, true));
-        ItemPath anItemPath = new ItemPath (menuList);
-        ItemTester.getItemTester().actionClickMenuItem (item, anItemPath);
-        waitTime( 1500 );
-        return ShellTester.waitVisible (newDialogName);
-    }
-
-    // helper method    
-    public void rightClickItem (Shell aShell, String itemText, String[] menuList) throws
MultipleFoundException, NotFoundException {
-        Item item = (Item) finder.find (workbenchShell, new WidgetTextMatcher (itemText,
Item.class, true));
-        ItemPath anItemPath = new ItemPath (menuList);
-        ItemTester.getItemTester().actionClickMenuItem (item, anItemPath);
-        waitTime( 1500 );
-    }
-
-    // helper method    
-    public Shell clickMenuItem (Shell aShell, String[] menuList, String newDialogName) throws
MultipleFoundException, NotFoundException {
-        ItemPath anItemPath = new ItemPath (menuList);
-        Menu bar = ShellTester.getShellTester().getMenuBar (aShell);
-        MenuTester.getMenuTester().actionClickItem (bar, anItemPath);
-        waitTime( 1500 );
-        return ShellTester.waitVisible (newDialogName);
-    }
-    
-    // helper method    
-    public void clickMenuItem (Shell aShell, String[] menuList) throws MultipleFoundException,
NotFoundException {
-        ItemPath anItemPath = new ItemPath (menuList);
-        Menu bar = ShellTester.getShellTester().getMenuBar (aShell);
-        MenuTester.getMenuTester().actionClickItem (bar, anItemPath);
-        waitTime( 1500 );
-    }
-
-    // helper method
-    // find the tool item by its tool tip text
-    public void clickToolItem (Shell aShell, String toolTipText) throws MultipleFoundException,
NotFoundException {
-        ToolItem toolItem = (ToolItem) finder.find (aShell, new WidgetToolTipMatcher (toolTipText,
ToolItem.class, true));
-        ToolItemTester.getToolItemTester().actionClick (toolItem);
-        waitTime( 1500 );
-    }
-
-    // helper method
-    public void clickTreeItem (Shell aShell, String[] treeList) throws MultipleFoundException,
NotFoundException {
-        ItemPath anItemPath = new ItemPath (treeList);
-        Tree tree = (Tree) finder.find (aShell, new WidgetClassMatcher (Tree.class));
-        TreeTester.getTreeTester().actionClickItem (tree, anItemPath);
-        waitTime( 1500 );
-    }
-
-    // helper method
-    public void setCombo (Shell aShell, String newText) throws MultipleFoundException, NotFoundException
{
-        Combo combo = (Combo) finder.find (aShell, new WidgetClassMatcher (Combo.class, true));
-        ComboTester.getComboTester().actionClick(combo);
-        ComboTester.getComboTester().actionKeyString(newText);
-        waitTime( 1500 );
-    }
-    
-    // helper method
-    public void setTextField (Shell aShell, String oldText, String newText) throws MultipleFoundException,
NotFoundException {
-        Text text = (Text) finder.find (aShell, new WidgetTextMatcher (oldText, Text.class,
true));
-        if (oldText.length() > 0)
-        {
-            TextTester.getTextTester().actionSelect (text, 0, oldText.length());
-            TextTester.getTextTester().actionKeyString (newText);
-        } else {
-            TextTester.getTextTester().actionKeyString (text, newText);  
-        }
-        waitTime( 1500 );
-    }
-
-    // helper method with a leap of faith that the cursor is
-    // exactly where we want it to be.
-    public void setCursorText (String newText) {
-        TextTester.getTextTester().actionKeyString (newText);
-        waitTime( 1500 );
-    }
-    
-    // helper method
-    public void waitForDialogDisposal (Shell aShell) {
-        while (!ShellTester.getShellTester().isDisposed (aShell))
-            ShellTester.getShellTester().actionDelay (1000);
-        // wait an extra 2 seconds
-        ShellTester.getShellTester().actionDelay (2000);
-    }
-
-    // helper method
-    public void waitForServerStatus (Shell aShell, String itemText, String desiredState)
throws MultipleFoundException, NotFoundException {
-        // will wait up to 2 minutes for status to change
-        boolean statusGood = false;
-        int countdown = 120;
-
-        while (statusGood == false && countdown > 0) {
-            TreeItem item = (TreeItem) finder.find (aShell, new WidgetTextMatcher (itemText,
TreeItem.class));
-            if (desiredState.equals (TreeItemTester.getTreeItemTester().getText (item, 1)))
-                statusGood = true;
-            
-            countdown--;
-            ShellTester.getShellTester().actionDelay (1000);
-        }
-        if (statusGood == false)
-            throw new NotFoundException ("Unable to start or stop the server");
-    }
-    
-    public void waitTime (long time) {
-        ShellTester.getShellTester().actionDelay (time);
-    }
-
-    // helper inner class
-    // Since Tool Items do not have text, the regular Widget Text Matcher won't work.
-    // This is a simple matcher to do the search for the tool tip.
-    // Theoretically, as Abbot gets better, then this code will be moved into Abbot
-    // and can be removed here
-    final class WidgetToolTipMatcher extends WidgetTextMatcher {
-        public WidgetToolTipMatcher (String text, Class clazz, boolean mustBeShowing) {
-            super (text, clazz, mustBeShowing);
-        }
-
-        protected String getText(Widget widget) {
-            if (widget instanceof ToolItem)
-                return ToolItemTester.getToolItemTester().getToolTipText((ToolItem) widget);
-
-            return null;
-        }
-    }
-    
-    // helper inner class
-    final class ButtonMultiMatcher extends TextMultiMatcher {
-        public ButtonMultiMatcher(String text, Class clazz, boolean mustBeShowing) {
-            super(text, clazz, mustBeShowing);
-        }
-
-        public ButtonMultiMatcher(String text, boolean mustBeShowing) {
-            this(text, Widget.class, mustBeShowing);
-        }
-
-        public ButtonMultiMatcher(String text, Class clazz) {
-            this(text, clazz, false);
-        }
-
-        public ButtonMultiMatcher(String text) {
-            this(text, Widget.class, false);
-        }
-
-        //TODO need to check to see if more than one are enabled
-        public Widget bestMatch(List<Widget> candidates) throws MultipleFoundException
{
-            Button aButton = null;
-            for (int i = 0; i < candidates.size(); i++) {
-                aButton = (Button)candidates.get(i);
-                    if (ButtonTester.getButtonTester().getEnabled(aButton))
-                        return aButton;
-            }
-            return aButton;
-        }
-    }
-}
+/*
+ * 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.geronimo.testsuite.common.ui;
+
+import java.util.List;
+
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Item;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.ToolItem;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.swt.widgets.Widget;
+
+import abbot.swt.finder.WidgetFinder;
+import abbot.swt.finder.WidgetFinderImpl;
+import abbot.swt.finder.generic.MultipleFoundException;
+import abbot.swt.finder.generic.NotFoundException;
+import abbot.swt.finder.matchers.TextMultiMatcher;
+import abbot.swt.finder.matchers.WidgetClassMatcher;
+import abbot.swt.finder.matchers.WidgetTextMatcher;
+import abbot.swt.tester.ButtonTester;
+import abbot.swt.tester.ComboTester;
+import abbot.swt.tester.ItemPath;
+import abbot.swt.tester.ItemTester;
+import abbot.swt.tester.MenuTester;
+import abbot.swt.tester.ShellTester;
+import abbot.swt.tester.TabItemTester;
+import abbot.swt.tester.TextTester;
+import abbot.swt.tester.ToolItemTester;
+import abbot.swt.tester.TreeItemTester;
+import abbot.swt.tester.TreeTester;
+import abbot.swt.utilities.ExtendedComparator;
+
+/**
+ * @version $Rev: 679174 $ $Date: 2008-07-23 12:52:55 -0700 (Wed, 23 Jul 2008) $
+ */
+public class AbbotHelper {
+    Shell workbenchShell;
+    WidgetFinder finder;
+
+    public AbbotHelper (Shell aShell) {
+        finder = WidgetFinderImpl.getDefault();
+        workbenchShell = aShell;
+    }
+    
+    // helper method
+    public void clickButton (Shell aShell, String buttonText) throws MultipleFoundException,
NotFoundException {
+        Button button = (Button) finder.find (aShell, new WidgetTextMatcher (buttonText,
Button.class, true));
+        ButtonTester.getButtonTester().actionClick (button);        
+        waitTime( 1500 );
+    }
+
+    // helper method
+    public Shell clickButton (Shell aShell, String buttonText, String newDialogName) throws
MultipleFoundException, NotFoundException {
+        Button button = (Button) finder.find (aShell, new WidgetTextMatcher (buttonText,
Button.class));
+        ButtonTester.getButtonTester().actionClick (button);  
+        waitTime( 1500 );
+        return ShellTester.waitVisible (newDialogName);
+    }
+
+    // helper method
+    public Shell clickEnabledButton (Shell aShell, String buttonText, String newDialogName)
throws MultipleFoundException, NotFoundException {
+        Button button = (Button) finder.find (aShell, new ButtonMultiMatcher (buttonText,
Button.class, true));
+        ButtonTester.getButtonTester().actionClick (button);  
+        waitTime( 1500 );
+        return ShellTester.waitVisible (newDialogName);
+    }
+
+    // helper method
+    public void doubleClickItem (Shell aShell, String itemText) throws MultipleFoundException,
NotFoundException {
+        Item item = (Item) finder.find (aShell, new WidgetTextMatcher (itemText, Item.class,
true));
+        ItemTester.getItemTester().actionDoubleClick(item);       
+        waitTime( 1500 );
+    }
+
+    // helper method
+    public void clickItem (Shell aShell, String itemText) throws MultipleFoundException,
NotFoundException {
+        Item item = (Item) finder.find (aShell, new WidgetTextMatcher (itemText, Item.class,
true));
+        ItemTester.getItemTester().actionClick (item, 3, 3);       
+        waitTime( 1500 );
+    }
+
+    // helper method    
+    public Shell rightClickItem (Shell aShell, String itemText, String[] menuList, String
newDialogName) throws MultipleFoundException, NotFoundException {
+        Item item = (Item) finder.find (workbenchShell, new WidgetTextMatcher (itemText,
Item.class, true));
+        ItemPath anItemPath = new ItemPath (menuList);
+        ItemTester.getItemTester().actionClickMenuItem (item, anItemPath);
+        waitTime( 1500 );
+        return ShellTester.waitVisible (newDialogName);
+    }
+
+    // helper method    
+    public void rightClickItem (Shell aShell, String itemText, String[] menuList) throws
MultipleFoundException, NotFoundException {
+        Item item = (Item) finder.find (workbenchShell, new WidgetTextMatcher (itemText,
Item.class, true));
+        ItemPath anItemPath = new ItemPath (menuList);
+        ItemTester.getItemTester().actionClickMenuItem (item, anItemPath);
+        waitTime( 1500 );
+    }
+
+    // helper method    
+    public Shell clickMenuItem (Shell aShell, String[] menuList, String newDialogName) throws
MultipleFoundException, NotFoundException {
+        ItemPath anItemPath = new ItemPath (menuList);
+        Menu bar = ShellTester.getShellTester().getMenuBar (aShell);
+        MenuTester.getMenuTester().actionClickItem (bar, anItemPath);
+        waitTime( 1500 );
+        return ShellTester.waitVisible (newDialogName);
+    }
+    
+    // helper method    
+    public void clickMenuItem (Shell aShell, String[] menuList) throws MultipleFoundException,
NotFoundException {
+        ItemPath anItemPath = new ItemPath (menuList);
+        Menu bar = ShellTester.getShellTester().getMenuBar (aShell);
+        MenuTester.getMenuTester().actionClickItem (bar, anItemPath);
+        waitTime( 1500 );
+    }
+
+    // helper method
+    // find the tool item by its tool tip text
+    public void clickToolItem (Shell aShell, String toolTipText) throws MultipleFoundException,
NotFoundException {
+        ToolItem toolItem = (ToolItem) finder.find (aShell, new WidgetToolTipMatcher (toolTipText,
ToolItem.class, true));
+        ToolItemTester.getToolItemTester().actionClick (toolItem);
+        waitTime( 1500 );
+    }
+    
+    //helper method to find the button by its tool tip text
+    public Shell clickImageButton (Shell aShell, String toolTipText, String newDialogName)
throws MultipleFoundException, NotFoundException {
+        Button button = (Button) finder.find (aShell, new WidgetToolTipMatcher (toolTipText,
Button.class, true));
+        ButtonTester.getButtonTester().actionClick (button);
+        waitTime( 1500 );
+        return ShellTester.waitVisible(newDialogName);
+    }
+
+    // helper method
+    public void clickTreeItem (Shell aShell, String[] treeList) throws MultipleFoundException,
NotFoundException {
+        ItemPath anItemPath = new ItemPath (treeList);
+        Tree tree = (Tree) finder.find (aShell, new WidgetClassMatcher (Tree.class));
+        TreeTester.getTreeTester().actionClickItem (tree, anItemPath);
+        waitTime( 1500 );
+    }
+
+    //helper method to check a box present in a tree
+    public void checkTreeItem (Shell aShell, String[] treeList) throws MultipleFoundException,
NotFoundException {
+        ItemPath anItemPath = new ItemPath (treeList);
+        Tree tree = (Tree) finder.find (aShell, new WidgetClassMatcher (Tree.class));
+        TreeTester.getTreeTester().actionCheckItem(tree, anItemPath, true);
+        waitTime( 1500 );
+    }
+
+    // helper method
+    public void setCombo (Shell aShell, String newText) throws MultipleFoundException, NotFoundException
{
+        Combo combo = (Combo) finder.find (aShell, new WidgetClassMatcher (Combo.class, true));
+        ComboTester.getComboTester().actionClick(combo);
+        ComboTester.getComboTester().actionKeyString(newText);
+        waitTime( 1500 );
+    }
+    
+    //helper method to select a Tab 
+    public void selectTabItem(Shell aShell, String newText)throws MultipleFoundException,NotFoundException
+    {
+        TabItem tabitem=(TabItem) finder.find (aShell, new WidgetTabMatcher (newText, TabItem.class,
true));
+        TabItemTester.getTabItemTester().actionClick(tabitem);      
+        waitTime(1500);
+    }
+    
+    // helper method
+    public void setTextField (Shell aShell, String oldText, String newText) throws MultipleFoundException,
NotFoundException {
+        Text text = (Text) finder.find (aShell, new WidgetTextMatcher (oldText, Text.class,
true));
+        if (oldText.length() > 0)
+        {
+            TextTester.getTextTester().actionSelect (text, 0, oldText.length());
+            TextTester.getTextTester().actionKeyString (newText);
+        } else {
+            TextTester.getTextTester().actionKeyString (text, newText);  
+        }
+        waitTime( 1500 );
+    }
+
+    // helper method with a leap of faith that the cursor is
+    // exactly where we want it to be.
+    public void setCursorText (String newText) {
+        TextTester.getTextTester().actionKeyString (newText);
+        waitTime( 1500 );
+    }
+       
+    // helper method
+    public void waitForDialogDisposal (Shell aShell) {
+        while (!ShellTester.getShellTester().isDisposed (aShell))
+            ShellTester.getShellTester().actionDelay (1000);
+        // wait an extra 2 seconds
+        ShellTester.getShellTester().actionDelay (2000);
+    }
+
+    // helper method
+    public void waitForServerStatus (Shell aShell, String itemText, String desiredState)
throws MultipleFoundException, NotFoundException {
+        // will wait up to 2 minutes for status to change
+        boolean statusGood = false;
+        int countdown = 120;
+
+        while (statusGood == false && countdown > 0) {
+            TreeItem item = (TreeItem) finder.find (aShell, new WidgetTextMatcher (itemText,
TreeItem.class));
+            if (desiredState.equals (TreeItemTester.getTreeItemTester().getText (item, 1)))
+                statusGood = true;
+            
+            countdown--;
+            ShellTester.getShellTester().actionDelay (1000);
+        }
+        if (statusGood == false)
+            throw new NotFoundException ("Unable to start or stop the server");
+    }
+    
+    public void waitTime (long time) {
+        ShellTester.getShellTester().actionDelay (time);
+    }
+    
+    // TabMatcher has bugs currently with abbot. This is a inner class
+    // for tab selection. This code can be removed once abbot has
+    //our code
+    final class WidgetTabMatcher extends WidgetTextMatcher{
+        protected final String text;
+        public WidgetTabMatcher(String text, Class clazz, boolean mustBeShowing) {
+            super(text,clazz, mustBeShowing);
+            if (text == null)
+                throw new IllegalArgumentException("text is null");
+            this.text = text;
+        }
+        
+        public boolean matches(Widget widget) {      
+            // If the widget's text is scalar and it matches our text then return true.
+            String widgetText = getText(widget);
+            if (widgetText != null && ExtendedComparator.stringsMatch(text, widgetText))
+                return true;
+
+            // If the widget has an array of texts and any of them match then return true.
+            String[] widgetTextArray = getTextArray(widget);
+            if (widgetTextArray != null && widgetTextArray.length > 0) {
+                for (int i = 0; i < widgetTextArray.length; i++) {
+                    if (ExtendedComparator.stringsMatch(text, widgetTextArray[i]))
+                        return true;
+                }
+            }
+            
+            // If we got here then no match.
+            return false;
+        }
+    }
+
+    // helper inner class
+    // Since Tool Items do not have text, the regular Widget Text Matcher won't work.
+    // This is a simple matcher to do the search for the tool tip.
+    // Theoretically, as Abbot gets better, then this code will be moved into Abbot
+    // and can be removed here
+    final class WidgetToolTipMatcher extends WidgetTextMatcher {
+        public WidgetToolTipMatcher (String text, Class clazz, boolean mustBeShowing) {
+            super (text, clazz, mustBeShowing);
+        }
+
+        protected String getText(Widget widget) {
+            if (widget instanceof ToolItem)
+                return ToolItemTester.getToolItemTester().getToolTipText((ToolItem) widget);
+            if (widget instanceof Button)
+                return ButtonTester.getButtonTester().getToolTipText((Button)widget);
+            return null;
+        }
+    }
+    
+    // helper inner class
+    final class ButtonMultiMatcher extends TextMultiMatcher {
+        public ButtonMultiMatcher(String text, Class clazz, boolean mustBeShowing) {
+            super(text, clazz, mustBeShowing);
+        }
+
+        public ButtonMultiMatcher(String text, boolean mustBeShowing) {
+            this(text, Widget.class, mustBeShowing);
+        }
+
+        public ButtonMultiMatcher(String text, Class clazz) {
+            this(text, clazz, false);
+        }
+
+        public ButtonMultiMatcher(String text) {
+            this(text, Widget.class, false);
+        }
+
+        //TODO need to check to see if more than one are enabled
+        public Widget bestMatch(List<Widget> candidates) throws MultipleFoundException
{
+            Button aButton = null;
+            for (int i = 0; i < candidates.size(); i++) {
+                aButton = (Button)candidates.get(i);
+                    if (ButtonTester.getButtonTester().getEnabled(aButton))
+                        return aButton;
+            }
+            return aButton;
+        }
+    }
+}

Added: geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/java/org/apache/geronimo/testsuite/v21/ui/EclipseUITest.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/java/org/apache/geronimo/testsuite/v21/ui/EclipseUITest.java?rev=693553&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/java/org/apache/geronimo/testsuite/v21/ui/EclipseUITest.java
(added)
+++ geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/java/org/apache/geronimo/testsuite/v21/ui/EclipseUITest.java
Tue Sep  9 11:42:04 2008
@@ -0,0 +1,83 @@
+/*
+ * 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.geronimo.testsuite.v21.ui;
+
+import org.apache.geronimo.testsuite.common.ui.AbbotHelper;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.widgets.Shell;
+
+import abbot.swt.eclipse.junit.extensions.WorkbenchTestCase;
+import abbot.swt.eclipse.utils.Preferences;
+import abbot.swt.eclipse.utils.WorkbenchUtilities;
+import abbot.swt.eclipse.utils.Preferences.Mode;
+
+/*
+ * @version $Rev$ $Date$ 
+ */
+public class EclipseUITest extends WorkbenchTestCase {
+    Shell aShell;
+    AbbotHelper aHelper;
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        Preferences.setPerspectiveSwitchPrompt(Mode.Always);
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    public void testEclipseUI()
+    {
+        try {
+            // About Eclipse Test Case. There are three Shell newShell, nextShell and nextNextShell

+            //used because we need to save the states for newShell and nextShell
+            //newShell->nextShell->nextNextShell this is the order in which shell comes
up
+            aShell = WorkbenchUtilities.getWorkbenchWindow().getShell();
+            aHelper = new AbbotHelper(aShell);
+            Shell newShell = aHelper.clickMenuItem(aShell, new String[]{"&Help","&About
Eclipse Platform"},"About Eclipse Platform");
+            Shell nextShell = aHelper.clickImageButton(newShell, "Apache.org - Geronimo v21
Server Tools Core Plug-in","About Eclipse Platform Features");
+            Shell nextNextShell = aHelper.clickButton(nextShell, "&Plug-in Details",
"Feature Plug-ins");
+            aHelper.clickButton(nextNextShell, IDialogConstants.OK_LABEL);
+            nextNextShell = aHelper.clickButton(nextShell, "&Columns...","Configure Columns");
+            aHelper.clickButton(nextNextShell, IDialogConstants.OK_LABEL);
+            aHelper.clickButton(nextShell, IDialogConstants.OK_LABEL);
+            aHelper.clickButton(newShell, IDialogConstants.OK_LABEL);
+
+            // Install GEP from Staging Site Test Case
+    
+            /*newShell=aHelper.clickMenuItem(aShell, new String[]{"&Help","&Software
Updates..."},"Software Updates and Add-ons");
+            aHelper.selectTabItem(newShell,"A&vailable Software");
+            nextShell=aHelper.clickButton(newShell, "&Add Site...", "Add Site");
+            aHelper.setTextField(nextShell, "http://", "http://apache.org/dist/geronimo/eclipse/updates/");
+            aHelper.clickButton(nextShell,"OK");
+            aHelper.waitTime(25000);
+            aHelper.clickTreeItem(newShell, new String[] {"http://apache.org/dist/geronimo/eclipse/updates/"});
+            aHelper.waitTime(10000);
+            aHelper.checkTreeItem(newShell, new String[] {"http://apache.org/dist/geronimo/eclipse/updates/",
"Geronimo WTP Server Adapters", "Geronimo v2.1 Server Adapter"});
+            aHelper.clickButton(newShell, "&Install...");
+            aHelper.waitTime(30000);
+            //aHelper.waitForDialogDisposal(nextShell);
+            aHelper.clickButton(newShell, "&Next");
+            //aHelper.clickItem(newShell, "Geronimo v2.1 Server Adapter");*/
+        }
+        catch(Exception e)
+        {
+            e.printStackTrace();
+        }
+    }
+}

Propchange: geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/java/org/apache/geronimo/testsuite/v21/ui/EclipseUITest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/java/org/apache/geronimo/testsuite/v21/ui/EclipseUITest.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/java/org/apache/geronimo/testsuite/v21/ui/EclipseUITest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/java/org/apache/geronimo/testsuite/v21/ui/NewServerTest.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/java/org/apache/geronimo/testsuite/v21/ui/NewServerTest.java?rev=693553&r1=693552&r2=693553&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/java/org/apache/geronimo/testsuite/v21/ui/NewServerTest.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/java/org/apache/geronimo/testsuite/v21/ui/NewServerTest.java
Tue Sep  9 11:42:04 2008
@@ -18,12 +18,10 @@
 package org.apache.geronimo.testsuite.v21.ui;
 
 import org.apache.geronimo.testsuite.common.selenium.EclipseSelenium;
-import org.apache.geronimo.testsuite.common.selenium.EclipseSeleniumServer;
 import org.apache.geronimo.testsuite.common.ui.AbbotHelper;
 import org.apache.geronimo.testsuite.common.ui.Constants;
 import org.apache.geronimo.testsuite.common.ui.ServerTasks;
 import org.apache.geronimo.testsuite.common.ui.WorkbenchTasks;
-import org.eclipse.core.runtime.SafeRunner;
 import org.eclipse.swt.widgets.Shell;
 
 import abbot.swt.eclipse.junit.extensions.WorkbenchTestCase;

Modified: geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.v21/test.xml
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.v21/test.xml?rev=693553&r1=693552&r2=693553&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.v21/test.xml
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.v21/test.xml
Tue Sep  9 11:42:04 2008
@@ -58,6 +58,20 @@
         <echo message="##                                                    " />
         <echo message="######################################################" />
 
+        <!--
+         #########################################################################
+         ##                                                                     ##
+         ## Check UI Installation testcase                                      ##
+         ##                                                                     ##
+         #########################################################################
+         -->
+        <ant target="ui-test" antfile="${library-file}" dir="${eclipse-home}">
+        <property name="data-dir" value="${jdt-folder}"/>
+        <property name="plugin-name" value="${plugin-name}"/>
+        <property name="classname"
+                  value="org.apache.geronimo.testsuite.v21.ui.EclipseUITest"/>
+        </ant>
+
         <!-- 
          #########################################################################
          ##                                                                     ##
@@ -101,7 +115,7 @@
                       value="org.apache.geronimo.testsuite.v21.ui.Tutorial5MinuteTest"/>
         </ant>
     </target>
-	
+
     <!-- This target holds code to cleanup the testing environment after -->
     <!-- after all of the tests have been run. You can use this target to -->
     <!-- delete temporary files that have been created. -->



Mime
View raw message