You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by mc...@apache.org on 2008/11/04 05:04:29 UTC

svn commit: r711169 - in /geronimo/devtools/eclipse-plugin/branches/2.1.4/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...

Author: mcconne
Date: Mon Nov  3 20:04:28 2008
New Revision: 711169

URL: http://svn.apache.org/viewvc?rev=711169&view=rev
Log:
GERONIMODEVTOOLS-528 Eliminate duplicate code in testsuite plugins

Removed:
    geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.common/src/main/java/org/apache/geronimo/testsuite/common/ui/Tutorial5Minute.java
Modified:
    geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.common/src/main/java/org/apache/geronimo/testsuite/common/ui/ProjectTasks.java
    geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v20/src/main/java/org/apache/geronimo/testsuite/v20/ui/Tutorial5MinuteTest.java
    geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/java/org/apache/geronimo/testsuite/v21/ui/Tutorial5MinuteTest.java

Modified: geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.common/src/main/java/org/apache/geronimo/testsuite/common/ui/ProjectTasks.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.common/src/main/java/org/apache/geronimo/testsuite/common/ui/ProjectTasks.java?rev=711169&r1=711168&r2=711169&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.common/src/main/java/org/apache/geronimo/testsuite/common/ui/ProjectTasks.java (original)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.common/src/main/java/org/apache/geronimo/testsuite/common/ui/ProjectTasks.java Mon Nov  3 20:04:28 2008
@@ -19,6 +19,8 @@
 
 import java.io.FileInputStream;
 
+import org.apache.geronimo.testsuite.common.AssertUtil;
+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;
@@ -157,6 +159,10 @@
         // 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 deleteProject (String projectName) throws MultipleFoundException, NotFoundException {
@@ -169,4 +175,20 @@
         aHelper.waitForDialogDisposal (questionShell);
     }
 
+    public void webTesting () throws Exception {
+        EclipseSelenium selenium = new EclipseSelenium();
+        selenium.start();
+        selenium.open( "http://localhost:8080/SampleWAR/");
+        selenium.type("name", "Tom");
+        selenium.click("submit");
+        selenium.waitForPageToLoad( "3000" );
+        AssertUtil.assertTrue(selenium.getHtmlSource().indexOf( "says hello to" ) > 0);
+
+        // 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!");
+        selenium.stop();
+    }
 }

Modified: geronimo/devtools/eclipse-plugin/branches/2.1.4/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/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v20/src/main/java/org/apache/geronimo/testsuite/v20/ui/Tutorial5MinuteTest.java?rev=711169&r1=711168&r2=711169&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v20/src/main/java/org/apache/geronimo/testsuite/v20/ui/Tutorial5MinuteTest.java (original)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v20/src/main/java/org/apache/geronimo/testsuite/v20/ui/Tutorial5MinuteTest.java Mon Nov  3 20:04:28 2008
@@ -1,97 +1,95 @@
-/*
- * 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);
-    }
-
-}
+/*
+ * 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.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();
+
+            projectTasks.createProjects ();
+
+            serverTasks.publishAllProjects();
+            serverTasks.startServer();
+
+            projectTasks.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/branches/2.1.4/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/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/java/org/apache/geronimo/testsuite/v21/ui/Tutorial5MinuteTest.java?rev=711169&r1=711168&r2=711169&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/java/org/apache/geronimo/testsuite/v21/ui/Tutorial5MinuteTest.java (original)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/java/org/apache/geronimo/testsuite/v21/ui/Tutorial5MinuteTest.java Mon Nov  3 20:04:28 2008
@@ -23,7 +23,6 @@
 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.core.resources.IWorkspace;
 import org.eclipse.core.resources.ResourcesPlugin;
@@ -74,13 +73,12 @@
             // create server from an installed instance
             serverTasks.createServer();
 
-            Tutorial5Minute tutorial = new Tutorial5Minute (workbenchShell, aHelper);
-            tutorial.createProjects ();
+            projectTasks.createProjects ();
 
             serverTasks.publishAllProjects();
             serverTasks.startServer();
 
-            tutorial.webTesting();
+            projectTasks.webTesting();
 
             serverTasks.stopServer();