Author: lzoubek(a)redhat.com
Date: 2011-04-06 11:30:55 -0400 (Wed, 06 Apr 2011)
New Revision: 30375
Added:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/.classpath
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/.project
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/.settings/
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/.settings/org.eclipse.jdt.core.prefs
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/META-INF/
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/META-INF/MANIFEST.MF
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/build.properties
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/org.jboss.tools.deltacloud.ui.bot.test.launch
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/pom.xml
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/resources/
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/log4j.xml
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/Activator.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/AllBotTests.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/CloudViewerTest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/ConnectionWizardTest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/Util.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/view/
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/view/CloudConnection.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/view/CloudViewer.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/view/ConnectionWizard.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/view/Instances.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/view/LaunchInstance.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/view/ManageKeys.java
Log:
initial version of deltacloud bot tests
Added: trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/.classpath
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/.classpath
(rev 0)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/.classpath 2011-04-06
15:30:55 UTC (rev 30375)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <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>
Added: trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/.project
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/.project
(rev 0)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/.project 2011-04-06
15:30:55 UTC (rev 30375)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.deltacloud.ui.bot.test</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/.settings/org.eclipse.jdt.core.prefs
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/.settings/org.eclipse.jdt.core.prefs
(rev 0)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/.settings/org.eclipse.jdt.core.prefs 2011-04-06
15:30:55 UTC (rev 30375)
@@ -0,0 +1,8 @@
+#Mon Aug 31 15:12:26 CEST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/META-INF/MANIFEST.MF
(rev 0)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/META-INF/MANIFEST.MF 2011-04-06
15:30:55 UTC (rev 30375)
@@ -0,0 +1,24 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Deltacloud SWTBot Tests
+Bundle-SymbolicName: org.jboss.tools.deltacloud.ui.bot.test
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.jboss.tools.deltacloud.ui.bot.test.Activator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.apache.log4j;bundle-version="1.2.13",
+ org.jboss.tools.ui.bot.ext,
+ org.eclipse.jdt.ui,
+ org.eclipse.swtbot.eclipse.core;bundle-version="2.0.0",
+ org.eclipse.swtbot.eclipse.finder;bundle-version="2.0.0",
+ org.eclipse.swtbot.eclipse.ui;bundle-version="2.0.0",
+ org.eclipse.swtbot.junit4_x;bundle-version="2.0.0",
+ org.eclipse.swtbot.swt.finder;bundle-version="2.0.0",
+ org.eclipse.ui.ide;bundle-version="3.5.1",
+ org.eclipse.ui.forms;bundle-version="3.4.1",
+ org.junit4;bundle-version="4.5.0",
+ org.eclipse.core.resources
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Eclipse-RegisterBuddy: org.apache.log4j
+Bundle-ClassPath: .
Added: trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/build.properties
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/build.properties
(rev 0)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/build.properties 2011-04-06
15:30:55 UTC (rev 30375)
@@ -0,0 +1,5 @@
+source.. = src/,\
+ resources/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
Added:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/org.jboss.tools.deltacloud.ui.bot.test.launch
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/org.jboss.tools.deltacloud.ui.bot.test.launch
(rev 0)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/org.jboss.tools.deltacloud.ui.bot.test.launch 2011-04-06
15:30:55 UTC (rev 30375)
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"
standalone="no"?>
+<launchConfiguration
type="org.eclipse.swtbot.eclipse.ui.launcher.JunitLaunchConfig">
+<booleanAttribute key="append.args" value="true"/>
+<booleanAttribute key="askclear" value="false"/>
+<booleanAttribute key="automaticAdd" value="true"/>
+<booleanAttribute key="automaticValidate" value="false"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="true"/>
+<booleanAttribute key="clearws" value="true"/>
+<booleanAttribute key="clearwslog" value="false"/>
+<booleanAttribute
key="com.mountainminds.eclemma.core.INPLACE_INSTRUMENTATION"
value="true"/>
+<listAttribute
key="com.mountainminds.eclemma.core.INSTRUMENTATION_PATHS">
+<listEntry value="/org.jboss.tools.deltacloud.integration/bin"/>
+<listEntry value="/org.jboss.tools.deltacloud.core/bin"/>
+<listEntry value="/org.jboss.tools.deltacloud.ui/bin"/>
+</listAttribute>
+<stringAttribute key="configLocation"
value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
+<booleanAttribute key="default" value="true"/>
+<booleanAttribute key="includeOptional" value="true"/>
+<stringAttribute key="location"
value="${workspace_loc}/../junit-workspace"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry
value="/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/AllBotTests.java"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="1"/>
+</listAttribute>
+<mapAttribute key="org.eclipse.debug.core.environmentVariables">
+<mapEntry key="DISPLAY" value=":1"/>
+</mapAttribute>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER"
value=""/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR"
value="false"/>
+<stringAttribute key="org.eclipse.jdt.junit.TESTNAME"
value=""/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND"
value="org.eclipse.jdt.junit.loader.junit4"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE"
value="org.jboss.tools.deltacloud.ui.bot.test.AllBotTests"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS"
value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl}
-consoleLog"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR"
value="org.jboss.tools.deltacloud.ui.bot.test"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER"
value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS"
value="-Dosgi.requiredJavaVersion=1.5 -XX:MaxPermSize=256m -Xms40m -Xmx512m
-Dusage_reporting_enabled=false
-Dswtbot.test.properties.file=${env_var:HOME}/swtbot.properties"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<stringAttribute key="product"
value="org.eclipse.platform.ide"/>
+<booleanAttribute key="show_selected_only" value="false"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useCustomFeatures" value="false"/>
+<booleanAttribute key="useDefaultConfig" value="true"/>
+<booleanAttribute key="useDefaultConfigArea" value="false"/>
+<booleanAttribute key="useProduct" value="true"/>
+</launchConfiguration>
Added: trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/pom.xml
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/pom.xml
(rev 0)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/pom.xml 2011-04-06
15:30:55 UTC (rev 30375)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+
+ <groupId>org.jboss.tools</groupId>
+ <artifactId>org.jboss.tools.parent.pom</artifactId>
+ <version>0.0.2-SNAPSHOT</version>
+ </parent>
+ <groupId>org.jboss.tools</groupId>
+ <artifactId>org.jboss.tools.deltacloud.ui.bot.test</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>eclipse-test-plugin</packaging>
+</project>
\ No newline at end of file
Added: trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/log4j.xml
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/log4j.xml
(rev 0)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/log4j.xml 2011-04-06
15:30:55 UTC (rev 30375)
@@ -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/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/Activator.java
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/Activator.java
(rev 0)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/Activator.java 2011-04-06
15:30:55 UTC (rev 30375)
@@ -0,0 +1,66 @@
+ /*******************************************************************************
+ * 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.deltacloud.ui.bot.test;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.tools.esb.ui.bot.test";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
+ * )
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
+ * )
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
Added:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/AllBotTests.java
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/AllBotTests.java
(rev 0)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/AllBotTests.java 2011-04-06
15:30:55 UTC (rev 30375)
@@ -0,0 +1,24 @@
+ /*******************************************************************************
+ * 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.deltacloud.ui.bot.test;
+
+import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite.SuiteClasses;
+
+@SuiteClasses({
+ ConnectionWizardTest.class,
+ CloudViewerTest.class
+ })
+(a)RunWith(RequirementAwareSuite.class)
+public class AllBotTests {
+
+}
Added:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/CloudViewerTest.java
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/CloudViewerTest.java
(rev 0)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/CloudViewerTest.java 2011-04-06
15:30:55 UTC (rev 30375)
@@ -0,0 +1,52 @@
+package org.jboss.tools.deltacloud.ui.bot.test;
+
+import java.util.Arrays;
+
+import org.jboss.tools.deltacloud.ui.bot.test.view.CloudConnection;
+import org.jboss.tools.deltacloud.ui.bot.test.view.CloudConnection.InstanceAction;
+import org.jboss.tools.deltacloud.ui.bot.test.view.CloudViewer;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.config.Annotations.SWTBotTestRequires;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+@SWTBotTestRequires(runOnce=true,perspective="Deltacloud",secureStorage=true)
+public class CloudViewerTest extends SWTTestExt {
+
+ private CloudViewer cloudViewer = new CloudViewer();
+
+ @AfterClass
+ public static void waitAMinute() {
+ //bot.sleep(Long.MAX_VALUE);
+ }
+ @BeforeClass
+ public static void setUpInstances() throws Exception {
+ Util.setupPreferences(false, false);
+ Util.setupDefaultConnection(new CloudViewer());
+ Util.setupInstances(new CloudViewer().getConnection(Util.CONNECTION_DEFAULT_NAME), 5);
+ }
+
+ @Test
+ public void instanceActions() {
+ CloudConnection con = cloudViewer.getConnection(Util.CONNECTION_DEFAULT_NAME);
+ log.info(Arrays.toString(con.getInstances().toArray()));
+ log.info(Arrays.toString(con.getImages().toArray()));
+ for (String instance :con.getInstances()) {
+ log.info("Instance "+ instance + "
"+con.canDo(InstanceAction.Reboot, instance));
+ log.info("Instance "+ instance + "
"+con.canDo(InstanceAction.Start, instance));
+ log.info("Instance "+ instance + "
"+con.canDo(InstanceAction.Stop, instance));
+ log.info("Instance "+ instance + "
"+con.canDo(InstanceAction.Destroy, instance));
+ con.selectInstance(instance);
+ properties.getPropertyValue("alias");
+ }
+ log.info(con.multiAction(InstanceAction.Stop, con.getInstances()));
+ log.info(con.multiAction(InstanceAction.Start, con.getInstances()));
+ log.info(con.multiAction(InstanceAction.Reboot, con.getInstances()));
+ }
+ @Test
+ public void instanceMultiActions() {
+
+ }
+
+}
Added:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/ConnectionWizardTest.java
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/ConnectionWizardTest.java
(rev 0)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/ConnectionWizardTest.java 2011-04-06
15:30:55 UTC (rev 30375)
@@ -0,0 +1,89 @@
+package org.jboss.tools.deltacloud.ui.bot.test;
+
+import java.util.Date;
+
+import org.jboss.tools.deltacloud.ui.bot.test.view.CloudViewer;
+import org.jboss.tools.deltacloud.ui.bot.test.view.ConnectionWizard;
+import org.jboss.tools.ui.bot.ext.Assertions;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.Timing;
+import org.jboss.tools.ui.bot.ext.config.Annotations.SWTBotTestRequires;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+@SWTBotTestRequires(runOnce=true,perspective="Deltacloud",secureStorage=true)
+public class ConnectionWizardTest extends SWTTestExt {
+
+ private CloudViewer cloudViewer = new CloudViewer();
+ private static final String connectionName=Util.CONNECTION_DEFAULT_NAME+"2";
+
+ @BeforeClass
+ public static void setUpInstances() throws Exception {
+ Util.setupDefaultConnection(new CloudViewer());
+ new CloudViewer().addConnection(connectionName, Util.MOCK_URL, Util.MOCK_USER,
Util.MOCK_PASS);
+ }
+
+ @AfterClass
+ public static void waitAMinute() {
+ //bot.sleep(Long.MAX_VALUE);
+ }
+
+ @Test
+ public void invalidURL() {
+ ConnectionWizard shell = cloudViewer.getConnection(connectionName).edit();
+ shell.setURL("xxx");
+ bot.sleep(Timing.time3S());
+ assertTrue("Wizard does not show warning when invalid cloud URL is entered",
shell.getErrorWarningText().startsWith("Invalid"));
+ Assertions.assertControlEnabled(shell.bot().button(IDELabel.Button.TEST), false);
+ shell.setURL("http://localhost:60000");
+ bot.sleep(Timing.time10S());
+ assertTrue("Wizard does not show warning when invalid cloud URL is entered",
shell.getErrorWarningText().startsWith("Invalid"));
+ Assertions.assertControlEnabled(shell.bot().button(IDELabel.Button.TEST), false);
+ shell.cancel();
+ }
+
+ @Test
+ public void testConnection() {
+ ConnectionWizard shell = cloudViewer.getConnection(connectionName).edit();
+ shell.setPassword("");
+ shell.setUsername("");
+ Assertions.assertControlEnabled(shell.bot().button(IDELabel.Button.TEST), true);
+ shell.testConnection();
+ // test should fail - credentials not provided
+ assertTrue("Connection Test did not fail for empty credentials",
shell.getErrorWarningText().contains("failed"));
+ shell.setUsername(Util.MOCK_USER);
+ shell.setPassword(Util.MOCK_PASS);
+ shell.testConnection();
+ assertFalse("Connection Test failed for valid credentials and URI",
"".equals(shell.getErrorWarningText()));
+ shell.cancel();
+
+ }
+ @Test
+ public void newConnection() {
+ cloudViewer.show().bot().tree().contextMenu("New Connection").click();
+ ConnectionWizard shell = new ConnectionWizard();
+ shell.setURL("");
+ Assertions.assertControlEnabled(shell.bot().button(IDELabel.Button.TEST), false);
+ Assertions.assertControlEnabled(shell.bot().button(IDELabel.Button.FINISH), false);
+ shell.setURL(Util.MOCK_URL);
+ shell.bot().sleep(TIME_1S);
+ Assertions.assertControlEnabled(shell.bot().button(IDELabel.Button.TEST), true);
+ Assertions.assertControlEnabled(shell.bot().button(IDELabel.Button.FINISH), false);
+ shell.setName(Util.CONNECTION_DEFAULT_NAME);
+ Assertions.assertControlEnabled(shell.bot().button(IDELabel.Button.FINISH), false);
+ shell.setName(Util.CONNECTION_DEFAULT_NAME+new Date().getTime());
+ Assertions.assertControlEnabled(shell.bot().button(IDELabel.Button.FINISH), true);
+ shell.setURL(Util.MOCK_URL+"x");
+ shell.bot().sleep(TIME_1S);
+ Assertions.assertControlEnabled(shell.bot().button(IDELabel.Button.TEST), false);
+ Assertions.assertControlEnabled(shell.bot().button(IDELabel.Button.FINISH), true);
+ shell.setURL(Util.MOCK_URL);
+ shell.bot().sleep(TIME_1S);
+ Assertions.assertControlEnabled(shell.bot().button(IDELabel.Button.TEST), true);
+ Assertions.assertControlEnabled(shell.bot().button(IDELabel.Button.FINISH), true);
+ shell.finish();
+ }
+
+
+}
Added:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/Util.java
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/Util.java
(rev 0)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/Util.java 2011-04-06
15:30:55 UTC (rev 30375)
@@ -0,0 +1,85 @@
+package org.jboss.tools.deltacloud.ui.bot.test;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox;
+import org.jboss.tools.deltacloud.ui.bot.test.view.CloudConnection;
+import org.jboss.tools.deltacloud.ui.bot.test.view.CloudViewer;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem.Preference;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+
+public class Util {
+ static Logger log = Logger.getLogger(Util.class);
+ public static final String CONNECTION_DEFAULT_NAME="default";
+ public static final String MOCK_URL="http://localhost:3000";
+ public static final String MOCK_USER="mockuser";
+ public static final String MOCK_PASS="mockpassword";
+
+ public static void setupDefaultConnection(CloudViewer viewer) {
+ viewer.addConnection("default", MOCK_URL, MOCK_USER, MOCK_PASS);
+ }
+
+ public static void setupPreferences(boolean warnInstances, boolean autoConnectRSE) {
+ SWTBot wiz =
SWTTestExt.open.preferenceOpen(Preference.create("Deltacloud"));
+ SWTBotCheckBox wi = wiz.checkBox("Do not warn me when launching an
instance");
+ SWTBotCheckBox acrse = wiz.checkBox("Automatically connect to RSE when creating an
instance");
+ if (warnInstances) wi.deselect();
+ else wi.select();
+ if (autoConnectRSE) acrse.select();
+ else acrse.deselect();
+ SWTTestExt.open.finish(wiz, IDELabel.Button.OK);
+ }
+
+ public static void setupInstances(CloudConnection conn, int instances) {
+ conn.destroyAllInstances();
+ final String instance="inst-";
+ List<String> images = conn.getImages();
+ assertTrue("No images in cloud, cannot continue", images.size()>0);
+ for (int i = 0;i<instances;i++) {
+ conn.launchDefault(instance, images.get(0), "default");
+ }
+ }
+
+ /**
+ * gets image id from image label ( format is xxx [id])
+ *
+ */
+ public static String getImageId(String imageLabel) {
+ int i = imageLabel.lastIndexOf("[");
+ if (i>0) {
+ return imageLabel.substring(i+1, imageLabel.length()-1);
+ }
+ return "";
+ }
+ public static boolean isDeltacloudRunning(String url) {
+ HttpURLConnection connection = null;
+ try {
+ URL u = new URL(url);
+ connection = (HttpURLConnection) u.openConnection();
+ connection.setRequestProperty("accept", "*/*");
+ if (HttpURLConnection.HTTP_OK == connection.getResponseCode()) {
+ return true;
+ }
+ log.error(connection.getResponseCode()+"
"+connection.getResponseMessage());
+ return false;
+ } catch (MalformedURLException e1) {
+ throw new RuntimeException(e1);
+ } catch (IOException e) {
+ log.error(e);
+ return false;
+ } finally {
+ if (connection != null) {
+ connection.disconnect();
+ }
+ }
+ }
+}
Added:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/view/CloudConnection.java
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/view/CloudConnection.java
(rev 0)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/view/CloudConnection.java 2011-04-06
15:30:55 UTC (rev 30375)
@@ -0,0 +1,190 @@
+package org.jboss.tools.deltacloud.ui.bot.test.view;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.deltacloud.ui.bot.test.ConnectionWizardTest;
+import org.jboss.tools.ui.bot.ext.SWTBotExt;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.SWTUtilExt;
+import org.jboss.tools.ui.bot.ext.Timing;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+
+public class CloudConnection {
+
+ Logger log = Logger.getLogger(CloudConnection.class);
+ private static final String INSTANCES="Instances";
+ private static final String IMAGES="Images";
+ public enum InstanceAction {
+ Start,
+ Destroy,
+ Reboot,
+ Stop,
+ }
+ private final CloudViewer viewer;
+ private final String name;
+ private final SWTUtilExt util = SWTTestExt.util;
+ public CloudConnection(CloudViewer viewer, String name) {
+ this.viewer = viewer;
+ this.name = name;
+ // force client to load instances and images
+ viewer.bot().tree().expandNode(name).expandNode(INSTANCES);
+ viewer.bot().tree().expandNode(name).expandNode(IMAGES);
+ util.waitForNonIgnoredJobs();
+ }
+ /**
+ * gets list of instances in cloud
+ * @return
+ */
+ public List<String> getInstances() {
+ List<String> instances = new ArrayList<String>();
+ for (SWTBotTreeItem instance : getItems(INSTANCES)) {
+ instances.add(instance.getText());
+ }
+ return instances;
+ }
+ private SWTBotTreeItem[] getItems(String node) {
+ return viewer.bot().tree().expandNode(name).expandNode(node).getItems();
+ }
+ /**
+ * gets list of images in cloud
+ * @return
+ */
+ public List<String> getImages() {
+ List<String> instances = new ArrayList<String>();
+ for (SWTBotTreeItem instance : getItems(IMAGES)) {
+ instances.add(instance.getText());
+ }
+ return instances;
+ }
+ /**
+ * performs an action on an instance
+ * @param action
+ * @param instance
+ */
+ public void action(InstanceAction action, String instance) {
+ selectInstance(instance);
+ viewer.bot().tree().contextMenu(action.toString()).click();
+ util.waitForNonIgnoredJobs();
+ }
+ /**
+ * performs click on item in context menu
+ * @param menu
+ * @return
+ */
+ public SWTBotMenu contextMenuClick(String menu) {
+ return viewer.show().bot().tree().contextMenu(menu).click();
+ }
+ /**
+ * performs given action on all instances, if action cannot be performed it is skipped
+ * @param action
+ */
+ public void actionAll(InstanceAction action) {
+ for (String instance : getInstances()) {
+ if (canDo(action, instance)) {
+ action(action, instance);
+ }
+ }
+ }
+ /**
+ * performs action on multiple instances (instances gets selected and than one action is
performed)
+ * @param action
+ * @param instances
+ * @return count of instances that have been affected by action (action was performed on
them)
+ */
+ public int multiAction(InstanceAction action, List<String> instances) {
+ int instances_before = instances.size();
+ viewer.bot().tree().expandNode(name).expandNode(INSTANCES).select(instances.toArray(new
String[0]));
+ if (!viewer.bot().tree().contextMenu(action.toString()).isEnabled()) {
+ return 0;
+ }
+ viewer.bot().tree().contextMenu(action.toString()).click();
+ SWTBotShell shell = new SWTBotExt().activeShell();
+ int count = shell.bot().table().rowCount();
+ shell.bot().button(IDELabel.Button.OK).click();
+ util.waitForNonIgnoredJobs();
+ int instances_after = getInstances().size();
+ assertEquals(String.format("Count of instances before multi-action '%s'
was performed is different, ",action.toString()),instances_before, instances_after);
+ return count;
+ }
+
+ public void destroyAllInstances() {
+ for (String instance : getInstances()) {
+ if (canDo(InstanceAction.Destroy, instance)) {
+ action(InstanceAction.Destroy, instance);
+ }
+ else {
+ action(InstanceAction.Stop, instance);
+ action(InstanceAction.Destroy, instance);
+ }
+ }
+ }
+ public boolean canDo(InstanceAction action, String instance) {
+ selectInstance(instance);
+ return viewer.bot().tree().contextMenu(action.toString()).isEnabled();
+ }
+ public SWTBotTreeItem selectInstance(String instance) {
+ return viewer.bot().tree().expandNode(name).expandNode(INSTANCES).select(instance);
+ }
+ public SWTBotTreeItem selectImage(String image) {
+ return viewer.bot().tree().expandNode(name).expandNode(IMAGES).select(image);
+ }
+ public SWTBotTreeItem selectImages() {
+ return viewer.bot().tree().expandNode(name).expandNode(IMAGES).select();
+ }
+ public SWTBotTreeItem selectInstances() {
+ return viewer.bot().tree().expandNode(name).expandNode(INSTANCES).select();
+ }
+ public LaunchInstance launch() {
+ contextMenuClick("Launch Instance");
+ return new LaunchInstance();
+ }
+ public LaunchInstance launch(String imageName) {
+ selectImage(imageName);
+ contextMenuClick("Launch Instance");
+ return new LaunchInstance();
+ }
+ public ManageKeys manageKeys() {
+ contextMenuClick("Manage Keys");
+ return new ManageKeys(SWTTestExt.bot.activeShell().widget);
+ }
+ public ConnectionWizard edit() {
+ viewer.bot().tree().expandNode(name).select();
+ contextMenuClick("Edit Connection");
+ return new ConnectionWizard();
+ }
+ /**
+ * launches default instance (without RSE or Server Adapter)
+ * @param name
+ * @param imageName
+ * @param key is created in management if does not exist
+ */
+ public void launchDefault(String name, String imageName, String key) {
+
+ LaunchInstance launch = launch(imageName);
+ launch.setName(name);
+ launch.setImage(imageName);
+ launch.setKey(key);
+ launch.bot().sleep(Timing.time1S());
+ ManageKeys keys = launch.manageKeys();
+ if (keys.getKeys().contains(key)) {
+ keys.clickCancel();
+ }
+ else {
+ keys.newKey(key, true);
+ keys.selectKey(key);
+ keys.clickOK();
+ }
+ launch.next();
+ launch.setCreateServer(false);
+ launch.setCreateRSE(false);
+ launch.finish();
+ }
+
+}
Added:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/view/CloudViewer.java
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/view/CloudViewer.java
(rev 0)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/view/CloudViewer.java 2011-04-06
15:30:55 UTC (rev 30375)
@@ -0,0 +1,69 @@
+package org.jboss.tools.deltacloud.ui.bot.test.view;
+
+import static org.eclipse.swtbot.swt.finder.waits.Conditions.shellIsActive;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.log4j.Logger;
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.widgets.TimeoutException;
+import org.jboss.tools.deltacloud.ui.bot.test.Util;
+import org.jboss.tools.ui.bot.ext.Assertions;
+import org.jboss.tools.ui.bot.ext.SWTBotExt;
+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.View;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.jboss.tools.ui.bot.ext.view.ViewBase;
+
+public class CloudViewer extends ViewBase {
+ Logger log = Logger.getLogger(CloudViewer.class);
+ SWTBotExt bot = SWTTestExt.bot;
+ public CloudViewer() {
+ this.viewObject = View.create("Deltacloud","Cloud Viewer");
+ }
+ public CloudConnection getConnection(String name) {
+ this.show().bot().tree().getTreeItem(name);
+ return new CloudConnection(this,name);
+ }
+ public boolean existsConnection(String name) {
+ try {
+ this.show().bot().tree().getTreeItem(name);
+ return true;
+ }
+ catch (WidgetNotFoundException e) {
+ return false;
+ }
+ }
+ public void addConnection(String name, String url, String user, String password) {
+ if (existsConnection(name)) {
+ return;
+ }
+ assertTrue("Deltacloud server is not listening on
"+url,Util.isDeltacloudRunning(url));
+ assertNotNull("Secure Stoarge password is not
configured",SWTTestExt.configuredState.getSecureStoragePassword());
+ CloudViewer cloud = new CloudViewer();
+ cloud.show().bot().tree().contextMenu("New Connection").click();
+ ConnectionWizard shell = new ConnectionWizard();
+ Assertions.assertControlEnabled(shell.bot().button(IDELabel.Button.FINISH), false);
+ shell.setName(name);
+ shell.setURL(url);
+ shell.setUsername(user);
+ shell.setPassword(password);
+ shell.testConnection();
+ try {
+ bot.waitUntil(shellIsActive("Secure Storage"), Timing.time3S());
+ SWTBot st = bot.shell("Secure Storage").activate().bot();
+ st.textWithLabel("Password:").setText(SWTTestExt.configuredState.getSecureStoragePassword());
+ st.button(IDELabel.Button.OK).click();
+ }
+ catch (TimeoutException ex) {
+
+ }
+ util.waitForNonIgnoredJobs();
+ Assertions.assertControlEnabled(shell.bot().button(IDELabel.Button.FINISH), true);
+ shell.finish();
+
+ }
+
+}
Added:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/view/ConnectionWizard.java
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/view/ConnectionWizard.java
(rev 0)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/view/ConnectionWizard.java 2011-04-06
15:30:55 UTC (rev 30375)
@@ -0,0 +1,41 @@
+package org.jboss.tools.deltacloud.ui.bot.test.view;
+
+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.NewObject;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.jboss.tools.ui.bot.ext.wizards.SWTBotWizard;
+
+public class ConnectionWizard extends SWTBotWizard {
+
+ public static ConnectionWizard create() {
+ SWTTestExt.open.newObject(NewObject.create("Deltacloud","Cloud
Connection"));
+ return new ConnectionWizard();
+ }
+ public void setName(String name) {
+ this.setText("Name:", name);
+ }
+ public void setURL(String url) {
+ this.setText("URL:", url);
+ }
+ public void setUsername(String username) {
+ this.setText("Username:", username);
+ }
+ public void setPassword(String pass) {
+ this.setText("Password:", pass);
+ }
+
+ public void testConnection() {
+ bot().button(IDELabel.Button.TEST).click();
+ bot().sleep(Timing.time2S());
+ SWTTestExt.util.waitForNonIgnoredJobs();
+ }
+ public String getErrorWarningText() {
+ return bot().text(4).getText();
+ }
+
+ protected void setText(String label, String text) {
+ super.setText(label, text);
+ bot().sleep(Timing.time2S());
+ }
+}
Added:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/view/Instances.java
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/view/Instances.java
(rev 0)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/view/Instances.java 2011-04-06
15:30:55 UTC (rev 30375)
@@ -0,0 +1,15 @@
+package org.jboss.tools.deltacloud.ui.bot.test.view;
+
+import org.apache.log4j.Logger;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem.View;
+import org.jboss.tools.ui.bot.ext.view.ViewBase;
+
+public class Instances extends ViewBase {
+
+ Logger log = Logger.getLogger(Instances.class);
+
+ public Instances() {
+ this.viewObject = View.create("Deltacloud","Instances");
+ }
+
+}
Added:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/view/LaunchInstance.java
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/view/LaunchInstance.java
(rev 0)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/view/LaunchInstance.java 2011-04-06
15:30:55 UTC (rev 30375)
@@ -0,0 +1,30 @@
+package org.jboss.tools.deltacloud.ui.bot.test.view;
+
+import org.jboss.tools.deltacloud.ui.bot.test.Util;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.wizards.SWTBotWizard;
+
+public class LaunchInstance extends SWTBotWizard {
+
+ public void setName(String name) {
+ this.setText("Name:", name);
+ }
+ public void setImage(String image) {
+ this.setText("Image:", Util.getImageId(image));
+ }
+ public void setKey(String key) {
+ this.setText("Key Name:", key);
+ }
+ public void setCreateRSE(boolean create) {
+ if (create) bot().checkBox("Create RSE Connection").select();
+ bot().checkBox("Create RSE Connection").deselect();
+ }
+ public void setCreateServer(boolean create) {
+ if (create) bot().checkBox("Create Server Adapter").select();
+ bot().checkBox("Create Server Adapter").deselect();
+ }
+ public ManageKeys manageKeys() {
+ bot().button("Manage...").click();
+ return new ManageKeys(SWTTestExt.bot.shell("Manage Keys").widget);
+ }
+}
Added:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/view/ManageKeys.java
===================================================================
---
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/view/ManageKeys.java
(rev 0)
+++
trunk/deltacloud/tests/org.jboss.tools.deltacloud.ui.bot.test/src/org/jboss/tools/deltacloud/ui/bot/test/view/ManageKeys.java 2011-04-06
15:30:55 UTC (rev 30375)
@@ -0,0 +1,59 @@
+package org.jboss.tools.deltacloud.ui.bot.test.view;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+
+public class ManageKeys extends SWTBotShell {
+
+ public ManageKeys(Shell shell) throws WidgetNotFoundException {
+ super(shell);
+ }
+
+ public void selectKey(String key) {
+ bot().list().select(key);
+ }
+
+ public void refreshKeys() {
+ bot().button("Refresh keys").click();
+ }
+ public List<String> getKeys() {
+ return Arrays.asList(bot().list().getItems());
+ }
+ /**
+ *
+ * @param name
+ * @param savePrivatePart
+ * @return path to .pem file
+ */
+ public String newKey(String name, boolean savePrivatePart) {
+ bot().button(IDELabel.Button.NEW).click();
+ SWTBot active = bot().activeShell().activate().bot();
+ active.text(0).setText(name);
+ if (!savePrivatePart) active.checkBox().deselect();
+ active.button(IDELabel.Button.OK).click();
+ SWTTestExt.util.waitForNonIgnoredJobs();
+ return name;
+ }
+ public void deleteKey(String name) {
+ selectKey(name);
+ bot().button(IDELabel.Button.DELETE).click();
+ }
+ public void delteAllKeys() {
+ for (String key:getKeys()) {
+ deleteKey(key);
+ }
+ }
+ public void clickOK() {
+ bot().button(IDELabel.Button.OK).click();
+ }
+ public void clickCancel() {
+ bot().button(IDELabel.Button.CANCEL).click();
+ }
+}