geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcco...@apache.org
Subject svn commit: r681934 - 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 03:32:21 GMT
Author: mcconne
Date: Fri Aug  1 20:32:20 2008
New Revision: 681934

URL: http://svn.apache.org/viewvc?rev=681934&view=rev
Log:
GERONIMODEVTOOLS-444 Patch to open web browser inside Eclipse. 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=681934&r1=681933&r2=681934&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 Fri Aug  1 20:32:20 2008
@@ -1,216 +1,255 @@
-/*
- * 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.Item;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-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.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.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
-    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 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);
-    }
-
-    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.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 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
+    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 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;
+        }
+    }
+}

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=681934&r1=681933&r2=681934&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 Fri Aug  1 20:32:20 2008
@@ -1,121 +1,137 @@
-/*
- * 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.io.File;
-
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.swt.widgets.Shell;
-
-import abbot.swt.finder.generic.MultipleFoundException;
-import abbot.swt.finder.generic.NotFoundException;
-
-public class ServerTasks {
-    Shell workbenchShell;
-    AbbotHelper aHelper;
-    String serverVersion;
-
-    public ServerTasks (Shell shell, AbbotHelper helper, String serverVersion) {
-        workbenchShell = shell;
-        aHelper = helper;
-        this.serverVersion = serverVersion;
-    }
-    
-    // just getting through this with no exceptions is success.
-    public void createServer() throws MultipleFoundException, NotFoundException {
-        // Launch the New Project wizard and aHelper.wait for it to open.
-        Shell wizardShell = aHelper.clickMenuItem (workbenchShell,
-                new String[] {"&File", "&New\tAlt+Shift+N", "&Other..."},
-                "New");
-
-        // Having 2 tree items with the same name is not very good design
-        aHelper.clickTreeItem (wizardShell, 
-                new String[] {"Server", "Server"});
-        aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
-
-        // Select the proper Server. why do we have this in there twice?
-        aHelper.clickItem (wizardShell, Constants.getConstant(serverVersion, Constants.SERVERNAME));
-        aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
-
-        //TODO would be nice to install the server instead of have to know where it is in advance
-        aHelper.setTextField (wizardShell, "", getServerInstallDirectory());
-
-        aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
-        aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
-        aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
-        aHelper.clickButton (wizardShell, IDialogConstants.FINISH_LABEL);
-    }
-
-    public void startServer () 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[] {"&Start"});
-        aHelper.waitForServerStatus (workbenchShell, serverDisplay, "Started");
-        
-        aHelper.waitTime( 1500 );
-    }
-    
-    public void stopServer () throws MultipleFoundException, NotFoundException {
-    	String serverDisplay = Constants.getConstant(serverVersion, Constants.SERVERDISPLAY);
-        aHelper.rightClickItem (workbenchShell, serverDisplay,
-                new String[] {"S&top"});
-        aHelper.waitForServerStatus (workbenchShell, serverDisplay, "Stopped");
-        
-        aHelper.waitTime( 1500 );
-    }
-
-    
-    // remove the server so that the test will be reset back to its original state.
-    public void removeServer () throws MultipleFoundException, NotFoundException {
-        Shell preferenceShell = aHelper.clickMenuItem (workbenchShell,
-                new String[] {"&Window", "&Preferences"},
-                "Preferences");
-
-        aHelper.clickTreeItem (preferenceShell,
-                new String[] {"Server", "Runtime Environments"});
-        aHelper.clickItem (preferenceShell, Constants.getConstant(serverVersion, Constants.SERVERRUNTIME));
-        Shell questionShell = aHelper.clickButton (preferenceShell, "&Remove", "Server");
-        
-        aHelper.clickButton (questionShell, IDialogConstants.OK_LABEL);
-        aHelper.clickButton (preferenceShell, IDialogConstants.OK_LABEL);
-    }
-
-    private String getServerInstallDirectory() {
-        IWorkspace ws = ResourcesPlugin.getWorkspace();
-        String location = ws.getRoot().getLocation().toOSString();
-        int index = location.lastIndexOf(File.separatorChar);
-        if (index > -1) {
-            location = location.substring(0,index);
-        }
-        index = location.lastIndexOf(File.separatorChar);
-        if (index > -1) {
-            location = location.substring(0,index);
-        }
-        index = location.lastIndexOf(File.separatorChar);
-        if (index > -1) {
-            location = location.substring(0,index);
-        }
-        location = location + File.separatorChar + Constants.getConstant(serverVersion, Constants.SERVERPATH); ;
-        return location;
-    }  
-}
+/*
+ * 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.io.File;
+
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.widgets.Shell;
+
+import abbot.swt.finder.generic.MultipleFoundException;
+import abbot.swt.finder.generic.NotFoundException;
+
+public class ServerTasks {
+    Shell workbenchShell;
+    AbbotHelper aHelper;
+    String serverVersion;
+
+    public ServerTasks (Shell shell, AbbotHelper helper, String serverVersion) {
+        workbenchShell = shell;
+        aHelper = helper;
+        this.serverVersion = serverVersion;
+    }
+    
+    // just getting through this with no exceptions is success.
+    public void createServer() throws MultipleFoundException, NotFoundException {
+        // Launch the New Project wizard and aHelper.wait for it to open.
+        Shell wizardShell = aHelper.clickMenuItem (workbenchShell,
+                new String[] {"&File", "&New\tAlt+Shift+N", "&Other..."},
+                "New");
+
+        // Having 2 tree items with the same name is not very good design
+        aHelper.clickTreeItem (wizardShell, 
+                new String[] {"Server", "Server"});
+        aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+
+        // Select the proper Server. why do we have this in there twice?
+        aHelper.clickItem (wizardShell, Constants.getConstant(serverVersion, Constants.SERVERNAME));
+        aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+
+        //TODO would be nice to install the server instead of have to know where it is in advance
+        aHelper.setTextField (wizardShell, "", getServerInstallDirectory());
+
+        aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+        aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+        aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+        aHelper.clickButton (wizardShell, IDialogConstants.FINISH_LABEL);
+    }
+
+    public void startServer () 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[] {"&Start"});
+        aHelper.waitForServerStatus (workbenchShell, serverDisplay, "Started");
+        
+        aHelper.waitTime( 1500 );
+    }
+    
+    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");
+        
+        aHelper.waitTime( 1500 );
+    }
+
+    
+    // remove the server so that the test will be reset back to its original state.
+    public void removeServer () throws MultipleFoundException, NotFoundException {
+        Shell preferenceShell = aHelper.clickMenuItem (workbenchShell,
+                new String[] {"&Window", "&Preferences"},
+                "Preferences");
+
+        aHelper.clickTreeItem (preferenceShell,
+                new String[] {"Server", "Runtime Environments"});
+        aHelper.clickItem (preferenceShell, Constants.getConstant(serverVersion, Constants.SERVERRUNTIME));
+        Shell questionShell = aHelper.clickButton (preferenceShell, "&Remove", "Server");
+        
+        aHelper.clickButton (questionShell, IDialogConstants.OK_LABEL);
+        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();
+        int index = location.lastIndexOf(File.separatorChar);
+        if (index > -1) {
+            location = location.substring(0,index);
+        }
+        index = location.lastIndexOf(File.separatorChar);
+        if (index > -1) {
+            location = location.substring(0,index);
+        }
+        index = location.lastIndexOf(File.separatorChar);
+        if (index > -1) {
+            location = location.substring(0,index);
+        }
+        location = location + File.separatorChar + Constants.getConstant(serverVersion, Constants.SERVERPATH); ;
+        return location;
+    }  
+}

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=681934&r1=681933&r2=681934&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 Fri Aug  1 20:32:20 2008
@@ -1,164 +1,188 @@
-/*
- * 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.io.FileInputStream;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.swt.widgets.Shell;
-
-import abbot.swt.finder.generic.MultipleFoundException;
-import abbot.swt.finder.generic.NotFoundException;
-
-/**
- * Tutorial5Minute
- *
- * @version $Rev: 679174 $ $Date: 2008-07-23 12:52:55 -0700 (Wed, 23 Jul 2008) $
- */
-public class Tutorial5Minute {
-
-    Shell workbenchShell;
-    AbbotHelper aHelper;
-
-    public Tutorial5Minute (Shell shell, AbbotHelper helper) {
-        workbenchShell = shell;
-        aHelper = helper;
-    }
-
-    public void createProjects() throws Exception {
-        createEARProject ();
-        createEJBProject ();
-        createWARProject ();
-        copyCode ();
-    }
-
-    private void createEARProject() throws MultipleFoundException, NotFoundException {
-        Shell wizardShell = aHelper.clickMenuItem (workbenchShell,
-                new String[] {"&File", "&New\tAlt+Shift+N", "&Other..."},
-                "New");
-
-        aHelper.clickTreeItem (wizardShell,
-                new String[] {"Java EE", "Enterprise Application Project"});
-        aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
-        aHelper.setTextField(wizardShell, "", "SampleEAR");
-        aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
-        aHelper.clickButton (wizardShell, "Generate Deployment Descriptor");
-        aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
-        aHelper.setTextField(wizardShell, "default", "sampleear");
-        aHelper.setTextField(wizardShell, "", "sample-ear");
-        aHelper.setTextField(wizardShell, "car", "ear");
-        aHelper.clickButton (wizardShell, IDialogConstants.FINISH_LABEL);
-
-        aHelper.waitForDialogDisposal (wizardShell);
-    }
-
-    private void createEJBProject() throws MultipleFoundException, NotFoundException {
-        Shell wizardShell = aHelper.clickMenuItem (workbenchShell,
-                new String[] {"&File", "&New\tAlt+Shift+N", "&Other..."},
-                "New");
-
-        aHelper.clickTreeItem (wizardShell,
-                new String[] {"EJB", "EJB Project"});
-        aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
-        aHelper.setTextField(wizardShell, "", "SampleEJB");
-        aHelper.clickButton (wizardShell, "Add project to an EAR");
-        aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
-        aHelper.clickButton (wizardShell, "Create an EJB Client JAR module to hold the client interfaces and classes.");
-        aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
-        aHelper.setTextField(wizardShell, "default", "sampleear");
-        aHelper.setTextField(wizardShell, "", "sample-ejb");
-        aHelper.setTextField(wizardShell, "car", "ejb");
-        aHelper.clickButton (wizardShell, IDialogConstants.FINISH_LABEL);
-        
-        aHelper.waitForDialogDisposal (wizardShell);
-        
-        aHelper.doubleClickItem(workbenchShell, "ejbModule");
-        aHelper.doubleClickItem(workbenchShell, "META-INF");
-        Shell questionShell = aHelper.rightClickItem(workbenchShell, "openejb-jar.xml",
-                new String[] {"&Delete"}, "Delete Resources");
-        aHelper.clickButton (questionShell, IDialogConstants.OK_LABEL);
-        aHelper.waitForDialogDisposal (questionShell);
-    }
-
-    private void createWARProject() throws MultipleFoundException, NotFoundException {
-        Shell wizardShell = aHelper.clickMenuItem (workbenchShell,
-                new String[] {"&File", "&New\tAlt+Shift+N", "&Other..."},
-                "New");
-
-        aHelper.clickTreeItem (wizardShell,
-                new String[] {"Web", "Dynamic Web Project"});
-        aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
-        aHelper.setTextField(wizardShell, "", "SampleWAR");
-        aHelper.clickButton (wizardShell, "Add project to an EAR");
-        aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
-        aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
-        aHelper.setTextField(wizardShell, "default", "sampleear");
-        aHelper.setTextField(wizardShell, "", "sample-war");
-        aHelper.setTextField(wizardShell, "car", "war");
-        aHelper.clickButton (wizardShell, IDialogConstants.FINISH_LABEL);
-        
-        aHelper.waitForDialogDisposal (wizardShell);
-    }
-    
-    private void copyCode () throws Exception {
-        aHelper.clickItem (workbenchShell, "SampleWAR");
-        Shell propShell = aHelper.clickMenuItem (workbenchShell,
-                new String[] {"&Project", "&Properties"},
-                "Properties for SampleWAR");
-        aHelper.clickItem (propShell, "Java EE Module Dependencies");
-        aHelper.clickButton (propShell, "Select &All");
-        aHelper.clickButton (propShell, "&Apply");
-        aHelper.clickButton (propShell, IDialogConstants.OK_LABEL);
-
-        IWorkspaceRoot aWSRoot = ResourcesPlugin.getWorkspace().getRoot();
-        IProject aProject = aWSRoot.getProject ("SampleEJB");
-        IFolder aFolder = aProject.getFolder("ejbModule/sampleear");
-        aFolder.create (false, true, null);
-        String fileDir = aWSRoot.getLocation().toOSString() + "/src/main/resources/ui-tutorial";
-        IFile aFile = aProject.getFile("ejbModule/sampleear/RemoteBusinessInterface.java");
-        aFile.create(new FileInputStream (fileDir + "/RemoteBusinessInterface.java"), true, null);
-        aFile = aProject.getFile("ejbModule/sampleear/MyStatelessSessionBean.java");
-        aFile.create(new FileInputStream (fileDir + "/MyStatelessSessionBean.java"), true, null);
-
-        aProject = aWSRoot.getProject ("SampleWAR");
-        aFolder = aProject.getFolder("src/sampleear");
-        aFolder.create (false, true, null);
-        aFile = aProject.getFile("WebContent/index.jsp");
-        aFile.create(new FileInputStream (fileDir + "/index.jsp"), true, null);
-        // have to go through Servlet Creation dialog to make the web.xml correct
-        Shell servletShell = aHelper.rightClickItem(workbenchShell, "SampleWAR",
-                new String [] {"&New", "Servlet"}, "Create Servlet");
-        aHelper.setCursorText("MyServlet");
-        aHelper.setTextField(servletShell, "", "sampleear");
-        aHelper.clickButton (servletShell, IDialogConstants.NEXT_LABEL);
-        aHelper.clickItem(servletShell, "/MyServlet");
-        Shell urlShell = aHelper.clickEnabledButton (servletShell, "Edit...", "URL Mappings");
-        aHelper.setTextField(urlShell, "/MyServlet", "/sayHello");
-        aHelper.clickButton (urlShell, IDialogConstants.OK_LABEL);
-        aHelper.clickButton (servletShell, IDialogConstants.FINISH_LABEL);
-
-        // copy over the correct contents
-        aFile = aProject.getFile("src/sampleear/MyServlet.java");
-        aFile.setContents(new FileInputStream (fileDir + "/MyServlet.java"), true, true, null);
-    }
-}
+/*
+ * 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.io.FileInputStream;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.widgets.Shell;
+
+import abbot.swt.finder.generic.MultipleFoundException;
+import abbot.swt.finder.generic.NotFoundException;
+
+/**
+ * Tutorial5Minute
+ *
+ * @version $Rev: 679174 $ $Date: 2008-07-23 12:52:55 -0700 (Wed, 23 Jul 2008) $
+ */
+public class Tutorial5Minute {
+
+    Shell workbenchShell;
+    AbbotHelper aHelper;
+
+    public Tutorial5Minute (Shell shell, AbbotHelper helper) {
+        workbenchShell = shell;
+        aHelper = helper;
+    }
+
+    public void createProjects() throws Exception {
+        createEARProject ();
+        createEJBProject ();
+        createWARProject ();
+        copyCode ();
+    }
+
+    private void createEARProject() throws MultipleFoundException, NotFoundException {
+        Shell wizardShell = aHelper.clickMenuItem (workbenchShell,
+                new String[] {"&File", "&New\tAlt+Shift+N", "&Other..."},
+                "New");
+
+        aHelper.clickTreeItem (wizardShell,
+                new String[] {"Java EE", "Enterprise Application Project"});
+        aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+        aHelper.setTextField(wizardShell, "", "SampleEAR");
+        aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+        aHelper.clickButton (wizardShell, "Generate Deployment Descriptor");
+        aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+        aHelper.setTextField(wizardShell, "default", "sampleear");
+        aHelper.setTextField(wizardShell, "", "sample-ear");
+        aHelper.setTextField(wizardShell, "car", "ear");
+        aHelper.clickButton (wizardShell, IDialogConstants.FINISH_LABEL);
+
+        aHelper.waitForDialogDisposal (wizardShell);
+    }
+
+    private void createEJBProject() throws MultipleFoundException, NotFoundException {
+        Shell wizardShell = aHelper.clickMenuItem (workbenchShell,
+                new String[] {"&File", "&New\tAlt+Shift+N", "&Other..."},
+                "New");
+
+        aHelper.clickTreeItem (wizardShell,
+                new String[] {"EJB", "EJB Project"});
+        aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+        aHelper.setTextField(wizardShell, "", "SampleEJB");
+        aHelper.clickButton (wizardShell, "Add project to an EAR");
+        aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+        aHelper.clickButton (wizardShell, "Create an EJB Client JAR module to hold the client interfaces and classes.");
+        aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+        aHelper.setTextField(wizardShell, "default", "sampleear");
+        aHelper.setTextField(wizardShell, "", "sample-ejb");
+        aHelper.setTextField(wizardShell, "car", "ejb");
+        aHelper.clickButton (wizardShell, IDialogConstants.FINISH_LABEL);
+        
+        aHelper.waitForDialogDisposal (wizardShell);
+        
+        aHelper.doubleClickItem(workbenchShell, "ejbModule");
+        aHelper.doubleClickItem(workbenchShell, "META-INF");
+        Shell questionShell = aHelper.rightClickItem(workbenchShell, "openejb-jar.xml",
+                new String[] {"&Delete"}, "Delete Resources");
+        aHelper.clickButton (questionShell, IDialogConstants.OK_LABEL);
+        aHelper.waitForDialogDisposal (questionShell);
+    }
+
+    private void createWARProject() throws MultipleFoundException, NotFoundException {
+        Shell wizardShell = aHelper.clickMenuItem (workbenchShell,
+                new String[] {"&File", "&New\tAlt+Shift+N", "&Other..."},
+                "New");
+
+        aHelper.clickTreeItem (wizardShell,
+                new String[] {"Web", "Dynamic Web Project"});
+        aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+        aHelper.setTextField(wizardShell, "", "SampleWAR");
+        aHelper.clickButton (wizardShell, "Add project to an EAR");
+        aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+        aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+        aHelper.setTextField(wizardShell, "default", "sampleear");
+        aHelper.setTextField(wizardShell, "", "sample-war");
+        aHelper.setTextField(wizardShell, "car", "war");
+        aHelper.clickButton (wizardShell, IDialogConstants.FINISH_LABEL);
+        
+        aHelper.waitForDialogDisposal (wizardShell);
+    }
+    
+    private void copyCode () throws Exception {
+        aHelper.clickItem (workbenchShell, "SampleWAR");
+        Shell propShell = aHelper.clickMenuItem (workbenchShell,
+                new String[] {"&Project", "&Properties"},
+                "Properties for SampleWAR");
+        aHelper.clickItem (propShell, "Java EE Module Dependencies");
+        aHelper.clickButton (propShell, "Select &All");
+        aHelper.clickButton (propShell, "&Apply");
+        aHelper.clickButton (propShell, IDialogConstants.OK_LABEL);
+
+        IWorkspaceRoot aWSRoot = ResourcesPlugin.getWorkspace().getRoot();
+        IProject aProject = aWSRoot.getProject ("SampleEJB");
+        IFolder aFolder = aProject.getFolder("ejbModule/sampleear");
+        aFolder.create (false, true, null);
+        String fileDir = aWSRoot.getLocation().toOSString() + "/src/main/resources/ui-tutorial";
+        IFile aFile = aProject.getFile("ejbModule/sampleear/RemoteBusinessInterface.java");
+        aFile.create(new FileInputStream (fileDir + "/RemoteBusinessInterface.java"), true, null);
+        aFile = aProject.getFile("ejbModule/sampleear/MyStatelessSessionBean.java");
+        aFile.create(new FileInputStream (fileDir + "/MyStatelessSessionBean.java"), true, null);
+
+        aProject = aWSRoot.getProject ("SampleWAR");
+        aFolder = aProject.getFolder("src/sampleear");
+        aFolder.create (false, true, null);
+        aFile = aProject.getFile("WebContent/index.jsp");
+        aFile.create(new FileInputStream (fileDir + "/index.jsp"), true, null);
+        // have to go through Servlet Creation dialog to make the web.xml correct
+        Shell servletShell = aHelper.rightClickItem(workbenchShell, "SampleWAR",
+                new String [] {"&New", "Servlet"}, "Create Servlet");
+        aHelper.setCursorText("MyServlet");
+        aHelper.setTextField(servletShell, "", "sampleear");
+        aHelper.clickButton (servletShell, IDialogConstants.NEXT_LABEL);
+        aHelper.clickItem(servletShell, "/MyServlet");
+        Shell urlShell = aHelper.clickEnabledButton (servletShell, "Edit...", "URL Mappings");
+        aHelper.setTextField(urlShell, "/MyServlet", "/sayHello");
+        aHelper.clickButton (urlShell, IDialogConstants.OK_LABEL);
+        aHelper.clickButton (servletShell, IDialogConstants.FINISH_LABEL);
+
+        // 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=681934&r1=681933&r2=681934&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 Fri Aug  1 20:32:20 2008
@@ -1,95 +1,97 @@
-/*
- * 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.v20.ui;
-
-import org.apache.geronimo.testsuite.common.ui.AbbotHelper;
-import org.apache.geronimo.testsuite.common.ui.Constants;
-import org.apache.geronimo.testsuite.common.ui.ProjectTasks;
-import org.apache.geronimo.testsuite.common.ui.ServerTasks;
-import org.apache.geronimo.testsuite.common.ui.Tutorial5Minute;
-import org.apache.geronimo.testsuite.common.ui.WorkbenchTasks;
-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;
-
-/**
- * Tutorial5MinuteTest
- *
- * @version $Rev: 679174 $ $Date: 2008-07-23 12:52:55 -0700 (Wed, 23 Jul 2008) $
- */
-public class Tutorial5MinuteTest extends WorkbenchTestCase {
-    Shell workbenchShell;
-    AbbotHelper aHelper;
-    
-    protected void setUp() throws Exception {
-        super.setUp();
-        Preferences.setPerspectiveSwitchPrompt(Mode.Always);
-    }
-
-    protected void tearDown() throws Exception {
-        super.tearDown();
-    }
-
-    // We only want to install/uninstall the server a single time so 
-    // we will roll all testcases into one large one that is controlled
-    // in the testAllGeronimoGUI method.
-    public void testAllGeronimoGUI() {
-        boolean success = false;
-        try {
-            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 );
-            
-            // so we are sure that we are looking in the desired perspective
-            workbenchTasks.showJEEPerspective();
-
-            // create server from an installed instance
-            serverTasks.createServer();
-
-            serverTasks.startServer();
-            Tutorial5Minute tutorial = new Tutorial5Minute (workbenchShell, aHelper);
-            tutorial.createProjects ();
-            serverTasks.stopServer();
-
-            // delete the projects that have been created
-            // reverse alphabetical is a little smoother
-            projectTasks.deleteProject ("SampleWAR");
-            projectTasks.deleteProject ("SampleEJB");
-            projectTasks.deleteProject ("SampleEAR");
-
-            // remove the server 
-            serverTasks.removeServer();
-
-            success = true;
-        }
-        catch (Exception e) {
-            e.printStackTrace();
-        }
-        assertTrue (success);
-    }
-
-}
+/*
+ * 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.v20.ui;
+
+import org.apache.geronimo.testsuite.common.ui.AbbotHelper;
+import org.apache.geronimo.testsuite.common.ui.Constants;
+import org.apache.geronimo.testsuite.common.ui.ProjectTasks;
+import org.apache.geronimo.testsuite.common.ui.ServerTasks;
+import org.apache.geronimo.testsuite.common.ui.Tutorial5Minute;
+import org.apache.geronimo.testsuite.common.ui.WorkbenchTasks;
+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;
+
+/**
+ * Tutorial5MinuteTest
+ *
+ * @version $Rev: 679174 $ $Date: 2008-07-23 12:52:55 -0700 (Wed, 23 Jul 2008) $
+ */
+public class Tutorial5MinuteTest extends WorkbenchTestCase {
+    Shell workbenchShell;
+    AbbotHelper aHelper;
+    
+    protected void setUp() throws Exception {
+        super.setUp();
+        Preferences.setPerspectiveSwitchPrompt(Mode.Always);
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    // We only want to install/uninstall the server a single time so 
+    // we will roll all testcases into one large one that is controlled
+    // in the testAllGeronimoGUI method.
+    public void testAllGeronimoGUI() {
+        boolean success = false;
+        try {
+            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 );
+            
+            // so we are sure that we are looking in the desired perspective
+            workbenchTasks.showJEEPerspective();
+
+            // create server from an installed instance
+            serverTasks.createServer();
+
+            Tutorial5Minute tutorial = new Tutorial5Minute (workbenchShell, aHelper);
+            tutorial.createProjects ();
+
+            serverTasks.publishAllProjects();
+            serverTasks.startServer();
+
+            tutorial.webTesting();
+
+            serverTasks.stopServer();
+
+            // delete the projects that have been created
+            // reverse alphabetical is a little smoother
+            projectTasks.deleteProject ("SampleWAR");
+            projectTasks.deleteProject ("SampleEJB");
+            projectTasks.deleteProject ("SampleEAR");
+
+            // remove the server 
+            serverTasks.removeServer();
+
+            success = true;
+        }
+        catch (Exception e) {
+            e.printStackTrace();
+        }
+        assertTrue (success);
+    }
+
+}

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=681934&r1=681933&r2=681934&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 Fri Aug  1 20:32:20 2008
@@ -60,10 +60,7 @@
     // in the testAllGeronimoGUI method.
     public void testAllGeronimoGUI() {
         boolean success = false;
-        try {
-            workbenchShell = WorkbenchUtilities.getWorkbenchWindow().getShell();
-            aHelper = new AbbotHelper (workbenchShell);
-            
+        try {            
             workbenchShell = WorkbenchUtilities.getWorkbenchWindow().getShell();
             aHelper = new AbbotHelper (workbenchShell);
             
@@ -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