[jbosstools-commits] JBoss Tools SVN: r41155 - in trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test: dialog/preferences and 3 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Fri May 18 10:05:07 EDT 2012


Author: ljelinko
Date: 2012-05-18 10:05:06 -0400 (Fri, 18 May 2012)
New Revision: 41155

Added:
   trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/dialog/preferences/PreferencesDialog.java
   trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/dialog/preferences/SeamPreferencesDialog.java
   trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/seam/seam22/CheckSeam22.java
   trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/seam/seam23/CheckSeam23.java
   trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/template/CheckSeamRuntimeTemplate.java
Modified:
   trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/AllTestsSuite.java
   trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/dialog/preferences/RuntimeDetectionPreferencesDialog.java
   trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/seam/seam22/DetectSeam22.java
   trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/seam/seam23/DetectSeam23.java
Log:
Added seam tests.

Modified: trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/AllTestsSuite.java
===================================================================
--- trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/AllTestsSuite.java	2012-05-18 13:59:58 UTC (rev 41154)
+++ trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/AllTestsSuite.java	2012-05-18 14:05:06 UTC (rev 41155)
@@ -1,6 +1,8 @@
 package org.jboss.tools.runtime.as.ui.bot.test;
 
+import org.jboss.tools.runtime.as.ui.bot.test.seam.seam22.CheckSeam22;
 import org.jboss.tools.runtime.as.ui.bot.test.seam.seam22.DetectSeam22;
+import org.jboss.tools.runtime.as.ui.bot.test.seam.seam23.CheckSeam23;
 import org.jboss.tools.runtime.as.ui.bot.test.seam.seam23.DetectSeam23;
 import org.jboss.tools.runtime.as.ui.bot.test.server.eap4.DetectEAP4;
 import org.jboss.tools.runtime.as.ui.bot.test.server.eap4.OperateEAP4;
@@ -44,8 +46,10 @@
 		OperateSOAP5.class, 
 		DetectSOAPStandalone5.class, 
 		OperateSOAPStandalone5.class,
