Author: lzoubek(a)redhat.com
Date: 2010-08-20 06:50:01 -0400 (Fri, 20 Aug 2010)
New Revision: 24332
Added:
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/.classpath
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/.project
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/.settings/
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/.settings/org.eclipse.jdt.core.prefs
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/META-INF/
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/META-INF/MANIFEST.MF
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/bin/
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/build.properties
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/pom.xml
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/resources/
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/log4j.xml
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/Activator.java
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/CreateRuntimeFromESB.java
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/CreateRuntimeFromSOA.java
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/ESBAllBotTests.java
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/Editing.java
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/NewProjectUsingBundledInEAP.java
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/NewProjectUsingBundledInSOA.java
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/NewProjectUsingRuntime.java
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/XmlFileValidator.java
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/editor/
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/editor/Assertions.java
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/editor/ESBAction.java
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/editor/ESBActionFactory.java
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/editor/ESBListener.java
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/editor/ESBListenerFactory.java
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/editor/ESBObject.java
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/editor/ESBObjectDummy.java
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/editor/ESBProvider.java
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/editor/ESBProviderFactory.java
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/editor/action/
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/editor/action/Notifier.java
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/ESBExampleTest.java
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/HelloWorld.java
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/HelloWorldAction.java
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/HelloWorldFileAction.java
Log:
added initial version of esb bot tests
Added: trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/.classpath
===================================================================
--- trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/.classpath
(rev 0)
+++ trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/.classpath 2010-08-20 10:50:01 UTC
(rev 24332)
@@ -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/esb/tests/org.jboss.tools.esb.ui.bot.test/.project
===================================================================
--- trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/.project (rev
0)
+++ trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/.project 2010-08-20 10:50:01 UTC (rev
24332)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.esb.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/esb/tests/org.jboss.tools.esb.ui.bot.test/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/.settings/org.eclipse.jdt.core.prefs
(rev 0)
+++
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/.settings/org.eclipse.jdt.core.prefs 2010-08-20
10:50:01 UTC (rev 24332)
@@ -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/esb/tests/org.jboss.tools.esb.ui.bot.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/META-INF/MANIFEST.MF
(rev 0)
+++ trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/META-INF/MANIFEST.MF 2010-08-20
10:50:01 UTC (rev 24332)
@@ -0,0 +1,24 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESB SWTBot Tests
+Bundle-SymbolicName: org.jboss.tools.esb.ui.bot.test
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.jboss.tools.esb.ui.bot.tests.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/esb/tests/org.jboss.tools.esb.ui.bot.test/build.properties
===================================================================
--- trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/build.properties
(rev 0)
+++ trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/build.properties 2010-08-20 10:50:01
UTC (rev 24332)
@@ -0,0 +1,5 @@
+source.. = src/,\
+ resources/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
Added: trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/pom.xml
===================================================================
--- trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/pom.xml (rev
0)
+++ trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/pom.xml 2010-08-20 10:50:01 UTC (rev
24332)
@@ -0,0 +1,14 @@
+<project
+xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <relativePath>../../../parent-pom.xml</relativePath>
+ <groupId>org.jboss.tools</groupId>
+ <artifactId>org.jboss.tools.parent.pom</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <groupId>org.jboss.tools</groupId>
+ <artifactId>org.jboss.tools.esb.ui.bot.test</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>eclipse-test-plugin</packaging>
+</project>
Added: trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/log4j.xml
===================================================================
--- trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/log4j.xml
(rev 0)
+++ trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/log4j.xml 2010-08-20 10:50:01 UTC
(rev 24332)
@@ -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/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/Activator.java
===================================================================
---
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/Activator.java
(rev 0)
+++
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/Activator.java 2010-08-20
10:50:01 UTC (rev 24332)
@@ -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.esb.ui.bot.tests;
+
+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/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/CreateRuntimeFromESB.java
===================================================================
---
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/CreateRuntimeFromESB.java
(rev 0)
+++
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/CreateRuntimeFromESB.java 2010-08-20
10:50:01 UTC (rev 24332)
@@ -0,0 +1,29 @@
+package org.jboss.tools.esb.ui.bot.tests;
+
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.config.TestConfigurator;
+import org.jboss.tools.ui.bot.ext.config.Annotations.*;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.junit.Test;
+@SWTBotTestRequires(esb=@ESB())
+public class CreateRuntimeFromESB extends SWTTestExt {
+
+ @Test
+ public void createESBRuntime() {
+ SWTBot wiz =
open.preferenceOpen(ActionItem.Preference.JBossToolsJBossESBRuntimes.LABEL);
+ wiz.button("Add").click();
+ bot.shell(IDELabel.Shell.NEW_ESB_RUNTIME).activate();
+ assertFalse("Finish button must not be enabled when no home dir is
defined",bot.button(IDELabel.Button.FINISH).isEnabled());
+ bot.text(1).setText(TestConfigurator.currentConfig.getEsb().esbHome);
+ assertTrue("Version was not automaticly selected by setting ESB home
dir",bot.comboBox().selection().equals(TestConfigurator.currentConfig.getEsb().version));
+ bot.text(0).setText("runtime");
+ String name = bot.text(0).getText();
+ assertFalse("Runtime name was not automaticly set by setting ESB home
dir",name.equals(""));
+ assertTrue("Finish button must be enabled when valid home dir is
defined",bot.button(IDELabel.Button.FINISH).isEnabled());
+ open.finish(bot.activeShell().bot());
+ open.finish(wiz, IDELabel.Button.OK);
+ eclipse.removeESBRuntime(name);
+ }
+}
Added:
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/CreateRuntimeFromSOA.java
===================================================================
---
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/CreateRuntimeFromSOA.java
(rev 0)
+++
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/CreateRuntimeFromSOA.java 2010-08-20
10:50:01 UTC (rev 24332)
@@ -0,0 +1,31 @@
+package org.jboss.tools.esb.ui.bot.tests;
+
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.config.TestConfigurator;
+import org.jboss.tools.ui.bot.ext.config.Annotations.*;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.junit.Test;
+
+@SWTBotTestRequires(server=(a)Server(type=ServerType.SOA))
+public class CreateRuntimeFromSOA extends SWTTestExt {
+
+ @Test
+ public void createESBRuntime() {
+ SWTBot wiz =
open.preferenceOpen(ActionItem.Preference.JBossToolsJBossESBRuntimes.LABEL);
+ wiz.button("Add").click();
+ bot.shell(IDELabel.Shell.NEW_ESB_RUNTIME).activate();
+ assertFalse("Finish button must not be enabled when no home dir is
defined",bot.button(IDELabel.Button.FINISH).isEnabled());
+ bot.text(1).setText(TestConfigurator.currentConfig.getServer().runtimeHome);
+ assertTrue("Version was not automaticly selected by setting ESB home
dir",bot.comboBox().selection().equals(configuredState.getServer().bundledESBVersion));
+ String name = bot.text(0).getText();
+ assertFalse("Runtime name was not automaticly set by setting ESB home
dir",name.equals(""));
+ assertTrue("Finish button must be enabled when valid home dir is
defined",bot.button(IDELabel.Button.FINISH).isEnabled());
+ open.finish(bot.activeShell().bot());
+ open.finish(wiz,IDELabel.Button.OK);
+ eclipse.removeESBRuntime(name);
+
+
+ }
+}
Added:
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/ESBAllBotTests.java
===================================================================
---
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/ESBAllBotTests.java
(rev 0)
+++
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/ESBAllBotTests.java 2010-08-20
10:50:01 UTC (rev 24332)
@@ -0,0 +1,29 @@
+ /*******************************************************************************
+ * 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.esb.ui.bot.tests;
+
+import org.jboss.tools.esb.ui.bot.tests.examples.HelloWorld;
+import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite.SuiteClasses;
+
+@SuiteClasses({
+ CreateRuntimeFromESB.class,
+ CreateRuntimeFromSOA.class,
+ NewProjectUsingRuntime.class,
+ NewProjectUsingBundledInEAP.class,
+ Editing.class,
+ HelloWorld.class,
+ })
+(a)RunWith(RequirementAwareSuite.class)
+public class ESBAllBotTests {
+
+}
Added:
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/Editing.java
===================================================================
---
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/Editing.java
(rev 0)
+++
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/Editing.java 2010-08-20
10:50:01 UTC (rev 24332)
@@ -0,0 +1,350 @@
+package org.jboss.tools.esb.ui.bot.tests;
+
+import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.widgetOfType;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
+import org.eclipse.swtbot.swt.finder.results.VoidResult;
+import org.eclipse.swtbot.swt.finder.results.WidgetResult;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.esb.ui.bot.tests.editor.Assertions;
+import org.jboss.tools.esb.ui.bot.tests.editor.ESBAction;
+import org.jboss.tools.esb.ui.bot.tests.editor.ESBActionFactory;
+import org.jboss.tools.esb.ui.bot.tests.editor.ESBListener;
+import org.jboss.tools.esb.ui.bot.tests.editor.ESBListenerFactory;
+import org.jboss.tools.esb.ui.bot.tests.editor.ESBObject;
+import org.jboss.tools.esb.ui.bot.tests.editor.ESBProvider;
+import org.jboss.tools.esb.ui.bot.tests.editor.ESBProviderFactory;
+import org.jboss.tools.ui.bot.ext.SWTEclipseExt;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.config.Annotations.SWTBotTestRequires;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem.NewObject.ESBESBFile;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem.NewObject.JavaProject;
+import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
+import org.jboss.tools.ui.bot.ext.parts.ObjectMultiPageEditorBot;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.jboss.tools.ui.bot.ext.view.ProblemsView;
+import org.jboss.tools.ui.bot.ext.widgets.SWTBotSection;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+@SWTBotTestRequires(perspective = "Java", runOnce = true)
+public class Editing extends SWTTestExt {
+
+ public static String menu_addService = "Add Service...";
+ public static String projectName = "ESB";
+ public static String configFile = "jboss-esb";
+ public static String configFileFull = configFile + ".xml";
+ public static String configFileFullNotSaved = configFile + ".xml*";
+ public static String node_globals = "Globals";
+ public static String node_services = "Services";
+ public static String node_providers = "Providers";
+
+ @BeforeClass
+ public static void setupProject() {
+ SWTBot wiz = open.newObject(JavaProject.LABEL);
+ wiz.textWithLabel(JavaProject.TEXT_PROJECT_NAME).setText(projectName);
+ wiz.button(IDELabel.Button.NEXT).click();
+ open.finish(wiz, true);
+ packageExplorer.show().bot().tree().select(projectName);
+ wiz = open.newObject(ESBESBFile.LABEL);
+ wiz.textWithLabel(ESBESBFile.TEXT_NAME).setText(configFile);
+ open.finish(wiz);
+ assertTrue(bot.editorByTitle(configFileFull) != null);
+ assertTrue("ESB Editor opened problems",
+ problems.getErrorsNode(bot) == null);
+ }
+
+ //@AfterClass
+ public static void waitAMinute() {
+ bot.sleep(Long.MAX_VALUE);
+ }
+
+ @Test
+ public void createEsbFile() {
+ packageExplorer.show().bot().tree().select(projectName);
+ SWTBot wiz = open.newObject(ESBESBFile.LABEL);
+ wiz.textWithLabel(ESBESBFile.TEXT_NAME).setText("another-esb-config");
+ open.finish(wiz);
+ assertTrue(bot.editorByTitle("another-esb-config.xml") != null);
+ assertTrue("ESB Editor opened problems",
+ problems.getErrorsNode(bot) == null);
+ }
+
+ @Test
+ public void providers() {
+ List<String> providerList = getAvailableProviders();
+ String[] actionPath = new String[] { configFileFull, node_providers };
+ // first create all actions
+ for (Method m : ESBProviderFactory.class.getMethods()) {
+
+ if (m.getReturnType().equals(ESBProvider.class)) {
+ try {
+ log.info("Invoke " + m.getName());
+ ESBProvider action = (ESBProvider) m.invoke(null, new Object[]{});
+ action.create(getEditor(), actionPath);
+ providerList.remove(action.getMenuLabel());
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+ assertTrue(
+ "Not all providers, covered, remaining are :"
+ + Arrays.toString(providerList.toArray()),
+ providerList.isEmpty());
+ collapseTree();
+ }
+
+ @Test
+ public void listeners() {
+ String service = "aaa";
+ addService(service);
+ List<String> listenerList = getAvailableListeners(service);
+ String[] actionPath = new String[] { configFileFull, node_services,
+ service, "Listeners" };
+ for (Method m : ESBListenerFactory.class.getMethods()) {
+
+ if (m.getReturnType().equals(ESBListener.class)) {
+ try {
+ log.info("Invoke " + m.getName());
+ ESBListener action = (ESBListener) m.invoke(null, new Object[]{});
+ action.setService(service);
+ action.create(getEditor(), actionPath);
+ listenerList.remove(action.getMenuLabel());
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+ assertTrue(
+ "Not all listeners, covered, remaining are :"
+ + Arrays.toString(listenerList.toArray()),
+ listenerList.isEmpty());
+ collapseTree();
+ }
+
+ @Test
+ public void actions() {
+ String service = "bbb";
+ addService(service);
+ String[] actionPath = new String[] { configFileFull, node_services,
+ "bbb", "Actions" };
+ // first create all actions
+ for (Method m : ESBActionFactory.class.getMethods()) {
+
+ if (m.getReturnType().equals(ESBAction.class)) {
+ try {
+ log.info("Invoke " + m.getName());
+ ESBAction action = (ESBAction) m.invoke(null, new Object[]{});
+ action.setService(service);
+ action.create(getEditor(), actionPath);
+ action.edit(getEditor(), actionPath);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ }
+ }
+ collapseTree();
+ // then do editing on each
+ for (Method m : ESBActionFactory.class.getMethods()) {
+
+ if (m.getReturnType().equals(ESBAction.class)) {
+ try {
+ log.info("Invoke " + m.getName());
+ ESBAction action = (ESBAction) m.invoke(null, new Object[]{});
+ action.setService(service);
+ action.edit(getEditor(), actionPath);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+
+ }
+
+ private SWTBotEditor getEditor() {
+ return bot.editorByTitle(configFileFull);
+ }
+
+ private void collapseTree() {
+ getEditor().show();
+ SWTEclipseExt.selectTreeLocation(getEditor().bot(), configFileFull)
+ .collapse();
+ }
+
+
+ private List<String> getMenuItems(String menuItem, String... treeLocation) {
+ final List<String> list = new ArrayList<String>();
+ SWTBotEditor editor = getEditor();
+ editor.show();
+ SWTBotTreeItem provItem = SWTEclipseExt.selectTreeLocation(
+ editor.bot(), treeLocation);
+ ContextMenuHelper.prepareTreeItemForContextMenu(editor.bot().tree(),
+ provItem);
+
+ final SWTBotMenu menuRunAs = new SWTBotMenu(
+ ContextMenuHelper.getContextMenu(editor.bot().tree(), menuItem,
+ false));
+ UIThreadRunnable.syncExec(new VoidResult() {
+ public void run() {
+ int menuItemIndex = 0;
+ MenuItem menuItem = null;
+ final MenuItem[] menuItems = menuRunAs.widget.getMenu()
+ .getItems();
+ while (menuItem == null && menuItemIndex < menuItems.length) {
+ String item = menuItems[menuItemIndex].getText();
+ if (!"".equals(item)) {
+ list.add(item);
+ }
+ menuItemIndex++;
+ }
+
+ }
+ });
+ return list;
+ }
+
+ private List<String> getAvailableProviders() {
+ return getMenuItems(IDELabel.Menu.NEW, configFileFull, node_providers);
+ }
+
+ private List<String> getAvailableListeners(String service) {
+ return getMenuItems(IDELabel.Menu.NEW, configFileFull, node_services,
+ service, "Listeners");
+ }
+
+ private void addService(String name) {
+ SWTBotEditor editor = getEditor();
+ SWTBotTreeItem services = SWTEclipseExt.selectTreeLocation(
+ editor.bot(), configFileFull, node_services);
+ ContextMenuHelper.prepareTreeItemForContextMenu(editor.bot().tree(),
+ services);
+ new SWTBotMenu(ContextMenuHelper.getContextMenu(editor.bot().tree(),
+ menu_addService, false)).click();
+ SWTBotShell shell = bot.shell("Add Service");
+ shell.activate();
+ SWTBot shellBot = shell.bot();
+ assertFalse(bot.button(IDELabel.Button.FINISH).isEnabled());
+ shellBot.text(0).setText(name);
+ assertFalse(bot.button(IDELabel.Button.FINISH).isEnabled());
+ shellBot.text(1).setText(name);
+ assertFalse(bot.button(IDELabel.Button.FINISH).isEnabled());
+ shellBot.text(2).setText(name);
+ assertTrue(bot.button(IDELabel.Button.FINISH).isEnabled());
+ open.finish(shellBot);
+ Assertions.assertXmlContentBool(getEditor().toTextEditor().getText(),
+ "count(//jbossesb/services/service[@name='" + name +
"'])=1");
+ Assertions.assertTreeContent(getEditor(),configFileFullNotSaved, node_services, name);
+ addPropertyWithXMLContent("//jbossesb/services/service[@name='" + name
+ + "']", configFileFullNotSaved, node_services, name);
+ editor.save();
+
+ }
+
+ /**
+ * adds property with several xml tags and attributes into item defined by
+ * given path
+ *
+ * @param path
+ */
+ private void addPropertyWithXMLContent(String xpathPath, String... path) {
+ String propertyName = xpathPath.replaceAll("\\/|\\@|\\[|\\]|\\'|\\=",
+ "");
+ SWTBotEditor editor = getEditor();
+ SWTEclipseExt.selectTreeLocation(editor.bot(), path);
+ SWTBotSection section = bot.section("Properties");
+ new SWTBotButton(bot.widget(widgetOfType(Button.class), section.widget))
+ .click();
+ SWTBotShell shell = bot.shell("Add Property").activate();
+ Assertions.assertButtonEnabled(shell.bot().button(IDELabel.Button.FINISH), false);
+ shell.bot().text(0).setText(propertyName);
+ shell.bot().text(1).setText("Value");
+ Assertions.assertButtonEnabled(shell.bot().button(IDELabel.Button.FINISH), true);
+ open.finish(shell.bot());
+ Assertions.assertXmlContentBool(getEditor().toTextEditor().getText(),
"count("
+ + xpathPath + "/property[@name='" + propertyName +
"'])=1");
+ path[0] = configFileFullNotSaved; // until we save file
+ SWTEclipseExt.selectTreeLocation(editor.bot(), path);
+ section = bot.section("Properties");
+ SWTBotTable table = new SWTBotTable(bot.widget(
+ widgetOfType(Table.class), section.widget));
+ assertTrue("Properties table does not containt recently added row",
+ table.containsItem(propertyName));
+ // property added and verified
+ List<String> propPathList = new ArrayList<String>();
+ for (String item : path) {
+ propPathList.add(item);
+ }
+ propPathList.add(propertyName);
+ String[] propPath = (String[]) propPathList.toArray(new String[] {});
+ SWTEclipseExt.selectTreeLocation(editor.bot(), propPath);
+ section = bot.section("Tags");
+ new SWTBotButton(bot.widget(widgetOfType(Button.class), section.widget))
+ .click();
+ shell = bot.shell("Add Tag").activate();
+ Assertions.assertButtonEnabled(shell.bot().button(IDELabel.Button.FINISH), false);
+ shell.bot().text().setText(propertyName);
+ Assertions.assertButtonEnabled(shell.bot().button(IDELabel.Button.FINISH), true);
+ open.finish(shell.bot());
+ Assertions.assertXmlContentBool(getEditor().toTextEditor().getText(),
"count("
+ + xpathPath + "/property[@name='" + propertyName + "']/"
+ + propertyName + ")=1");
+ propPathList.add(propertyName);
+ String[] tagPath = (String[]) propPathList.toArray(new String[] {});
+ SWTEclipseExt.selectTreeLocation(editor.bot(), tagPath);
+ // tag added, now try attribute
+ section = bot.section("Attributes");
+ new SWTBotButton(bot.widget(widgetOfType(Button.class), section.widget))
+ .click();
+ shell = bot.shell("Add Attribute...").activate();
+ Assertions.assertButtonEnabled(shell.bot().button(IDELabel.Button.FINISH), false);
+ shell.bot().text(0).setText("name");
+ shell.bot().text(1).setText("value");
+ Assertions.assertButtonEnabled(shell.bot().button(IDELabel.Button.FINISH), true);
+ open.finish(shell.bot());
+ Assertions.assertXmlContentBool(getEditor().toTextEditor().getText(),
"count("
+ + xpathPath + "/property[@name='" + propertyName + "']/"
+ + propertyName + "[@name='value'])=1");
+ // add some content into tag's body
+ section = bot.section("Body Content");
+ SWTBotText text = new SWTBotText(bot.widget(widgetOfType(Text.class),
+ section.widget));
+ text.setFocus();
+ text.setText("<>@&");
+ getEditor().save();
+
+ Assertions.assertXmlContentString(getEditor().toTextEditor().getText(), xpathPath
+ + "/property[@name='" + propertyName + "']/" +
propertyName
+ + "[@name='value']/text()", "<>@&");
+ getEditor().save();
+
+ }
+
+
+
+
+
+}
Added:
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/NewProjectUsingBundledInEAP.java
===================================================================
---
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/NewProjectUsingBundledInEAP.java
(rev 0)
+++
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/NewProjectUsingBundledInEAP.java 2010-08-20
10:50:01 UTC (rev 24332)
@@ -0,0 +1,48 @@
+package org.jboss.tools.esb.ui.bot.tests;
+
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.config.Annotations.SWTBotTestRequires;
+import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
+import org.jboss.tools.ui.bot.ext.config.Annotations.ServerType;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem.NewObject.ESBESBProject;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.junit.AfterClass;
+import org.junit.Test;
+
+/**
+ * tests warning message, which should be displayed by new ESB project wizard, when user
+ * selects server runtime with non-bundled ESB
+ * @author lzoubek
+ *
+ */
+@SWTBotTestRequires(server=(a)Server(type=ServerType.EAP))
+public class NewProjectUsingBundledInEAP extends SWTTestExt {
+
+ @AfterClass
+ public static void waitAMinute() {
+ //bot.sleep(Long.MAX_VALUE);
+ }
+ @Test
+ public void newProject() {
+ testNewProject("ESBwithWarning");
+ }
+ public void testNewProject(String projectName) {
+ SWTBot wiz = open.newObject(ActionItem.NewObject.ESBESBProject.LABEL);
+ wiz.textWithLabel(ESBESBProject.TEXT_PROJECT_NAME).setText(projectName);
+ wiz.comboBoxInGroup("Target
runtime").setSelection(configuredState.getServer().name);
+ wiz.button(IDELabel.Button.NEXT).click();
+ wiz.button(IDELabel.Button.NEXT).click();
+ try {
+ String text = wiz.text(2).getText();
+ assertTrue("New ESB project wizard did not warn, when using runtime without
ESB",text.contains("does not contain a valid ESB"));
+ } catch (IndexOutOfBoundsException ex) {
+ assertTrue("New ESB project wizard did not warn, when using runtime without
ESB",false);
+ }
+ wiz.radio(1).click();
+
+ open.closeCancel(wiz);
+
+ }
+}
Added:
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/NewProjectUsingBundledInSOA.java
===================================================================
---
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/NewProjectUsingBundledInSOA.java
(rev 0)
+++
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/NewProjectUsingBundledInSOA.java 2010-08-20
10:50:01 UTC (rev 24332)
@@ -0,0 +1,34 @@
+package org.jboss.tools.esb.ui.bot.tests;
+
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.config.Annotations.*;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem.NewObject.ESBESBProject;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.junit.Test;
+
+@SWTBotTestRequires(server=(a)Server(type=ServerType.SOA))
+public class NewProjectUsingBundledInSOA extends SWTTestExt{
+
+
+
+ @Test
+ public void newProject() {
+ testNewProject("ESBstandalone");
+ }
+ public void testNewProject(String projectName) {
+ SWTBot wiz = open.newObject(ActionItem.NewObject.ESBESBProject.LABEL);
+ wiz.textWithLabel(ESBESBProject.TEXT_PROJECT_NAME).setText(projectName);
+ wiz.comboBoxInGroup("Target
runtime").setSelection(configuredState.getServer().name);
+ wiz.comboBoxInGroup("JBoss ESB
version").setSelection(SWTTestExt.configuredState.getServer().bundledESBVersion);
+ wiz.button(IDELabel.Button.NEXT).click();
+ wiz.button(IDELabel.Button.NEXT).click();
+ assertTrue(wiz.comboBox(0).getText().equals(SWTTestExt.configuredState.getEsb().name));
+ open.finish(wiz);
+ assertTrue(projectExplorer.existsResource(projectName));
+ assertTrue(projectExplorer.existsResource(projectName, "JBoss ESB Runtime
["+configuredState.getServer().name+"]"));
+ assertTrue(bot.editorByTitle("jboss-esb.xml")!=null);
+
+ }
+}
Added:
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/NewProjectUsingRuntime.java
===================================================================
---
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/NewProjectUsingRuntime.java
(rev 0)
+++
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/NewProjectUsingRuntime.java 2010-08-20
10:50:01 UTC (rev 24332)
@@ -0,0 +1,37 @@
+package org.jboss.tools.esb.ui.bot.tests;
+
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.config.Annotations.ESB;
+import org.jboss.tools.ui.bot.ext.config.Annotations.SWTBotTestRequires;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem.NewObject.ESBESBProject;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.junit.AfterClass;
+import org.junit.Test;
+
+@SWTBotTestRequires(esb=@ESB())
+public class NewProjectUsingRuntime extends SWTTestExt{
+
+ @AfterClass
+ public static void waitAMinute() {
+ // bot.sleep(Long.MAX_VALUE);
+ }
+
+ @Test
+ public void newProject() {
+ testNewProject("ESB");
+ }
+ public static void testNewProject(String projectName) {
+ SWTBot wiz = open.newObject(ActionItem.NewObject.ESBESBProject.LABEL);
+ wiz.textWithLabel(ESBESBProject.TEXT_PROJECT_NAME).setText(projectName);
+ wiz.comboBoxInGroup("JBoss ESB
version").setSelection(SWTTestExt.configuredState.getEsb().version);
+ wiz.button(IDELabel.Button.NEXT).click();
+ wiz.button(IDELabel.Button.NEXT).click();
+ wiz.radio(1).click();
+ assertTrue(wiz.comboBox(0).getText().equals(SWTTestExt.configuredState.getEsb().name));
+ open.finish(wiz);
+ assertTrue(projectExplorer.existsResource(projectName));
+ assertTrue(bot.editorByTitle("jboss-esb.xml")!=null);
+ }
+}
Added:
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/XmlFileValidator.java
===================================================================
---
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/XmlFileValidator.java
(rev 0)
+++
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/XmlFileValidator.java 2010-08-20
10:50:01 UTC (rev 24332)
@@ -0,0 +1,50 @@
+package org.jboss.tools.esb.ui.bot.tests;
+
+import java.io.StringReader;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+
+import org.apache.log4j.Logger;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+
+public class XmlFileValidator {
+ private static final Logger log = Logger.getLogger(XmlFileValidator.class);
+ private final static DocumentBuilderFactory docFactory =
DocumentBuilderFactory.newInstance();
+ private final static XPathFactory xpFactory = XPathFactory.newInstance();
+ private final Document doc;
+ private final XPath xpath;
+
+ public XmlFileValidator(String xmlContent) throws Exception {
+ DocumentBuilder db = docFactory.newDocumentBuilder();
+ doc = db.parse(new InputSource(new StringReader(xmlContent)));
+ xpath = xpFactory.newXPath();
+ }
+ public Document getDocument() {
+ return doc;
+ }
+ public XPath getXpath() {
+ return xpath;
+ }
+ public boolean executeBoolean(String expr) {
+ try {
+ return (Boolean)xpath.evaluate(expr, getDocument(), XPathConstants.BOOLEAN);
+ } catch (XPathExpressionException e) {
+ log.error("Error evaluating xPath '"+expr+"'", e);
+ return false;
+ }
+ }
+ public String executeString(String expr) {
+ try {
+ return (String)xpath.evaluate(expr, getDocument(), XPathConstants.STRING);
+ } catch (XPathExpressionException e) {
+ log.error("Error evaluating xPath '"+expr+"'", e);
+ return null;
+ }
+ }
+}
Added:
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/editor/Assertions.java
===================================================================
---
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/editor/Assertions.java
(rev 0)
+++
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/editor/Assertions.java 2010-08-20
10:50:01 UTC (rev 24332)
@@ -0,0 +1,62 @@
+package org.jboss.tools.esb.ui.bot.tests.editor;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.fail;
+
+import java.util.Arrays;
+
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;
+import org.jboss.tools.esb.ui.bot.tests.XmlFileValidator;
+import org.jboss.tools.ui.bot.ext.SWTEclipseExt;
+
+public class Assertions {
+ public static void assertTreeContent(SWTBotEditor editor, String... items) {
+ assertTrue("Editor tree does not contain expected path of nodes : "
+ + Arrays.toString(items),
+ SWTEclipseExt.containstInTree(editor.bot().tree(), items));
+ }
+ public static void assertButtonEnabled(SWTBotButton button, boolean enabled) {
+ if (enabled) {
+ assertTrue(button.getText()+ " button is not enabled when all required fields are
filled",button.isEnabled());
+ }
+ else {
+ assertFalse(button.getText()+" button is not enabled when all required fields are
filled",button.isEnabled());
+ }
+
+ }
+ public static void assertXmlContentBool(String xml, String xpath) {
+ XmlFileValidator validator = null;
+ try {
+ validator = new XmlFileValidator(xml);
+ } catch (Exception e) {
+ fail("Unable to parse ESB editor source content to XML");
+ }
+ assertTrue("XML content was not expected by xpath '"+xpath+"'\n
instead content was\n"+xml,validator.executeBoolean(xpath));
+
+ }
+ public static void assertXmlContentString(String xml, String xpath,
+ String expected) {
+ XmlFileValidator validator = null;
+ try {
+ validator = new XmlFileValidator(xml);
+ } catch (Exception e) {
+ fail("Unable to parse ESB editor source content to XML");
+ }
+ String selected = validator.executeString(xpath);
+ assertTrue("Expected content was '" + expected + "', selected
was '"
+ + selected + "' - xpath '" + xpath
+ + "'\n XML instead content was\n" + xml,
+ expected.equals(selected));
+
+ }
+ /**
+ * asserts given xpath against given xml, given xpath is covered by xpath count
expression
+ * @param xml
+ * @param xpath
+ */
+ public static void assertXmlContentExists(String xml, String xpath) {
+ assertXmlContentBool(xml, "count("+xpath+")=1");
+ }
+}
Added:
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/editor/ESBAction.java
===================================================================
---
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/editor/ESBAction.java
(rev 0)
+++
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/editor/ESBAction.java 2010-08-20
10:50:01 UTC (rev 24332)
@@ -0,0 +1,138 @@
+package org.jboss.tools.esb.ui.bot.tests.editor;
+
+import static org.junit.Assert.assertTrue;
+
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Random;
+
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.finders.ContextMenuFinder;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.ui.bot.ext.SWTEclipseExt;
+import org.jboss.tools.ui.bot.ext.SWTOpenExt;
+import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.jboss.tools.ui.bot.ext.widgets.SWTBotSection;
+
+public abstract class ESBAction extends ESBObject {
+
+ public final String category;
+ private final String className;
+ private String service;
+
+ public ESBAction(String uiName, String category, String className) {
+ super(uiName, "action");
+ this.category = category;
+ this.className = className;
+ }
+
+ public void setService(String service) {
+ this.service = service;
+ }
+
+ public String getService() {
+ return service;
+ }
+
+ public String getClassName() {
+ return className;
+ }
+
+ @Override
+ public String getXpath() {
+ return this.xmlName + "[@class='" + getClassName() + "' and
@name='"
+ + this.uiName + "']";
+ }
+
+ @Override
+ public String getBaseXPath() {
+ return "//jbossesb/services/service[@name='" + getService()
+ + "']/actions/";
+ }
+
+ protected SWTBotShell openForm(SWTBotEditor editor, String... path) {
+ editor.show();
+ SWTBotTreeItem provItem = SWTEclipseExt.selectTreeLocation(
+ editor.bot(), path);
+ ContextMenuHelper.prepareTreeItemForContextMenu(editor.bot().tree(),
+ provItem);
+ if (category == null) {
+ ContextMenuHelper.clickContextMenu(editor.bot().tree(),
+ IDELabel.Menu.NEW, getMenuLabel());
+ } else {
+ ContextMenuHelper.clickContextMenu(editor.bot().tree(),
+ IDELabel.Menu.NEW, category, getMenuLabel());
+ }
+ return new SWTBot().shell(getShellTitle());
+ }
+
+ protected void doFillForm(SWTBotShell shell) {
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()),
+ false);
+ shell.bot().text(0).setText(this.uiName);
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()),
+ true);
+ }
+
+ protected void doEditing(SWTBotEditor editor, String... path) {
+ // SWTBotSection section = bot.section(getSectionTitle());
+ }
+
+ @Override
+ public String getSectionTitle() {
+ return this.uiName + " Action";
+ }
+
+ protected void editProcess(SWTBotEditor editor, boolean combo) {
+ SWTBotSection section = bot.section(editor.bot(), getSectionTitle());
+ String value = "process";
+ if (combo) {
+ section.bot().comboBoxWithLabel("Process:").setSelection(0);
+ } else {
+ SWTBotText text = section.bot().textWithLabel("Process:");
+ if (text.isEnabled())
+ text.setText(value);
+ }
+ String text = editor.toTextEditor().getText();
+ String xpath;
+ if ("".equals(value)) {
+ xpath = "count(" + getBaseXPath() + getXpath() + ")=1";
+ } else {
+ xpath = "count(" + getBaseXPath()
+ + getXpath().substring(0, getXpath().length() - 1)
+ + " and @process='" + value + "'])=1";
+ }
+ editor.save();
+ Assertions.assertXmlContentBool(text, xpath);
+ }
+
+ public void edit(SWTBotEditor editor, String... path) {
+ editor.show();
+ List<String> newPath = new ArrayList<String>();
+ for (String str : path) {
+ newPath.add(str);
+ }
+ newPath.add(this.uiName);
+ SWTEclipseExt.selectTreeLocation(editor.bot(),
+ newPath.toArray(new String[] {}));
+ doEditing(editor, path);
+ editor.save();
+ }
+
+ public void create(SWTBotEditor editor, String... path) {
+ SWTBotShell shell = openForm(editor, path);
+ doFillForm(shell);
+ shell.bot().button(getFinishButton()).click();
+ String text = editor.toTextEditor().getText();
+ String xpath = "count(" + getBaseXPath() + getXpath() + ")=1";
+ Assertions.assertXmlContentBool(text, xpath);
+ editor.save();
+ }
+
+}
Added:
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/editor/ESBActionFactory.java
===================================================================
---
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/editor/ESBActionFactory.java
(rev 0)
+++
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/editor/ESBActionFactory.java 2010-08-20
10:50:01 UTC (rev 24332)
@@ -0,0 +1,492 @@
+package org.jboss.tools.esb.ui.bot.tests.editor;
+
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.jboss.tools.esb.ui.bot.tests.editor.action.Notifier;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.jboss.tools.ui.bot.ext.widgets.SWTBotSection;
+
+public class ESBActionFactory {
+ public static ESBAction customAction() {
+ return new ESBAction("Custom Action",null,"java.lang.Object") {
+ @Override
+ public String getShellTitle() {
+ return "Add Action";
+ }
+ @Override
+ public String getFinishButton() {
+ return IDELabel.Button.OK;
+ }
+ @Override
+ public String getSectionTitle() {
+ return "Action";
+ }
+ @Override
+ protected void doEditing(SWTBotEditor editor, String... path) {
+ SWTBotSection section = bot.section(editor.bot(),getSectionTitle());
+ editProcess(editor,false);
+ }
+ @Override
+ protected void doFillForm(SWTBotShell shell) {
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), false);
+ shell.bot().text(0).setText(this.uiName);
+ shell.bot().text(1).setText("java.lang.Object");
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), true);
+ }
+ };
+ }
+ public static ESBAction bpmProcessor() {
+ return new ESBAction("BPM
Processor","BPM","org.jboss.soa.esb.services.jbpm.actions.BpmProcessor")
{
+
+ @Override
+ public String getMenuLabel() {
+ return this.uiName;
+ }
+ @Override
+ public String getSectionTitle() {
+ return "Bpm Processor Action";
+ }
+ @Override
+ protected void doEditing(SWTBotEditor editor, String... path) {
+ SWTBotSection section = bot.section(editor.bot(),getSectionTitle());
+ editTextProperty(editor, section.bot(), "Process Definition Name:",
"process-definition-name", "process");
+ editProcess(editor,true);
+ }
+ @Override
+ protected void doFillForm(SWTBotShell shell) {
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), false);
+ shell.bot().text(0).setText(this.uiName);
+ shell.bot().comboBox().setSelection(1);
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), true);
+ }
+
+ };
+ }
+ public static ESBAction bpmRulesProcessor() {
+ return new ESBAction("Business Rules
Processor","BPM","org.jboss.soa.esb.actions.BusinessRulesProcessor")
{
+ @Override
+ public String getMenuLabel() {
+ return this.uiName;
+ }
+ @Override
+ public String getShellTitle() {
+ return this.uiName+"...";
+ }
+ @Override
+ public String getSectionTitle() {
+ return "Business Rules Processor";
+ }
+ @Override
+ protected void doEditing(SWTBotEditor editor, String... path) {
+ SWTBotSection section = bot.section(editor.bot(),getSectionTitle());
+ editProcess(editor,true);
+ }
+ };
+ }
+ public static ESBAction byteArrayToString() {
+ return new ESBAction("Byte Array To
String","Converters/Transformers","org.jboss.soa.esb.actions.converters.ByteArrayToString")
{
+ };
+ }
+ public static ESBAction commandInterpreter() {
+ return new ESBAction("Command
Interpreter","Converters/Transformers","org.jboss.soa.esb.actions.jbpm.CommandInterpreter")
{
+ };
+ }
+ public static ESBAction longToDate() {
+ return new ESBAction("Long To
Date","Converters/Transformers","org.jboss.soa.esb.actions.converters.LongToDateConverter")
{
+ };
+ }
+ public static ESBAction messagePersister() {
+ return new ESBAction("Message
Persister","Converters/Transformers","org.jboss.soa.esb.actions.MessagePersister")
{
+ @Override
+ protected void doFillForm(SWTBotShell shell) {
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), false);
+ shell.bot().text(0).setText(this.uiName);
+ shell.bot().text(1).setText("java.lang.Object");
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), true);
+ }
+ };
+ }
+ public static ESBAction objectInvoke() {
+ return new ESBAction("Object
Invoke","Converters/Transformers","org.jboss.soa.esb.actions.converters.ObjectInvoke")
{
+ @Override
+ protected void doFillForm(SWTBotShell shell) {
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), false);
+ shell.bot().text(0).setText(this.uiName);
+ shell.bot().text(1).setText("java.lang.Object");
+ shell.bot().text(2).setText("toString");
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), true);
+ }
+ };
+ }
+ public static ESBAction objectToCSVString() {
+ return new ESBAction("Object To CSV
String","Converters/Transformers","org.jboss.soa.esb.actions.converters.ObjectToCSVString")
{
+ @Override
+ protected void doFillForm(SWTBotShell shell) {
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), false);
+ shell.bot().text(0).setText(this.uiName);
+ shell.bot().text(1).setText("a=a");
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), true);
+ }
+ };
+ }
+ public static ESBAction objectToXStream() {
+ return new ESBAction("Object To
XStream","Converters/Transformers","org.jboss.soa.esb.actions.converters.ObjectToXStream")
{
+ };
+ }
+ public static ESBAction smooksAction() {
+ return new ESBAction("Smooks
Action","Converters/Transformers","org.jboss.soa.esb.smooks.SmooksAction")
{
+ @Override
+ protected void doFillForm(SWTBotShell shell) {
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), false);
+ shell.bot().text(0).setText(this.uiName);
+ shell.bot().text(1).setText("smooks-config.xml");
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), true);
+ }
+ };
+ }
+ public static ESBAction xStreamToObject() {
+ return new ESBAction("XStream To
Object","Converters/Transformers","org.jboss.soa.esb.actions.converters.XStreamToObject")
{
+ @Override
+ protected void doFillForm(SWTBotShell shell) {
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), false);
+ shell.bot().text(0).setText(this.uiName);
+ shell.bot().text(2).setText("java.lang.Object");
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), true);
+ }
+ };
+ }
+ public static ESBAction xsltAction() {
+ return new ESBAction("XSLT
Action","Converters/Transformers","org.jboss.soa.esb.actions.transformation.xslt.XsltAction")
{
+ @Override
+ public String getMenuLabel() {
+ return this.uiName;
+ }
+ @Override
+ protected void doFillForm(SWTBotShell shell) {
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), false);
+ shell.bot().text(0).setText(this.uiName);
+ shell.bot().text(1).setText("template.xsl");
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), true);
+ }
+ };
+ }
+ public static ESBAction printline() {
+ return new ESBAction("System
Println","Miscellaneous","org.jboss.soa.esb.actions.SystemPrintln")
{
+ @Override
+ protected void doFillForm(SWTBotShell shell) {
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), false);
+ shell.bot().text(0).setText(this.uiName);
+ shell.bot().text(1).setText("Hello!");
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), true);
+ }
+ };
+ }
+ public static ESBAction schemaValidation() {
+ return new ESBAction("Schema
Validation","Miscellaneous","org.jboss.soa.esb.actions.validation.SchemaValidationAction")
{
+ @Override
+ public String getShellTitle() {
+ return this.uiName+"...";
+ }
+ @Override
+ protected void doFillForm(SWTBotShell shell) {
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), false);
+ shell.bot().text(0).setText(this.uiName);
+ shell.bot().text(1).setText("schema.xsd");
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), true);
+ }
+ };
+ }
+ public static ESBAction aggregator() {
+ return new
ESBAction("Aggregator","Routers","org.jboss.soa.esb.actions.Aggregator")
{
+ };
+ }
+ public static ESBAction routerDrools() {
+ return new ESBAction("Content Based Router
(Drools)","Routers","org.jboss.soa.esb.actions.ContentBasedRouter")
{
+ @Override
+ public String getShellTitle() {
+ return "Add Drools Router";
+ }
+ @Override
+ public String getSectionTitle() {
+ return "Content Based Router Action";
+ }
+ @Override
+ protected void doEditing(SWTBotEditor editor, String... path) {
+ SWTBotSection section = bot.section(editor.bot(),getSectionTitle());
+ editProcess(editor,true);
+ }
+ @Override
+ protected void doFillForm(SWTBotShell shell) {
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), false);
+ shell.bot().text(0).setText(this.uiName);
+ shell.bot().text(1).setText("rules");
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), true);
+ }
+ };
+ }
+ public static ESBAction cbrGeneric() {
+ return new ESBAction("Content Based Router
(Generic)","Routers","org.jboss.soa.esb.actions.ContentBasedRouter")
{
+ @Override
+ public String getShellTitle() {
+ return "Add Content Based Router";
+ }
+ @Override
+ public String getSectionTitle() {
+ return "Content Based Router Action";
+ }
+ @Override
+ protected void doEditing(SWTBotEditor editor, String... path) {
+ SWTBotSection section = bot.section(editor.bot(),getSectionTitle());
+ editProcess(editor,true);
+ }
+ @Override
+ protected void doFillForm(SWTBotShell shell) {
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), false);
+ shell.bot().text(0).setText(this.uiName);
+ shell.bot().comboBox(0).setSelection(2);
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), true);
+ }
+ };
+ }
+ public static ESBAction cbrRegex() {
+ return new ESBAction("Content Based Router
(Regex)","Routers","org.jboss.soa.esb.actions.ContentBasedRouter")
{
+ @Override
+ public String getShellTitle() {
+ return "Add Regex Router";
+ }
+ @Override
+ public String getSectionTitle() {
+ return "Content Based Router Action";
+ }
+ @Override
+ protected void doEditing(SWTBotEditor editor, String... path) {
+ SWTBotSection section = bot.section(editor.bot(),getSectionTitle());
+ editProcess(editor,true);
+ }
+ };
+ }
+ public static ESBAction cbrXpath() {
+ return new ESBAction("Content Based Router
(XPath)","Routers","org.jboss.soa.esb.actions.ContentBasedRouter")
{
+ @Override
+ public String getShellTitle() {
+ return "Add XPath Router";
+ }
+ @Override
+ public String getSectionTitle() {
+ return "Content Based Router Action";
+ }
+ @Override
+ protected void doEditing(SWTBotEditor editor, String... path) {
+ SWTBotSection section = bot.section(editor.bot(),getSectionTitle());
+ editProcess(editor,true);
+ }
+ };
+ }
+ public static ESBAction routerEcho() {
+ return new ESBAction("Echo
Router","Routers","org.jboss.soa.esb.actions.routing.EchoRouter")
{
+ @Override
+ public String getShellTitle() {
+ return "Add "+this.uiName;
+ }
+ };
+ }
+ public static ESBAction routerEmail() {
+ return new ESBAction("EMail
Router","Routers","org.jboss.soa.esb.actions.routing.email.EmailRouter")
{
+ @Override
+ public String getShellTitle() {
+ return "Add "+this.uiName;
+ }
+ @Override
+ public String getMenuLabel() {
+ return this.uiName;
+ }
+ @Override
+ public String getSectionTitle() {
+ return "Email Router Action";
+ }
+ @Override
+ protected void doEditing(SWTBotEditor editor, String... path) {
+ SWTBotSection section = bot.section(editor.bot(),getSectionTitle());
+ editProcess(editor,true);
+ }
+ };
+ }
+ public static ESBAction routerEmailWiretap() {
+ return new ESBAction("EMail
Wiretap","Routers","org.jboss.soa.esb.actions.routing.email.EmailWiretap")
{
+ @Override
+ public String getMenuLabel() {
+ return this.uiName;
+ }
+ @Override
+ public String getSectionTitle() {
+ return "Email Wiretap Action";
+ }
+ @Override
+ protected void doEditing(SWTBotEditor editor, String... path) {
+ SWTBotSection section = bot.section(editor.bot(),getSectionTitle());
+ editProcess(editor,true);
+ }
+ };
+ }
+ public static ESBAction routerHTTPRouter() {
+ return new ESBAction("HTTP
Router","Routers","org.jboss.soa.esb.actions.routing.http.HttpRouter")
{
+ @Override
+ public String getShellTitle() {
+ return "Add HTTP Wiretap";
+ }
+ @Override
+ public String getMenuLabel() {
+ return this.uiName;
+ }
+ };
+ }
+ public static ESBAction routerJMS() {
+ return new ESBAction("JMS
Router","Routers","org.jboss.soa.esb.actions.routing.JMSRouter")
{
+ @Override
+ public String getMenuLabel() {
+ return this.uiName;
+ }
+ @Override
+ protected void doEditing(SWTBotEditor editor, String... path) {
+ SWTBotSection section = bot.section(editor.bot(),getSectionTitle());
+ editProcess(editor,true);
+ }
+ };
+ }
+ public static ESBAction notifier() {
+ return new Notifier();
+ }
+ public static ESBAction staticRouter() {
+ return new ESBAction("Static
Router","Routers","org.jboss.soa.esb.actions.StaticRouter") {
+ @Override
+ protected void doEditing(SWTBotEditor editor, String... path) {
+ SWTBotSection section = bot.section(editor.bot(),getSectionTitle());
+ editProcess(editor,true);
+ }
+ };
+ }
+ public static ESBAction staticWiretap() {
+ return new ESBAction("Static
Wiretap","Routers","org.jboss.soa.esb.actions.StaticWiretap") {
+ @Override
+ protected void doEditing(SWTBotEditor editor, String... path) {
+ SWTBotSection section = bot.section(editor.bot(),getSectionTitle());
+ editProcess(editor,true);
+ }
+ };
+ }
+ public static ESBAction syncServiceInvoker() {
+ return new ESBAction("Sync Service
Invoker","Routers","org.jboss.soa.esb.actions.SyncServiceInvoker")
{
+ @Override
+ public String getMenuLabel() {
+ return this.uiName;
+ }
+ @Override
+ protected void doFillForm(SWTBotShell shell) {
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), false);
+ shell.bot().text(0).setText(this.uiName);
+ shell.bot().text(1).setText("Category");
+ shell.bot().text(2).setText("HelloService");
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), true);
+ }
+ };
+ }
+ public static ESBAction scripting() {
+ return new
ESBAction("Scripting","Scripting","org.jboss.soa.esb.actions.scripting.ScriptingAction")
{
+ @Override
+ public String getMenuLabel() {
+ return this.uiName;
+ }
+ @Override
+ public String getShellTitle() {
+ return "Add Scripting Action";
+ }
+ @Override
+ protected void doFillForm(SWTBotShell shell) {
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), false);
+ shell.bot().text(0).setText(this.uiName);
+ shell.bot().text(1).setText("script");
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), true);
+ }
+ };
+ }
+ public static ESBAction groovyActionProcessor() {
+ return new ESBAction("Groovy Action
Processor","Scripting","org.jboss.soa.esb.actions.scripting.GroovyActionProcessor")
{
+ @Override
+ protected void doFillForm(SWTBotShell shell) {
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), false);
+ shell.bot().text(0).setText(this.uiName);
+ shell.bot().text(1).setText("script.groovy");
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), true);
+ }
+ };
+ }
+ public static ESBAction ejbProcessor() {
+ return new ESBAction("EJB
Processor","Services","org.jboss.soa.esb.actions.EJBProcessor")
{
+ @Override
+ protected void doFillForm(SWTBotShell shell) {
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), false);
+ shell.bot().text(0).setText(this.uiName);
+ shell.bot().text(1).setText("script.groovy");
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), true);
+ }
+ @Override
+ public String getMenuLabel() {
+ return this.uiName;
+ }
+ };
+ }
+ public static ESBAction soapProcessor() {
+ return new ESBAction("SOAP
Processor","Webservices","org.jboss.soa.esb.actions.soap.SOAPProcessor")
{
+ @Override
+ protected void doFillForm(SWTBotShell shell) {
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), false);
+ shell.bot().text(0).setText(this.uiName);
+ shell.bot().text(1).setText("endpoint");
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), true);
+ }
+ };
+ }
+ public static ESBAction soapClient() {
+ return new ESBAction("SOAP
Client","Webservices","org.jboss.soa.esb.actions.soap.SOAPClient")
{
+ @Override
+ protected void doFillForm(SWTBotShell shell) {
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), false);
+ shell.bot().text(0).setText(this.uiName);
+ shell.bot().text(1).setText("wsdl");
+ shell.bot().text(2).setText("action");
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), true);
+ }
+ };
+ }
+ public static ESBAction soapProxy() {
+ return new ESBAction("SOAP
Proxy","Webservices","org.jboss.soa.esb.actions.soap.proxy.SOAPProxy")
{
+ @Override
+ public String getMenuLabel() {
+ return this.uiName;
+ }
+ @Override
+ protected void doFillForm(SWTBotShell shell) {
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), false);
+ shell.bot().text(0).setText(this.uiName);
+ shell.bot().text(1).setText("endpoint");
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), true);
+ }
+ };
+ }
+ public static ESBAction soapWiseClient() {
+ return new ESBAction("SOAP Wise
Client","Webservices","org.jboss.soa.esb.actions.soap.wise.SOAPClient")
{
+ @Override
+ public String getMenuLabel() {
+ return this.uiName;
+ }
+ @Override
+ protected void doFillForm(SWTBotShell shell) {
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), false);
+ shell.bot().text(0).setText(this.uiName);
+ shell.bot().text(1).setText("wsdl");
+ shell.bot().text(2).setText("action");
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), true);
+ }
+ };
+ }
+}
Added:
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/editor/ESBListener.java
===================================================================
---
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/editor/ESBListener.java
(rev 0)
+++
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/editor/ESBListener.java 2010-08-20
10:50:01 UTC (rev 24332)
@@ -0,0 +1,51 @@
+package org.jboss.tools.esb.ui.bot.tests.editor;
+
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.jboss.tools.ui.bot.ext.SWTEclipseExt;
+
+public class ESBListener extends ESBObject {
+
+ private String service;
+
+ public ESBListener(String uiName, String xmlName) {
+ super(uiName, xmlName);
+ }
+ public String getService() {
+ return service;
+ }
+ public void setService(String service) {
+ this.service = service;
+ }
+ @Override
+ public String getBaseXPath() {
+ return
"//jbossesb/services/service[@name='"+getService()+"']/listeners/";
+ }
+ protected void doFillForm(SWTBotShell shell) {
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), false);
+ shell.bot().text(0).setText(this.uiName);
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), true);
+ }
+ protected void doEditing(SWTBotEditor editor, String... path) {
+
+ }
+
+ public void edit(SWTBotEditor editor, String... path) {
+ editor.show();
+ SWTEclipseExt.selectTreeLocation(editor.bot(), path);
+ doEditing(editor, null);
+ editor.bot().sleep(5000);
+ editor.save();
+ }
+
+ public void create(SWTBotEditor editor, String... path) {
+ SWTBotShell shell = openForm(editor, path);
+ doFillForm(shell);
+ shell.bot().button(getFinishButton()).click();
+ String text = editor.toTextEditor().getText();
+ String xpath="count("+getBaseXPath()+getXpath()+")=1";
+ Assertions.assertXmlContentBool(text, xpath);
+ editor.save();
+ }
+
+}
Added:
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/editor/ESBListenerFactory.java
===================================================================
---
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/editor/ESBListenerFactory.java
(rev 0)
+++
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/editor/ESBListenerFactory.java 2010-08-20
10:50:01 UTC (rev 24332)
@@ -0,0 +1,69 @@
+package org.jboss.tools.esb.ui.bot.tests.editor;
+
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+
+public class ESBListenerFactory {
+
+ public static ESBListener listenerGeneric() {
+ return new ESBListener("Listener", "listener");
+ }
+ public static ESBListener listenerFTP() {
+ return new ESBListener("FTP Listener", "ftp-listener");
+ }
+ public static ESBListener listenerFS() {
+ return new ESBListener("FS Listener", "fs-listener");
+ }
+ public static ESBListener listenerGroovy() {
+ return new ESBListener("Groovy Listener", "groovy-listener") {
+ @Override
+ protected void doFillForm(SWTBotShell shell) {
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), false);
+ shell.bot().text(0).setText(this.uiName);
+ shell.bot().text(1).setText(this.uiName + ".groovy");
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), true);
+ }
+ };
+ }
+ public static ESBListener listenerHibernate() {
+ return new ESBListener("Hibernate Listener",
"hibernate-listener");
+ }
+ public static ESBListener listenerHTTPGateway() {
+ return new ESBListener("HTTP Gateway", "http-gateway");
+ }
+ public static ESBListener listenerJBR() {
+ return new ESBListener("JBR Listener", "jbr-listener");
+ }
+ public static ESBListener listenerJMS() {
+ return new ESBListener("JMS Listener", "jms-listener");
+ }
+ public static ESBListener listenerJCA() {
+ return new ESBListener("JCA Gateway", "jca-gateway") {
+ @Override
+ protected void doFillForm(SWTBotShell shell) {
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), false);
+ shell.bot().text(0).setText(this.uiName);
+ shell.bot().text(1).setText(this.uiName + ".adapter");
+ shell.bot().text(2).setText("java.lang.Object");
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), true);
+ }
+ };
+ }
+ public static ESBListener listenerScheduled() {
+ return new ESBListener("Scheduled Listener",
"scheduled-listener");
+ }
+ public static ESBListener listenerSQL() {
+ return new ESBListener("SQL Listener", "sql-listener");
+ }
+ public static ESBListener listenerUDP() {
+ return new ESBListener("UDP Listener", "udp-listener") {
+ @Override
+ protected void doFillForm(SWTBotShell shell) {
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), false);
+ shell.bot().text(0).setText(this.uiName);
+ shell.bot().text(1).setText("localhost");
+ shell.bot().text(2).setText("123");
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), true);
+ }
+ };
+ }
+}
Added:
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/editor/ESBObject.java
===================================================================
---
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/editor/ESBObject.java
(rev 0)
+++
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/editor/ESBObject.java 2010-08-20
10:50:01 UTC (rev 24332)
@@ -0,0 +1,84 @@
+package org.jboss.tools.esb.ui.bot.tests.editor;
+
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.ui.bot.ext.SWTBotExt;
+import org.jboss.tools.ui.bot.ext.SWTEclipseExt;
+import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+
+public abstract class ESBObject {
+
+ protected static final SWTBotExt bot = new SWTBotExt();
+ protected final String uiName;
+ public final String xmlName;
+
+ public ESBObject(String uiName, String xmlName) {
+ this.uiName=uiName;
+ this.xmlName=xmlName;
+ }
+ @Override
+ public boolean equals(Object obj) {
+ if (obj.getClass().equals(this.getClass())) {
+ return this.uiName.equals(((ESBObject)obj).uiName);
+ }
+ return super.equals(obj);
+ }
+ public String getBaseXPath() {
+ return "//jbossesb/";
+ }
+ public String getShellTitle() {
+ return "Add "+this.uiName;
+ }
+ public String getMenuLabel() {
+ return this.uiName+"...";
+ }
+ public String getSectionTitle() {
+ return this.uiName;
+ }
+ public String getXpath() {
+ return this.xmlName+"[(a)name='"+this.uiName+"']";
+ }
+ public String getFinishButton() {
+ return IDELabel.Button.FINISH;
+ }
+
+ protected abstract void doFillForm(SWTBotShell shell);
+ protected abstract void doEditing(SWTBotEditor editor, String... path);
+ public abstract void create(SWTBotEditor editor, String... path);
+
+ protected void editTextProperty(SWTBotEditor editor,SWTBot ebot,String withLabel, String
name, String value) {
+ ebot.textWithLabel(withLabel).setText(value);
+ editor.save();
+ String text = editor.toTextEditor().getText();
+ String xpath =
"count("+getBaseXPath()+getXpath()+"/property[@name='"+name+"'
and @value='"+value+"'])=1";
+ Assertions.assertXmlContentBool(text, xpath);
+ }
+
+
+ protected SWTBotShell openForm(SWTBotEditor editor, String... path) {
+ editor.show();
+ SWTBotTreeItem provItem = SWTEclipseExt.selectTreeLocation(editor.bot(), path);
+ ContextMenuHelper.prepareTreeItemForContextMenu(editor.bot().tree(), provItem);
+ ContextMenuHelper.clickContextMenu(editor.bot().tree(),
IDELabel.Menu.NEW,getMenuLabel());
+ return new SWTBot().shell(getShellTitle());
+ }
+
+ public static String[] arrayAppend(String[] array, String... items) {
+ String[] ret = new String[array.length+items.length];
+ int i=0;
+ for (i=0;i<array.length;i++) {
+ ret[i] = array[i];
+ }
+ for (int j=0;j<items.length;j++) {
+ ret[i+j] = items[j];
+ }
+ return ret;
+ }
+
+
+
+
+}
Added:
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/editor/ESBObjectDummy.java
===================================================================
---
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/editor/ESBObjectDummy.java
(rev 0)
+++
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/editor/ESBObjectDummy.java 2010-08-20
10:50:01 UTC (rev 24332)
@@ -0,0 +1,31 @@
+package org.jboss.tools.esb.ui.bot.tests.editor;
+
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+
+public class ESBObjectDummy extends ESBObject {
+
+ public ESBObjectDummy(String uiName, String xmlName) {
+ super(uiName, xmlName);
+ // TODO Auto-generated constructor stub
+ }
+
+ @Override
+ protected void doFillForm(SWTBotShell shell) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ protected void doEditing(SWTBotEditor editor, String... path) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void create(SWTBotEditor editor, String... path) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Added:
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/editor/ESBProvider.java
===================================================================
---
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/editor/ESBProvider.java
(rev 0)
+++
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/editor/ESBProvider.java 2010-08-20
10:50:01 UTC (rev 24332)
@@ -0,0 +1,37 @@
+package org.jboss.tools.esb.ui.bot.tests.editor;
+
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+
+public class ESBProvider extends ESBObject {
+
+ public ESBProvider(String uiName, String xmlName) {
+ super(uiName, xmlName);
+ }
+
+ protected void doFillForm(SWTBotShell shell) {
+ Assertions.assertButtonEnabled(shell.bot().button(IDELabel.Button.NEXT), false);
+ shell.bot().text(0).setText(this.uiName);
+ Assertions.assertButtonEnabled(shell.bot().button(IDELabel.Button.NEXT), true);
+ shell.bot().button(IDELabel.Button.NEXT).click();
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), false);
+ shell.bot().text(0).setText(this.uiName);
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), true);
+ }
+
+ protected void doEditing(SWTBotEditor editor, String... path) {
+
+ }
+
+ public void create(SWTBotEditor editor, String... path) {
+ SWTBotShell shell = openForm(editor, path);
+ doFillForm(shell);
+ shell.bot().button(getFinishButton()).click();
+ String text = editor.toTextEditor().getText();
+ String xpath="count(//jbossesb/providers/"+getXpath()+")=1";
+ Assertions.assertXmlContentBool(text, xpath);
+ editor.save();
+ }
+
+}
Added:
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/editor/ESBProviderFactory.java
===================================================================
---
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/editor/ESBProviderFactory.java
(rev 0)
+++
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/editor/ESBProviderFactory.java 2010-08-20
10:50:01 UTC (rev 24332)
@@ -0,0 +1,98 @@
+package org.jboss.tools.esb.ui.bot.tests.editor;
+
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+
+public class ESBProviderFactory {
+ public static ESBProvider providerBus() {
+ return new ESBProvider("Bus Provider", "bus-provider");
+ }
+ public static ESBProvider providerFS() {
+ return new ESBProvider("FS Provider", "fs-provider");
+ }
+ public static ESBProvider providerFTP() {
+ return new ESBProvider("FTP Provider", "ftp-provider") {
+ protected void doFillForm(SWTBotShell shell) {
+ Assertions.assertButtonEnabled(shell.bot().button(IDELabel.Button.NEXT), false);
+ shell.bot().text(0).setText(this.uiName);
+ shell.bot().text(1).setText("localhost");
+ Assertions.assertButtonEnabled(shell.bot().button(IDELabel.Button.NEXT), true);
+ shell.bot().button(IDELabel.Button.NEXT).click();
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), false);
+ shell.bot().text(0).setText(this.uiName);
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), true);
+ }
+ };
+ }
+ public static ESBProvider providerHibernate() {
+ return new ESBProvider("Hibernate Provider",
"hibernate-provider"){
+ protected void doFillForm(SWTBotShell shell) {
+ Assertions.assertButtonEnabled(shell.bot().button(IDELabel.Button.NEXT), false);
+ shell.bot().text(0).setText(this.uiName);
+ shell.bot().text(1).setText("hibernate.cfg.xml");
+ Assertions.assertButtonEnabled(shell.bot().button(IDELabel.Button.NEXT), true);
+ shell.bot().button(IDELabel.Button.NEXT).click();
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), false);
+ shell.bot().text(0).setText(this.uiName);
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), true);
+ }
+ };
+ }
+ public static ESBProvider providerHTTP() {
+ return new ESBProvider("HTTP Provider", "http-provider");
+ }
+ public static ESBProvider providerJBR() {
+ return new ESBProvider("JBR Provider", "jbr-provider") {
+ protected void doFillForm(SWTBotShell shell) {
+ Assertions.assertButtonEnabled(shell.bot().button(IDELabel.Button.NEXT), false);
+ shell.bot().text(0).setText(this.uiName);
+ Assertions.assertButtonEnabled(shell.bot().button(IDELabel.Button.NEXT), true);
+ shell.bot().button(IDELabel.Button.NEXT).click();
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), false);
+ shell.bot().text(0).setText(this.uiName);
+ shell.bot().text(1).setText("8888");
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), true);
+ }
+ };
+ }
+ public static ESBProvider providerJCA() {
+ return new ESBProvider("JCA Provider", "jms-jca-provider") {
+ protected void doFillForm(SWTBotShell shell) {
+ Assertions.assertButtonEnabled(shell.bot().button(IDELabel.Button.NEXT), false);
+ shell.bot().text(0).setText(this.uiName);
+ shell.bot().text(1).setText(this.uiName);
+ Assertions.assertButtonEnabled(shell.bot().button(IDELabel.Button.NEXT), true);
+ shell.bot().button(IDELabel.Button.NEXT).click();
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), false);
+ shell.bot().text(0).setText(this.uiName);
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), true);
+ }
+ };
+ }
+ public static ESBProvider providerJMS() {
+ return new ESBProvider("JMS Provider", "jms-provider") {
+ protected void doFillForm(SWTBotShell shell) {
+ Assertions.assertButtonEnabled(shell.bot().button(IDELabel.Button.NEXT), false);
+ shell.bot().text(0).setText(this.uiName);
+ shell.bot().text(1).setText(this.uiName);
+ Assertions.assertButtonEnabled(shell.bot().button(IDELabel.Button.NEXT), true);
+ shell.bot().button(IDELabel.Button.NEXT).click();
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), false);
+ shell.bot().text(0).setText(this.uiName);
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), true);
+ }
+ };
+ }
+ public static ESBProvider providerSchedule() {
+ return new ESBProvider("Schedule Provider", "schedule-provider") {
+ protected void doFillForm(SWTBotShell shell) {
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), false);
+ shell.bot().text(0).setText(this.uiName);
+ Assertions.assertButtonEnabled(shell.bot().button(getFinishButton()), true);
+ }
+ };
+ }
+ public static ESBProvider providerSQL() {
+ return new ESBProvider("SQL Provider", "sql-provider");
+ }
+}
Added:
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/editor/action/Notifier.java
===================================================================
---
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/editor/action/Notifier.java
(rev 0)
+++
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/editor/action/Notifier.java 2010-08-20
10:50:01 UTC (rev 24332)
@@ -0,0 +1,97 @@
+package org.jboss.tools.esb.ui.bot.tests.editor.action;
+
+import static org.junit.Assert.fail;
+
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.esb.ui.bot.tests.editor.Assertions;
+import org.jboss.tools.esb.ui.bot.tests.editor.ESBAction;
+import org.jboss.tools.esb.ui.bot.tests.editor.ESBObject;
+import org.jboss.tools.esb.ui.bot.tests.editor.ESBObjectDummy;
+import org.jboss.tools.ui.bot.ext.SWTEclipseExt;
+import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.jboss.tools.ui.bot.ext.widgets.SWTBotSection;
+
+public class Notifier extends ESBAction {
+
+ public Notifier() {
+ super("Notifier","Routers","org.jboss.soa.esb.actions.Notifier");
+
+ }
+
+ protected void doEditing(SWTBotEditor editor, String... path) {
+ SWTBotSection section = bot.section(editor.bot(),getSectionTitle());
+ editTextProperty(editor, section.bot(), "Ok Method:", "okMethod",
"method");
+ editTextProperty(editor, section.bot(), "Exception Method:",
"exceptionMethod", "method");
+ section = bot.section(editor.bot(),"Notification Lists");
+ section.bot().button(IDELabel.Button.ADD).click();
+ SWTBotShell shell = bot.shell("Add Notification List...").activate();
+ shell.bot().text().setText("list");
+ shell.bot().button(IDELabel.Button.FINISH).click();
+ String xpath =
getBaseXPath()+getXpath()+"/property[@name='destinations']/NotificationList[@type='list']";
+ Assertions.assertXmlContentExists(editor.toTextEditor().getText(), xpath);
+ section = bot.section(editor.bot(),"Targets");
+ editor.save();
+ String[] notifiersPath = arrayAppend(path, "Notifier","list");
+ addTarget(editor, xpath, notifiersPath);
+ addNotifier(editor, new ESBObjectDummy("Notify Console",
"NotifyConsole"), xpath, notifiersPath);
+ addEmail(editor, xpath, notifiersPath);
+ addNotifier(editor, new ESBObjectDummy("Notify Files",
"NotifyFiles"), xpath, notifiersPath);
+ addNotifier(editor, new ESBObjectDummy("Notify FTP", "NotifyFTP"),
xpath, notifiersPath);
+ addNotifier(editor, new ESBObjectDummy("Notify FTP List",
"NotifyFTPList"), xpath, notifiersPath);
+ addNotifier(editor, new ESBObjectDummy("Notify Queues",
"NotifyQueues"), xpath, notifiersPath);
+ addSQL(editor, xpath, notifiersPath);
+ addNotifier(editor, new ESBObjectDummy("Notify TCP", "NotifyTCP"),
xpath, notifiersPath);
+ addNotifier(editor, new ESBObjectDummy("Notify Topics",
"NotifyTopics"), xpath, notifiersPath);
+ fail("OK");
+ }
+
+ private void addTarget(SWTBotEditor editor,String xpath,String... path) {
+ SWTBotTreeItem item = SWTEclipseExt.selectTreeLocation(editor.bot(), path);
+ ContextMenuHelper.prepareTreeItemForContextMenu(editor.bot().tree(),item);
+ ContextMenuHelper.clickContextMenu(editor.bot().tree(),
IDELabel.Menu.NEW,"Target...");
+ SWTBot shellBot = bot.shell("Add Target").bot();
+ shellBot.text().setText("java.lang.Object");
+ shellBot.button(IDELabel.Button.FINISH).click();
+ editor.save();
+ xpath+="/target[(a)class='java.lang.Object']";
+ Assertions.assertXmlContentExists(editor.toTextEditor().getText(), xpath);
+ }
+ private void addNotifier(SWTBotEditor editor, ESBObject obj,String xpath,String... path)
{
+ SWTBotTreeItem item = SWTEclipseExt.selectTreeLocation(editor.bot(), path);
+ ContextMenuHelper.prepareTreeItemForContextMenu(editor.bot().tree(),item);
+ ContextMenuHelper.clickContextMenu(editor.bot().tree(),
IDELabel.Menu.NEW,obj.getMenuLabel());
+ editor.save();
+ xpath+="/target[(a)class='"+obj.xmlName+"']";
+ Assertions.assertXmlContentExists(editor.toTextEditor().getText(), xpath);
+ }
+ private void addEmail(SWTBotEditor editor,String xpath,String... path) {
+ SWTBotTreeItem item = SWTEclipseExt.selectTreeLocation(editor.bot(), path);
+ ContextMenuHelper.prepareTreeItemForContextMenu(editor.bot().tree(),item);
+ ContextMenuHelper.clickContextMenu(editor.bot().tree(), IDELabel.Menu.NEW,"Notify
Email...");
+ SWTBot shellBot = bot.shell("Notify Email...").bot();
+ shellBot.text(0).setText("a");
+ shellBot.text(1).setText("b");
+ shellBot.text(2).setText("c");
+ shellBot.button(IDELabel.Button.FINISH).click();
+ editor.save();
+ xpath+="/target[@class='NotifyEmail' and @from='a' and
@sendTo='b' and @subject='c']";
+ Assertions.assertXmlContentExists(editor.toTextEditor().getText(), xpath);
+ }
+ private void addSQL(SWTBotEditor editor,String xpath,String... path) {
+ SWTBotTreeItem item = SWTEclipseExt.selectTreeLocation(editor.bot(), path);
+ ContextMenuHelper.prepareTreeItemForContextMenu(editor.bot().tree(),item);
+ ContextMenuHelper.clickContextMenu(editor.bot().tree(), IDELabel.Menu.NEW,"Notify
SQL Table...");
+ SWTBot shellBot = bot.shell("Notify SQL Table...").bot();
+ shellBot.text(1).setText("a");
+ shellBot.text(2).setText("b");
+ shellBot.text(3).setText("c");
+ shellBot.button(IDELabel.Button.FINISH).click();
+ editor.save();
+ xpath+="/target[@class='NotifySQLTable' and @driver-class='a' and
@connection-url='b' and @user-name='c']";
+ Assertions.assertXmlContentExists(editor.toTextEditor().getText(), xpath);
+ }
+}
Added:
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/ESBExampleTest.java
===================================================================
---
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/ESBExampleTest.java
(rev 0)
+++
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/ESBExampleTest.java 2010-08-20
10:50:01 UTC (rev 24332)
@@ -0,0 +1,51 @@
+package org.jboss.tools.esb.ui.bot.tests.examples;
+
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+
+public class ESBExampleTest extends SWTTestExt{
+ protected void fixLibrary(String project, String lib) {
+ SWTBotTree tree = projectExplorer.show().bot().tree();
+ SWTBotTreeItem proj = tree.select(project).getTreeItem(project);
+ boolean fixed=false;
+ for (SWTBotTreeItem item : proj.getItems()) {
+ if (item.getText().startsWith(lib)) {
+ ContextMenuHelper.prepareTreeItemForContextMenu(tree, item);
+ new SWTBotMenu(ContextMenuHelper.getContextMenu(tree, IDELabel.Menu.PROPERTIES,
false)).click();
+ SWTBotShell shell = bot.activeShell();
+ shell.bot().table().select(configuredState.getServer().name);
+ open.finish(shell.bot(),IDELabel.Button.OK);
+ fixed=true;
+ break;
+ }
+ }
+ if (!fixed) {
+ bot.sleep(Long.MAX_VALUE);
+ }
+ }
+ /**
+ * gets label in project examples tree derived by version of soa we currently run
+ * @return
+ */
+ protected String getRunningSoaVersionTreeLabel() {
+ String ret = "ESB for SOA-P ";
+ if (configuredState.getServer().version.equals("5.0")) {
+ ret+="5.0";
+ }
+ else if (configuredState.getServer().version.equals("4.3")) {
+ ret+="4.3";
+ if (jbt.isJBDSRun()) {
+ return "ESB";
+ }
+ }
+ else {
+ return null;
+ }
+ return ret;
+ }
+}
Added:
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/HelloWorld.java
===================================================================
---
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/HelloWorld.java
(rev 0)
+++
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/HelloWorld.java 2010-08-20
10:50:01 UTC (rev 24332)
@@ -0,0 +1,96 @@
+package org.jboss.tools.esb.ui.bot.tests.examples;
+
+import static org.eclipse.swtbot.swt.finder.waits.Conditions.shellCloses;
+
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.ui.bot.ext.SWTEclipseExt;
+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.config.Annotations.Server;
+import org.jboss.tools.ui.bot.ext.config.Annotations.ServerState;
+import org.jboss.tools.ui.bot.ext.config.Annotations.ServerType;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem.NewObject.JBossToolsProjectExamples;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.junit.AfterClass;
+import org.junit.Test;
+
+@SWTBotTestRequires(server=(a)Server(type=ServerType.SOA,state=ServerState.NotRunning))
+public class HelloWorld extends ESBExampleTest {
+
+ String projectName="helloworld";
+ String projectClientName="helloworld_client";
+
+ @AfterClass
+ public static void waitaminute() {
+ //bot.sleep(Long.MAX_VALUE);
+ }
+ @Test
+ public void helloWorldExample() {
+ String soaNode = getRunningSoaVersionTreeLabel();
+ assertNotNull("We are running on unexpected SOA-P version
"+configuredState.getServer().version+" update test source code
"+this.getClass().getName(), soaNode);
+ if (jbt.isJBDSRun()) {
+ createHelloWorldExample(soaNode, "JBoss ESB HelloWorld Example - ESB",
"helloworld", "JBoss ESB HelloWorld Example - Client",
"helloworld_testclient");
+ }
+ else {
+ createHelloWorldExample(soaNode, "JBoss ESB HelloWorld Example - ESB",
"helloworld", null, "helloworld_testclient");
+ }
+ }
+
+ /**
+ * creates example
+ * @param soaNode first treenode name on projectExamples dialog
+ * @param exampleName name of example node
+ * @param projectName projectname that will be generated by example
+ * @param exampleClientName name of example client example (when null, client project is
assumed to be together with example)
+ * @param projectClientName name of client project that will be generated by example (or
client example)
+ */
+ private void createHelloWorldExample(String soaNode, String exampleName,String
projectName, String exampleClientName, String projectClientName) {
+ SWTBot wiz = open.newObject(JBossToolsProjectExamples.LABEL);
+ SWTBotTree tree = wiz.tree();
+ tree.expandNode(soaNode).select(exampleName);
+ assertTrue(wiz.textWithLabel(JBossToolsProjectExamples.TEXT_PROJECT_NAME).getText().equals(projectName));
+ wiz.button(IDELabel.Button.FINISH).click();
+ SWTBotShell shell = bot.shell("Downloading...");
+ shell.activate();
+ bot.waitUntil(shellCloses(shell),Timing.time100S());
+ shell = bot.shell("Quick Fix");
+ shell.activate();
+ open.finish(shell.bot());
+ assertTrue(projectExplorer.existsResource(projectName));
+ assertTrue(projectExplorer.existsResource(projectName,"esbcontent","META-INF","jboss-esb.xml"));
+ if (exampleClientName!=null) {
+ wiz = open.newObject(JBossToolsProjectExamples.LABEL);
+ tree = wiz.tree();
+ tree.expandNode(soaNode).select(exampleClientName);
+ assertTrue(wiz.textWithLabel(JBossToolsProjectExamples.TEXT_PROJECT_NAME).getText().equals(projectClientName));
+ wiz.button(IDELabel.Button.FINISH).click();
+ shell = bot.shell("Downloading...");
+ shell.activate();
+ bot.waitUntil(shellCloses(shell),Timing.time100S());
+ shell = bot.shell("Quick Fix");
+ shell.activate();
+ open.finish(shell.bot());
+ }
+ assertTrue(projectExplorer.existsResource(projectClientName));
+ fixLibrary(projectName,"Server Library");
+ fixLibrary(projectClientName,"Server Library");
+ fixLibrary(projectName,"JBoss ESB Runtime");
+ fixLibrary(projectClientName,"JBoss ESB Runtime");
+ SWTBotTreeItem errors = problems.getErrorsNode(bot);
+ assertTrue("Project still contain problems
:"+eclipse.getFormattedTreeNodesText(problems.show().bot().tree(),
errors.getItems()),errors==null);
+ packageExplorer.runOnServer(projectName);
+ String text = console.getConsoleText();
+ SWTBotTreeItem jmsCall =
SWTEclipseExt.selectTreeLocation(packageExplorer.show().bot(),projectClientName,"src","org.jboss.soa.esb.samples.quickstart.helloworld.test","SendJMSMessage.java");
+ eclipse.runTreeItemAsJavaApplication(jmsCall);
+ bot.sleep(Timing.time5S());
+ console.switchConsole(configuredState.getServer().name);
+ String text2 = console.getConsoleText(TIME_5S, TIME_20S, false);
+ assertTrue("Calling JMS Send message failed, nothing appened to server
log",text.length()<text2.length());
+ String diff = text2.substring(text.length());
+ assertTrue("Calling JMS Send message failed, unexpected server output
:"+diff,diff.contains("Body: Hello World"));
+
+ }
+}
Added:
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/HelloWorldAction.java
===================================================================
---
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/HelloWorldAction.java
(rev 0)
+++
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/HelloWorldAction.java 2010-08-20
10:50:01 UTC (rev 24332)
@@ -0,0 +1,5 @@
+package org.jboss.tools.esb.ui.bot.tests.examples;
+
+public class HelloWorldAction extends ESBExampleTest {
+
+}
Added:
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/HelloWorldFileAction.java
===================================================================
---
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/HelloWorldFileAction.java
(rev 0)
+++
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/HelloWorldFileAction.java 2010-08-20
10:50:01 UTC (rev 24332)
@@ -0,0 +1,5 @@
+package org.jboss.tools.esb.ui.bot.tests.examples;
+
+public class HelloWorldFileAction extends ESBExampleTest {
+
+}