[jbosstools-commits] JBoss Tools SVN: r42923 - in trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test: src/org/jboss/tools/openshift/ui/bot/test and 3 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Wed Aug 8 08:55:59 EDT 2012


Author: sbunciak
Date: 2012-08-08 08:55:59 -0400 (Wed, 08 Aug 2012)
New Revision: 42923

Added:
   trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/
   trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/Connection.java
   trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/CreateApp.java
   trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/CreateDomain.java
   trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/DeleteApp.java
   trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/DeleteDomain.java
   trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/EmbedCartrides.java
   trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/RenameDomain.java
   trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/wizard/
   trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/wizard/RepublishApp.java
Removed:
   trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/CreateAppAS7.java
   trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/CreateDomain.java
   trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/DeleteAppAS7.java
   trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/DestroyDomain.java
   trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/EmbeddCartrides.java
   trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/RenameDomain.java
   trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/RepublishAppASS7.java
   trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/SSHKeyManagement.java
   trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/ValidateCredentials.java
   trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/util/DomainDestroyer.java
Modified:
   trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/resources/openshift.ui.bot.test.properties
   trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/OpenShiftAllBotTests.java
   trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/util/OpenShiftUI.java
   trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/util/TestProperties.java
Log:
Refactored OpenShift SWTBot tests.

Modified: trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/resources/openshift.ui.bot.test.properties
===================================================================
--- trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/resources/openshift.ui.bot.test.properties	2012-08-08 12:52:55 UTC (rev 42922)
+++ trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/resources/openshift.ui.bot.test.properties	2012-08-08 12:55:59 UTC (rev 42923)
@@ -1,8 +1,7 @@
-openshift.user.name=sbunciak
+openshift.user.name=sbunciak+jbt at redhat.com
 openshift.user.pwd=rhtest123
 openshift.jbossapp.name=jbossapp
 openshift.jbossapp.cartridges=mysql;cron
 openshift.user.wrongpwd=rhtest
 openshift.domain=rhtestdomain
 openshift.domain.new=rhtest
-openshift.ssh.passphrase=dXZlZ2VsNFJPVj8\=

Deleted: trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/CreateAppAS7.java
===================================================================
--- trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/CreateAppAS7.java	2012-08-08 12:52:55 UTC (rev 42922)
+++ trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/CreateAppAS7.java	2012-08-08 12:55:59 UTC (rev 42923)
@@ -1,57 +0,0 @@
-package org.jboss.tools.openshift.ui.bot.test;
-
-import org.eclipse.swtbot.swt.finder.waits.Conditions;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo;
-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;
-import org.jboss.tools.ui.bot.ext.SWTTestExt;
-import org.jboss.tools.ui.bot.ext.types.IDELabel;
-import org.junit.Test;
-
-public class CreateAppAS7 extends SWTTestExt {
-
-	@Test
-	public void canCreateApplication() {
-
-		SWTBotText appNameText = bot.textInGroup("New application", 0);
-		bot.waitUntil(Conditions.widgetIsEnabled(appNameText));
-		
-		assertTrue("App name should be empty!", appNameText.getText()
-				.equals(""));
-
-		appNameText.setText(TestProperties
-				.getProperty("openshift.jbossapp.name"));
-		
-		log.info("OpenShift SWTBot Tests: Application name set.");
-		
-		SWTBotCombo appTypeCombo = bot.comboBoxInGroup("New application");
-		bot.waitUntil(Conditions.widgetIsEnabled(appNameText));
-		appTypeCombo.setSelection(OpenShiftUI.AppType.JBOSS);
-		
-		log.info("OpenShift SWTBot Tests: Application type selected.");
-		
-		bot.button(IDELabel.Button.NEXT).click();
-
-		bot.waitUntil(Conditions.widgetIsEnabled(bot
-				.button(IDELabel.Button.FINISH)));
-		bot.button(IDELabel.Button.FINISH).click();
-
-		log.info("OpenShift SWTBot Tests: Application creation started.");
-		
-		bot.waitForShell("Information", 500);
-		bot.text(0).setText(TestProperties.getPassphrase());
-		bot.button(IDELabel.Button.OK).click();
-
-		log.info("OpenShift SWTBot Tests: SSH passphrase given.");
-		
-		bot.waitUntil(Conditions.shellCloses(bot.activeShell()), TIME_20S);
-		
-		log.info("OpenShift SWTBot Tests: 'New Application wizard' was closed.");
-		
-		assertNotNull("OpenShift Server runtime is not in the Servers View!",
-				servers.findServerByName(servers.show().bot().tree(),
-						TestProperties.getProperty("openshift.jbossapp.name")));
-	}
-
-}

Deleted: trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/CreateDomain.java
===================================================================
--- trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/CreateDomain.java	2012-08-08 12:52:55 UTC (rev 42922)
+++ trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/CreateDomain.java	2012-08-08 12:55:59 UTC (rev 42923)
@@ -1,63 +0,0 @@
-package org.jboss.tools.openshift.ui.bot.test;
-
-import org.eclipse.swtbot.swt.finder.SWTBot;
-import org.eclipse.swtbot.swt.finder.waits.ICondition;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
-import org.jboss.tools.openshift.ui.bot.util.TestProperties;
-import org.jboss.tools.ui.bot.ext.SWTTestExt;
-import org.jboss.tools.ui.bot.ext.condition.NonSystemJobRunsCondition;
-import org.jboss.tools.ui.bot.ext.types.IDELabel;
-import org.junit.Test;
-
-/**
- * Domain creation consists of creating the SSH key pair, storing user password
- * in the secure storage and creating the domain itself.
- * 
- * @author sbunciak
- * 
- */
-public class CreateDomain extends SWTTestExt {
-
-	@Test
-	public void canCreateDomain() throws InterruptedException {
-
-			SWTBotText domainText = bot.text(0);
-			
-			assertTrue("Domain should not be set at this stage!", domainText
-					.getText().equals(""));
-
-			domainText.setText(TestProperties.getProperty("openshift.domain"));
-			bot.button(IDELabel.Button.FINISH).click();
-
-			log.info("OpenShift SWTBot Tests: Domain name set.");
-			
-			// wait while the domain is being created
-			bot.waitWhile(new ICondition() {
-				@Override
-				public boolean test() {
-					return bot.shell(IDELabel.Shell.SECURE_STORAGE).isVisible();
-				}
-
-				@Override
-				public void init(SWTBot bot) {
-					// keep empty
-				}
-
-				@Override
-				public String getFailureMessage() {
-					return "Domain creation wizard still visible in user account after reasonable timeout.";
-				}
-				
-			}, TIME_20S, TIME_1S);
-			
-			log.info("OpenShift SWTBot Tests: Domain created.");
-			log.info("OpenShift SWTBot Tests: Waiting for 'New Application wizard'.");
-			
-			bot.waitForShell("New OpenShift Application", 100);
-			
-			log.info("OpenShift SWTBot Tests: 'New Application wizard' created.");
-			
-			bot.waitUntil(new NonSystemJobRunsCondition());
-	}
-
-}

