geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcco...@apache.org
Subject svn commit: r682000 - 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.v20/src/main/java/org/apache/geronimo/testsuit...
Date Sat, 02 Aug 2008 15:51:58 GMT
Author: mcconne
Date: Sat Aug  2 08:51:58 2008
New Revision: 682000

URL: http://svn.apache.org/viewvc?rev=682000&view=rev
Log:
GERONIMODEVTOOLS-444 Patch to open internal web browser for 5 Minute Tutorial testsuite --
Thanks to BJ Reed for this patch !!

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.common/src/main/java/org/apache/geronimo/testsuite/common/ui/ServerTasks.java
    geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.common/src/main/java/org/apache/geronimo/testsuite/common/ui/Tutorial5Minute.java
    geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.v20/src/main/java/org/apache/geronimo/testsuite/v20/ui/Tutorial5MinuteTest.java
    geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/java/org/apache/geronimo/testsuite/v21/ui/Tutorial5MinuteTest.java

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=682000&r1=681999&r2=682000&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
Sat Aug  2 08:51:58 2008
@@ -20,10 +20,12 @@
 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;
@@ -36,11 +38,13 @@
 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;
 
@@ -119,7 +123,7 @@
         return ShellTester.waitVisible (newDialogName);
     }
     
- // helper method    
+    // helper method    
     public void clickMenuItem (Shell aShell, String[] menuList) throws MultipleFoundException,
NotFoundException {
         ItemPath anItemPath = new ItemPath (menuList);
         Menu bar = ShellTester.getShellTester().getMenuBar (aShell);
@@ -128,6 +132,14 @@
     }
 
     // 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));
@@ -136,6 +148,14 @@
     }
 
     // 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)
@@ -185,6 +205,25 @@
         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);

Modified: geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.common/src/main/java/org/apache/geronimo/testsuite/common/ui/ServerTasks.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/ServerTasks.java?rev=682000&r1=681999&r2=682000&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.common/src/main/java/org/apache/geronimo/testsuite/common/ui/ServerTasks.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.common/src/main/java/org/apache/geronimo/testsuite/common/ui/ServerTasks.java
Sat Aug  2 08:51:58 2008
@@ -77,6 +77,9 @@
     
     public void stopServer () throws MultipleFoundException, NotFoundException {
     	String serverDisplay = Constants.getConstant(serverVersion, Constants.SERVERDISPLAY);
+        aHelper.clickMenuItem (workbenchShell,
+                new String[] {"&Window", "Show &View", "Servers"});
+
         aHelper.rightClickItem (workbenchShell, serverDisplay,
                 new String[] {"S&top"});
         aHelper.waitForServerStatus (workbenchShell, serverDisplay, "Stopped");
@@ -100,6 +103,19 @@
         aHelper.clickButton (preferenceShell, IDialogConstants.OK_LABEL);
     }
 
+    public void publishAllProjects () throws MultipleFoundException, NotFoundException {
+        String serverDisplay = Constants.getConstant(serverVersion, Constants.SERVERDISPLAY);
+        
+        aHelper.clickMenuItem (workbenchShell,
+                new String[] {"&Window", "Show &View", "Servers"});
+        Shell deployShell = aHelper.rightClickItem (workbenchShell, serverDisplay,
+                 new String[] {"Add and Remove &Projects..."}, "Add and Remove Projects");
+        aHelper.clickButton (deployShell, "Add A&ll >>");
+        
+        aHelper.clickButton (deployShell, IDialogConstants.FINISH_LABEL);
+        aHelper.waitForDialogDisposal (deployShell);
+    }
+
     private String getServerInstallDirectory() {
         IWorkspace ws = ResourcesPlugin.getWorkspace();
         String location = ws.getRoot().getLocation().toOSString();

Modified: geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.common/src/main/java/org/apache/geronimo/testsuite/common/ui/Tutorial5Minute.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/Tutorial5Minute.java?rev=682000&r1=681999&r2=682000&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.common/src/main/java/org/apache/geronimo/testsuite/common/ui/Tutorial5Minute.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.common/src/main/java/org/apache/geronimo/testsuite/common/ui/Tutorial5Minute.java
Sat Aug  2 08:51:58 2008
@@ -160,5 +160,29 @@
         // copy over the correct contents
         aFile = aProject.getFile("src/sampleear/MyServlet.java");
         aFile.setContents(new FileInputStream (fileDir + "/MyServlet.java"), true, true,
null);
+
+        // close the open file
+        aHelper.clickMenuItem (workbenchShell,
+                new String[] {"&File", "&Close"});
+    }
+
+    public void webTesting () throws MultipleFoundException, NotFoundException {
+        aHelper.clickMenuItem (workbenchShell,
+                new String[] {"&Window", "Web Browser", "&0 Internal Web Browser"});
+        Shell openShell = aHelper.clickMenuItem (workbenchShell,
+                new String[] {"&Window", "Show &View", "&Other..."}, "Show View");
+        aHelper.clickTreeItem (openShell, 
+                new String[] {"General", "Internal Web Browser"});
+        aHelper.clickButton (openShell, IDialogConstants.OK_LABEL);
+
+        aHelper.setCombo (workbenchShell, "http://localhost:8080/SampleWAR/");
+        aHelper.clickToolItem (workbenchShell, "Go to the selected URL");
+        aHelper.waitTime (15000);
+
+        // TODO fill in a name and click the Process button
+        // This is a problem, HTML objects are not the same as SWT objects and 
+        // Abbot cannot find these
+        //aHelper.setTextField(workbenchShell, "", "MyName");
+        //aHelper.clickButton (workbenchShell, "Press me!");
     }
 }

