geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bjr...@apache.org
Subject svn commit: r736695 [2/2] - in /geronimo/devtools/eclipse-plugin/trunk: plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/ testsuite/plugins/org.apache.geronimo.testsuite.common/src/main/java/org/apache/geronimo/testsuite/co...
Date Thu, 22 Jan 2009 16:36:18 GMT
Modified: geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.v22/src/main/java/org/apache/geronimo/testsuite/v22/ui/SharedLibPojoTest.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.v22/src/main/java/org/apache/geronimo/testsuite/v22/ui/SharedLibPojoTest.java?rev=736695&r1=736694&r2=736695&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.v22/src/main/java/org/apache/geronimo/testsuite/v22/ui/SharedLibPojoTest.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.v22/src/main/java/org/apache/geronimo/testsuite/v22/ui/SharedLibPojoTest.java
Thu Jan 22 08:36:14 2009
@@ -19,12 +19,8 @@
 
 import java.io.FileInputStream;
 
-import org.apache.geronimo.testsuite.common.AssertUtil;
 import org.apache.geronimo.testsuite.common.selenium.EclipseSelenium;
 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.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IWorkspaceRoot;
@@ -32,239 +28,232 @@
 import org.eclipse.jface.dialogs.IDialogConstants;
 import org.eclipse.swt.widgets.Shell;
 
-import abbot.swt.eclipse.junit.extensions.WorkbenchTestCase;
 import abbot.swt.eclipse.utils.WorkbenchUtilities;
 
 /*
  * @version $Rev$ $Date$
  */
