Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Tiede2016-04-06 10:11:35 -0400
committerMarvin Mueller2017-09-06 05:26:24 -0400
commit7a18a7091030fef8a2131fcab18343353088cc1f (patch)
tree352074cfb46c19dcc23dcca52b967883fbfe0e42 /org.eclipse.jubula.examples.api.adder.javafx.osgi
parent04fa4ba30fc72ba5ad26fd90ec188ee318b487f2 (diff)
downloadorg.eclipse.jubula.core-7a18a7091030fef8a2131fcab18343353088cc1f.tar.gz
org.eclipse.jubula.core-7a18a7091030fef8a2131fcab18343353088cc1f.tar.xz
org.eclipse.jubula.core-7a18a7091030fef8a2131fcab18343353088cc1f.zip
Non-sprint task - add support for embedded AUT-Agent within OSGi-API context
Diffstat (limited to 'org.eclipse.jubula.examples.api.adder.javafx.osgi')
-rw-r--r--org.eclipse.jubula.examples.api.adder.javafx.osgi/META-INF/MANIFEST.MF4
-rw-r--r--org.eclipse.jubula.examples.api.adder.javafx.osgi/launch/JavaFX - SimpleAdder JUnit Plug-in Test - OSGi.launch46
-rw-r--r--org.eclipse.jubula.examples.api.adder.javafx.osgi/launch/SimpleAdder JUnit Test - OSGi.launch18
-rw-r--r--org.eclipse.jubula.examples.api.adder.javafx.osgi/src/org/eclipse/jubula/examples/api/adder/javafx/SimpleAdder.java66
4 files changed, 85 insertions, 49 deletions
diff --git a/org.eclipse.jubula.examples.api.adder.javafx.osgi/META-INF/MANIFEST.MF b/org.eclipse.jubula.examples.api.adder.javafx.osgi/META-INF/MANIFEST.MF
index 9b2b75b08..6babb721e 100644
--- a/org.eclipse.jubula.examples.api.adder.javafx.osgi/META-INF/MANIFEST.MF
+++ b/org.eclipse.jubula.examples.api.adder.javafx.osgi/META-INF/MANIFEST.MF
@@ -15,6 +15,8 @@ Require-Bundle: org.junit;bundle-version="[4.0.0,5.0.0)",
org.eclipse.jubula.toolkit.javafx.api;bundle-version="[5.0.0,6.0.0)",
org.slf4j.api;bundle-version="[1.7.2,2.0.0)",
org.apache.commons.codec;bundle-version="[1.4.0,2.0.0)",
- org.apache.commons.lang;bundle-version="[2.6.0,3.0.0)"
+ org.apache.commons.lang;bundle-version="[2.6.0,3.0.0)",
+ org.eclipse.jubula.rc.javafx;bundle-version="[5.0.0,7.0.0)",
+ org.eclipse.jubula.autagent.api;bundle-version="[4.0.0,5.0.0)"
Bundle-ClassPath: .
Bundle-Name: Examples - API - SimpleAdder - JavaFX - OSGi
diff --git a/org.eclipse.jubula.examples.api.adder.javafx.osgi/launch/JavaFX - SimpleAdder JUnit Plug-in Test - OSGi.launch b/org.eclipse.jubula.examples.api.adder.javafx.osgi/launch/JavaFX - SimpleAdder JUnit Plug-in Test - OSGi.launch
new file mode 100644
index 000000000..524b45dcf
--- /dev/null
+++ b/org.eclipse.jubula.examples.api.adder.javafx.osgi/launch/JavaFX - SimpleAdder JUnit Plug-in Test - OSGi.launch
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
+<booleanAttribute key="append.args" value="true"/>
+<stringAttribute key="application" value="org.eclipse.pde.junit.runtime.coretestapplication"/>
+<booleanAttribute key="askclear" value="false"/>
+<booleanAttribute key="automaticAdd" value="false"/>
+<booleanAttribute key="automaticValidate" value="false"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="true"/>
+<booleanAttribute key="clearws" value="true"/>
+<booleanAttribute key="clearwslog" value="false"/>
+<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
+<booleanAttribute key="default" value="false"/>
+<booleanAttribute key="includeOptional" value="false"/>
+<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/org.eclipse.jubula.examples.api.adder.javafx.osgi"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="4"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=org.eclipse.jubula.examples.api.adder.javafx.osgi"/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
+<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog -clean"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.jubula.examples.api.adder.javafx.osgi"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="/projects/guidancer/Workspace/hu_snapshot/current/platforms/lin.gtk.x86/jubula"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<stringAttribute key="product" value="org.eclipse.platform.ide"/>
+<booleanAttribute key="run_in_ui_thread" value="false"/>
+<stringAttribute key="selected_target_plugins" value="ch.qos.logback.classic@default:default,ch.qos.logback.core@default:default,ch.qos.logback.slf4j@default:false,javax.xml@default:default,org.apache.commons.beanutils@default:default,org.apache.commons.codec*1.6.0.v201305230611@default:default,org.apache.commons.collections@default:default,org.apache.commons.lang*2.6.0.v201404270220@default:default,org.apache.oro@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.core.runtime@default:true,org.eclipse.equinox.app@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.region@default:false,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.transforms.hook@default:false,org.eclipse.equinox.weaving.hook@default:false,org.eclipse.osgi.compatibility.state@default:false,org.eclipse.osgi@-1:true,org.hamcrest.core@default:default,org.junit@default:default,org.slf4j.api@default:default,org.slf4j.jcl@default:default,org.slf4j.jul@default:default"/>
+<stringAttribute key="selected_workspace_plugins" value="com.bredexsw.guidancer.autagent@default:false,com.bredexsw.jubula.rc.common@default:default,com.bredexsw.jubula.version@default:false,org.eclipse.jubula.autagent.api@default:default,org.eclipse.jubula.autagent@default:default,org.eclipse.jubula.client.api.commands@default:default,org.eclipse.jubula.client.api@default:default,org.eclipse.jubula.communication@default:default,org.eclipse.jubula.examples.api.adder.javafx.osgi@default:default,org.eclipse.jubula.logging@default:default,org.eclipse.jubula.rc.common.agent@default:default,org.eclipse.jubula.rc.common@default:default,org.eclipse.jubula.rc.javafx.j8u40@default:false,org.eclipse.jubula.rc.javafx@default:default,org.eclipse.jubula.toolkit.api@default:default,org.eclipse.jubula.toolkit.base.api@default:default,org.eclipse.jubula.toolkit.concrete.api@default:default,org.eclipse.jubula.toolkit.javafx.api@default:default,org.eclipse.jubula.tools@default:default,org.eclipse.jubula.version@default:default"/>
+<booleanAttribute key="show_selected_only" value="false"/>
+<stringAttribute key="templateConfig" value="${target_home}/configuration/config.ini"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useCustomFeatures" value="false"/>
+<booleanAttribute key="useDefaultConfig" value="true"/>
+<booleanAttribute key="useDefaultConfigArea" value="false"/>
+<booleanAttribute key="useProduct" value="false"/>
+</launchConfiguration>
diff --git a/org.eclipse.jubula.examples.api.adder.javafx.osgi/launch/SimpleAdder JUnit Test - OSGi.launch b/org.eclipse.jubula.examples.api.adder.javafx.osgi/launch/SimpleAdder JUnit Test - OSGi.launch
deleted file mode 100644
index b71fb8c35..000000000
--- a/org.eclipse.jubula.examples.api.adder.javafx.osgi/launch/SimpleAdder JUnit Test - OSGi.launch
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/org.eclipse.jubula.examples.api.adder.javafx.osgi/src"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="2"/>
-</listAttribute>
-<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
-<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=org.eclipse.jubula.examples.api.adder.javafx.osgi/src"/>
-<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
-<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
-<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
-<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
-<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.jubula.examples.api.adder.javafx.osgi"/>
-</launchConfiguration>
diff --git a/org.eclipse.jubula.examples.api.adder.javafx.osgi/src/org/eclipse/jubula/examples/api/adder/javafx/SimpleAdder.java b/org.eclipse.jubula.examples.api.adder.javafx.osgi/src/org/eclipse/jubula/examples/api/adder/javafx/SimpleAdder.java
index a0b218512..681967eac 100644
--- a/org.eclipse.jubula.examples.api.adder.javafx.osgi/src/org/eclipse/jubula/examples/api/adder/javafx/SimpleAdder.java
+++ b/org.eclipse.jubula.examples.api.adder.javafx.osgi/src/org/eclipse/jubula/examples/api/adder/javafx/SimpleAdder.java
@@ -10,12 +10,13 @@
*******************************************************************************/
package org.eclipse.jubula.examples.api.adder.javafx;
+import java.io.File;
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.jubula.autagent.Embedded;
import org.eclipse.jubula.client.AUT;
import org.eclipse.jubula.client.AUTAgent;
-import org.eclipse.jubula.client.MakeR;
import org.eclipse.jubula.client.Result;
import org.eclipse.jubula.client.exceptions.CheckFailedException;
import org.eclipse.jubula.client.launch.AUTConfiguration;
@@ -37,10 +38,6 @@ import org.junit.Test;
/** @author BREDEX GmbH */
public class SimpleAdder {
- /** AUT-Agent host name to use */
- public static final String AGENT_HOST = "localhost"; //$NON-NLS-1$
- /** AUT-Agent port to use */
- public static final int AGENT_PORT = 60000;
/** the value1 */
private static TextInputComponent value1;
/** the value2 */
@@ -49,8 +46,6 @@ public class SimpleAdder {
private static GraphicsComponent button;
/** the result */
private static TextComponent result;
- /** the AUT-Agent */
- private AUTAgent m_agent;
/** the AUT */
private AUT m_aut;
@@ -72,29 +67,44 @@ public class SimpleAdder {
/** prepare */
@Before
public void setUp() throws Exception {
- /* Connecting to external Jubula AUT Agent which
- must be started manually BEFORE test execution! */
- m_agent = getAUTAgentInstance();
- m_agent.connect();
+ AUTAgent agent = Embedded.INSTANCE.agent();
final String autID = "SimpleAdder_javafx"; //$NON-NLS-1$
- AUTConfiguration config = new JavaFXAUTConfiguration(
- "api.aut.conf.simple.adder.javafx", //$NON-NLS-1$
- autID,
- "..\\jre\\bin\\java.exe", //$NON-NLS-1$
- "..\\examples\\", //$NON-NLS-1$
- new String[]{"-jar", "AUTs\\SimpleAdder\\javafx\\SimpleAdder.jar"} //$NON-NLS-1$ //$NON-NLS-2$
- );
+ AUTConfiguration config = createAutConfiguration(autID);
- AUTIdentifier id = m_agent.startAUT(config);
+ AUTIdentifier id = agent.startAUT(config);
if (id != null) {
- m_aut = m_agent.getAUT(id, JavafxComponents.getToolkitInformation());
+ m_aut = agent.getAUT(id, JavafxComponents.getToolkitInformation());
m_aut.connect();
} else {
Assert.fail("AUT start has failed!"); //$NON-NLS-1$
}
}
+ /**
+ * @param autID the AUT-Id to use
+ * @return a configuration
+ */
+ private AUTConfiguration createAutConfiguration(final String autID) {
+ return new JavaFXAUTConfiguration(
+ "api.aut.conf.simple.adder.javafx", //$NON-NLS-1$
+ autID,
+ "..\\jre\\bin\\java.exe", //$NON-NLS-1$
+ new StringBuilder()
+ .append("..") //$NON-NLS-1$
+ .append(File.separatorChar)
+ .append("examples") //$NON-NLS-1$
+ .append(File.separatorChar)
+ .append("AUTs") //$NON-NLS-1$
+ .append(File.separatorChar)
+ .append("SimpleAdder") //$NON-NLS-1$
+ .append(File.separatorChar)
+ .append("javafx") //$NON-NLS-1$
+ .append(File.separatorChar)
+ .toString(),
+ new String[]{"-jar", "SimpleAdder.jar"}); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
/** the actual test method */
@Test(expected = CheckFailedException.class)
public void testTestFirstSimpleAdderSteps() throws Exception {
@@ -124,15 +134,11 @@ public class SimpleAdder {
/** cleanup */
@After
public void tearDown() throws Exception {
- m_aut.disconnect();
- m_agent.stopAUT(m_aut.getIdentifier());
- m_agent.disconnect();
- }
-
- /**
- * @return an AUT-Agent instance
- */
- protected AUTAgent getAUTAgentInstance() {
- return MakeR.createAUTAgent(AGENT_HOST, AGENT_PORT);
+ AUTAgent agent = Embedded.INSTANCE.agent();
+ if (m_aut != null) {
+ m_aut.disconnect();
+ agent.stopAUT(m_aut.getIdentifier());
+ }
+ agent.disconnect();
}
} \ No newline at end of file

Back to the top