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

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Wed Mar 28 17:14:18 EDT 2012


Author: sbunciak
Date: 2012-03-28 17:14:18 -0400 (Wed, 28 Mar 2012)
New Revision: 39901

Removed:
   trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/CredentialsValidation.java
Modified:
   trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/build.properties
   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/ValidateCredentials.java
   trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/util/DomainDestroyer.java
Log:
Resolving Application deletion: https://issues.jboss.org/browse/JBQA-6127

Modified: trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/build.properties
===================================================================
--- trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/build.properties	2012-03-28 20:06:04 UTC (rev 39900)
+++ trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/build.properties	2012-03-28 21:14:18 UTC (rev 39901)
@@ -1,4 +1,4 @@
-source.. = src/
+source.. = src/,resources/
 output.. = bin/
 bin.includes = META-INF/,\
                .

Modified: 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-03-28 20:06:04 UTC (rev 39900)
+++ trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/CreateDomain.java	2012-03-28 21:14:18 UTC (rev 39901)
@@ -1,11 +1,8 @@
 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.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.waits.ICondition;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
-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.condition.NonSystemJobRunsCondition;
@@ -36,12 +33,29 @@
 
 			bot.waitForShell("New OpenShift Express Application", 100);
 			
-			@SuppressWarnings("unchecked")
-			Matcher<Widget> matcher = WidgetMatcherFactory.allOf(
-					WidgetMatcherFactory.widgetOfType(Shell.class),
-					WidgetMatcherFactory.withText("New OpenShift Express Application"));
+			//@SuppressWarnings("unchecked")
+			//Matcher<Widget> matcher = WidgetMatcherFactory.allOf(
+			//		WidgetMatcherFactory.widgetOfType(Shell.class),
+			//		WidgetMatcherFactory.withText("New OpenShift Express Application"));
 
-			bot.waitUntilWidgetAppears(Conditions.waitForWidget(matcher));
+			//bot.waitUntilWidgetAppears(Conditions.waitForWidget(matcher));
+			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);
 			
 			bot.waitUntil(new NonSystemJobRunsCondition());
 	}

Deleted: trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/CredentialsValidation.java
===================================================================
--- trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/CredentialsValidation.java	2012-03-28 20:06:04 UTC (rev 39900)
+++ trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/CredentialsValidation.java	2012-03-28 21:14:18 UTC (rev 39901)
@@ -1,73 +0,0 @@
-package org.jboss.tools.openshift.ui.bot.test;
-
-import org.eclipse.swtbot.swt.finder.SWTBot;
-import org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory;
-import org.eclipse.swtbot.swt.finder.waits.Conditions;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;
-import org.jboss.tools.openshift.ui.bot.util.TestProperties;
-import org.jboss.tools.ui.bot.ext.SWTTestExt;
-import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
-import org.jboss.tools.ui.bot.ext.gen.ActionItem;
-import org.jboss.tools.ui.bot.ext.types.IDELabel;
-import org.junit.Test;
-
- at Require(clearWorkspace = true)
-public class CredentialsValidation extends SWTTestExt {
-
-    @Test
-    public void testUserCredentialsValidation() throws InterruptedException {
-        // try to create new OpenShift Express Application
-        SWTBot wiz = open.newObject(ActionItem.NewObject.create("OpenShift",
-                "OpenShift Express Application"));
-
-        SWTBotButton validateButton = wiz.button("Validate");
-
-        assertFalse("Validation button shouldn't be enabled at this step.",
-                validateButton.isEnabled());
-
-        // set wrong user credentials
-        wiz.text(0).setText(TestProperties.getProperty("openshift.user.name"));
-        wiz.text(1).setText(TestProperties.getProperty("openshift.user.wrongpwd"));
-
-        assertTrue(
-                "Validation button should be enabled to check the user credentials.",
-                validateButton.isEnabled());
-
-        SWTBotButton nextButton = wiz.button(IDELabel.Button.NEXT);
-        // try to move forward
-        nextButton.click();
-
-        // wait for credentials validation
-        bot.waitUntilWidgetAppears(Conditions
-                .waitForWidget(WidgetMatcherFactory
-                        .withText(" The given credentials are not valid")));
-
-        assertFalse("Next > button shouldn't be enabled to move forward.",
-                nextButton.isEnabled());
-
-        // set correct user credentials
-        wiz.text(0).setText(TestProperties.getProperty("openshift.user.name"));
-        wiz.text(1).setText(TestProperties.getProperty("openshift.user.pwd"));
-
-        assertTrue(
-                "Validation button should be enabled again, user credentials has been changed.",
-                validateButton.isEnabled());
-
-        // validate credentials
-        validateButton.click();
-
-        bot.waitUntil(Conditions.widgetIsEnabled(nextButton));
-
-        // buttons assertion
-        assertFalse(
-                "Validation button shouldn't be enabled until user credentials hasn't been changed.",
-                validateButton.isEnabled());
-        assertFalse(
-                "Finish button shouldn't be enabled at this step, can't finish wizard.",
-                wiz.button("Finish").isEnabled());
-
-        // move forward
-        nextButton.click();
-    }
-
-}