-		DetectSeam22.class, 
-		DetectSeam23.class
+		DetectSeam22.class,
+		CheckSeam22.class,
+		DetectSeam23.class,
+		CheckSeam23.class
 })
 public class AllTestsSuite {
 

Added: trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/dialog/preferences/PreferencesDialog.java
===================================================================
--- trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/dialog/preferences/PreferencesDialog.java	                        (rev 0)
+++ trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/dialog/preferences/PreferencesDialog.java	2012-05-18 14:05:06 UTC (rev 41155)
@@ -0,0 +1,17 @@
+package org.jboss.tools.runtime.as.ui.bot.test.dialog.preferences;
+
+import org.jboss.tools.ui.bot.ext.SWTBotFactory;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem.Preference;
+import org.jboss.tools.ui.bot.ext.gen.IPreference;
+
+public class PreferencesDialog {
+
+	protected void open(String... path){
+		IPreference preference = Preference.create(path);
+		SWTBotFactory.getOpen().preferenceOpen(preference);
+	}
+	
+	public void ok(){
+		SWTBotFactory.getBot().button("OK").click();
+	}
+}

Modified: trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/dialog/preferences/RuntimeDetectionPreferencesDialog.java
===================================================================
--- trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/dialog/preferences/RuntimeDetectionPreferencesDialog.java	2012-05-18 13:59:58 UTC (rev 41154)
+++ trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/dialog/preferences/RuntimeDetectionPreferencesDialog.java	2012-05-18 14:05:06 UTC (rev 41155)
@@ -7,14 +7,11 @@
 import org.jboss.tools.runtime.core.model.RuntimePath;
 import org.jboss.tools.runtime.ui.RuntimeUIActivator;
 import org.jboss.tools.ui.bot.ext.SWTBotFactory;
-import org.jboss.tools.ui.bot.ext.gen.ActionItem.Preference;
-import org.jboss.tools.ui.bot.ext.gen.IPreference;
 
-public class RuntimeDetectionPreferencesDialog {
+public class RuntimeDetectionPreferencesDialog extends PreferencesDialog{
 
 	public void open(){
-		IPreference preference = Preference.create("JBoss Tools", "JBoss Tools Runtime Detection");
-		SWTBotFactory.getOpen().preferenceOpen(preference);
+		open("JBoss Tools", "JBoss Tools Runtime Detection");
 	}
 	
 	public SearchingForRuntimesDialog addPath(final String path){
@@ -38,10 +35,6 @@
 		SWTBotFactory.getBot().button("Remove").click();
 	}
 	
-	public void ok(){
-		SWTBotFactory.getBot().button("OK").click();
-	}
-	
 	public SearchingForRuntimesDialog search(){
 		SWTBotFactory.getBot().button("Search...").click();
 		return new SearchingForRuntimesDialog();

Added: trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/dialog/preferences/SeamPreferencesDialog.java
===================================================================
--- trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/dialog/preferences/SeamPreferencesDialog.java	                        (rev 0)
+++ trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/dialog/preferences/SeamPreferencesDialog.java	2012-05-18 14:05:06 UTC (rev 41155)
@@ -0,0 +1,45 @@
+package org.jboss.tools.runtime.as.ui.bot.test.dialog.preferences;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.keyboard.KeyboardFactory;
+import org.eclipse.swtbot.swt.finder.keyboard.Keystrokes;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
+import org.jboss.tools.runtime.as.ui.bot.test.entity.Runtime;
+import org.jboss.tools.ui.bot.ext.SWTBotFactory;
+
+public class SeamPreferencesDialog extends PreferencesDialog {
+
+	public void open(){
+		open("JBoss Tools", "Web", "Seam");
+	}
+	
+	public List<Runtime> getRuntimes(){
+		List<Runtime> runtimes = new ArrayList<Runtime>();
+		
+		SWTBotTable table = SWTBotFactory.getBot().table();
+		
+		for (int i = 0; i < table.rowCount(); i++){
+			Runtime runtime = new Runtime();
+			runtime.setName(table.cell(i, 1));
+			runtime.setVersion(table.cell(i, 2));
+			runtime.setLocation(table.cell(i, 3));
+			runtimes.add(runtime);
+		}
+		return runtimes;
+	}
+	
+	public void removeAllRuntimes(){
+		SWTBot bot = SWTBotFactory.getBot();
+		SWTBotTable table = bot.table();
+		
+		for (int i = 0; i < table.rowCount(); i++){
+			table.click(0, 0);
+			bot.button("Remove").click();
+			KeyboardFactory.getAWTKeyboard().pressShortcut(Keystrokes.RIGHT, Keystrokes.CR, Keystrokes.LF);
+			bot.shell("Preferences").activate();
+		}
+	}
+}

Added: trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/seam/seam22/CheckSeam22.java
===================================================================
--- trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/seam/seam22/CheckSeam22.java	                        (rev 0)
+++ trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/seam/seam22/CheckSeam22.java	2012-05-18 14:05:06 UTC (rev 41155)
@@ -0,0 +1,17 @@
+package org.jboss.tools.runtime.as.ui.bot.test.seam.seam22;
+
+import org.jboss.tools.runtime.as.ui.bot.test.RuntimeProperties;
+import org.jboss.tools.runtime.as.ui.bot.test.entity.Runtime;
+import org.jboss.tools.runtime.as.ui.bot.test.template.CheckSeamRuntimeTemplate;
+
+public class CheckSeam22 extends CheckSeamRuntimeTemplate {
+
+	@Override
+	protected Runtime getExpectedRuntime() {
+		Runtime server = new Runtime();
+		server.setName("Seam " + DetectSeam22.SEAM_ID + " 2.2");
+		server.setVersion("2.2");
+		server.setLocation(RuntimeProperties.getInstance().getRuntimePath(DetectSeam22.SEAM_ID));
+		return server;
+	}
+}

Modified: trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/seam/seam22/DetectSeam22.java
===================================================================
--- trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/seam/seam22/DetectSeam22.java	2012-05-18 13:59:58 UTC (rev 41154)
+++ trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/seam/seam22/DetectSeam22.java	2012-05-18 14:05:06 UTC (rev 41155)
@@ -8,6 +8,8 @@
 
 	public static final String SEAM_ID = "jboss-seam-2.2.2.Final";
 	
+	public static final String VERSION = "2.2.2.Final";
+	
 	@Override
 	protected String getRuntimeID() {
 		return SEAM_ID;
@@ -18,7 +20,7 @@
 		Runtime server = new Runtime();
 		server.setName(getRuntimeID());
 		server.setType("SEAM");
-		server.setVersion("2.2.2.Final");
+		server.setVersion(VERSION);
 		server.setLocation(RuntimeProperties.getInstance().getRuntimePath(getRuntimeID()));
 		return server;
 	}

Added: trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/seam/seam23/CheckSeam23.java
===================================================================
--- trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/seam/seam23/CheckSeam23.java	                        (rev 0)
+++ trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/seam/seam23/CheckSeam23.java	2012-05-18 14:05:06 UTC (rev 41155)
@@ -0,0 +1,17 @@
+package org.jboss.tools.runtime.as.ui.bot.test.seam.seam23;
+
+import org.jboss.tools.runtime.as.ui.bot.test.RuntimeProperties;
+import org.jboss.tools.runtime.as.ui.bot.test.entity.Runtime;
+import org.jboss.tools.runtime.as.ui.bot.test.template.CheckSeamRuntimeTemplate;
+
+public class CheckSeam23 extends CheckSeamRuntimeTemplate {
+
+	@Override
+	protected Runtime getExpectedRuntime() {
+		Runtime server = new Runtime();
+		server.setName("Seam " + DetectSeam23.SEAM_ID + " 2.3");
+		server.setVersion("2.3");
+		server.setLocation(RuntimeProperties.getInstance().getRuntimePath(DetectSeam23.SEAM_ID));
+		return server;
+	}
+}

Modified: trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/seam/seam23/DetectSeam23.java
===================================================================
--- trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/seam/seam23/DetectSeam23.java	2012-05-18 13:59:58 UTC (rev 41154)
+++ trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/seam/seam23/DetectSeam23.java	2012-05-18 14:05:06 UTC (rev 41155)
@@ -8,6 +8,8 @@
 
 	public static final String SEAM_ID = "jboss-seam-2.3.0.Beta1";
 	
+	public static final String VERSION = "2.3.0.Beta1";
+	
 	@Override
 	protected String getRuntimeID() {
 		return SEAM_ID;
@@ -18,7 +20,7 @@
 		Runtime server = new Runtime();
 		server.setName(getRuntimeID());
 		server.setType("SEAM");
-		server.setVersion("2.3.0.Beta1");
+		server.setVersion(VERSION);
 		server.setLocation(RuntimeProperties.getInstance().getRuntimePath(getRuntimeID()));
 		return server;
 	}

Added: trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/template/CheckSeamRuntimeTemplate.java
===================================================================
--- trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/template/CheckSeamRuntimeTemplate.java	                        (rev 0)
+++ trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/template/CheckSeamRuntimeTemplate.java	2012-05-18 14:05:06 UTC (rev 41155)
@@ -0,0 +1,32 @@
+package org.jboss.tools.runtime.as.ui.bot.test.template;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+
+import org.jboss.tools.runtime.as.ui.bot.test.dialog.preferences.SeamPreferencesDialog;
+import org.jboss.tools.runtime.as.ui.bot.test.entity.Runtime;
+import org.jboss.tools.runtime.as.ui.bot.test.matcher.RuntimeMatcher;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.junit.After;
+import org.junit.Test;
+
+public abstract class CheckSeamRuntimeTemplate extends SWTTestExt {
+
+	private SeamPreferencesDialog seamPreferences = new SeamPreferencesDialog();
+	
+	protected abstract Runtime getExpectedRuntime();
+	
+	@Test
+	public void checkSeamRuntime(){
+		seamPreferences.open();
+		
+		assertThat(seamPreferences.getRuntimes().size(), is(1));
+		assertThat(seamPreferences.getRuntimes().get(0), new RuntimeMatcher(getExpectedRuntime()));
+	}
+	
+	@After
+	public void cleanup(){
+		seamPreferences.removeAllRuntimes();
+		seamPreferences.ok();
+	}
+}



More information about the jbosstools-commits mailing list