Deleted: trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/DeleteAppAS7.java
===================================================================
--- trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/DeleteAppAS7.java	2012-08-08 12:52:55 UTC (rev 42922)
+++ trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/DeleteAppAS7.java	2012-08-08 12:55:59 UTC (rev 42923)
@@ -1,78 +0,0 @@
-package org.jboss.tools.openshift.ui.bot.test;
-
-import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
-import org.eclipse.swtbot.swt.finder.SWTBot;
-import org.eclipse.swtbot.swt.finder.waits.ICondition;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
-import org.jboss.tools.openshift.ui.bot.util.OpenShiftUI;
-import org.jboss.tools.openshift.ui.bot.util.TestProperties;
-import org.jboss.tools.ui.bot.ext.SWTTestExt;
-import org.jboss.tools.ui.bot.ext.types.IDELabel;
-import org.junit.Test;
-
-public class DeleteAppAS7 extends SWTTestExt {
-		
-	SWTBotTreeItem account;
-	
-	@Test
-	public void canDeleteApplication() {
-		projectExplorer.show();
-		projectExplorer.bot().tree(0).contextMenu("Delete").click();
-
-		bot.waitForShell("Delete Resources");
-		bot.checkBox().select();
-		bot.button(IDELabel.Button.OK).click();
-
-		assertFalse("The project still exists!",
-				projectExplorer.existsResource(TestProperties
-						.getProperty("openshift.jbossapp.name")));
-
-		SWTBotView openshiftConsole = open.viewOpen(OpenShiftUI.Console.iView);
-
-		SWTBot consoleBot = openshiftConsole.bot();
-
-		account = consoleBot.tree()
-				.expandNode(TestProperties.getProperty("openshift.user.name"))
-				.doubleClick();
-
-		account.getNode(0).contextMenu("Delete Application").click();
-
-		bot.waitForShell("Application deletion");
-
-		bot.button(IDELabel.Button.OK).click();
-		bot.waitWhile(new ICondition() {
-			@Override
-			public boolean test() throws Exception {
-				return account.getItems().length > 0;
-			}
-
-			@Override
-			public void init(SWTBot bot) {
-				// keep empty
-			}
-
-			@Override
-			public String getFailureMessage() {
-				return "Application is still present in user account after reasonable timeout.";
-			}
-			
-		}, TIME_60S, TIME_1S);
-
-		
-		/*
-		 * TODO
-		 * 
-		 * // delete jenkins if present if (account.getNode("jenkins") != null)
-		 * { account.getNode("jenkins").contextMenu("Delete Application");
-		 * 
-		 * bot.waitForShell("Application deletion");
-		 * bot.button(IDELabel.Button.OK).click();
-		 * 
-		 * bot.waitUntil(new NonSystemJobRunsCondition()); }
-		 */
-		assertTrue("Application still present in the OpenShift Console view!",
-				account.getItems().length == 0);
-
-	}
-	
-}

Deleted: trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/DestroyDomain.java
===================================================================
--- trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/DestroyDomain.java	2012-08-08 12:52:55 UTC (rev 42922)
+++ trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/DestroyDomain.java	2012-08-08 12:55:59 UTC (rev 42923)
@@ -1,27 +0,0 @@
-package org.jboss.tools.openshift.ui.bot.test;
-
-import org.jboss.tools.openshift.ui.bot.util.DomainDestroyer;
-import org.jboss.tools.openshift.ui.bot.util.TestProperties;
-import org.jboss.tools.ui.bot.ext.SWTTestExt;
-import org.junit.Test;
-
-public class DestroyDomain extends SWTTestExt {
-
-	/*
-	 * Since there is no way how to destroy a domain from JBoss Tools, we need
-	 * to use OpenShift REST API to clean the account
-	 */
-	@Test
-	public void canDestroyDomain() {
-
-		// destroy domain
-		int resp_code = DomainDestroyer.destroyDomain(
-				TestProperties.getProperty("openshift.domain.new"),
-				TestProperties.getProperty("openshift.user.name"),
-				TestProperties.getProperty("openshift.user.pwd"));
-
-		assertTrue("Trying to destroy domain: HTTP Response code is not 200.",
-				resp_code == 200);
-
-	}
-}

