[jbosstools-commits] JBoss Tools SVN: r43043 - in branches/jbosstools-3.3.x/openshift/tests/org.jboss.tools.openshift.ui.bot.test: src/org/jboss/tools/openshift/ui/bot/test/explorer and 1 other directory.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Wed Aug 15 07:48:32 EDT 2012


Author: sbunciak
Date: 2012-08-15 07:48:31 -0400 (Wed, 15 Aug 2012)
New Revision: 43043

Modified:
   branches/jbosstools-3.3.x/openshift/tests/org.jboss.tools.openshift.ui.bot.test/OpenShiftBotTests.launch
   branches/jbosstools-3.3.x/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/CreateApp.java
   branches/jbosstools-3.3.x/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/CreateDomain.java
   branches/jbosstools-3.3.x/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/DeleteDomain.java
Log:
OpenShift SWTBot tests: added creation of ssh keys.

Modified: branches/jbosstools-3.3.x/openshift/tests/org.jboss.tools.openshift.ui.bot.test/OpenShiftBotTests.launch
===================================================================
--- branches/jbosstools-3.3.x/openshift/tests/org.jboss.tools.openshift.ui.bot.test/OpenShiftBotTests.launch	2012-08-15 11:20:01 UTC (rev 43042)
+++ branches/jbosstools-3.3.x/openshift/tests/org.jboss.tools.openshift.ui.bot.test/OpenShiftBotTests.launch	2012-08-15 11:48:31 UTC (rev 43043)
@@ -31,7 +31,7 @@
 <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
 <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.jboss.tools.openshift.ui.bot.test"/>
 <stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dosgi.requiredJavaVersion=1.5 -XX:MaxPermSize=256m -Xms40m -Xmx512m -Dswtbot.test.properties.file=${env_var:HOME}/swtbot.properties -Dusage_reporting_enabled=false"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dosgi.requiredJavaVersion=1.5 -XX:MaxPermSize=256m -Xms40m -Xmx512m -Dswtbot.test.properties.file=${project_loc}/resources/swtbot.properties -Dusage_reporting_enabled=false"/>
 <stringAttribute key="pde.version" value="3.3"/>
 <stringAttribute key="product" value="org.eclipse.platform.ide"/>
 <booleanAttribute key="show_selected_only" value="false"/>

Modified: branches/jbosstools-3.3.x/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/CreateApp.java
===================================================================
--- branches/jbosstools-3.3.x/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/CreateApp.java	2012-08-15 11:20:01 UTC (rev 43042)
+++ branches/jbosstools-3.3.x/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/CreateApp.java	2012-08-15 11:48:31 UTC (rev 43043)
@@ -72,17 +72,22 @@
 
 		log.info("*** OpenShift SWTBot Tests: Application creation started. ***");
 
-		// only for the 1st time
-		// bot.waitForShell("Question", 500);
-		// bot.button(IDELabel.Button.YES).click();
+		// only for the 1st time - with known_hosts deleting it will appear every time
+		// add to known_hosts
+		bot.waitForShell("Question", TIME_60S * 3);
+		bot.button(IDELabel.Button.YES).click();
+		// create known_hosts since it does not exists any more
+		bot.waitForShell("Question", TIME_60S * 3);
+		bot.button(IDELabel.Button.YES).click();
+		
 
-		bot.waitForShell("Information", 500);
+		bot.waitForShell("Information", TIME_60S * 3);
 		bot.text(0).setText(TestProperties.get("openshift.user.pwd"));
 		bot.button(IDELabel.Button.OK).click();
 
 		log.info("*** OpenShift SWTBot Tests: SSH passphrase given. ***");
 
-		bot.waitUntil(Conditions.shellCloses(bot.activeShell()), TIME_60S);
+		bot.waitUntil(Conditions.shellCloses(bot.activeShell()), TIME_60S, TIME_1S);
 
 		log.info("*** OpenShift SWTBot Tests: New Application wizard closed. ***");
 