-public class SharedLibPojoTest extends WorkbenchTestCase {
+public class SharedLibPojoTest extends AbstractTestCase {
+    
+    @Override
+    public boolean buildTestCase() {
+        boolean success = createPojoProject();
+        if (success == true) {
+            success = copyCodeToPojoProject();
+        }
+        if (success == true) {
+            success = createHelloWorldProject();
+        }
+        if (success == true) {
+            success = copyCodeToHelloWorldProject();
+        }
+        if (success == true) {
+            success = modifyHelloWorldBuildPath();
+        }
+        return success;
+    }
 
-    Shell aShell;
-    AbbotHelper aHelper;
-    boolean success = false;
-
-    protected void setUp() throws Exception {
-        super.setUp();
-    }
-
-    protected void tearDown() throws Exception {
-        super.tearDown();
-        deleteProjects();
-        deleteServer();
-    }
-
-    public void testSharedLib()
-    {
-        createPojoProject();
-        copyCodeToPojoProject();
-        createHelloWorldProject();
-        copyCodeToHelloWorldProject();
-        modifyHelloWorldBuildPath();
-        deployHelloWorldProject();
-        addSharedLibSupport();
-        displayApplication();    
-    }
-
-    public void createPojoProject()
-    {
-        try {
-            aShell = WorkbenchUtilities.getWorkbenchWindow().getShell();
-            aHelper = new AbbotHelper(aShell);
-            ServerTasks serverTasks = new ServerTasks(aShell, aHelper, Constants.SERVER_V22
);
-            serverTasks.createServer();
-            aHelper.clickMenuItem (aShell,new String[] {"&Window", "&Close Perspective"});
-            Shell perspectiveShell = aHelper.clickMenuItem (aShell,
+    @Override
+    public boolean runTestCase() {
+        boolean success = deployHelloWorldProject();
+        if (success == true) {
+            success = toggleSharedLibSupport();
+        }
+        if (success == true) {
+            success = displayApplication();
+        }
+        return success;
+    }
+
+    @Override
+    public boolean cleanupTestCase() {
+        boolean success = serverTasks.removeAllProjects();
+        if (success == true) {
+            success = projectTasks.deleteProject ("HelloWorld");
+        }
+        if (success == true) {
+            success = projectTasks.deleteProject ("CurrencyConverterPojo");
+        }
+        if (success == true) {
+            success = toggleSharedLibSupport();
+        }
+
+        return success;
+    }
+
+    public boolean createPojoProject() {
+        boolean success = true;
+        try {
+            workbenchShell = WorkbenchUtilities.getWorkbenchWindow().getShell();
+            abbotHelper = new AbbotHelper(workbenchShell);
+
+            abbotHelper.clickMenuItem (workbenchShell,new String[] {"&Window", "&Close
Perspective"});
+            Shell perspectiveShell = abbotHelper.clickMenuItem (workbenchShell,
                                                             new String[] {"&Window",
"&Open Perspective", "&Other..."},
                                                             "Open Perspective");
-            aHelper.clickItem (perspectiveShell, "Java");
-            aHelper.clickButton (perspectiveShell, IDialogConstants.OK_LABEL);  
+            abbotHelper.clickItem (perspectiveShell, "Java");
+            abbotHelper.clickButton (perspectiveShell, IDialogConstants.OK_LABEL);  
 
-            Shell wizardShell = aHelper.clickMenuItem (aShell,
+            Shell wizardShell = abbotHelper.clickMenuItem (workbenchShell,
                                                        new String[] {"&File", "&New\tAlt+Shift+N",
"&Other..."},
                                                        "New");
-            aHelper.clickTreeItem (wizardShell,
+            abbotHelper.clickTreeItem (wizardShell,
                                    new String[] {"Java", "Java Project"});
-            aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
-            aHelper.setTextField(wizardShell,"", "CurrencyConverterPojo");
-            aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
-            aHelper.clickButton (wizardShell, IDialogConstants.FINISH_LABEL);
-            aHelper.doubleClickItem(aShell, "CurrencyConverterPojo");
+            abbotHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+            abbotHelper.setTextField(wizardShell,"", "CurrencyConverterPojo");
+            abbotHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+            abbotHelper.clickButton (wizardShell, IDialogConstants.FINISH_LABEL);
+            abbotHelper.doubleClickItem(workbenchShell, "CurrencyConverterPojo");
 
-            wizardShell=aHelper.clickMenuItem (aShell,
+            wizardShell = abbotHelper.clickMenuItem (workbenchShell,
                                                new String[] {"&File", "&New\tAlt+Shift+N",
"&Other..."},
                                                "New");
-            aHelper.clickTreeItem (wizardShell,
+            abbotHelper.clickTreeItem (wizardShell,
                                    new String[] {"Java", "Package"});
-            aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
-            aHelper.setTextField(wizardShell,"", "myPackage");
-            aHelper.clickButton (wizardShell, IDialogConstants.FINISH_LABEL);           
+            abbotHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+            abbotHelper.setTextField(wizardShell,"", "myPackage");
+            abbotHelper.clickButton (wizardShell, IDialogConstants.FINISH_LABEL);       
   
         }
         catch (Exception e) {
             e.printStackTrace();
+            success = false;
         }
+        return success;
     }
 
-    public void copyCodeToPojoProject()
-    {
+    public boolean copyCodeToPojoProject() {
+        boolean success = true;
         try {
             IWorkspaceRoot aWSRoot = ResourcesPlugin.getWorkspace().getRoot();
             IProject aProject = aWSRoot.getProject ("CurrencyConverterPojo");
-            String fileDir =aWSRoot.getLocation().toOSString()+ "/src/main/resources/sharedlib";
+            String fileDir = aWSRoot.getLocation().toOSString()+ "/src/main/resources/sharedlib";
             IFile aFile = aProject.getFile("src/myPackage/CurrencyConverter.java");
             aFile.create(new FileInputStream (fileDir + "/CurrencyConverter.java"), true,
null);
-            aHelper.waitTime(1500);
+            abbotHelper.waitTime(AbbotHelper.WAIT_STANDARD);
         }
         catch (Exception e) {
             e.printStackTrace();
+            success = false;
         }
+        return success;
     }
 
-    public void createHelloWorldProject()
-    {
+    public boolean createHelloWorldProject() {
+        boolean success = true;
         try {
-            aHelper.clickMenuItem (aShell,
+            abbotHelper.clickMenuItem (workbenchShell,
                                    new String[] {"&Window", "&Close Perspective"});
-            Shell perspectiveShell = aHelper.clickMenuItem (aShell,
+            Shell perspectiveShell = abbotHelper.clickMenuItem (workbenchShell,
                                                             new String[] {"&Window",
"&Open Perspective", "&Other..."},
                                                             "Open Perspective");
-            aHelper.clickItem (perspectiveShell, "Java EE (default)");
-            aHelper.clickButton (perspectiveShell, IDialogConstants.OK_LABEL);  
-            Shell wizardShell = aHelper.clickMenuItem (aShell,
+            abbotHelper.clickItem (perspectiveShell, "Java EE (default)");
+            abbotHelper.clickButton (perspectiveShell, IDialogConstants.OK_LABEL);  
+            Shell wizardShell = abbotHelper.clickMenuItem (workbenchShell,
                                                        new String[] {"&File", "&New\tAlt+Shift+N",
"&Other..."},
                                                        "New");
-            aHelper.clickTreeItem (wizardShell,
+            abbotHelper.clickTreeItem (wizardShell,
                                    new String[] {"Web", "Dynamic Web Project"});
-            aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
-            aHelper.setTextField(wizardShell,"", "HelloWorld");
-            aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
-            aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
-            aHelper.clickButton(wizardShell, "Add a runtime dependency to Geronimo's shared
library");
-            aHelper.clickButton (wizardShell, IDialogConstants.FINISH_LABEL);
-            aHelper.waitForDialogDisposal(wizardShell);
+            abbotHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+            abbotHelper.setTextField(wizardShell,"", "HelloWorld");
+            abbotHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+            abbotHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+            abbotHelper.clickButton(wizardShell, "Add a runtime dependency to Geronimo's
shared library");
+            abbotHelper.clickButton (wizardShell, IDialogConstants.FINISH_LABEL);
+            abbotHelper.waitForDialogDisposal(wizardShell);
         }
         catch (Exception e) {
             e.printStackTrace();
+            success = false;
         }
-
+        return success;
     }
-    public void copyCodeToHelloWorldProject()
-    {
+
+    public boolean copyCodeToHelloWorldProject() {
+        boolean success = true;
         try {
             IWorkspaceRoot aWSRoot = ResourcesPlugin.getWorkspace().getRoot();
             IProject aProject = aWSRoot.getProject ("HelloWorld");
             String fileDir =aWSRoot.getLocation().toOSString()+"/src/main/resources/sharedlib";
             IFile aFile = aProject.getFile("WebContent/index.jsp");
             aFile.create(new FileInputStream (fileDir + "/index.jsp"), true, null);
-            aHelper.waitTime(1500);
+            abbotHelper.waitTime(AbbotHelper.WAIT_STANDARD);
         }
         catch (Exception e) {
             e.printStackTrace();
+            success = false;
         }
+        return success;
     }
 
-    public void modifyHelloWorldBuildPath()
-    {
+    public boolean modifyHelloWorldBuildPath() {
+        boolean success = true;
         try {
-            Shell wizardShell=aHelper.clickMenuItem (aShell,
+            Shell wizardShell = abbotHelper.clickMenuItem (workbenchShell,
                                                      new String[] {"&Project","&Properties"},
                                                      "Properties for HelloWorld");
-            aHelper.clickItem(wizardShell,"Java Build Path");
-            aHelper.selectTabItem(wizardShell,"&Projects");
-            Shell newShell=aHelper.clickButton(wizardShell, "&Add...","Required Project
Selection");
-            aHelper.clickButton(newShell, "&Select All");
-            aHelper.clickButton(newShell, IDialogConstants.OK_LABEL);
-            aHelper.clickButton(wizardShell, IDialogConstants.OK_LABEL);
-            newShell=aHelper.clickMenuItem(aShell, new String[]{"&Project","Clea&n..."},
"Clean");
-            aHelper.clickButton(newShell, IDialogConstants.OK_LABEL);               
+            abbotHelper.clickItem(wizardShell,"Java Build Path");
+            abbotHelper.selectTabItem(wizardShell,"&Projects");
+            Shell newShell=abbotHelper.clickButton(wizardShell, "&Add...","Required Project
Selection");
+            abbotHelper.clickButton(newShell, "&Select All");
+            abbotHelper.clickButton(newShell, IDialogConstants.OK_LABEL);
+            abbotHelper.clickButton(wizardShell, IDialogConstants.OK_LABEL);
+            newShell = abbotHelper.clickMenuItem(workbenchShell, new String[]{"&Project","Clea&n..."},
"Clean");
+            abbotHelper.clickButton(newShell, IDialogConstants.OK_LABEL);               
         }
         catch (Exception e) {
             e.printStackTrace();
+            success = false;
         }
+        return success;
     }
 
-    public void addSharedLibSupport()
-    {
+    public boolean toggleSharedLibSupport() {
+        boolean success = true;
         try {
-            ServerTasks serverTasks = new ServerTasks(aShell, aHelper, Constants.SERVER_V22
);
-            serverTasks.editServer();
-            aHelper.clickButton(aShell, "Enable in-place shared library support.");
-            aHelper.clickMenuItem(aShell,new String[]{"&File","&Save"});
-            aHelper.clickMenuItem(aShell, new String[]{"&File","C&lose All"});
-            serverTasks.startServer();
+            serverTasks.showServerOverview();
+            abbotHelper.clickButton(workbenchShell, "Enable in-place shared library support.");
+            abbotHelper.clickMenuItem(workbenchShell,new String[]{"&File","&Save"});
+            abbotHelper.clickMenuItem(workbenchShell, new String[]{"&File","C&lose
All"});
+            // restart the server to pick up the change
+            serverTasks.startServer (true);
         }
         catch (Exception e) {
-            e.printStackTrace();        
+            e.printStackTrace();
+            success = false;
         }
+        return success;
     }
 
-    public void deployHelloWorldProject()
-    {
+    public boolean deployHelloWorldProject() {
+        boolean success = true;
         try {
-            aHelper.clickMenuItem (aShell,
-                                   new String[] {"&Window", "&Close Perspective"});
-            Shell perspectiveShell = aHelper.clickMenuItem (aShell,
-                                                            new String[] {"&Window",
"&Open Perspective", "&Other..."},
-                                                            "Open Perspective");
-            aHelper.clickItem (perspectiveShell, "Java EE (default)");
-            aHelper.clickButton (perspectiveShell, IDialogConstants.OK_LABEL);  
-            ServerTasks serverTasks = new ServerTasks(aShell, aHelper, Constants.SERVER_V22
);
             serverTasks.publishAllProjects();   
         }
         catch (Exception e) {
             e.printStackTrace();
+            success = false;
         }
+        return success;
     }
 
-    public void displayApplication()
-    {
+    public boolean displayApplication() {
+        boolean success = true;
         try {
             EclipseSelenium selenium = new EclipseSelenium();
             selenium.start();
-            selenium.open("http://localhost:8080/HelloWorld/index.jsp");
-            selenium.waitForPageToLoad("60000");
-            AssertUtil.assertTrue(selenium.getHtmlSource().indexOf( "Hello World!!" ) >
0);
-            AssertUtil.assertTrue(selenium.getHtmlSource().indexOf( "100 USD = 3938.81 INR"
) > 0);
-            aHelper.waitTime(1500);
+            selenium.open ("http://localhost:8080/HelloWorld/index.jsp");
+            selenium.waitForPageToLoad ("60000");
+            success = (selenium.getHtmlSource().indexOf ("Hello World!!") > 0);
+            if (success == true) {
+                success = (selenium.getHtmlSource().indexOf ("100 USD = 3938.81 INR") >
0);
+            }
+            abbotHelper.waitTime (AbbotHelper.WAIT_STANDARD);
             selenium.stop();
-            success=true;
         }
         catch (Exception e) {
             e.printStackTrace();
+            success = false;
         }
-        assertTrue(success);
+        return success;
     }
-
-    public void deleteProjects()
-    {
-        try {
-            ProjectTasks projectTasks = new ProjectTasks(aShell, aHelper, Constants.SERVER_V22
);
-            // delete the projects that have been created
-            // reverse alphabetical is a little smoother
-            projectTasks.deleteProject ("HelloWorld");
-            projectTasks.deleteProject ("CurrencyConverterPojo");
-            success=true;
-        }
-        catch (Exception e) {
-            e.printStackTrace();
-        }
-        assertTrue(success);
-    }
-
-    public void deleteServer()
-    {
-        try {
-            ServerTasks serverTasks = new ServerTasks(aShell, aHelper, Constants.SERVER_V22
);
-            // stop the server 
-            serverTasks.stopServer();
-            // 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.v22/src/main/java/org/apache/geronimo/testsuite/v22/ui/Tutorial5MinuteTest.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.v22/src/main/java/org/apache/geronimo/testsuite/v22/ui/Tutorial5MinuteTest.java?rev=736695&r1=736694&r2=736695&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.v22/src/main/java/org/apache/geronimo/testsuite/v22/ui/Tutorial5MinuteTest.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.v22/src/main/java/org/apache/geronimo/testsuite/v22/ui/Tutorial5MinuteTest.java
Thu Jan 22 08:36:14 2009
@@ -17,85 +17,231 @@
 
 package org.apache.geronimo.testsuite.v22.ui;
 
-import java.io.File;
+import java.io.FileInputStream;
 
-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.WorkbenchTasks;
-import org.eclipse.core.resources.IWorkspace;
+import org.apache.geronimo.testsuite.common.selenium.EclipseSelenium;
+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.eclipse.junit.extensions.WorkbenchTestCase;
-import abbot.swt.eclipse.utils.Preferences;
-import abbot.swt.eclipse.utils.WorkbenchUtilities;
-import abbot.swt.eclipse.utils.Preferences.Mode;
-import abbot.swt.finder.generic.MultipleFoundException;
-import abbot.swt.finder.generic.NotFoundException;
-
 /**
  * Tutorial5MinuteTest
  *
  * @version $Rev$ $Date$
  */
-public class Tutorial5MinuteTest extends WorkbenchTestCase {
-    Shell workbenchShell;
-    AbbotHelper aHelper;
-    
-    protected void setUp() throws Exception {
-        super.setUp();
-        Preferences.setPerspectiveSwitchPrompt(Mode.Always);
-    }
+public class Tutorial5MinuteTest extends AbstractTestCase {
+
+    @Override
+    public boolean buildTestCase() {
+        boolean success = createProjects ();
+        if (success == true) {
+            success = copyCode();
+        }
 
-    protected void tearDown() throws Exception {
-        super.tearDown();
+        return success;
     }
 
-    // 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_V22
);
-            WorkbenchTasks workbenchTasks = new WorkbenchTasks(workbenchShell, aHelper);
-            ProjectTasks projectTasks = new ProjectTasks(workbenchShell, aHelper, Constants.SERVER_V22
);
-            
-            // so we are sure that we are looking in the desired perspective
-            workbenchTasks.showJEEPerspective();
+    @Override
+    public boolean runTestCase() {
+        boolean success = serverTasks.publishAllProjects();
+        if (success == true) {
+            success = webTesting();
+        }
 
-            // create server from an installed instance
-            serverTasks.createServer();
+        return success;
+    }
 
-            projectTasks.createProjects ();
+    @Override
+    public boolean cleanupTestCase() {
+        boolean success = serverTasks.removeAllProjects();
+        if (success == true) {
+            success =  projectTasks.deleteProject ("SampleWAR");
+        }
+        if (success == true) {
+            success = projectTasks.deleteProject ("SampleEJB");
+        }
+        if (success == true) {
+            success = projectTasks.deleteProject ("SampleEAR");
+        }
 
-            serverTasks.publishAllProjects();
-            serverTasks.startServer();
+        return success;
+    }
 
-            projectTasks.webTesting();
+    public boolean createProjects() {
+        boolean success = createEARProject ();
+        if (success == true) {
+            success = createEJBProject ();
+        }
+        if (success == true) {
+            success = createWARProject ();
+        }
 
-            serverTasks.stopServer();
+        return success;
+    }
 
-            // delete the projects that have been created
-            // reverse alphabetical is a little smoother
-            projectTasks.deleteProject ("SampleWAR");
-            projectTasks.deleteProject ("SampleEJB");
-            projectTasks.deleteProject ("SampleEAR");
+    private boolean createEARProject() {
+        boolean success = true;
+        try {
+            Shell wizardShell = abbotHelper.clickMenuItem (workbenchShell,
+                    new String[] {"&File", "&New\tAlt+Shift+N", "&Other..."},
+                    "New");
+
+            abbotHelper.clickTreeItem (wizardShell,
+                    new String[] {"Java EE", "Enterprise Application Project"});
+            abbotHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+            abbotHelper.setTextField(wizardShell, "", "SampleEAR");
+            abbotHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+            abbotHelper.clickButton (wizardShell, "Generate Deployment Descriptor");
+            abbotHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+            abbotHelper.setTextField(wizardShell, "default", "sampleear");
+            abbotHelper.setTextField(wizardShell, "", "sample-ear");
+            abbotHelper.setTextField(wizardShell, "car", "ear");
+            abbotHelper.clickButton (wizardShell, IDialogConstants.FINISH_LABEL);
 
-            // remove the server 
-            serverTasks.removeServer();
+            abbotHelper.waitForDialogDisposal (wizardShell);
+        } catch (Exception e) {
+            e.printStackTrace();
+            success = false;
+        }
+        return success;
+    }
 
-            success = true;
+    private boolean createEJBProject() {
+        boolean success = true;
+        try {
+            Shell wizardShell = abbotHelper.clickMenuItem (workbenchShell,
+                    new String[] {"&File", "&New\tAlt+Shift+N", "&Other..."},
+                    "New");
+
+            abbotHelper.clickTreeItem (wizardShell,
+                    new String[] {"EJB", "EJB Project"});
+            abbotHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+            abbotHelper.setTextField(wizardShell, "", "SampleEJB");
+            abbotHelper.clickButton (wizardShell, "Add &project to an EAR");
+            abbotHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+            abbotHelper.clickButton (wizardShell, "Create an EJB Client JAR module to hold
the client interfaces and classes.");
+            abbotHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+            abbotHelper.setTextField(wizardShell, "default", "sampleear");
+            abbotHelper.setTextField(wizardShell, "", "sample-ejb");
+            abbotHelper.setTextField(wizardShell, "car", "ejb");
+            abbotHelper.clickButton (wizardShell, IDialogConstants.FINISH_LABEL);
+
+            abbotHelper.waitForDialogDisposal (wizardShell);
+
+            abbotHelper.doubleClickItem(workbenchShell, "SampleEJB");
+            abbotHelper.doubleClickItem(workbenchShell, "ejbModule");
+            abbotHelper.doubleClickItem(workbenchShell, "META-INF");
+            Shell questionShell = abbotHelper.rightClickItem(workbenchShell, "openejb-jar.xml",
+                    new String[] {"&Delete"}, "Delete Resources");
+            abbotHelper.clickButton (questionShell, IDialogConstants.OK_LABEL);
+            abbotHelper.waitForDialogDisposal (questionShell);
+        } catch (Exception e) {
+            e.printStackTrace();
+            success = false;
         }
-        catch (Exception e) {
+        return success;
+    }
+
+    private boolean createWARProject() {
+        boolean success = true;
+        try {
+            Shell wizardShell = abbotHelper.clickMenuItem (workbenchShell,
+                    new String[] {"&File", "&New\tAlt+Shift+N", "&Other..."},
+                    "New");
+
+            abbotHelper.clickTreeItem (wizardShell,
+                    new String[] {"Web", "Dynamic Web Project"});
+            abbotHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+            abbotHelper.setTextField(wizardShell, "", "SampleWAR");
+            abbotHelper.clickButton (wizardShell, "Add &project to an EAR");
+            abbotHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+            abbotHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+            abbotHelper.setTextField(wizardShell, "default", "sampleear");
+            abbotHelper.setTextField(wizardShell, "", "sample-war");
+            abbotHelper.setTextField(wizardShell, "car", "war");
+            abbotHelper.clickButton (wizardShell, IDialogConstants.FINISH_LABEL);
+        
+            abbotHelper.waitForDialogDisposal (wizardShell);
+        } catch (Exception e) {
+            e.printStackTrace();
+            success = false;
+        }
+        return success;
+    }
+    
+    private boolean copyCode ()  {
+        boolean success = true;
+        try {
+            abbotHelper.clickItem (workbenchShell, "SampleWAR");
+            Shell propShell = abbotHelper.clickMenuItem (workbenchShell,
+                    new String[] {"&Project", "&Properties"},
+                    "Properties for SampleWAR");
+            abbotHelper.clickItem (propShell, "Java EE Module Dependencies");
+            abbotHelper.clickButton (propShell, "Select &All");
+            abbotHelper.clickButton (propShell, "&Apply");
+            abbotHelper.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 = abbotHelper.rightClickItem(workbenchShell, "SampleWAR",
+                    new String [] {"&New", "Servlet"}, "Create Servlet");
+            abbotHelper.setCursorText("MyServlet");
+            abbotHelper.setTextField(servletShell, "", "sampleear");
+            abbotHelper.clickButton (servletShell, IDialogConstants.NEXT_LABEL);
+            abbotHelper.clickItem(servletShell, "/MyServlet");
+            Shell urlShell = abbotHelper.clickEnabledButton (servletShell, "Edit...", "URL
Mappings");
+            abbotHelper.setTextField(urlShell, "/MyServlet", "/sayHello");
+            abbotHelper.clickButton (urlShell, IDialogConstants.OK_LABEL);
+            abbotHelper.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
+            abbotHelper.clickMenuItem (workbenchShell,
+                    new String[] {"&File", "&Close"});
+        } catch (Exception e) {
+            e.printStackTrace();
+            success = false;
+        }
+        return success;
+    }
+
+    private boolean webTesting () {
+        boolean success = true;
+        try {
+            EclipseSelenium selenium = new EclipseSelenium();
+            selenium.start();
+            selenium.open ("http://localhost:8080/SampleWAR/");
+            selenium.type ("name", "Tom");
+            selenium.click ("submit");
+            selenium.waitForPageToLoad ("3000");
+            success = (selenium.getHtmlSource().indexOf ("says hello to") > 0);
+
+            selenium.stop();
+        } catch (Exception e) {
             e.printStackTrace();
+            success = false;
         }
-        assertTrue (success);
+        return success;
     }
 }

Modified: geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.v22/test.xml
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.v22/test.xml?rev=736695&r1=736694&r2=736695&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.v22/test.xml
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/testsuite/plugins/org.apache.geronimo.testsuite.v22/test.xml
Thu Jan 22 08:36:14 2009
@@ -74,7 +74,7 @@
         <!--
          #########################################################################
          ##                                                                     ##
-         ## Check UI Installation testcase                                      ##
+         ## Run all test case plugins                                           ##
          ##                                                                     ##
          #########################################################################
          -->
@@ -85,67 +85,6 @@
                       value="org.apache.geronimo.testsuite.v22.ui.EclipseUITest"/>
         </ant>
 
-
-        <!--
-         #########################################################################
-         ##                                                                     ##
-         ## Run on Server 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.v22.ui.RunOnServerTest"/>
-        </ant>
-
-
-        <!--
-         #########################################################################      
                                                              ##
-         ##                                                                     ##
-         ## Shared Lib Pojo 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.v22.ui.SharedLibPojoTest"/>
-        </ant>
-    
-    
-        <!-- 
-         #########################################################################
-         ##                                                                     ##
-         ## Define new server 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.v22.ui.NewServerTest"/>
-        </ant>
-
-
-        <!-- 
-         #########################################################################
-         ##                                                                     ##
-         ## 5 minute tutorial 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.v22.ui.Tutorial5MinuteTest"/>
-        </ant>
-
-
     </target>
 
     <!-- This target holds code to cleanup the testing environment after -->



Mime
View raw message