Deleted: trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/EmbeddCartrides.java
===================================================================
--- trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/EmbeddCartrides.java	2012-08-08 12:52:55 UTC (rev 42922)
+++ trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/EmbeddCartrides.java	2012-08-08 12:55:59 UTC (rev 42923)
@@ -1,83 +0,0 @@
-package org.jboss.tools.openshift.ui.bot.test;
-
-import java.util.StringTokenizer;
-
-import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
-import org.jboss.tools.openshift.ui.bot.util.OpenShiftUI;
-import org.jboss.tools.openshift.ui.bot.util.TestProperties;
-import org.jboss.tools.ui.bot.ext.SWTTestExt;
-import org.jboss.tools.ui.bot.ext.condition.NonSystemJobRunsCondition;
-import org.jboss.tools.ui.bot.ext.types.IDELabel;
-import org.junit.Test;
-
-public class EmbeddCartrides extends SWTTestExt {
-
-	@Test
-	public void canEmbeddCartriges() {
-
-		SWTBotView openshiftConsole = open.viewOpen(OpenShiftUI.Console.iView);
-
-		SWTBotTreeItem account = openshiftConsole.bot().tree()
-				.expandNode(TestProperties.getProperty("openshift.user.name"))
-				.doubleClick();
-
-		account.getNode(0).contextMenu("Edit Embeddable Cartridges").click();
-
-		StringTokenizer tokenizer = new StringTokenizer(
-				TestProperties.getProperty("openshift.jbossapp.cartridges"),
-				";");
-
-		bot.waitForShell("");
-		
-		SWTBotTable cartridgeTable = bot.tableInGroup("Embeddable Cartridges");
-
-		selectCartridges(tokenizer, cartridgeTable);
-
-		bot.button(IDELabel.Button.FINISH).click();
-
-		bot.waitForShell("Embedded Cartridges");
-		bot.button(IDELabel.Button.OK).click();
-	}
-
-	private void selectCartridges(StringTokenizer tokenizer,
-			SWTBotTable cartridgeTable) {
-		
-		while (tokenizer.hasMoreTokens()) {
-
-			String cartridge = tokenizer.nextToken();
-			System.out.println(cartridge);
-			if (cartridge.equals("jenkins")) {
-				cartridgeTable.getTableItem(OpenShiftUI.Cartridge.JENKINS).toggleCheck();
-				bot.waitForShell("New Jenkins application");
-				bot.text(0).setText("jenkins");
-				bot.button(IDELabel.Button.OK).click();
-				//bot.waitUntil(condition, timeout)
-				bot.waitUntil(new NonSystemJobRunsCondition(), 200);
-			}
-			if (cartridge.equals("mysql")) {
-				cartridgeTable.getTableItem(OpenShiftUI.Cartridge.MYSQL).toggleCheck();
-			}
-			if (cartridge.equals("phpmyadmin")) {
-				cartridgeTable.getTableItem(OpenShiftUI.Cartridge.PHPMYADMIN).toggleCheck();
-			}
-			if (cartridge.equals("cron")) {
-				cartridgeTable.getTableItem(OpenShiftUI.Cartridge.CRON).toggleCheck();
-			}
-			if (cartridge.equals("postgresql")) {
-				cartridgeTable.getTableItem(OpenShiftUI.Cartridge.POSTGRESQL).toggleCheck();
-			}
-			if (cartridge.equals("mongodb")) {
-				cartridgeTable.getTableItem(OpenShiftUI.Cartridge.MONGODB).toggleCheck();
-			}
-			if (cartridge.equals("rockmongo")) {
-				cartridgeTable.getTableItem(OpenShiftUI.Cartridge.ROCKMONGO).toggleCheck();
-			}
-			if (cartridge.equals("metrics")) {
-				cartridgeTable.getTableItem(OpenShiftUI.Cartridge.METRICS).toggleCheck();
-			}
-		}
-	}
-
-}

Modified: trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/OpenShiftAllBotTests.java
===================================================================
--- trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/OpenShiftAllBotTests.java	2012-08-08 12:52:55 UTC (rev 42922)
+++ trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/OpenShiftAllBotTests.java	2012-08-08 12:55:59 UTC (rev 42923)
@@ -10,6 +10,14 @@
  ******************************************************************************/
 package org.jboss.tools.openshift.ui.bot.test;
 
+import org.jboss.tools.openshift.ui.bot.test.explorer.CreateApp;
+import org.jboss.tools.openshift.ui.bot.test.explorer.CreateDomain;
+import org.jboss.tools.openshift.ui.bot.test.explorer.DeleteApp;
+import org.jboss.tools.openshift.ui.bot.test.explorer.DeleteDomain;
+import org.jboss.tools.openshift.ui.bot.test.explorer.EmbedCartrides;
+import org.jboss.tools.openshift.ui.bot.test.explorer.RenameDomain;
+import org.jboss.tools.openshift.ui.bot.test.explorer.Connection;
+import org.jboss.tools.openshift.ui.bot.test.wizard.RepublishApp;
 import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
 import org.junit.runner.RunWith;
 import org.junit.runners.Suite.SuiteClasses;
@@ -19,35 +27,17 @@
  * <br>
  * This bot test will try to demonstrate a new OpenShift Application and domain life cycle. 
  * 