Modified: branches/jbosstools-3.3.x/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/CreateDomain.java
===================================================================
--- branches/jbosstools-3.3.x/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/CreateDomain.java	2012-08-15 11:20:01 UTC (rev 43042)
+++ branches/jbosstools-3.3.x/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/CreateDomain.java	2012-08-15 11:48:31 UTC (rev 43043)
@@ -4,6 +4,7 @@
 
 import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
 import org.eclipse.swtbot.swt.finder.waits.Conditions;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
 import org.jboss.tools.openshift.ui.bot.util.OpenShiftUI;
 import org.jboss.tools.openshift.ui.bot.util.TestProperties;
@@ -25,15 +26,16 @@
 
 	@Before
 	public void prepareSSHPrefs() {
-		// clear dir from libra stuff
-
+		// clear dir from libra stuff so wizard can create new
 		File sshDir = new File(System.getProperty("user.home") + "/.ssh");
 
 		if (sshDir.exists() && sshDir.isDirectory()
 				&& sshDir.listFiles().length > 0) {
 			for (File file : sshDir.listFiles()) {
 				if (file.getName().contains("id_rsa"))
-					keyAvailable = true;
+					file.delete();
+				if (file.getName().contains("known_hosts"))
+					file.delete();
 			}
 		}
 
@@ -60,25 +62,26 @@
 		domainText.setText(TestProperties.get("openshift.domain"));
 		log.info("*** OpenShift SWTBot Tests: Domain name set. ***");
 
+		SWTBotButton finishBtn = bot.button(IDELabel.Button.FINISH);
+		
 		if (keyAvailable) {
 
-			assertTrue("SSH key should be set!",bot.text(1).getText().contains("id_rsa"));
-			
+			assertTrue("SSH key should be set!", bot.text(1).getText()
+					.contains("id_rsa"));
+
 		} else {
-			throw new UnsupportedOperationException(
-					"Creation of ssh key not implemented yet.");
-			/*
-			 * bot.button(IDELabel.Shell.NEW).click();
-			 * bot.waitForShell(OpenShiftUI.Shell.NEW_SSH);
-			 * bot.text(0).setText(TestProperties.getPassphrase());
-			 * bot.button(IDELabel.Button.OK).click();
-			 * bot.waitForShell(OpenShiftUI.Shell.DOMAIN);
-			 * 
-			 * log.info("*** OpenShift SWTBot Tests: SSH Keys created. ***");
-			 */
+
+			bot.button(IDELabel.Shell.NEW).click();
+			bot.waitForShell(OpenShiftUI.Shell.NEW_SSH);
+			bot.text(0).setText(TestProperties.get("openshift.user.pwd"));
+			bot.button(IDELabel.Button.OK).click();
+			bot.waitForShell(OpenShiftUI.Shell.DOMAIN);
+
+			log.info("*** OpenShift SWTBot Tests: SSH Keys created. ***");
 		}
 
-		bot.button(IDELabel.Button.FINISH).click();
+		bot.waitUntil(Conditions.widgetIsEnabled(finishBtn));
+		finishBtn.click();
 
 		// wait while the domain is being created
 		bot.waitUntil(Conditions.shellCloses(bot.activeShell()), TIME_60S);

Modified: branches/jbosstools-3.3.x/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/DeleteDomain.java
===================================================================
--- branches/jbosstools-3.3.x/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/DeleteDomain.java	2012-08-15 11:20:01 UTC (rev 43042)
+++ branches/jbosstools-3.3.x/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/DeleteDomain.java	2012-08-15 11:48:31 UTC (rev 43043)
@@ -19,7 +19,7 @@
 				.getTreeItem(TestProperties.get("openshift.user.name"))
 				.contextMenu(OpenShiftUI.Labels.REFRESH).click();
 
-		bot.waitWhile(new NonSystemJobRunsCondition(), TIME_UNLIMITED);
+		bot.waitWhile(new NonSystemJobRunsCondition(), TIME_60S * 3, TIME_1S);
 		
 		// delete
 		explorer.bot().tree()
@@ -29,6 +29,6 @@
 		bot.checkBox().select();
 		bot.button("OK").click();
 
-		bot.waitWhile(new NonSystemJobRunsCondition(), TIME_60S + TIME_30S);		
+		bot.waitWhile(new NonSystemJobRunsCondition(), TIME_60S * 3, TIME_1S);		
 	}
 }



More information about the jbosstools-commits mailing list