Author: sbunciak
Date: 2011-12-01 05:28:44 -0500 (Thu, 01 Dec 2011)
New Revision: 36826
Added:
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/resources/
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/screenshots/
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/log4j.xml
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/DomainManipulation.java
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/
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/.classpath
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/META-INF/MANIFEST.MF
Log:
OpenShift user credential validation automated
Modified: trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/.classpath
===================================================================
--- trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/.classpath 2011-12-01
09:28:49 UTC (rev 36825)
+++ trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/.classpath 2011-12-01
10:28:44 UTC (rev 36826)
@@ -3,5 +3,6 @@
<classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con"
path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="resources"/>
<classpathentry kind="output" path="bin"/>
</classpath>
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 2011-12-01
09:28:49 UTC (rev 36825)
+++
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/META-INF/MANIFEST.MF 2011-12-01
10:28:44 UTC (rev 36826)
@@ -6,6 +6,17 @@
Bundle-Activator: org.jboss.tools.openshift.ui.bot.test.Activator
Bundle-Vendor: Red Hat
Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime
+ org.eclipse.core.runtime,
+ org.apache.log4j;bundle-version="1.2.15",
+ org.jboss.tools.ui.bot.ext,
+ org.junit4;bundle-version="4.8.1",
+ org.eclipse.swtbot.eclipse.core;bundle-version="2.0.5",
+ org.eclipse.swtbot.eclipse.finder;bundle-version="2.0.5",
+ org.eclipse.swtbot.eclipse.ui;bundle-version="2.0.5",
+ org.eclipse.swtbot.junit4_x;bundle-version="2.0.5",
+ 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"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Added:
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
(rev 0)
+++
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/resources/openshift.ui.bot.test.properties 2011-12-01
10:28:44 UTC (rev 36826)
@@ -0,0 +1,4 @@
+openshift.user.name=sbunciak
+openshift.user.pwd=rhtest123
+openshift.user.wrongpwd=rhtest
+openshift.domain=rhtestdomain
Added: 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)
Property changes on:
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/screenshots/Default -
testUserCredentialsValidation(org.jboss.tools.openshift.ui.bot.test.CredentialsValidation).jpeg
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added:
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/screenshots/screenshot-CredentialsValidation.testUserCredentialsValidation.jpeg
===================================================================
(Binary files differ)
Property changes on:
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/screenshots/screenshot-CredentialsValidation.testUserCredentialsValidation.jpeg
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/log4j.xml
===================================================================
--- trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/log4j.xml
(rev 0)
+++ trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/log4j.xml 2011-12-01
10:28:44 UTC (rev 36826)
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+<log4j:configuration
xmlns:log4j="http://jakarta.apache.org/log4j/"
+ debug="false">
+
+ <appender name="consoleAppender"
class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out" />
+ <layout class="org.apache.log4j.PatternLayout">
+ <!--
+ <param name="ConversionPattern"
+ value="%d{dd MMM yyyy HH:mm:ss.SSS} - %25t - %-5p - %30c{1} - (%C{1}.java:%L) -
%m%n" />
+ -->
+ <param name="ConversionPattern"
+ value="(%C{1}.java:%L) - %m%n" />
+
+ </layout>
+ </appender>
+
+ <appender name="fileAppender"
class="org.apache.log4j.FileAppender">
+ <param name="File" value="/tmp/debug.log" />
+ <param name="Append" value="false" />
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern"
+ value="%d{dd MMM yyyy HH:mm:ss.SSS} - %25t - %-5p - %30c{1} - (%C{1}.java:%L) -
%m%n" />
+ </layout>
+ </appender>
+
+ <appender name="asyncAppender"
class="org.apache.log4j.AsyncAppender">
+ <appender-ref ref="consoleAppender" />
+ <appender-ref ref="fileAppender" />
+ </appender>
+
+ <!-- don't log matchers, this is very high amount of chatter -->
+ <category name="org.eclipse.swtbot.swt.finder.matchers">
+ <priority value="OFF" />
+ </category>
+
+ <!--
+ don't log widget notification events, this is moderately high chatter
+ -->
+ <category name="org.eclipse.swtbot.swt.finder.widgets">
+ <priority value="OFF" />
+ </category>
+
+ <!-- don't log finders, this is moderate chatter -->
+ <category name="org.eclipse.swtbot.swt.finder.finders">
+ <priority value="DEBUG" />
+ </category>
+
+ <category name="org.eclipse.swtbot.swt.finder.keyboard">
+ <!-- set to a value higher than debug to turn on. -->
+ <priority value="DEBUG" />
+ </category>
+
+ <category name="org.eclipse.swtbot">
+ <priority value="ALL" />
+ </category>
+
+ <root>
+ <priority value="INFO" />
+ <appender-ref ref="consoleAppender" />
+ <appender-ref ref="fileAppender" />
+ </root>
+
+</log4j:configuration>
\ No newline at end of file
Added:
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
(rev 0)
+++
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/CredentialsValidation.java 2011-12-01
10:28:44 UTC (rev 36826)
@@ -0,0 +1,77 @@
+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.OpenShiftTestProperties;
+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.junit.Test;
+
+@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(
+ OpenShiftTestProperties.getProperty("openshift.user.name"));
+ wiz.text(1).setText(
+
OpenShiftTestProperties.getProperty("openshift.user.wrongpwd"));
+
+ assertTrue(
+ "Validation button should be enabled to check the user
credentials.",
+ validateButton.isEnabled());
+
+ SWTBotButton nextButton = wiz.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());
+
+ // 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"));
+
+ 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();
+ }
+
+}
Added:
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
(rev 0)
+++
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/DomainManipulation.java 2011-12-01
10:28:44 UTC (rev 36826)
@@ -0,0 +1,22 @@
+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/OpenShiftAllBotTests.java
===================================================================
---
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/OpenShiftAllBotTests.java
(rev 0)
+++
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/OpenShiftAllBotTests.java 2011-12-01
10:28:44 UTC (rev 36826)
@@ -0,0 +1,40 @@
+ /*******************************************************************************
+ * 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;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite.SuiteClasses;
+
+/**
+ * <b>OpenShift SWTBot TestSuite</b>
+ *
+ * <br>
+ * TestSuite containing following test cases :
+ * <ul>
+ * <li>JBDS50_XXXX User credentials validation</li>
+ * <li>JBDS50_XXXX Domain is created, renamed correctly</li>
+ * </ul>
+ *
+ * @author sbunciak
+ */
+@SuiteClasses({
+
+ CredentialsValidation.class,
+ DomainManipulation.class
+
+ })
+(a)RunWith(RequirementAwareSuite.class)
+public class OpenShiftAllBotTests {
+
+ // TODO : delete test domain created in DomainManipulation
+
+}
Added:
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
(rev 0)
+++
trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/util/OpenShiftTestProperties.java 2011-12-01
10:28:44 UTC (rev 36826)
@@ -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 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);
+ }
+
+}