- * <br>
- * TestSuite covers following test cases :
- * <ul>
- * <li>JBDS50_XXXX User credentials validation</li>
- * <li></li>
- * <li>JBDS50_XXXX Domain is created, renamed correctly</li>
- * <li>JBDS50_XXXX App with JBossAS7 cartridge is created correctly via
- * OpenShift wizards</li>
- * <li>JBDS50_XXXX Embed jenkins etc. into OpenShift applications</li>
- * <li>JBDS50_XXXX App with JBossAS7 cartridge can be deleted</li>
- * <li>JBDS50_XXXX JBoss server adapter is created successfully</li>
- * <li>JBDS50_XXXX App with JBossAS7 cartridge can be modified and republished</li>
- * <li>JBDS50_XXXX SSH keys management</li>
- * </ul>
- * 
  * @author sbunciak
  */
 @SuiteClasses({
-
-ValidateCredentials.class, 
-SSHKeyManagement.class,
+Connection.class,
 CreateDomain.class,
-CreateAppAS7.class,
-EmbeddCartrides.class,
-RepublishAppASS7.class,
+CreateApp.class,
+EmbedCartrides.class,
+RepublishApp.class,
 RenameDomain.class,
-DeleteAppAS7.class, 
-DestroyDomain.class
-
+DeleteApp.class, 
+DeleteDomain.class
 })
 @RunWith(RequirementAwareSuite.class)
 public class OpenShiftAllBotTests {

Deleted: trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/RenameDomain.java
===================================================================
--- trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/RenameDomain.java	2012-08-08 12:52:55 UTC (rev 42922)
+++ trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/RenameDomain.java	2012-08-08 12:55:59 UTC (rev 42923)
@@ -1,54 +0,0 @@
-package org.jboss.tools.openshift.ui.bot.test;
-
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.methods.GetMethod;
-import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
-import org.eclipse.swtbot.swt.finder.waits.Conditions;
-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;
-import org.jboss.tools.ui.bot.ext.SWTTestExt;
-import org.jboss.tools.ui.bot.ext.types.IDELabel;
-import org.junit.Test;
-
-public class RenameDomain extends SWTTestExt {
-
-	@Test
-	public void canRenameDomain() {
-
-		SWTBotView openshiftConsole = open.viewOpen(OpenShiftUI.Console.iView);
-
-		openshiftConsole.bot().tree()
-				.getTreeItem(TestProperties.getProperty("openshift.user.name"))
-				.contextMenu("Create or Edit Domain").click();
-
-		bot.waitForShell("");
-		
-		SWTBotText domainText = bot.text(0);
-
-		assertTrue(
-				"Domain should be set correctly at this stage!",
-				domainText.getText().equals(
-						TestProperties.getProperty("openshift.domain")));
-
-		domainText.setText(TestProperties.getProperty("openshift.domain.new"));
-
-		bot.button(IDELabel.Button.FINISH).click();
-		bot.waitUntil(Conditions.shellCloses(bot.activeShell()), TIME_60S);
-		
-		HttpClient client = new HttpClient();
-		GetMethod method = new GetMethod("https://"
-				+ TestProperties.getProperty("openshift.jbossapp.name") + "-"
-				+ TestProperties.getProperty("openshift.domain.new")
-				+ ".rhcloud.com/Test.html");
-		
-		try {
-			assertTrue(client.executeMethod(method) == 200);
-		} catch (Exception e) {
-			log.error("File has not been published to the server!", e);
-		} finally {
-			method.releaseConnection();
-		}
-	}
-
-}

Deleted: trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/RepublishAppASS7.java
===================================================================
--- trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/RepublishAppASS7.java	2012-08-08 12:52:55 UTC (rev 42922)
+++ trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/RepublishAppASS7.java	2012-08-08 12:55:59 UTC (rev 42923)
@@ -1,59 +0,0 @@
-package org.jboss.tools.openshift.ui.bot.test;
-
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.methods.GetMethod;
-import org.eclipse.swtbot.swt.finder.SWTBot;
-import org.jboss.tools.openshift.ui.bot.util.TestProperties;
-import org.jboss.tools.ui.bot.ext.SWTTestExt;
-import org.jboss.tools.ui.bot.ext.gen.ActionItem;
-import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
-import org.jboss.tools.ui.bot.ext.types.IDELabel;
-import org.junit.Test;
-
-public class RepublishAppASS7 extends SWTTestExt {
-
-	@Test
-	public void canModifyAndRepublishApp() {
-		SWTBot wiz = open.newObject(ActionItem.NewObject.WebHTMLPage.LABEL);
-		wiz.text(0).setText(
-				TestProperties.getProperty("openshift.jbossapp.name")
-						+ "/src/main/webapp");
-		wiz.text(1).setText("Test.html");
-
-		wiz.button(IDELabel.Button.FINISH).click();
-
-		projectExplorer.show();
-		projectExplorer.bot().tree().select(0);
-		ContextMenuHelper.clickContextMenu(projectExplorer.bot().tree(),
-				"Team", "Commit and Push...");
-
-		bot.waitForShell("Commit Changes");
-		bot.styledText(0).setText("comment");
-		
-		bot.table().getTableItem(0).toggleCheck();
-		//bot.toolbarButtonWithTooltip("Select All").click();
-
-		bot.button("Commit").click();
-
-		bot.waitForShell("Push to Another Repository");
-		bot.button(IDELabel.Button.FINISH).click();
-
-		bot.waitForShell("Push Results: origin", 200);
-		bot.button(IDELabel.Button.OK).click();
-		
-		HttpClient client = new HttpClient();
-		GetMethod method = new GetMethod("https://"
-				+ TestProperties.getProperty("openshift.jbossapp.name") + "-"
-				+ TestProperties.getProperty("openshift.domain")
-				+ ".rhcloud.com/Test.html");
-
-		try {
-			assertTrue(client.executeMethod(method) == 200);
-		} catch (Exception e) {
-			log.error("File has not been published to the server!", e);
-		} finally {
-			method.releaseConnection();
-		}
-	}
-
-}

Deleted: trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/SSHKeyManagement.java
===================================================================
--- trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/SSHKeyManagement.java	2012-08-08 12:52:55 UTC (rev 42922)
+++ trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/SSHKeyManagement.java	2012-08-08 12:55:59 UTC (rev 42923)
@@ -1,50 +0,0 @@
-package org.jboss.tools.openshift.ui.bot.test;
-
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.swtbot.eclipse.finder.matchers.WidgetMatcherFactory;
-import org.eclipse.swtbot.swt.finder.waits.Conditions;
-import org.hamcrest.Matcher;
-import org.jboss.tools.openshift.ui.bot.util.TestProperties;
-import org.jboss.tools.ui.bot.ext.SWTTestExt;
-import org.jboss.tools.ui.bot.ext.types.IDELabel;
-import org.junit.Test;
-
-public class SSHKeyManagement extends SWTTestExt {
-	
-	@Test
-	public void canCreateSSHKey() {
-
-		bot.waitForShell("", 100);
-
-		@SuppressWarnings("unchecked")
-		Matcher<Widget> matcher = WidgetMatcherFactory.allOf(
-				WidgetMatcherFactory.widgetOfType(Shell.class),
-				WidgetMatcherFactory.withText(""));
-
-		bot.waitUntilWidgetAppears(Conditions.waitForWidget(matcher));
-
-		log.info("OpenShift SWTBot Tests: SSH Keys creation.");
-		
-		bot.link(0).click("SSH2 Preferences");
-		bot.waitForShell(IDELabel.Shell.PREFERENCES);
-
-		log.info("OpenShift SWTBot Tests: SSH Preferences opened.");
-		
-		//SWTBotText sshDirText = bot.text(1);
-		//sshDirText.setText(System.getProperty("user.home") + "/.ssh2");
-
-		bot.button(IDELabel.Button.OK).click();
-		bot.waitUntilWidgetAppears(Conditions.waitForWidget(matcher));
-
-		bot.button(IDELabel.Shell.NEW).click();
-		bot.waitForShell("New ssh key");
-		bot.text(0).setText(TestProperties.getPassphrase());
-		bot.button(IDELabel.Button.OK).click();
-
-		log.info("OpenShift SWTBot Tests: SSH Keys created.");
-		
-		bot.waitUntilWidgetAppears(Conditions.waitForWidget(matcher));
-	}
-
-}

Deleted: trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/ValidateCredentials.java
===================================================================
--- trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/ValidateCredentials.java	2012-08-08 12:52:55 UTC (rev 42922)
+++ trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/ValidateCredentials.java	2012-08-08 12:55:59 UTC (rev 42923)
@@ -1,81 +0,0 @@
-package org.jboss.tools.openshift.ui.bot.test;
-
-import java.io.File;
-
-import org.eclipse.swtbot.swt.finder.SWTBot;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;
-import org.jboss.tools.openshift.ui.bot.util.OpenShiftUI;
-import org.jboss.tools.openshift.ui.bot.util.TestProperties;
-import org.jboss.tools.ui.bot.ext.SWTTestExt;
-import org.jboss.tools.ui.bot.ext.condition.NonSystemJobRunsCondition;
-import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
-import org.jboss.tools.ui.bot.ext.types.IDELabel;
-import org.junit.Before;
-import org.junit.Test;
-
- at Require(clearWorkspace = true)
-public class ValidateCredentials extends SWTTestExt {
-
-	@Before
-	public void prepareSSHPrefs() {
-		// clear dir from libra stuff
-		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("libra"))
-					file.delete();
-			}
-		}
-
-	}
-
-	@Test
-	public void canValidateCredentials() throws InterruptedException {
-		// create new OpenShift Application
-		SWTBot wiz = open.newObject(OpenShiftUI.NewApplication.iNewObject);
-
-		storePasswordThenForward();
-
-		// set wrong user credentials
-		wiz.text(0).setText(TestProperties.getProperty("openshift.user.name"));
-		wiz.text(1).setText(
-				TestProperties.getProperty("openshift.user.wrongpwd"));
-
-		SWTBotButton nextButton = wiz.button(IDELabel.Button.NEXT);
-		// try to move forward
-		nextButton.click();
-
-		// wait for credentials validation
-		bot.waitUntil(new NonSystemJobRunsCondition());
-
-		assertFalse("Next > button shouldn't be enabled to move forward.",
-				nextButton.isEnabled());
-
-		// set correct user credentials and save it to secure storage
-		wiz.text(0).setText(TestProperties.getProperty("openshift.user.name"));
-		wiz.text(1).setText(TestProperties.getProperty("openshift.user.pwd"));
-		wiz.checkBox(0).select();
-
-		// move forward
-		nextButton.click();
-
-		storePasswordThenForward();
-
-		bot.waitForShell("", 100);
-		
-		log.info("OpenShift SWTBot Tests: Credentials validated.");
-	}
-
-	/*
-	 * give the secure storage password (will use the same as user's ssh
-	 * passphrase)
-	 */
-	private void storePasswordThenForward() {
-		if (bot.waitForShell(IDELabel.Shell.SECURE_STORAGE) != null) {
-			bot.text(0).setText(TestProperties.getPassphrase());
-			bot.button(IDELabel.Button.OK).click();
-		}
-	}
-
-}