Modified: geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.v20/src/main/java/org/apache/geronimo/testsuite/v20/ui/Tutorial5MinuteTest.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.v20/src/main/java/org/apache/geronimo/testsuite/v20/ui/Tutorial5MinuteTest.java?rev=682000&r1=681999&r2=682000&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.v20/src/main/java/org/apache/geronimo/testsuite/v20/ui/Tutorial5MinuteTest.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.v20/src/main/java/org/apache/geronimo/testsuite/v20/ui/Tutorial5MinuteTest.java
Sat Aug  2 08:51:58 2008
@@ -57,9 +57,6 @@
             workbenchShell = WorkbenchUtilities.getWorkbenchWindow().getShell();
             aHelper = new AbbotHelper (workbenchShell);
             
-            workbenchShell = WorkbenchUtilities.getWorkbenchWindow().getShell();
-            aHelper = new AbbotHelper (workbenchShell);
-            
             ServerTasks serverTasks = new ServerTasks(workbenchShell, aHelper, Constants.SERVER_V20
);
             WorkbenchTasks workbenchTasks = new WorkbenchTasks(workbenchShell, aHelper);
             ProjectTasks projectTasks = new ProjectTasks(workbenchShell, aHelper, Constants.SERVER_V20
);
@@ -70,9 +67,14 @@
             // create server from an installed instance
             serverTasks.createServer();
 
-            serverTasks.startServer();
             Tutorial5Minute tutorial = new Tutorial5Minute (workbenchShell, aHelper);
             tutorial.createProjects ();
+
+            serverTasks.publishAllProjects();
+            serverTasks.startServer();
+
+            tutorial.webTesting();
+
             serverTasks.stopServer();
 
             // delete the projects that have been created

Modified: geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/java/org/apache/geronimo/testsuite/v21/ui/Tutorial5MinuteTest.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/Tutorial5MinuteTest.java?rev=682000&r1=681999&r2=682000&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/java/org/apache/geronimo/testsuite/v21/ui/Tutorial5MinuteTest.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/java/org/apache/geronimo/testsuite/v21/ui/Tutorial5MinuteTest.java
Sat Aug  2 08:51:58 2008
@@ -64,9 +64,6 @@
             workbenchShell = WorkbenchUtilities.getWorkbenchWindow().getShell();
             aHelper = new AbbotHelper (workbenchShell);
             
-            workbenchShell = WorkbenchUtilities.getWorkbenchWindow().getShell();
-            aHelper = new AbbotHelper (workbenchShell);
-            
             ServerTasks serverTasks = new ServerTasks(workbenchShell, aHelper, Constants.SERVER_V21
);
             WorkbenchTasks workbenchTasks = new WorkbenchTasks(workbenchShell, aHelper);
             ProjectTasks projectTasks = new ProjectTasks(workbenchShell, aHelper, Constants.SERVER_V21
);
@@ -77,9 +74,14 @@
             // create server from an installed instance
             serverTasks.createServer();
 
-            serverTasks.startServer();
             Tutorial5Minute tutorial = new Tutorial5Minute (workbenchShell, aHelper);
             tutorial.createProjects ();
+
+            serverTasks.publishAllProjects();
+            serverTasks.startServer();
+
+            tutorial.webTesting();
+
             serverTasks.stopServer();
 
             // delete the projects that have been created



Mime
View raw message