Author: sbunciak
Date: 2012-01-24 05:42:01 -0500 (Tue, 24 Jan 2012)
New Revision: 38080
Added:
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/ImportRepublishAppASS7.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/SSHKeysManagment.java
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/TestProperties.java
Removed:
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/screenshots/Default -
testUserCredentialsValidation(org.jboss.tools.openshift.ui.bot.test.CredentialsValidation).jpeg
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/screenshots/screenshot-CredentialsValidation.testUserCredentialsValidation.jpeg
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/DomainManipulation.java
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/util/OpenShiftTestProperties.java
Modified:
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/META-INF/MANIFEST.MF
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/CredentialsValidation.java
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/OpenShiftAllBotTests.java
Log:
Completed bot tests coverage
Modified:
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/META-INF/MANIFEST.MF
===================================================================
---
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/META-INF/MANIFEST.MF 2012-01-24
10:41:53 UTC (rev 38079)
+++
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/META-INF/MANIFEST.MF 2012-01-24
10:42:01 UTC (rev 38080)
@@ -17,6 +17,9 @@
org.eclipse.swtbot.swt.finder;bundle-version="2.0.5",
org.eclipse.core.resources;bundle-version="3.7.100",
org.eclipse.ui.forms;bundle-version="3.5.100",
- org.eclipse.ui.ide;bundle-version="3.7.0"
+ org.eclipse.ui.ide;bundle-version="3.7.0",
+ org.apache.commons.httpclient;bundle-version="3.1.0",
+ org.apache.commons.logging;bundle-version="1.0.4",
+ org.apache.commons.codec;bundle-version="1.3.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
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-01-24
10:41:53 UTC (rev 38079)
+++
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/resources/openshift.ui.bot.test.properties 2012-01-24
10:42:01 UTC (rev 38080)
@@ -1,4 +1,9 @@
openshift.user.name=sbunciak
openshift.user.pwd=rhtest123
+openshift.jbossapp.name=jbossapp
+openshift.jbossapp.cartridges=mysql-5.1;jenkins-client-1.4
openshift.user.wrongpwd=rhtest
openshift.domain=rhtestdomain
+openshift.domain.new=rhtest
+openshift.ssh.passphrase=uvegel4ROV?
+createDomain=true
Deleted: trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/screenshots/Default -
testUserCredentialsValidation(org.jboss.tools.openshift.ui.bot.test.CredentialsValidation).jpeg
===================================================================
(Binary files differ)
Deleted:
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/screenshots/screenshot-CredentialsValidation.testUserCredentialsValidation.jpeg
===================================================================
(Binary files differ)
Added:
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
(rev 0)
+++
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/CreateAppAS7.java 2012-01-24
10:42:01 UTC (rev 38080)
@@ -0,0 +1,34 @@
+package org.jboss.tools.openshift.ui.bot.test;
+
+import org.eclipse.swtbot.swt.finder.waits.Conditions;
+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.types.IDELabel;
+import org.junit.Test;
+
+public class CreateAppAS7 extends SWTTestExt {
+
+ @Test
+ public void createApplication() {
+ bot.button(IDELabel.Menu.NEW).click();
+
+ SWTBotText appNameText = bot.text(0);
+
+ assertTrue("App name should be empty!", appNameText.getText()
+ .equals(""));
+
+ appNameText.setText(TestProperties
+ .getProperty("openshift.jbossapp.name"));
+
+ bot.comboBox(0).setSelection("jbossas-7.0");
+
+ bot.button(IDELabel.Button.FINISH).click();
+
+ bot.waitUntil(Conditions.shellCloses(bot.activeShell()));
+
+ assertTrue(bot.tableInGroup("Available Applications").containsItem(
+ TestProperties.getProperty("openshift.jbossapp.name")));
+ }
+
+}
Copied:
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/CreateDomain.java
(from rev 36826,
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/DomainManipulation.java)
===================================================================
---
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/CreateDomain.java
(rev 0)
+++
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/CreateDomain.java 2012-01-24
10:42:01 UTC (rev 38080)
@@ -0,0 +1,30 @@
+package org.jboss.tools.openshift.ui.bot.test;
+
+import org.eclipse.swtbot.swt.finder.waits.Conditions;
+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.junit.Test;
+
+public class CreateDomain extends SWTTestExt {
+
+ @Test
+ public void domainCreate() {
+
+ // create domain only if explicit configured
+ if (Boolean.parseBoolean(TestProperties.getProperty("createDomain")))
{
+
+ SWTBotText domainText = bot.textInGroup("Domain", 0);
+
+ bot.waitUntil(Conditions.widgetIsEnabled(domainText));
+
+ assertTrue("Domain should not be set at this stage!", domainText
+ .getText().equals(""));
+
+
domainText.setText(TestProperties.getProperty("openshift.domain"));
+
+ bot.button("Create").click();
+ }
+ }
+
+}
Modified:
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-01-24
10:41:53 UTC (rev 38079)
+++
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/CredentialsValidation.java 2012-01-24
10:42:01 UTC (rev 38080)
@@ -4,10 +4,11 @@
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.OpenShiftTestProperties;
+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;
@Require(clearWorkspace = true)
@@ -25,16 +26,14 @@
validateButton.isEnabled());
// set wrong user credentials
- wiz.text(0).setText(
- OpenShiftTestProperties.getProperty("openshift.user.name"));
- wiz.text(1).setText(
-
OpenShiftTestProperties.getProperty("openshift.user.wrongpwd"));
+
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("Next >");
+ SWTBotButton nextButton = wiz.button(IDELabel.Button.NEXT);
// try to move forward
nextButton.click();
@@ -46,12 +45,9 @@
assertFalse("Next > button shouldn't be enabled to move
forward.",
nextButton.isEnabled());
- // test on changed credentials
// set correct user credentials
- wiz.text(0).setText(
- OpenShiftTestProperties.getProperty("openshift.user.name"));
- wiz.text(1).setText(
- OpenShiftTestProperties.getProperty("openshift.user.pwd"));
+
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.",
Added:
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
(rev 0)
+++
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/DeleteAppAS7.java 2012-01-24
10:42:01 UTC (rev 38080)
@@ -0,0 +1,108 @@
+package org.jboss.tools.openshift.ui.bot.test;
+
+import java.io.File;
+import java.io.IOException;
+
+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.SWTBotTable;
+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.gen.ActionItem;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.junit.Test;
+
+public class DeleteAppAS7 extends SWTTestExt {
+ @Test
+ public void deleteApplication() {
+ SWTBot wiz = open.newObject(ActionItem.NewObject.create("OpenShift",
+ "OpenShift Express Application"));
+
wiz.text(0).setText(TestProperties.getProperty("openshift.user.name"));
+ wiz.text(1).setText(TestProperties.getProperty("openshift.user.pwd"));
+ wiz.button(IDELabel.Button.NEXT).click();
+
+ SWTBotText domainText = bot.textInGroup("Domain", 0);
+ bot.waitUntil(Conditions.widgetIsEnabled(domainText));
+
+ SWTBotTable appTable = bot.tableInGroup("Available Applications");
+
+
appTable.select(TestProperties.getProperty("openshift.jbossapp.name"));
+
+ bot.buttonInGroup(IDELabel.Button.DELETE, "Available Applications")
+ .click();
+
+ bot.waitUntilWidgetAppears(Conditions
+ .waitForWidget(WidgetMatcherFactory
+ .withLabel("You're up to delete all data within an
application. "
+ + "The data may not be recovered. Are you sure that
you want to delete application
"+TestProperties.getProperty("openshift.jbossapp.name")+"?")));
+
+ bot.button(IDELabel.Button.YES).click();
+
+ bot.waitUntil(Conditions.widgetIsEnabled(appTable));
+
+ assertFalse(appTable.containsItem(TestProperties
+ .getProperty("openshift.jbossapp.name")));
+
+ deleteJenkins();
+
+ deleteLocalGitRepo();
+ }
+
+ /*
+ * Since the JBoss tooling doesn't remove app repos, we need to delete it
+ * manually
+ */
+ private void deleteLocalGitRepo() {
+
+ String userHome = System.getProperty("user.home");
+ String defaultGitLocation = userHome + "\\git\\"
+ + TestProperties.getProperty("openshift.jbossapp.name");
+
+ log.info("Removing " + defaultGitLocation);
+
+ File gitDir = new File(defaultGitLocation);
+ if (gitDir.exists() && gitDir.isDirectory()) {
+ try {
+ doDelete(gitDir);
+ } catch (IOException e) {
+ log.error("Exception when trying to delete git repo!", e);
+ }
+ }
+
+ }
+
+ private void doDelete(File path) throws IOException {
+ if (path.isDirectory()) {
+ for (File child : path.listFiles()) {
+ doDelete(child);
+ }
+ }
+ if (!path.delete()) {
+ throw new IOException("Could not delete " + path);
+ }
+ }
+
+ private void deleteJenkins() {
+ SWTBotTable appTable = bot.tableInGroup("Available Applications");
+
+ if (appTable.containsItem("jenkins")) {
+ appTable.select("jenkins");
+
+ bot.buttonInGroup(IDELabel.Button.DELETE, "Available
Applications")
+ .click();
+
+ bot.waitUntilWidgetAppears(Conditions
+ .waitForWidget(WidgetMatcherFactory
+ .withLabel("You're up to delete all data within an
application. "
+ + "The data may not be recovered. Are you sure
that you want to delete application jbossapp?")));
+
+ bot.button(IDELabel.Button.YES).click();
+
+ bot.waitUntil(Conditions.widgetIsEnabled(appTable));
+
+ assertFalse(appTable.containsItem("jenkins"));
+ }
+ }
+}
Added:
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
(rev 0)
+++
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/DestroyDomain.java 2012-01-24
10:42:01 UTC (rev 38080)
@@ -0,0 +1,24 @@
+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 testDestroyDomain() {
+
+ 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/DomainManipulation.java
===================================================================
---
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/DomainManipulation.java 2012-01-24
10:41:53 UTC (rev 38079)
+++
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/DomainManipulation.java 2012-01-24
10:42:01 UTC (rev 38080)
@@ -1,22 +0,0 @@
-package org.jboss.tools.openshift.ui.bot.test;
-
-import org.jboss.tools.ui.bot.ext.SWTTestExt;
-import org.junit.Test;
-
-public class DomainManipulation extends SWTTestExt {
-
- @Test
- public void domainCreated() {
-
- bot.sleep(TIME_10S);
-
-
-
- }
-
- @Test
- public void domainRenamed() {
-
- }
-
-}
Added:
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
(rev 0)
+++
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/EmbeddCartrides.java 2012-01-24
10:42:01 UTC (rev 38080)
@@ -0,0 +1,58 @@
+package org.jboss.tools.openshift.ui.bot.test;
+
+import java.util.StringTokenizer;
+
+import org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory;
+import org.eclipse.swtbot.swt.finder.waits.Conditions;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
+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 EmbeddCartrides extends SWTTestExt {
+
+ @Test
+ public void embeddCartriges() {
+
+ //TODO: be sure to have app selected
+
+ bot.buttonInGroup("Edit", "Available Applications").click();
+
+ // TODO: Doesn't work
+ bot.waitUntilWidgetAppears(Conditions
+ .waitForWidget(WidgetMatcherFactory
+ .withText("Embeddable Cartridges")));
+
+ StringTokenizer tokenizer = new StringTokenizer(
+ TestProperties.getProperty("openshift.jbossapp.cartridges"),
+ ";");
+
+ SWTBotTable cartridgeTable = bot.tableInGroup("Embeddable Cartridges",
+ 0);
+
+ while (tokenizer.hasMoreTokens()) {
+ String cartridge = tokenizer.nextToken();
+
+ cartridgeTable.getTableItem(cartridge).click();
+
+ if (cartridge.contains("jenkins")) {
+ bot.text(0).setText("jenkins");
+ bot.button(IDELabel.Button.OK).click();
+ bot.waitUntilWidgetAppears(Conditions
+ .waitForWidget(WidgetMatcherFactory
+ .withLabel(IDELabel.Button.OK)));
+ bot.button(IDELabel.Button.OK).click();
+ }
+
+ bot.button(IDELabel.Button.FINISH).click();
+
+ bot.waitUntilWidgetAppears(Conditions
+ .waitForWidget(WidgetMatcherFactory
+ .withLabel(IDELabel.Button.OK)));
+ bot.button(IDELabel.Button.OK).click();
+ }
+
+ }
+
+}
Added:
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/ImportRepublishAppASS7.java
===================================================================
---
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/ImportRepublishAppASS7.java
(rev 0)
+++
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/ImportRepublishAppASS7.java 2012-01-24
10:42:01 UTC (rev 38080)
@@ -0,0 +1,63 @@
+package org.jboss.tools.openshift.ui.bot.test;
+
+import org.eclipse.swtbot.swt.finder.SWTBot;
+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.gen.ActionItem;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.junit.Test;
+
+public class ImportRepublishAppASS7 extends SWTTestExt {
+
+ private void finishWizardAndImportApp() {
+
+ bot.tableInGroup("Available Applications").select(
+ TestProperties.getProperty("openshift.jbossapp.name"));
+
+ bot.button(IDELabel.Button.NEXT).click();
+
+ SWTBotButton finishButton = bot.button(IDELabel.Button.FINISH);
+
+ bot.waitUntil(Conditions.widgetIsEnabled(finishButton));
+
+ finishButton.click();
+
+ // TODO: wait for new shell
+ bot.text(0).setText(TestProperties
+ .getProperty("openshift.ssh.passphrase"));
+
+ bot.waitUntil(Conditions.shellCloses(bot.activeShell()));
+
+ assertTrue("App is not in the Package Explorer!",
+ packageExplorer.existsResource(TestProperties
+ .getProperty("openshift.jbossapp.name")));
+ }
+
+ @Test
+ public void adapterIsCreated() {
+ finishWizardAndImportApp();
+
+ assertNotNull("App runtime not in the Servers View!",
+ servers.findServerByName(servers.show().bot().tree(),
+
TestProperties.getProperty("openshift.jbossapp.name")));
+ }
+
+ private void modifyApp() {
+ SWTBot wiz = open.newObject(ActionItem.NewObject.WebHTMLPage.LABEL);
+ wiz.text(1).setText("Test.html");
+ wiz.button(IDELabel.Button.FINISH);
+ }
+
+ @Test
+ public void republishApp() {
+ modifyApp();
+
+ servers.findServerByName(servers.show().bot().tree(),
+ TestProperties.getProperty("openshift.jbossapp.name"))
+ .select("Jon, Doe").contextMenu("Publish").click();
+
+ }
+
+}
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-01-24
10:41:53 UTC (rev 38079)
+++
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/OpenShiftAllBotTests.java 2012-01-24
10:42:01 UTC (rev 38080)
@@ -1,13 +1,13 @@
- /*******************************************************************************
- * Copyright (c) 2007-2009 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.openshift.ui.bot.test;
import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
@@ -18,23 +18,36 @@
* <b>OpenShift SWTBot TestSuite</b>
*
* <br>
- * TestSuite containing following test cases :
+ * TestSuite covers following test cases :
* <ul>
- * <li>JBDS50_XXXX User credentials validation</li>
- * <li>JBDS50_XXXX Domain is created, renamed correctly</li>
+ * <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 Express
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({
+@SuiteClasses({
- CredentialsValidation.class,
- DomainManipulation.class
-
- })
+CredentialsValidation.class,
+CreateDomain.class,
+SSHKeysManagment.class,
+RenameDomain.class,
+CreateAppAS7.class,
+EmbeddCartrides.class,
+ImportRepublishAppASS7.class,
+DeleteAppAS7.class,
+DestroyDomain.class
+
+})
@RunWith(RequirementAwareSuite.class)
public class OpenShiftAllBotTests {
-
- // TODO : delete test domain created in DomainManipulation
-
+ // TODO: test republishing with selenium
}
Added:
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
(rev 0)
+++
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/RenameDomain.java 2012-01-24
10:42:01 UTC (rev 38080)
@@ -0,0 +1,30 @@
+package org.jboss.tools.openshift.ui.bot.test;
+
+import org.eclipse.swtbot.swt.finder.SWTBotTestCase;
+import org.eclipse.swtbot.swt.finder.waits.Conditions;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
+import org.jboss.tools.openshift.ui.bot.util.TestProperties;
+import org.junit.Test;
+
+public class RenameDomain extends SWTBotTestCase {
+
+ @Test
+ public void domainRename() {
+
+ SWTBotText domainText = bot.textInGroup("Domain", 0);
+
+ bot.waitUntil(Conditions.widgetIsEnabled(domainText));
+
+ 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("Rename").click();
+
+ bot.waitUntil(Conditions.widgetIsEnabled(domainText));
+ }
+
+}
Added:
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/SSHKeysManagment.java
===================================================================
---
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/SSHKeysManagment.java
(rev 0)
+++
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/SSHKeysManagment.java 2012-01-24
10:42:01 UTC (rev 38080)
@@ -0,0 +1,31 @@
+package org.jboss.tools.openshift.ui.bot.test;
+
+import org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory;
+import org.eclipse.swtbot.swt.finder.waits.Conditions;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.junit.Test;
+
+public class SSHKeysManagment extends SWTTestExt {
+
+ @Test
+ public void addPrivateKey() {
+
+ bot.waitUntilWidgetAppears(Conditions.waitForWidget(WidgetMatcherFactory
+ .withLabel("SSH Public Key")));
+
+ bot.link(0).click("SSH2 Preferences");
+ //TODO: wait
+
+ SWTBotText privateKeysText = bot.text(2);
+
+ privateKeysText.setText(privateKeysText.getText() + ",libra_id_rsa");
+
+ bot.button("OK").click();
+
+ // TODO: repeat untilClosedActiveShell - due to HTTP 500
+
+ bot.button("Finish").click();
+ }
+
+}
Added:
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
(rev 0)
+++
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/util/DomainDestroyer.java 2012-01-24
10:42:01 UTC (rev 38080)
@@ -0,0 +1,52 @@
+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 Express
+ *
+ * @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.err.println(e);
+ } finally {
+ method.releaseConnection();
+ }
+ return resp_code;
+ }
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+ destroyDomain("rhtestdomain", "sbunciak",
"rhtest123");
+ }
+}
Deleted:
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/util/OpenShiftTestProperties.java
===================================================================
---
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/util/OpenShiftTestProperties.java 2012-01-24
10:41:53 UTC (rev 38079)
+++
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/util/OpenShiftTestProperties.java 2012-01-24
10:42:01 UTC (rev 38080)
@@ -1,40 +0,0 @@
-package org.jboss.tools.openshift.ui.bot.util;
-
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.Properties;
-
-import org.apache.log4j.Logger;
-
-/**
- * Just static properties holder
- *
- * @author sbunciak
- *
- */
-public class OpenShiftTestProperties {
-
- public static Properties props = new Properties();
-
- static {
-
- try {
- props.load(new FileInputStream(
- "resources/openshift.ui.bot.test.properties"));
-
- } catch (FileNotFoundException e) {
- Logger.getLogger(OpenShiftTestProperties.class).error(
- "Property file not found !", e);
- } catch (IOException e) {
- Logger.getLogger(OpenShiftTestProperties.class).error(
- "IO Exception !", e);
- }
-
- }
-
- public static String getProperty(String key) {
- return props.getProperty(key);
- }
-
-}
Copied:
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/util/TestProperties.java
(from rev 36826,
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/util/OpenShiftTestProperties.java)
===================================================================
---
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/util/TestProperties.java
(rev 0)
+++
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/util/TestProperties.java 2012-01-24
10:42:01 UTC (rev 38080)
@@ -0,0 +1,40 @@
+package org.jboss.tools.openshift.ui.bot.util;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.Properties;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Just static properties holder
+ *
+ * @author sbunciak
+ *
+ */
+public class TestProperties {
+
+ public static Properties props = new Properties();
+
+ static {
+
+ try {
+ props.load(new FileInputStream(
+ "resources/openshift.ui.bot.test.properties"));
+
+ } catch (FileNotFoundException e) {
+ Logger.getLogger(TestProperties.class).error(
+ "Property file not found !", e);
+ } catch (IOException e) {
+ Logger.getLogger(TestProperties.class).error(
+ "IO Exception !", e);
+ }
+
+ }
+
+ public static String getProperty(String key) {
+ return props.getProperty(key);
+ }
+
+}