Copied: trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/Connection.java (from rev 42883, trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/ValidateCredentials.java)
===================================================================
--- trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/Connection.java	                        (rev 0)
+++ trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/Connection.java	2012-08-08 12:55:59 UTC (rev 42923)
@@ -0,0 +1,54 @@
+package org.jboss.tools.openshift.ui.bot.test.explorer;
+
+import org.eclipse.swtbot.swt.finder.waits.Conditions;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;
+import org.jboss.tools.openshift.ui.bot.util.OpenShiftUI;
+import org.jboss.tools.openshift.ui.bot.util.TestProperties;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.condition.NonSystemJobRunsCondition;
+import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.junit.Test;
+
+ at Require(clearWorkspace = true)
+public class Connection extends SWTTestExt {
+
+	@Test
+	public void canCreateConnectionToOpenShiftAccount() {
+		// open OpenShift Explorer
+		open.viewOpen(OpenShiftUI.Explorer.iView);
+
+		bot.toolbarButtonWithTooltip(OpenShiftUI.Labels.CONNECT_TO_OPENSHIFT)
+				.click();
+
+		// open credentials dialog
+		bot.waitForShell(OpenShiftUI.Shell.CREDENTIALS);
+
+		// set wrong user credentials
+		bot.text(0).setText(TestProperties.get("openshift.user.name"));
+		bot.text(1).setText(TestProperties.get("openshift.user.wrongpwd"));
+		bot.checkBox(0).deselect();
+
+		SWTBotButton finishButton = bot.button(IDELabel.Button.FINISH);
+		// try to move forward
+		finishButton.click();
+
+		// wait for credentials validation
+		bot.waitUntil(new NonSystemJobRunsCondition());
+
+		assertFalse("Finish button shouldn't be enabled.",
+				finishButton.isEnabled());
+
+		// set correct user credentials and save it to secure storage
+		bot.text(0).setText(TestProperties.get("openshift.user.name"));
+		bot.text(1).setText(TestProperties.get("openshift.user.pwd"));
+
+		// create connection to OpenShift account
+		finishButton.click();
+
+		bot.waitUntil(Conditions.shellCloses(bot.activeShell()));
+
+		log.info("*** OpenShift SWTBot Tests: Credentials validated. ***");
+		log.info("*** OpenShift SWTBot Tests: Connection to OpenShift established. ***");
+	}
+}

Copied: trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/CreateApp.java (from rev 42883, trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/CreateAppAS7.java)
===================================================================
--- trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/CreateApp.java	                        (rev 0)
+++ trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/CreateApp.java	2012-08-08 12:55:59 UTC (rev 42923)
@@ -0,0 +1,66 @@
+package org.jboss.tools.openshift.ui.bot.test.explorer;
+
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
+import org.eclipse.swtbot.swt.finder.waits.Conditions;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo;
+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;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.junit.Test;
+
+public class CreateApp extends SWTTestExt {
+
+	@Test
+	public void canCreateImportAppFromExplorer() {
+		SWTBotView openshiftConsole = open.viewOpen(OpenShiftUI.Explorer.iView);
+
+		openshiftConsole.bot().tree()
+				.getTreeItem(TestProperties.get("openshift.user.name"))
+				.contextMenu(OpenShiftUI.Labels.EXPLORER_NEW_APP).click();
+
+		bot.waitForShell(OpenShiftUI.Shell.NEW_APP);
+
+		// fill app info
+		SWTBotText appNameText = bot.textInGroup("New application", 0);
+		bot.waitUntil(Conditions.widgetIsEnabled(appNameText));
+
+		assertTrue("App name should be empty!", appNameText.getText()
+				.equals(""));
+
+		appNameText.setText(TestProperties.get("openshift.jbossapp.name"));
+
+		log.info("*** OpenShift SWTBot Tests: Application name set. ***");
+
+		SWTBotCombo appTypeCombo = bot.comboBoxInGroup("New application");
+		bot.waitUntil(Conditions.widgetIsEnabled(appNameText));
+		appTypeCombo.setSelection(OpenShiftUI.AppType.JBOSS);
+
+		log.info("*** OpenShift SWTBot Tests: Application type selected. ***");
+
+		bot.button(IDELabel.Button.NEXT).click();
+
+		bot.waitUntil(Conditions.widgetIsEnabled(bot
+				.button(IDELabel.Button.FINISH)));
+		bot.button(IDELabel.Button.FINISH).click();
+
+		log.info("*** OpenShift SWTBot Tests: Application creation started. ***");
+
+		bot.waitForShell("Information", 500);
+		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_20S);
+
+		log.info("*** OpenShift SWTBot Tests: New Application wizard closed. ***");
+
+		servers.serverExists(TestProperties.get("openshift.jbossapp.name")
+				+ " OpenShift Server");
+
+		log.info("*** OpenShift SWTBot Tests: OpenShift Server Adapter created. ***");
+	}
+
+}

