Author: ljelinko
Date: 2012-04-19 05:36:22 -0400 (Thu, 19 Apr 2012)
New Revision: 40326
Added:
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/.classpath
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/.project
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/META-INF/
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/META-INF/MANIFEST.MF
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/build.properties
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/launchers/
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/launchers/RT_detection_AllTestsSuite.launch
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/launchers/prepare_workspace/
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/launchers/prepare_workspace/pom.xml
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/resources/
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/resources/runtimes.properties
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/Activator.java
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/AllTestsSuite.java
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/RuntimeProperties.java
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/dialog/
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/dialog/preferences/
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/dialog/preferences/RuntimeDetectionPreferencesDialog.java
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/dialog/preferences/SearchingForRuntimesDialog.java
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/entity/
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/entity/Server.java
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/jboss71/
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/jboss71/DetectJBoss71.java
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/jboss71/OperateJBoss71.java
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/matcher/
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/matcher/ServerMatcher.java
Log:
Initial commit
Added: trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/.classpath
===================================================================
--- trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/.classpath
(rev 0)
+++ trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/.classpath 2012-04-19
09:36:22 UTC (rev 40326)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <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/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/.project
===================================================================
--- trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/.project
(rev 0)
+++ trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/.project 2012-04-19
09:36:22 UTC (rev 40326)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.runtime.as.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/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/META-INF/MANIFEST.MF
(rev 0)
+++
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/META-INF/MANIFEST.MF 2012-04-19
09:36:22 UTC (rev 40326)
@@ -0,0 +1,21 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Runtime Test
+Bundle-SymbolicName: org.jboss.tools.runtime.as.ui.bot.test;singleton:=true
+Bundle-Version: 1.3.0.qualifier
+Bundle-ActivationPolicy: lazy
+Bundle-Vendor:
+ JBoss by Red Hat
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.swtbot.eclipse.core;bundle-version="2.0.0",
+ org.eclipse.swtbot.eclipse.finder;bundle-version="2.0.0",
+ org.eclipse.swtbot.swt.finder;bundle-version="2.0.0",
+ org.apache.log4j;bundle-version="1.2.13",
+ org.junit4;bundle-version="4.8.1",
+ org.jboss.tools.ui.bot.ext;bundle-version="1.0.0",
+ org.hamcrest;bundle-version="1.1.0",
+ org.jboss.tools.runtime.core,
+ org.jboss.tools.runtime.ui;bundle-version="1.3.0"
+
Added: trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/build.properties
===================================================================
--- trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/build.properties
(rev 0)
+++ trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/build.properties 2012-04-19
09:36:22 UTC (rev 40326)
@@ -0,0 +1,6 @@
+source.. = src/,\
+ resources/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ resources/
\ No newline at end of file
Added:
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/launchers/RT_detection_AllTestsSuite.launch
===================================================================
---
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/launchers/RT_detection_AllTestsSuite.launch
(rev 0)
+++
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/launchers/RT_detection_AllTestsSuite.launch 2012-04-19
09:36:22 UTC (rev 40326)
@@ -0,0 +1,42 @@
+<?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"/>
+<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.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/AllTestsSuite.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=":${string_prompt:display
number:0}"/>
+</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.runtime.as.ui.bot.test.AllTestsSuite"/>
+<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.runtime.as.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="-Xmx1024m -XX:MaxPermSize=256m"/>
+<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/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/launchers/prepare_workspace/pom.xml
===================================================================
---
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/launchers/prepare_workspace/pom.xml
(rev 0)
+++
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/launchers/prepare_workspace/pom.xml 2012-04-19
09:36:22 UTC (rev 40326)
@@ -0,0 +1,21 @@
+<?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">
+
+ <groupId>org.jboss.tools.runtime.as.ui.bot.test</groupId>
+ <artifactId>prepare.workspace</artifactId>
+ <version>0.0.0-SNAPSHOT</version>
+ <modelVersion>4.0.0</modelVersion>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>../../resources/template</directory>
+ <filtering>true</filtering>
+ <includes>
+ <include>runtimes.properties</include>
+ </includes>
+ </resource>
+ </resources>
+ <outputDirectory>../../resources</outputDirectory>
+ </build>
+</project>
\ No newline at end of file
Added:
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/resources/runtimes.properties
===================================================================
---
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/resources/runtimes.properties
(rev 0)
+++
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/resources/runtimes.properties 2012-04-19
09:36:22 UTC (rev 40326)
@@ -0,0 +1 @@
+jboss-as-7.1.0.Final=${jboss-as-7-1}
\ No newline at end of file
Added:
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/Activator.java
===================================================================
---
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/Activator.java
(rev 0)
+++
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/Activator.java 2012-04-19
09:36:22 UTC (rev 40326)
@@ -0,0 +1,50 @@
+package org.jboss.tools.runtime.as.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.runtime.as.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/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/AllTestsSuite.java
===================================================================
---
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/AllTestsSuite.java
(rev 0)
+++
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/AllTestsSuite.java 2012-04-19
09:36:22 UTC (rev 40326)
@@ -0,0 +1,16 @@
+package org.jboss.tools.runtime.as.ui.bot.test;
+
+import org.jboss.tools.runtime.as.ui.bot.test.jboss71.DetectJBoss71;
+import org.jboss.tools.runtime.as.ui.bot.test.jboss71.OperateJBoss71;
+import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+(a)RunWith(RequirementAwareSuite.class)
+(a)Suite.SuiteClasses({
+ DetectJBoss71.class,
+ OperateJBoss71.class
+})
+public class AllTestsSuite {
+
+}
Added:
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/RuntimeProperties.java
===================================================================
---
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/RuntimeProperties.java
(rev 0)
+++
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/RuntimeProperties.java 2012-04-19
09:36:22 UTC (rev 40326)
@@ -0,0 +1,54 @@
+package org.jboss.tools.runtime.as.ui.bot.test;
+
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.Properties;
+
+import org.jboss.tools.ui.bot.ext.SWTUtilExt;
+
+/**
+ * Reads the configured runtimes from the property file.
+ *
+ * @author Lucia Jelinkova
+ *
+ */
+public class RuntimeProperties {
+
+ private static final RuntimeProperties INSTANCE = new RuntimeProperties();
+
+ private static Properties properties;
+
+ private RuntimeProperties() {
+ // singleton
+ }
+
+ public static RuntimeProperties getInstance() {
+ return INSTANCE;
+ }
+
+ public String getRuntimePath(String runtimeId){
+ if (properties == null){
+ loadProperties();
+ }
+
+ String path = properties.getProperty(runtimeId);
+
+ if (path == null){
+ throw new IllegalArgumentException("No runtime path found for runtime id " +
runtimeId);
+ }
+
+ return path;
+ }
+
+ private void loadProperties() {
+ try {
+ properties = new Properties();
+ properties.load(new FileReader(SWTUtilExt.getResourceFile(Activator.PLUGIN_ID,
"/runtimes.properties")));
+ } catch (FileNotFoundException e) {
+ throw new RuntimeException(e);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
Added:
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/dialog/preferences/RuntimeDetectionPreferencesDialog.java
===================================================================
---
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/dialog/preferences/RuntimeDetectionPreferencesDialog.java
(rev 0)
+++
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/dialog/preferences/RuntimeDetectionPreferencesDialog.java 2012-04-19
09:36:22 UTC (rev 40326)
@@ -0,0 +1,44 @@
+package org.jboss.tools.runtime.as.ui.bot.test.dialog.preferences;
+
+import java.util.Set;
+
+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
+import org.eclipse.swtbot.swt.finder.results.VoidResult;
+import org.jboss.tools.runtime.core.model.RuntimePath;
+import org.jboss.tools.runtime.ui.RuntimeUIActivator;
+import org.jboss.tools.ui.bot.ext.SWTBotFactory;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem.Preference;
+import org.jboss.tools.ui.bot.ext.gen.IPreference;
+
+public class RuntimeDetectionPreferencesDialog {
+
+ public void open(){
+ IPreference preference = Preference.create("JBoss Tools", "JBoss Tools
Runtime Detection");
+ SWTBotFactory.getOpen().preferenceOpen(preference);
+ }
+
+ public SearchingForRuntimesDialog addPath(final String path){
+ UIThreadRunnable.syncExec(new VoidResult() {
+
+ @Override
+ public void run() {
+ Set<RuntimePath> runtimePaths =
RuntimeUIActivator.getDefault().getRuntimePaths();
+ runtimePaths.add(new RuntimePath(path));
+ RuntimeUIActivator.getDefault().saveRuntimePaths();
+ }
+ });
+
+ SWTBotFactory.getBot().button("OK").click();
+ open();
+ return new SearchingForRuntimesDialog();
+ }
+
+ public void ok(){
+ SWTBotFactory.getBot().button("OK").click();
+ }
+
+ public SearchingForRuntimesDialog search(){
+ SWTBotFactory.getBot().button("Search...").click();
+ return new SearchingForRuntimesDialog();
+ }
+}
Added:
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/dialog/preferences/SearchingForRuntimesDialog.java
===================================================================
---
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/dialog/preferences/SearchingForRuntimesDialog.java
(rev 0)
+++
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/dialog/preferences/SearchingForRuntimesDialog.java 2012-04-19
09:36:22 UTC (rev 40326)
@@ -0,0 +1,30 @@
+package org.jboss.tools.runtime.as.ui.bot.test.dialog.preferences;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.jboss.tools.runtime.as.ui.bot.test.entity.Server;
+import org.jboss.tools.ui.bot.ext.SWTBotFactory;
+
+public class SearchingForRuntimesDialog {
+
+ public List<Server> getServers(){
+ List<Server> servers = new ArrayList<Server>();
+ SWTBotTree tree = SWTBotFactory.getBot().tree();
+
+ for (int i = 0; i < tree.rowCount(); i++){
+ Server server = new Server();
+ server.setName(tree.cell(i, 0));
+ server.setVersion(tree.cell(i, 1));
+ server.setType(tree.cell(i, 2));
+ server.setLocation(tree.cell(i, 3));
+ servers.add(server);
+ }
+ return servers;
+ }
+
+ public void ok(){
+ SWTBotFactory.getBot().button("OK").click();
+ }
+}
Added:
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/entity/Server.java
===================================================================
---
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/entity/Server.java
(rev 0)
+++
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/entity/Server.java 2012-04-19
09:36:22 UTC (rev 40326)
@@ -0,0 +1,94 @@
+package org.jboss.tools.runtime.as.ui.bot.test.entity;
+
+public class Server {
+
+ String name;
+
+ String version;
+
+ String type;
+
+ String location;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result
+ + ((location == null) ? 0 : location.hashCode());
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ result = prime * result + ((type == null) ? 0 : type.hashCode());
+ result = prime * result + ((version == null) ? 0 : version.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ Server other = (Server) obj;
+ if (location == null) {
+ if (other.location != null)
+ return false;
+ } else if (!location.equals(other.location))
+ return false;
+ if (name == null) {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
+ if (type == null) {
+ if (other.type != null)
+ return false;
+ } else if (!type.equals(other.type))
+ return false;
+ if (version == null) {
+ if (other.version != null)
+ return false;
+ } else if (!version.equals(other.version))
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "Server [name=" + name + ", version=" + version + ",
type="
+ + type + ", location=" + location + "]";
+ }
+}
\ No newline at end of file
Added:
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/jboss71/DetectJBoss71.java
===================================================================
---
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/jboss71/DetectJBoss71.java
(rev 0)
+++
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/jboss71/DetectJBoss71.java 2012-04-19
09:36:22 UTC (rev 40326)
@@ -0,0 +1,48 @@
+package org.jboss.tools.runtime.as.ui.bot.test.jboss71;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+
+import org.jboss.tools.runtime.as.ui.bot.test.RuntimeProperties;
+import
org.jboss.tools.runtime.as.ui.bot.test.dialog.preferences.RuntimeDetectionPreferencesDialog;
+import
org.jboss.tools.runtime.as.ui.bot.test.dialog.preferences.SearchingForRuntimesDialog;
+import org.jboss.tools.runtime.as.ui.bot.test.entity.Server;
+import org.jboss.tools.runtime.as.ui.bot.test.matcher.ServerMatcher;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.junit.After;
+import org.junit.Test;
+
+public class DetectJBoss71 extends SWTTestExt {
+
+ public static final String JBOSS_7_1 = "jboss-as-7.1.0.Final";
+
+ private RuntimeDetectionPreferencesDialog preferences;
+
+ private SearchingForRuntimesDialog searchingForRuntimesDialog;
+
+ @Test
+ public void detectJBoss71(){
+ preferences = new RuntimeDetectionPreferencesDialog();
+ preferences.open();
+ preferences.addPath(RuntimeProperties.getInstance().getRuntimePath(JBOSS_7_1));
+ searchingForRuntimesDialog = preferences.search();
+
+ assertThat(searchingForRuntimesDialog.getServers().size(), is(1));
+ assertThat(searchingForRuntimesDialog.getServers().get(0), new
ServerMatcher(getExpectedServer()));
+ }
+
+ private Server getExpectedServer() {
+ Server expectedServer = new Server();
+ expectedServer.setName(JBOSS_7_1);
+ expectedServer.setVersion("7.1");
+ expectedServer.setType("AS");
+ expectedServer.setLocation(RuntimeProperties.getInstance().getRuntimePath(JBOSS_7_1));
+ return expectedServer;
+ }
+
+ @After
+ public void closePreferences(){
+ searchingForRuntimesDialog.ok();
+ preferences.ok();
+ }
+}
Added:
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/jboss71/OperateJBoss71.java
===================================================================
---
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/jboss71/OperateJBoss71.java
(rev 0)
+++
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/jboss71/OperateJBoss71.java 2012-04-19
09:36:22 UTC (rev 40326)
@@ -0,0 +1,54 @@
+package org.jboss.tools.runtime.as.ui.bot.test.jboss71;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.not;
+
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.matcher.console.ConsoleOutputMatcher;
+import org.jboss.tools.ui.bot.ext.view.ServersView;
+import org.junit.Test;
+
+public class OperateJBoss71 extends SWTTestExt {
+
+ private ServersView serversView = new ServersView();
+
+ @Test
+ public void startJBoss71(){
+ serversView.startServer(DetectJBoss71.JBOSS_7_1);
+
+ assertNoException();
+ assertServerState("Started");
+ }
+
+ @Test
+ public void restartJBoss71(){
+ serversView.restartServer(DetectJBoss71.JBOSS_7_1);
+
+ assertNoException();
+ assertServerState("Started");
+ }
+
+ @Test
+ public void stopJBoss71(){
+ serversView.stopServer(DetectJBoss71.JBOSS_7_1);
+
+ assertNoException();
+ assertServerState("Stopped");
+ }
+
+ @Test
+ public void deleteJBoss71(){
+ serversView.deleteServer(DetectJBoss71.JBOSS_7_1);
+
+ assertFalse(serversView.serverExists(DetectJBoss71.JBOSS_7_1));
+ }
+
+ private void assertNoException() {
+ assertThat("Exception:", not(new ConsoleOutputMatcher()));
+ }
+
+ private void assertServerState(String state) {
+ assertThat(serversView.getServerStatus(DetectJBoss71.JBOSS_7_1), is(state));
+ }
+}
Added:
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/matcher/ServerMatcher.java
===================================================================
---
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/matcher/ServerMatcher.java
(rev 0)
+++
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/matcher/ServerMatcher.java 2012-04-19
09:36:22 UTC (rev 40326)
@@ -0,0 +1,24 @@
+package org.jboss.tools.runtime.as.ui.bot.test.matcher;
+
+import org.hamcrest.Description;
+import org.hamcrest.TypeSafeMatcher;
+import org.jboss.tools.runtime.as.ui.bot.test.entity.Server;
+
+public class ServerMatcher extends TypeSafeMatcher<Server>{
+
+ private Server expected;
+
+ public ServerMatcher(Server expected) {
+ this.expected = expected;
+ }
+
+ @Override
+ public boolean matchesSafely(Server item) {
+ return expected.equals(item);
+ }
+
+ @Override
+ public void describeTo(Description description) {
+ description.appendValue(expected);
+ }
+}