Modified: 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-03-28 20:06:04 UTC (rev 39900)
+++ trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/DeleteAppAS7.java	2012-03-28 21:14:18 UTC (rev 39901)
@@ -1,9 +1,5 @@
 package org.jboss.tools.openshift.ui.bot.test;
 
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.jobs.Job;
 import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
 import org.eclipse.swtbot.swt.finder.SWTBot;
 import org.eclipse.swtbot.swt.finder.waits.ICondition;
@@ -15,6 +11,9 @@
 import org.junit.Test;
 
 public class DeleteAppAS7 extends SWTTestExt {
+		
+	SWTBotTreeItem account;
+	
 	@Test
 	public void canDeleteApplication() {
 		projectExplorer.show();
@@ -32,7 +31,7 @@
 
 		SWTBot consoleBot = openshiftConsole.bot();
 
-		SWTBotTreeItem account = consoleBot.tree()
+		account = consoleBot.tree()
 				.expandNode(TestProperties.getProperty("openshift.user.name"))
 				.doubleClick();
 
@@ -41,52 +40,25 @@
 		bot.waitForShell("Application deletion");
 
 		bot.button(IDELabel.Button.OK).click();
-// TODO !!!
 		bot.waitWhile(new ICondition() {
-
-			private boolean deletionInvoked = false;
-
 			@Override
 			public boolean test() throws Exception {
-
-				if (deletionInvoked && getJobs().size() == 0) {
-					return false;
-				} else {
-					return true;
-				}
-
+				return account.getItems().length > 0;
 			}
 
 			@Override
 			public void init(SWTBot bot) {
-				// Keep empty
+				// keep empty
 			}
 
 			@Override
 			public String getFailureMessage() {
-				return "Deletion was not invoked in timeout.";
+				return "Application is still present in user account after reasonable timeout.";
 			}
-
-			private List<Job> getJobs() {
-				List<Job> jobs = new ArrayList<Job>();
-				for (Job job : Job.getJobManager().find(null)) {
-					if (Job.SLEEPING != job.getState()) {
-						jobs.add(job);
-
-						System.out.println("Job: " + job.getName());
-
-						if (job.getName().contains("OpenShift")) {
-							System.out
-									.println("!!!!!!!!!!!FOUND ONE!!!!!!!!!!!!!");
-							deletionInvoked = true;
-						}
-
-					}
-				}
-				return jobs;
-			}
+			
 		}, TIME_60S, TIME_1S);
 
+		
 		/*
 		 * TODO
 		 * 
@@ -102,4 +74,5 @@
 				account.getItems().length == 0);
 
 	}
+	
 }

Modified: 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-03-28 20:06:04 UTC (rev 39900)
+++ trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/ValidateCredentials.java	2012-03-28 21:14:18 UTC (rev 39901)
@@ -35,6 +35,8 @@
 		// create new OpenShift Express 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(
@@ -68,9 +70,10 @@
 	 * passphrase)
 	 */
 	private void storePasswordThenForward() {
-		bot.waitForShell(IDELabel.Shell.SECURE_STORAGE);
-		bot.text(0).setText(TestProperties.getPassphrase());
-		bot.button(IDELabel.Button.OK).click();
+		if (bot.waitForShell(IDELabel.Shell.SECURE_STORAGE) != null) {
+			bot.text(0).setText(TestProperties.getPassphrase());
+			bot.button(IDELabel.Button.OK).click();
+		}
 	}
 
 }

Modified: 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-03-28 20:06:04 UTC (rev 39900)
+++ trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/util/DomainDestroyer.java	2012-03-28 21:14:18 UTC (rev 39901)
@@ -47,7 +47,7 @@
      * @param args
      */
     public static void main(String[] args) {
-        if (destroyDomain("rhtest", "sbunciak", "rhtest123") == 200) {
+        if (destroyDomain("rhtestdomain", "sbunciak", "rhtest123") == 200) {
         	System.out.println("Domain destroyed.");
         } else {
         	System.out.println("Domain was not destroyed.");



More information about the jbosstools-commits mailing list