Copied: trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/CreateDomain.java (from rev 42883, trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/CreateDomain.java)
===================================================================
--- trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/CreateDomain.java	                        (rev 0)
+++ trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/CreateDomain.java	2012-08-08 12:55:59 UTC (rev 42923)
@@ -0,0 +1,92 @@
+package org.jboss.tools.openshift.ui.bot.test.explorer;
+
+import java.io.File;
+
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
+import org.eclipse.swtbot.swt.finder.waits.Conditions;
+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;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.condition.NonSystemJobRunsCondition;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Domain creation consists of creating the SSH key pair, storing user password
+ * in the secure storage and creating the domain itself.
+ * 
+ * @author sbunciak
+ * 
+ */
+public class CreateDomain extends SWTTestExt {
+
+	private boolean keyAvailable = false;
+
+	@Before
+	public void prepareSSHPrefs() {
+		// clear dir from libra stuff
+
+		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;
+			}
+		}
+
+	}
+
+	@Test
+	public void canCreateDomain() throws InterruptedException {
+		// open OpenShift Explorer
+		SWTBotView openshiftExplorer = open
+				.viewOpen(OpenShiftUI.Explorer.iView);
+
+		openshiftExplorer.bot().tree()
+				.getTreeItem(TestProperties.get("openshift.user.name"))
+				.contextMenu(OpenShiftUI.Labels.EXPLORER_CREATE_EDIT_DOMAIN)
+				.click();
+
+		bot.waitForShell(OpenShiftUI.Shell.DOMAIN);
+
+		SWTBotText domainText = bot.text(0);
+
+		assertTrue("Domain should not be set at this stage!", domainText
+				.getText().equals(""));
+
+		domainText.setText(TestProperties.get("openshift.domain"));
+		log.info("*** OpenShift SWTBot Tests: Domain name set. ***");
+
+		if (keyAvailable) {
+
+			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.Button.FINISH).click();
+
+		// wait while the domain is being created
+		bot.waitUntil(Conditions.shellCloses(bot.activeShell()), TIME_60S);
+
+		log.info("*** OpenShift SWTBot Tests: Domain created. ***");
+
+		bot.waitUntil(new NonSystemJobRunsCondition(), TIME_20S);
+	}
+
+}

Copied: trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/DeleteApp.java (from rev 42883, trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/DeleteAppAS7.java)
===================================================================
--- trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/DeleteApp.java	                        (rev 0)
+++ trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/DeleteApp.java	2012-08-08 12:55:59 UTC (rev 42923)
@@ -0,0 +1,64 @@
+package org.jboss.tools.openshift.ui.bot.test.explorer;
+
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.waits.ICondition;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.openshift.ui.bot.util.OpenShiftUI;
+import org.jboss.tools.openshift.ui.bot.util.TestProperties;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.junit.Test;
+
+public class DeleteApp extends SWTTestExt {
+
+	SWTBotTreeItem account;
+
+	@Test
+	public void canDeleteApplication() {
+
+		SWTBotView explorer = open.viewOpen(OpenShiftUI.Explorer.iView);
+
+		account = explorer.bot().tree()
+				.expandNode(TestProperties.get("openshift.user.name"))
+				.doubleClick();
+
+		account.getNode(0).contextMenu(OpenShiftUI.Labels.EXPLORER_DELETE_APP)
+				.click();
+
+		bot.waitForShell(OpenShiftUI.Shell.DELETE_APP);
+
+		bot.button(IDELabel.Button.OK).click();
+		bot.waitWhile(new ICondition() {
+			@Override
+			public boolean test() throws Exception {
+				return account.getItems().length > 0;
+			}
+
+			@Override
+			public void init(SWTBot bot) {
+				// keep empty
+			}
+
+			@Override
+			public String getFailureMessage() {
+				return "Application is still present in user account after reasonable timeout.";
+			}
+
+		}, TIME_60S, TIME_1S);
+
+		assertTrue("Application still present in the OpenShift Console view!",
+				account.getItems().length == 0);
+
+		projectExplorer.show();
+		projectExplorer.bot().tree(0).contextMenu("Delete").click();
+
+		bot.waitForShell("Delete Resources");
+		bot.checkBox().select();
+		bot.button(IDELabel.Button.OK).click();
+
+		assertFalse("The project still exists!",
+				projectExplorer.existsResource(TestProperties
+						.get("openshift.jbossapp.name")));
+	}
+}

Copied: trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/DeleteDomain.java (from rev 42883, trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/DestroyDomain.java)
===================================================================
--- trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/DeleteDomain.java	                        (rev 0)
+++ trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/DeleteDomain.java	2012-08-08 12:55:59 UTC (rev 42923)
@@ -0,0 +1,28 @@
+package org.jboss.tools.openshift.ui.bot.test.explorer;
+
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
+import org.jboss.tools.openshift.ui.bot.util.OpenShiftUI;
+import org.jboss.tools.openshift.ui.bot.util.TestProperties;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.condition.NonSystemJobRunsCondition;
+import org.junit.Test;
+
+public class DeleteDomain extends SWTTestExt {
+
+	@Test
+	public void canDestroyDomain() throws InterruptedException {
+
+		SWTBotView explorer = open.viewOpen(OpenShiftUI.Explorer.iView);
+
+		explorer.bot().tree()
+				.getTreeItem(TestProperties.get("openshift.user.name"))
+				.contextMenu(OpenShiftUI.Labels.EXPLORER_DELETE_DOMAIN).click();
+
+		
+		bot.wait(TIME_5S);
+		
+		bot.waitUntil(new NonSystemJobRunsCondition());
+		
+		
+	}
+}

Copied: trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/EmbedCartrides.java (from rev 42883, trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/EmbeddCartrides.java)
===================================================================
--- trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/EmbedCartrides.java	                        (rev 0)
+++ trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/EmbedCartrides.java	2012-08-08 12:55:59 UTC (rev 42923)
@@ -0,0 +1,114 @@
+package org.jboss.tools.openshift.ui.bot.test.explorer;
+
+import java.util.StringTokenizer;
+
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.waits.ICondition;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.openshift.ui.bot.util.OpenShiftUI;
+import org.jboss.tools.openshift.ui.bot.util.TestProperties;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.junit.Test;
+
+public class EmbedCartrides extends SWTTestExt {
+	SWTBotTreeItem account;
+
+	@Test
+	public void canEmbeddCartriges() {
+
+		SWTBotView explorer = open.viewOpen(OpenShiftUI.Explorer.iView);
+
+		account = explorer.bot().tree()
+				.expandNode(TestProperties.get("openshift.user.name"))
+				.doubleClick();
+
+		// custom condition to wait for app to show
+		bot.waitUntil(new ICondition() {
+			@Override
+			public boolean test() {
+
+				for (SWTBotTreeItem item : account.getItems()) {
+					if (item.getText().contains(
+							TestProperties.get("openshift.jbossapp.name"))) {
+						return true;
+					}
+				}
+				return false;
+			}
+
+			@Override
+			public void init(SWTBot bot) {
+				// keep empty
+			}
+
+			@Override
+			public String getFailureMessage() {
+				return "Application did not appear in user account after reasonable timeout.";
+			}
+
+		}, TIME_60S, TIME_1S);
+
+		account.getNode(0).contextMenu(OpenShiftUI.Labels.EDIT_CARTRIDGES)
+				.click();
+
+		bot.waitForShell("");
+
+		SWTBotTable cartridgeTable = bot.tableInGroup("Embeddable Cartridges");
+
+		selectCartridges(cartridgeTable);
+
+		bot.button(IDELabel.Button.FINISH).click();
+
+		bot.waitForShell("Embedded Cartridges");
+		bot.button(IDELabel.Button.OK).click();
+	}
+
+	/*
+	 * Jenkins cartridge not supported yet
+	 */
+	private void selectCartridges(SWTBotTable cartridgeTable) {
+
+		StringTokenizer tokenizer = new StringTokenizer(
+				TestProperties.get("openshift.jbossapp.cartridges"),
+				";");
+
+		while (tokenizer.hasMoreTokens()) {
+
+			String cartridge = tokenizer.nextToken();
+			System.out.println(cartridge);
+
+			if (cartridge.equals("mysql")) {
+				cartridgeTable.getTableItem(OpenShiftUI.Cartridge.MYSQL)
+						.toggleCheck();
+			}
+			if (cartridge.equals("phpmyadmin")) {
+				cartridgeTable.getTableItem(OpenShiftUI.Cartridge.PHPMYADMIN)
+						.toggleCheck();
+			}
+			if (cartridge.equals("cron")) {
+				cartridgeTable.getTableItem(OpenShiftUI.Cartridge.CRON)
+						.toggleCheck();
+			}
+			if (cartridge.equals("postgresql")) {
+				cartridgeTable.getTableItem(OpenShiftUI.Cartridge.POSTGRESQL)
+						.toggleCheck();
+			}
+			if (cartridge.equals("mongodb")) {
+				cartridgeTable.getTableItem(OpenShiftUI.Cartridge.MONGODB)
+						.toggleCheck();
+			}
+			if (cartridge.equals("rockmongo")) {
+				cartridgeTable.getTableItem(OpenShiftUI.Cartridge.ROCKMONGO)
+						.toggleCheck();
+			}
+			if (cartridge.equals("metrics")) {
+				cartridgeTable.getTableItem(OpenShiftUI.Cartridge.METRICS)
+						.toggleCheck();
+			}
+		}
+	}
+
+}

Copied: trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/RenameDomain.java (from rev 42883, trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/RenameDomain.java)
===================================================================
--- trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/RenameDomain.java	                        (rev 0)
+++ trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/RenameDomain.java	2012-08-08 12:55:59 UTC (rev 42923)
@@ -0,0 +1,55 @@
+package org.jboss.tools.openshift.ui.bot.test.explorer;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
+import org.eclipse.swtbot.swt.finder.waits.Conditions;
+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;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.junit.Test;
+
+public class RenameDomain extends SWTTestExt {
+
+	@Test
+	public void canRenameDomain() {
+
+		SWTBotView explorer = open.viewOpen(OpenShiftUI.Explorer.iView);
+
+		explorer.bot().tree()
+				.getTreeItem(TestProperties.get("openshift.user.name"))
+				.contextMenu(OpenShiftUI.Labels.EXPLORER_CREATE_EDIT_DOMAIN)
+				.click();
+
+		bot.waitForShell("");
+
+		SWTBotText domainText = bot.text(0);
+
+		assertTrue(
+				"Domain should be set correctly at this stage!",
+				domainText.getText().equals(
+						TestProperties.get("openshift.domain")));
+
+		domainText.setText(TestProperties.get("openshift.domain.new"));
+
+		bot.button(IDELabel.Button.FINISH).click();
+		bot.waitUntil(Conditions.shellCloses(bot.activeShell()), TIME_60S);
+
+		HttpClient client = new HttpClient();
+		GetMethod method = new GetMethod("https://"
+				+ TestProperties.get("openshift.jbossapp.name") + "-"
+				+ TestProperties.get("openshift.domain.new")
+				+ ".rhcloud.com");
+
+		try {
+			assertTrue(client.executeMethod(method) == 200);
+		} catch (Exception e) {
+			log.error("File has not been published to the server!", e);
+		} finally {
+			method.releaseConnection();
+		}
+	}
+
+}

Copied: trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/wizard/RepublishApp.java (from rev 42883, trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/RepublishAppASS7.java)
===================================================================
--- trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/wizard/RepublishApp.java	                        (rev 0)
+++ trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/wizard/RepublishApp.java	2012-08-08 12:55:59 UTC (rev 42923)
@@ -0,0 +1,81 @@
+package org.jboss.tools.openshift.ui.bot.test.wizard;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.waits.ICondition;
+import org.jboss.tools.openshift.ui.bot.util.TestProperties;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.Timing;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem;
+import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.junit.Test;
+
+public class RepublishApp extends SWTTestExt {
+
+	@Test
+	public void canModifyAndRepublishApp() {
+		SWTBot wiz = open.newObject(ActionItem.NewObject.WebHTMLPage.LABEL);
+		wiz.text(0).setText(
+				TestProperties.get("openshift.jbossapp.name")
+						+ "/src/main/webapp");
+		wiz.text(1).setText("Test.html");
+
+		wiz.button(IDELabel.Button.FINISH).click();
+
+		projectExplorer.show();
+		projectExplorer.bot().tree().select(0);
+		ContextMenuHelper.clickContextMenu(projectExplorer.bot().tree(),
+				"Team", "Commit and Push...");
+
+		bot.waitForShell("Commit Changes");
+		bot.styledText(0).setText("comment");
+
+		bot.table().getTableItem(0).toggleCheck();
+		// bot.toolbarButtonWithTooltip("Select All").click();
+
+		bot.button("Commit").click();
+
+		bot.waitForShell("Push to Another Repository");
+		bot.button(IDELabel.Button.FINISH).click();
+
+		// custom condition to wait for the openshift server to be synchronized
+		bot.waitUntil(new ICondition() {
+			@Override
+			public boolean test() {
+
+				return servers.getServerPublishStatus(
+						TestProperties.get("openshift.jbossapp.name")
+								+ " OpenShift Server").equalsIgnoreCase(
+						"synchronized");
+			}
+
+			@Override
+			public void init(SWTBot bot) {
+				// keep empty
+			}
+
+			@Override
+			public String getFailureMessage() {
+				return "OpenShift server is not synchronized after reasonable timeout.";
+			}
+
+		}, Timing.time100S(), TIME_1S);
+
+		HttpClient client = new HttpClient();
+		GetMethod method = new GetMethod("https://"
+				+ TestProperties.get("openshift.jbossapp.name") + "-"
+				+ TestProperties.get("openshift.domain")
+				+ ".rhcloud.com/Test.html");
+
+		try {
+			assertTrue(client.executeMethod(method) == 200);
+		} catch (Exception e) {
+			log.error("File has not been published to the server!", e);
+		} finally {
+			method.releaseConnection();
+		}
+	}
+
+}

Deleted: trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/util/DomainDestroyer.java
===================================================================
--- trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/util/DomainDestroyer.java	2012-08-08 12:52:55 UTC (rev 42922)
+++ trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/util/DomainDestroyer.java	2012-08-08 12:55:59 UTC (rev 42923)
@@ -1,61 +0,0 @@
-package org.jboss.tools.openshift.ui.bot.util;
-
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.methods.PostMethod;
-
-/**
- * 
- * @author sbunciak
- *
- * Utility class to destroy domain on OpenShift 
- */
-public class DomainDestroyer {
-
-    /**
-     * 
-     * Destroys registered domain on OpenShift
-     * 
-     * @param domain
-     * @param login
-     * @param password
-     * @return HTTP Response code or 0 if some Exception was caught
-     */
-    public static int destroyDomain(String domain, String login, String password) {
-
-        int resp_code = 0;
-        String input = "{\"namespace\": \"" + domain + "\", \"rhlogin\": \""
-                + login + "\", \"delete\": true }";
-
-        HttpClient client = new HttpClient();
-        PostMethod method = new PostMethod(
-                "https://openshift.redhat.com/broker/domain");
-
-        method.addParameter("json_data", input);
-        method.addParameter("password", password);
-
-        try {
-            resp_code = client.executeMethod(method);
-        } catch (Exception e) {
-            System.out.println(e);
-        } finally {
-            method.releaseConnection();
-        }
-        return resp_code;
-    }
-
-    /**
-     * @param args
-     */
-    public static void main(String[] args) {
-    	int resp_code = DomainDestroyer.destroyDomain(
-				TestProperties.getProperty("openshift.domain.new"),
-				TestProperties.getProperty("openshift.user.name"),
-				TestProperties.getProperty("openshift.user.pwd"));
-    	
-        if (resp_code == 200) {
-        	System.out.println("Domain destroyed.");
-        } else {
-        	System.out.println("Domain was not destroyed. Response code: "+resp_code);
-        }
-    }
-}

Modified: trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/util/OpenShiftUI.java
===================================================================
--- trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/util/OpenShiftUI.java	2012-08-08 12:52:55 UTC (rev 42922)
+++ trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/util/OpenShiftUI.java	2012-08-08 12:55:59 UTC (rev 42923)
@@ -20,7 +20,7 @@
 	 * Class representing OpenShift Console View
 	 *
 	 */
-	public static class Console {
+	public static class Explorer {
 
 		public static final IView iView = new IView() {
 			@Override
@@ -92,4 +92,27 @@
 		public static final String METRICS = "metrics-0.1";
 		public static final String ROCKMONGO = "rockmongo-1.1";
 	}
-}
+	
+	public static class Labels {
+		
+		public static final String CONNECT_TO_OPENSHIFT = "Connect to OpenShift";
+		public static final String EXPLORER_NEW_APP = "New OpenShift Application...";
+		public static final String EXPLORER_CREATE_EDIT_DOMAIN = "Create or Edit Domain...";
+		public static final String EXPLORER_DELETE_DOMAIN = "Delete Domain";
+		public static final String EXPLORER_CREATE_SERVER = "Create a Server Adapter";
+		public static final String EXPLORER_DELETE_APP = "Delete Application(s)";
+		public static final String EDIT_CARTRIDGES = "Edit Embedded Cartridges...";
+		
+	}
+	
+	public static class Shell {
+		
+		public static final String NO_TITLE = "";
+		public static final String NEW_APP = "New OpenShift Application";
+		public static final String DOMAIN = "";
+		public static final String CREDENTIALS = "";
+		public static final String NEW_SSH = "New ssh key";
+		public static final String DELETE_APP = "Application deletion";
+		
+	}
+}
\ No newline at end of file

Modified: trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/util/TestProperties.java
===================================================================
--- trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/util/TestProperties.java	2012-08-08 12:52:55 UTC (rev 42922)
+++ trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/util/TestProperties.java	2012-08-08 12:55:59 UTC (rev 42923)
@@ -5,7 +5,6 @@
 import java.io.IOException;
 import java.util.Properties;
 
-import org.apache.commons.codec.binary.Base64;
 import org.apache.log4j.Logger;
 
 /**
@@ -34,14 +33,8 @@
 
     }
 
-    public static String getProperty(String key) {
-        return props.getProperty(key);
+    public static String get(String key) {
+    	return props.getProperty(key);
     }
-
-    public static String getPassphrase() {
-    	String passphrase = new String(new Base64().decode(TestProperties.getProperty(
-				"openshift.ssh.passphrase").getBytes()));
-    	return passphrase;
-    }
     
-}
+}
\ No newline at end of file



More information about the jbosstools-commits mailing list