Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.jubula.examples.api.swing/.classpath61
-rw-r--r--org.eclipse.jubula.examples.api.swing/.gitignore4
-rw-r--r--org.eclipse.jubula.examples.api.swing/.project17
-rw-r--r--org.eclipse.jubula.examples.api.swing/.settings/org.eclipse.jdt.core.prefs11
-rw-r--r--org.eclipse.jubula.examples.api.swing/README.md17
-rw-r--r--org.eclipse.jubula.examples.api.swing/SimpleAdder.cmd3
-rw-r--r--org.eclipse.jubula.examples.api.swing/about.html28
-rw-r--r--org.eclipse.jubula.examples.api.swing/junit4Resources/JubulaRunner.java128
-rw-r--r--org.eclipse.jubula.examples.api.swing/libs/.keep0
-rw-r--r--org.eclipse.jubula.examples.api.swing/src/extension/junit/AUTs.java34
-rw-r--r--org.eclipse.jubula.examples.api.swing/src/extension/junit/JubulaJunitExtension.java121
-rw-r--r--org.eclipse.jubula.examples.api.swing/src/extension/junit/StartAgentAndAUT.java31
-rw-r--r--org.eclipse.jubula.examples.api.swing/src/org/eclipse/jubula/examples/api/swing/OM.java38
-rw-r--r--org.eclipse.jubula.examples.api.swing/src/org/eclipse/jubula/examples/api/swing/SimpleAdder.java67
14 files changed, 560 insertions, 0 deletions
diff --git a/org.eclipse.jubula.examples.api.swing/.classpath b/org.eclipse.jubula.examples.api.swing/.classpath
new file mode 100644
index 000000000..8d21ba350
--- /dev/null
+++ b/org.eclipse.jubula.examples.api.swing/.classpath
@@ -0,0 +1,61 @@
+<?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/JavaSE-1.8"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="lib" path="libs/ch.qos.logback.classic.jar"/>
+ <classpathentry kind="lib" path="libs/ch.qos.logback.core.jar"/>
+ <classpathentry kind="lib" path="libs/ch.qos.logback.slf4j.jar"/>
+ <classpathentry kind="lib" path="libs/com.thoughtworks.xstream.jar"/>
+ <classpathentry kind="lib" path="libs/javax.xml.jar"/>
+ <classpathentry kind="lib" path="libs/javax.xml.stream.jar"/>
+ <classpathentry kind="lib" path="libs/org.apache.commons.beanutils.jar"/>
+ <classpathentry kind="lib" path="libs/org.apache.commons.codec.jar"/>
+ <classpathentry kind="lib" path="libs/org.apache.commons.exec.jar"/>
+ <classpathentry kind="lib" path="libs/org.apache.commons.io.jar"/>
+ <classpathentry kind="lib" path="libs/org.apache.commons.lang.jar"/>
+ <classpathentry kind="lib" path="libs/org.apache.oro.jar"/>
+ <classpathentry kind="lib" path="libs/org.eclipse.jdt.annotation.jar"/>
+ <classpathentry kind="lib" path="libs/org.eclipse.jubula.autagent.api.jar"/>
+ <classpathentry kind="lib" path="libs/org.eclipse.jubula.autagent.api.source.jar"/>
+ <classpathentry kind="lib" path="libs/org.eclipse.jubula.autagent.common.jar"/>
+ <classpathentry kind="lib" path="libs/org.eclipse.jubula.autagent.common.source.jar"/>
+ <classpathentry kind="lib" path="libs/org.eclipse.jubula.client.api.commands.jar"/>
+ <classpathentry kind="lib" path="libs/org.eclipse.jubula.client.api.commands.source.jar"/>
+ <classpathentry kind="lib" path="libs/org.eclipse.jubula.client.api.converter.annotations.jar"/>
+ <classpathentry kind="lib" path="libs/org.eclipse.jubula.client.api.converter.annotations.source.jar"/>
+ <classpathentry kind="lib" path="libs/org.eclipse.jubula.client.api.jar"/>
+ <classpathentry kind="lib" path="libs/org.eclipse.jubula.client.api.source.jar"/>
+ <classpathentry kind="lib" path="libs/org.eclipse.jubula.communication.jar"/>
+ <classpathentry kind="lib" path="libs/org.eclipse.jubula.communication.source.jar"/>
+ <classpathentry kind="lib" path="libs/org.eclipse.jubula.feature.api.core.jar"/>
+ <classpathentry kind="lib" path="libs/org.eclipse.jubula.feature.api.core.source.jar"/>
+ <classpathentry kind="lib" path="libs/org.eclipse.jubula.feature.api.embedded.jar"/>
+ <classpathentry kind="lib" path="libs/org.eclipse.jubula.feature.api.embedded.source.jar"/>
+ <classpathentry kind="lib" path="libs/org.eclipse.jubula.feature.api.jar"/>
+ <classpathentry kind="lib" path="libs/org.eclipse.jubula.feature.api.source.jar"/>
+ <classpathentry kind="lib" path="libs/org.eclipse.jubula.rc.common.agent.jar"/>
+ <classpathentry kind="lib" path="libs/org.eclipse.jubula.rc.common.agent.source.jar"/>
+ <classpathentry kind="lib" path="libs/org.eclipse.jubula.rc.common.jar"/>
+ <classpathentry kind="lib" path="libs/org.eclipse.jubula.rc.common.source.jar"/>
+ <classpathentry kind="lib" path="libs/org.eclipse.jubula.rc.swing.jar"/>
+ <classpathentry kind="lib" path="libs/org.eclipse.jubula.rc.swing.source.jar"/>
+ <classpathentry kind="lib" path="libs/org.eclipse.jubula.toolkit.api.jar"/>
+ <classpathentry kind="lib" path="libs/org.eclipse.jubula.toolkit.api.source.jar"/>
+ <classpathentry kind="lib" path="libs/org.eclipse.jubula.toolkit.base.api.jar"/>
+ <classpathentry kind="lib" path="libs/org.eclipse.jubula.toolkit.base.api.source.jar"/>
+ <classpathentry kind="lib" path="libs/org.eclipse.jubula.toolkit.concrete.api.jar"/>
+ <classpathentry kind="lib" path="libs/org.eclipse.jubula.toolkit.concrete.api.source.jar"/>
+ <classpathentry kind="lib" path="libs/org.eclipse.jubula.toolkit.swing.api.jar"/>
+ <classpathentry kind="lib" path="libs/org.eclipse.jubula.toolkit.swing.api.source.jar"/>
+ <classpathentry kind="lib" path="libs/org.eclipse.jubula.tools.exec.jar"/>
+ <classpathentry kind="lib" path="libs/org.eclipse.jubula.tools.exec.source.jar"/>
+ <classpathentry kind="lib" path="libs/org.eclipse.jubula.tools.jar"/>
+ <classpathentry kind="lib" path="libs/org.eclipse.jubula.tools.source.jar"/>
+ <classpathentry kind="lib" path="libs/org.eclipse.osgi.jar"/>
+ <classpathentry kind="lib" path="libs/org.slf4j.api.jar"/>
+ <classpathentry kind="lib" path="libs/org.slf4j.jcl.jar"/>
+ <classpathentry kind="lib" path="libs/org.slf4j.jul.jar"/>
+ <classpathentry kind="lib" path="libs/org.xmlpull.jar"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.jubula.examples.api.swing/.gitignore b/org.eclipse.jubula.examples.api.swing/.gitignore
new file mode 100644
index 000000000..f20a891fc
--- /dev/null
+++ b/org.eclipse.jubula.examples.api.swing/.gitignore
@@ -0,0 +1,4 @@
+/build
+/bin
+/target
+*.jar \ No newline at end of file
diff --git a/org.eclipse.jubula.examples.api.swing/.project b/org.eclipse.jubula.examples.api.swing/.project
new file mode 100644
index 000000000..1f3c0b746
--- /dev/null
+++ b/org.eclipse.jubula.examples.api.swing/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.jubula.examples.api.swing</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.jubula.examples.api.swing/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jubula.examples.api.swing/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..3a2153707
--- /dev/null
+++ b/org.eclipse.jubula.examples.api.swing/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,11 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/org.eclipse.jubula.examples.api.swing/README.md b/org.eclipse.jubula.examples.api.swing/README.md
new file mode 100644
index 000000000..ab6f6641c
--- /dev/null
+++ b/org.eclipse.jubula.examples.api.swing/README.md
@@ -0,0 +1,17 @@
+# Jubula API Junit 5 example
+
+This is an example for a Junit 5 test. The JubulaJunitExtension.java is an simple version to have a workflow for starting, restarting and taking a screenshot during errors.
+There is also a Junit 4 Runnter located in "./junit4Resources
+
+
+The StartAgentAndAUT is starting the jubula agent and the AUT. This class can be used to start the embedded Agent and the AUT to do object mappings.
+Please keep in mind to close the AUT-Agent after you have closed the application.
+
+
+## Setup
+
+ * SimpleAdder.jar must be copied into this folder, use the file from the Jubula installation ({JUBULA}/examples/AUTs/SimpleAdder/swing/)
+ * all development jars for the API({JUBULA}/development/api/JARs/) must be copied into the "libs" folder
+ * import the project into eclipse
+ * run the SimpleAdder Unit Test
+
diff --git a/org.eclipse.jubula.examples.api.swing/SimpleAdder.cmd b/org.eclipse.jubula.examples.api.swing/SimpleAdder.cmd
new file mode 100644
index 000000000..6498ce942
--- /dev/null
+++ b/org.eclipse.jubula.examples.api.swing/SimpleAdder.cmd
@@ -0,0 +1,3 @@
+@echo off
+
+javaw -jar SimpleAdder.jar %1
diff --git a/org.eclipse.jubula.examples.api.swing/about.html b/org.eclipse.jubula.examples.api.swing/about.html
new file mode 100644
index 000000000..f1be81099
--- /dev/null
+++ b/org.eclipse.jubula.examples.api.swing/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 22, 2011</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/org.eclipse.jubula.examples.api.swing/junit4Resources/JubulaRunner.java b/org.eclipse.jubula.examples.api.swing/junit4Resources/JubulaRunner.java
new file mode 100644
index 000000000..07f6359d8
--- /dev/null
+++ b/org.eclipse.jubula.examples.api.swing/junit4Resources/JubulaRunner.java
@@ -0,0 +1,128 @@
+package org.deidentifier.arx.test.ui.util;
+
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+import javax.imageio.ImageIO;
+
+import org.eclipse.jubula.autagent.Embedded;
+import org.eclipse.jubula.autagent.common.agent.AutAgent;
+import org.eclipse.jubula.client.AUT;
+import org.eclipse.jubula.client.AUTAgent;
+import org.eclipse.jubula.client.AUTRegistry;
+import org.eclipse.jubula.client.launch.AUTConfiguration;
+import org.eclipse.jubula.toolkit.ToolkitInfo;
+import org.eclipse.jubula.toolkit.enums.ValueSets.Operator;
+import org.eclipse.jubula.toolkit.swing.SwingComponents;
+import org.eclipse.jubula.tools.AUTIdentifier;
+import org.junit.internal.AssumptionViolatedException;
+import org.junit.internal.runners.model.EachTestNotifier;
+import org.junit.runner.Description;
+import org.junit.runner.notification.RunNotifier;
+import org.junit.runner.notification.StoppedByUserException;
+import org.junit.runners.BlockJUnit4ClassRunner;
+import org.junit.runners.model.InitializationError;
+import org.junit.runners.model.Statement;
+
+import extension.junit.AUTs;
+
+public class JubulaRunner extends BlockJUnit4ClassRunner {
+
+
+ /** user information */
+ private static ToolkitInfo toolkit = SwingComponents.getToolkitInformation(); // the Toolkit used
+ private static AUTConfiguration configuration = AUTs.SIMPLEADDER.getConfig(); // the configuration which should be started
+ private static String applicationFirstWindow = ".*"; // uses matches
+
+ /** settings */
+ private static final boolean shouldRestartAfterFail = true;
+ private static final boolean shouldTakeScreenshot = true;
+
+ /** implementation */
+ private static AUT aut;
+ private static AUTIdentifier startAUT;
+
+ public JubulaRunner(Class<?> clazz) throws InitializationError {
+ super(clazz);
+ }
+
+ @Override
+ public void run(RunNotifier notifier) {
+ if (aut == null) {
+ AUTAgent agent = Embedded.INSTANCE.agent();
+ agent.connect();
+ startAut(agent);
+ }
+ EachTestNotifier testNotifier = new EachTestNotifier(notifier,
+ getDescription());
+ try {
+ Statement statement = classBlock(notifier);
+ statement.evaluate();
+ } catch (AssumptionViolatedException e) {
+ testNotifier.addFailedAssumption(handleTestExecutionException(e, getDescription()));
+ } catch (StoppedByUserException e) {
+ throw e;
+ } catch (Throwable e) {
+
+ testNotifier.addFailure(handleTestExecutionException(e, getDescription()));
+ }
+ }
+
+ public static <T extends Throwable> T handleTestExecutionException(T throwable, Description description) {
+ String testMethod = description.getMethodName();
+ System.err.println("Error in: " + testMethod);
+ List<StackTraceElement> collect = Arrays.stream(throwable.getStackTrace()).filter(v -> {
+ String className = v.getClassName();
+ boolean contains = className.contains("test")
+ || (className.contains("jubula") && className.contains("toolkit"));
+ return contains;
+ }).collect(Collectors.toList());
+ collect.forEach(v -> System.err.println(v));
+ if (shouldTakeScreenshot) {
+ if (aut.isConnected()) {
+ try {
+ BufferedImage screenshot = aut.getScreenshot();
+ String name = testMethod;
+ File file = new File("./result/" + name + ".png");
+ file.getParentFile().mkdirs();
+ ImageIO.write(screenshot, "png", file);
+ } catch (Exception e) {
+ System.err.println("Error during creation of screenshot" + e);
+ }
+ }
+ }
+ if (shouldRestartAfterFail) {
+ AUTAgent agent = Embedded.INSTANCE.agent();
+ agent.stopAUT(startAUT);
+ if (agent.isConnected()) {
+ startAut(agent);
+ }
+ }
+ throw throwable;
+ }
+
+ /**
+ * starts the AUT
+ *
+ * @param agent the {@link AutAgent}
+ */
+ private static void startAut(AUTAgent agent) {
+ try {
+ Thread.interrupted();
+ Thread.sleep(5000);
+ } catch (Exception e) {
+ }
+ startAUT = agent.startAUT(configuration);
+ aut = agent.getAUT(startAUT, toolkit);
+ aut.connect();
+ AUTRegistry.INSTANCE.register(aut);
+ SwingComponents.createApplicationActionHandler().waitForWindow(applicationFirstWindow, Operator.matches, 500);
+ }
+
+}
diff --git a/org.eclipse.jubula.examples.api.swing/libs/.keep b/org.eclipse.jubula.examples.api.swing/libs/.keep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/org.eclipse.jubula.examples.api.swing/libs/.keep
diff --git a/org.eclipse.jubula.examples.api.swing/src/extension/junit/AUTs.java b/org.eclipse.jubula.examples.api.swing/src/extension/junit/AUTs.java
new file mode 100644
index 000000000..deb061451
--- /dev/null
+++ b/org.eclipse.jubula.examples.api.swing/src/extension/junit/AUTs.java
@@ -0,0 +1,34 @@
+package extension.junit;
+/*******************************************************************************
+ * Copyright (c) 2019 BREDEX GmbH.
+ * All rights reserved. This program and the accompanying materials
+ * are 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
+ *
+ * Contributors:
+ * BREDEX GmbH - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+
+import org.eclipse.jubula.client.launch.AUTConfiguration;
+import org.eclipse.jubula.toolkit.swing.config.SwingAUTConfiguration;
+
+public enum AUTs {
+
+ SIMPLEADDER(new SwingAUTConfiguration("SimpleAdder", "SimpleAdder", "SimpleAdder.cmd", ".\\", new String[0]));
+
+ private AUTConfiguration config;
+
+ AUTs(AUTConfiguration config) {
+ this.setConfig(config);
+
+ }
+
+ public AUTConfiguration getConfig() {
+ return config;
+ }
+
+ public void setConfig(AUTConfiguration config) {
+ this.config = config;
+ }
+}
diff --git a/org.eclipse.jubula.examples.api.swing/src/extension/junit/JubulaJunitExtension.java b/org.eclipse.jubula.examples.api.swing/src/extension/junit/JubulaJunitExtension.java
new file mode 100644
index 000000000..0dfcf57c0
--- /dev/null
+++ b/org.eclipse.jubula.examples.api.swing/src/extension/junit/JubulaJunitExtension.java
@@ -0,0 +1,121 @@
+package extension.junit;
+/*******************************************************************************
+ * Copyright (c) 2019 BREDEX GmbH.
+ * All rights reserved. This program and the accompanying materials
+ * are 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
+ *
+ * Contributors:
+ * BREDEX GmbH - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+import javax.imageio.ImageIO;
+
+import org.eclipse.jubula.autagent.Embedded;
+import org.eclipse.jubula.autagent.common.agent.AutAgent;
+import org.eclipse.jubula.client.AUT;
+import org.eclipse.jubula.client.AUTAgent;
+import org.eclipse.jubula.client.AUTRegistry;
+import org.eclipse.jubula.client.launch.AUTConfiguration;
+import org.eclipse.jubula.toolkit.ToolkitInfo;
+import org.eclipse.jubula.toolkit.enums.ValueSets.Operator;
+import org.eclipse.jubula.toolkit.swing.SwingComponents;
+import org.eclipse.jubula.tools.AUTIdentifier;
+import org.junit.jupiter.api.extension.BeforeTestExecutionCallback;
+import org.junit.jupiter.api.extension.ExtensionContext;
+import org.junit.jupiter.api.extension.TestExecutionExceptionHandler;
+
+/**
+ * Handles the lifecycle of the AUT in between tests. If there was an Problem
+ * during a test, it is most likely that the AUT should be restarted because we
+ * do not know the exact state of the Application
+ *
+ * this class needs adaption to use the correct toolkit / filter for error messages
+ * @author BREDEX GmbH
+ */
+public class JubulaJunitExtension implements BeforeTestExecutionCallback, TestExecutionExceptionHandler {
+
+ /** user information */
+ private ToolkitInfo toolkit = SwingComponents.getToolkitInformation(); // the Toolkit used
+ private AUTConfiguration configuration = AUTs.SIMPLEADDER.getConfig(); // the configuration which should be started
+ private String applicationFirstWindow = ".*"; // uses matches
+
+ /** settings */
+ private static final boolean shouldRestartAfterFail = true;
+ private static final boolean shouldTakeScreenshot = true;
+
+ /** implementation */
+ private static AUT aut;
+ private static AUTIdentifier startAUT;
+
+ @Override
+ public void handleTestExecutionException(ExtensionContext context, Throwable throwable) throws Throwable {
+ Optional<Method> testMethod = context.getTestMethod();
+ testMethod.ifPresent(m -> System.err.println("Error in: " + m));
+ List<StackTraceElement> collect = Arrays.stream(throwable.getStackTrace()).filter(v -> {
+ String className = v.getClassName();
+ boolean contains = className.contains("test")
+ || (className.contains("jubula") && className.contains("toolkit"));
+ return contains;
+ }).collect(Collectors.toList());
+ collect.forEach(v -> System.err.println(v));
+ if (shouldTakeScreenshot) {
+ if (aut.isConnected()) {
+ try {
+ BufferedImage screenshot = aut.getScreenshot();
+ String name = testMethod.isPresent() ? testMethod.get().getName() : "screenshot";
+ File file = new File("./result/" + name + ".png");
+ file.getParentFile().mkdirs();
+ ImageIO.write(screenshot, "png", file);
+ } catch (Exception e) {
+ System.err.println("Error during creation of screenshot" + e);
+ }
+ }
+ }
+ if (shouldRestartAfterFail) {
+ AUTAgent agent = Embedded.INSTANCE.agent();
+ agent.stopAUT(startAUT);
+ if (agent.isConnected()) {
+ startAut(agent);
+ }
+ }
+ throw throwable;
+ }
+
+ @Override
+ public void beforeTestExecution(ExtensionContext context) throws Exception {
+ if (aut == null) {
+ AUTAgent agent = Embedded.INSTANCE.agent();
+ agent.connect();
+ startAut(agent);
+ }
+ }
+
+ /**
+ * starts the AUT
+ *
+ * @param agent the {@link AutAgent}
+ */
+ private void startAut(AUTAgent agent) {
+ try {
+ Thread.interrupted();
+ Thread.sleep(5000);
+ } catch (Exception e) {
+ }
+ startAUT = agent.startAUT(configuration);
+ aut = agent.getAUT(startAUT, toolkit);
+ aut.connect();
+ AUTRegistry.INSTANCE.register(aut);
+ SwingComponents.createApplicationActionHandler().waitForWindow(applicationFirstWindow, Operator.matches, 500);
+ }
+
+}
diff --git a/org.eclipse.jubula.examples.api.swing/src/extension/junit/StartAgentAndAUT.java b/org.eclipse.jubula.examples.api.swing/src/extension/junit/StartAgentAndAUT.java
new file mode 100644
index 000000000..c76bacc12
--- /dev/null
+++ b/org.eclipse.jubula.examples.api.swing/src/extension/junit/StartAgentAndAUT.java
@@ -0,0 +1,31 @@
+package extension.junit;
+/*******************************************************************************
+ * Copyright (c) 2021 BREDEX GmbH.
+ * All rights reserved. This program and the accompanying materials
+ * are 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
+ *
+ * Contributors:
+ * BREDEX GmbH - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+
+import org.eclipse.jubula.autagent.Embedded;
+import org.eclipse.jubula.client.AUTAgent;
+
+/**
+ * This class can be used to start the AUT Agent and the AUT. This is needed
+ * @author BREDEX GmbH
+ *
+ */
+public class StartAgentAndAUT {
+
+ public static void main(String[] args) {
+ AUTAgent agent = Embedded.INSTANCE.agent();
+ agent.connect();
+ agent.startAUT(AUTs.SIMPLEADDER.getConfig());
+ agent.disconnect();
+
+ }
+
+}
diff --git a/org.eclipse.jubula.examples.api.swing/src/org/eclipse/jubula/examples/api/swing/OM.java b/org.eclipse.jubula.examples.api.swing/src/org/eclipse/jubula/examples/api/swing/OM.java
new file mode 100644
index 000000000..96b31a049
--- /dev/null
+++ b/org.eclipse.jubula.examples.api.swing/src/org/eclipse/jubula/examples/api/swing/OM.java
@@ -0,0 +1,38 @@
+package org.eclipse.jubula.examples.api.swing;
+/*******************************************************************************
+ * Copyright (c) 2015 BREDEX GmbH.
+ * All rights reserved. This program and the accompanying materials
+ * are 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
+ *
+ * Contributors:
+ * BREDEX GmbH - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+
+
+import org.eclipse.jubula.client.MakeR;
+import org.eclipse.jubula.toolkit.concrete.components.ButtonComponent;
+import org.eclipse.jubula.toolkit.concrete.components.TextComponent;
+import org.eclipse.jubula.toolkit.concrete.components.TextInputComponent;
+import org.eclipse.jubula.tools.ComponentIdentifier;
+
+/**
+ * Exported Object Mapping
+ * @Generated
+ */
+public class OM {
+ /** The component identifier for "equalsButton"*/
+ public static final ComponentIdentifier<ButtonComponent> equalsButton = MakeR.createCI("rO0ABXNyAD1vcmcuZWNsaXBzZS5qdWJ1bGEudG9vbHMuaW50ZXJuYWwub2JqZWN0cy5Db21wb25lbnRJZGVudGlmaWVyAAAAAAAABAcCAAlaABRtX2VxdWFsT3JpZ2luYWxGb3VuZEQAEW1fbWF0Y2hQZXJjZW50YWdlSQAhbV9udW1iZXJPZk90aGVyTWF0Y2hpbmdDb21wb25lbnRzTAAYbV9hbHRlcm5hdGl2ZURpc3BsYXlOYW1ldAASTGphdmEvbGFuZy9TdHJpbmc7TAAUbV9jb21wb25lbnRDbGFzc05hbWVxAH4AAUwAFW1fY29tcG9uZW50UHJvcGVydGllc3QAD0xqYXZhL3V0aWwvTWFwO0wAEG1faGllcmFyY2h5TmFtZXN0ABBMamF2YS91dGlsL0xpc3Q7TAAMbV9uZWlnaGJvdXJzcQB+AANMABRtX3N1cHBvcnRlZENsYXNzTmFtZXEAfgABeHAAv/AAAAAAAAD/////cHQAE2phdmF4LnN3aW5nLkpCdXR0b25wc3IAE2phdmEudXRpbC5BcnJheUxpc3R4gdIdmcdhnQMAAUkABHNpemV4cAAAAAZ3BAAAAAZ0AAZmcmFtZTB0ABdqYXZheC5zd2luZy5KUm9vdFBhbmVfMXQAEG51bGwubGF5ZXJlZFBhbmV0ABBudWxsLmNvbnRlbnRQYW5ldABBb3JnLmVjbGlwc2UuanVidWxhLmV4YW1wbGVzLmF1dC5hZGRlci5zd2luZy5ndWkuQ2FsY3VsYXRvclBhbmVsXzF0AAVlcXVhbHhzcQB+AAYAAAAIdwQAAAAIdAAUamF2YXguc3dpbmcuSkxhYmVsXzF0ABRqYXZheC5zd2luZy5KTGFiZWxfMnQAFGphdmF4LnN3aW5nLkpMYWJlbF8zdAAUamF2YXguc3dpbmcuSkxhYmVsXzR0ABhqYXZheC5zd2luZy5KU2VwYXJhdG9yXzF0ABhqYXZheC5zd2luZy5KVGV4dEZpZWxkXzF0ABhqYXZheC5zd2luZy5KVGV4dEZpZWxkXzJ0ABhqYXZheC5zd2luZy5KVGV4dEZpZWxkXzN4dAAaamF2YXguc3dpbmcuQWJzdHJhY3RCdXR0b24="); //$NON-NLS-1$
+ /** The component identifier for "resultField"*/
+ public static final ComponentIdentifier<TextComponent> resultField = MakeR.createCI("rO0ABXNyAD1vcmcuZWNsaXBzZS5qdWJ1bGEudG9vbHMuaW50ZXJuYWwub2JqZWN0cy5Db21wb25lbnRJZGVudGlmaWVyAAAAAAAABAcCAAlaABRtX2VxdWFsT3JpZ2luYWxGb3VuZEQAEW1fbWF0Y2hQZXJjZW50YWdlSQAhbV9udW1iZXJPZk90aGVyTWF0Y2hpbmdDb21wb25lbnRzTAAYbV9hbHRlcm5hdGl2ZURpc3BsYXlOYW1ldAASTGphdmEvbGFuZy9TdHJpbmc7TAAUbV9jb21wb25lbnRDbGFzc05hbWVxAH4AAUwAFW1fY29tcG9uZW50UHJvcGVydGllc3QAD0xqYXZhL3V0aWwvTWFwO0wAEG1faGllcmFyY2h5TmFtZXN0ABBMamF2YS91dGlsL0xpc3Q7TAAMbV9uZWlnaGJvdXJzcQB+AANMABRtX3N1cHBvcnRlZENsYXNzTmFtZXEAfgABeHAAv/AAAAAAAAD/////cHQAFmphdmF4LnN3aW5nLkpUZXh0RmllbGRwc3IAE2phdmEudXRpbC5BcnJheUxpc3R4gdIdmcdhnQMAAUkABHNpemV4cAAAAAZ3BAAAAAZ0AAZmcmFtZTB0ABdqYXZheC5zd2luZy5KUm9vdFBhbmVfMXQAEG51bGwubGF5ZXJlZFBhbmV0ABBudWxsLmNvbnRlbnRQYW5ldABBb3JnLmVjbGlwc2UuanVidWxhLmV4YW1wbGVzLmF1dC5hZGRlci5zd2luZy5ndWkuQ2FsY3VsYXRvclBhbmVsXzF0AANzdW14c3EAfgAGAAAACHcEAAAACHQAFWphdmF4LnN3aW5nLkpCdXR0b25fMXQAFGphdmF4LnN3aW5nLkpMYWJlbF8xdAAUamF2YXguc3dpbmcuSkxhYmVsXzJ0ABRqYXZheC5zd2luZy5KTGFiZWxfM3QAFGphdmF4LnN3aW5nLkpMYWJlbF80dAAYamF2YXguc3dpbmcuSlNlcGFyYXRvcl8xdAAYamF2YXguc3dpbmcuSlRleHRGaWVsZF8xdAAYamF2YXguc3dpbmcuSlRleHRGaWVsZF8yeHQAH2phdmF4LnN3aW5nLnRleHQuSlRleHRDb21wb25lbnQ="); //$NON-NLS-1$
+ /** The component identifier for "value1"*/
+ public static final ComponentIdentifier<TextInputComponent> value1 = MakeR.createCI("rO0ABXNyAD1vcmcuZWNsaXBzZS5qdWJ1bGEudG9vbHMuaW50ZXJuYWwub2JqZWN0cy5Db21wb25lbnRJZGVudGlmaWVyAAAAAAAABAcCAAlaABRtX2VxdWFsT3JpZ2luYWxGb3VuZEQAEW1fbWF0Y2hQZXJjZW50YWdlSQAhbV9udW1iZXJPZk90aGVyTWF0Y2hpbmdDb21wb25lbnRzTAAYbV9hbHRlcm5hdGl2ZURpc3BsYXlOYW1ldAASTGphdmEvbGFuZy9TdHJpbmc7TAAUbV9jb21wb25lbnRDbGFzc05hbWVxAH4AAUwAFW1fY29tcG9uZW50UHJvcGVydGllc3QAD0xqYXZhL3V0aWwvTWFwO0wAEG1faGllcmFyY2h5TmFtZXN0ABBMamF2YS91dGlsL0xpc3Q7TAAMbV9uZWlnaGJvdXJzcQB+AANMABRtX3N1cHBvcnRlZENsYXNzTmFtZXEAfgABeHAAv/AAAAAAAAD/////cHQAFmphdmF4LnN3aW5nLkpUZXh0RmllbGRwc3IAE2phdmEudXRpbC5BcnJheUxpc3R4gdIdmcdhnQMAAUkABHNpemV4cAAAAAZ3BAAAAAZ0AAZmcmFtZTB0ABdqYXZheC5zd2luZy5KUm9vdFBhbmVfMXQAEG51bGwubGF5ZXJlZFBhbmV0ABBudWxsLmNvbnRlbnRQYW5ldABBb3JnLmVjbGlwc2UuanVidWxhLmV4YW1wbGVzLmF1dC5hZGRlci5zd2luZy5ndWkuQ2FsY3VsYXRvclBhbmVsXzF0AAZ2YWx1ZTF4c3EAfgAGAAAACHcEAAAACHQAFWphdmF4LnN3aW5nLkpCdXR0b25fMXQAFGphdmF4LnN3aW5nLkpMYWJlbF8xdAAUamF2YXguc3dpbmcuSkxhYmVsXzJ0ABRqYXZheC5zd2luZy5KTGFiZWxfM3QAFGphdmF4LnN3aW5nLkpMYWJlbF80dAAYamF2YXguc3dpbmcuSlNlcGFyYXRvcl8xdAAYamF2YXguc3dpbmcuSlRleHRGaWVsZF8xdAAYamF2YXguc3dpbmcuSlRleHRGaWVsZF8yeHQAH2phdmF4LnN3aW5nLnRleHQuSlRleHRDb21wb25lbnQ="); //$NON-NLS-1$
+ /** The component identifier for "value2"*/
+ public static final ComponentIdentifier<TextInputComponent> value2 = MakeR.createCI("rO0ABXNyAD1vcmcuZWNsaXBzZS5qdWJ1bGEudG9vbHMuaW50ZXJuYWwub2JqZWN0cy5Db21wb25lbnRJZGVudGlmaWVyAAAAAAAABAcCAAlaABRtX2VxdWFsT3JpZ2luYWxGb3VuZEQAEW1fbWF0Y2hQZXJjZW50YWdlSQAhbV9udW1iZXJPZk90aGVyTWF0Y2hpbmdDb21wb25lbnRzTAAYbV9hbHRlcm5hdGl2ZURpc3BsYXlOYW1ldAASTGphdmEvbGFuZy9TdHJpbmc7TAAUbV9jb21wb25lbnRDbGFzc05hbWVxAH4AAUwAFW1fY29tcG9uZW50UHJvcGVydGllc3QAD0xqYXZhL3V0aWwvTWFwO0wAEG1faGllcmFyY2h5TmFtZXN0ABBMamF2YS91dGlsL0xpc3Q7TAAMbV9uZWlnaGJvdXJzcQB+AANMABRtX3N1cHBvcnRlZENsYXNzTmFtZXEAfgABeHAAv/AAAAAAAAD/////cHQAFmphdmF4LnN3aW5nLkpUZXh0RmllbGRwc3IAE2phdmEudXRpbC5BcnJheUxpc3R4gdIdmcdhnQMAAUkABHNpemV4cAAAAAZ3BAAAAAZ0AAZmcmFtZTB0ABdqYXZheC5zd2luZy5KUm9vdFBhbmVfMXQAEG51bGwubGF5ZXJlZFBhbmV0ABBudWxsLmNvbnRlbnRQYW5ldABBb3JnLmVjbGlwc2UuanVidWxhLmV4YW1wbGVzLmF1dC5hZGRlci5zd2luZy5ndWkuQ2FsY3VsYXRvclBhbmVsXzF0AAZ2YWx1ZTJ4c3EAfgAGAAAACHcEAAAACHQAFWphdmF4LnN3aW5nLkpCdXR0b25fMXQAFGphdmF4LnN3aW5nLkpMYWJlbF8xdAAUamF2YXguc3dpbmcuSkxhYmVsXzJ0ABRqYXZheC5zd2luZy5KTGFiZWxfM3QAFGphdmF4LnN3aW5nLkpMYWJlbF80dAAYamF2YXguc3dpbmcuSlNlcGFyYXRvcl8xdAAYamF2YXguc3dpbmcuSlRleHRGaWVsZF8xdAAYamF2YXguc3dpbmcuSlRleHRGaWVsZF8yeHQAH2phdmF4LnN3aW5nLnRleHQuSlRleHRDb21wb25lbnQ="); //$NON-NLS-1$
+
+ /** Constructor */
+ private OM() {
+ // private
+ }
+}
diff --git a/org.eclipse.jubula.examples.api.swing/src/org/eclipse/jubula/examples/api/swing/SimpleAdder.java b/org.eclipse.jubula.examples.api.swing/src/org/eclipse/jubula/examples/api/swing/SimpleAdder.java
new file mode 100644
index 000000000..5ba083b74
--- /dev/null
+++ b/org.eclipse.jubula.examples.api.swing/src/org/eclipse/jubula/examples/api/swing/SimpleAdder.java
@@ -0,0 +1,67 @@
+package org.eclipse.jubula.examples.api.swing;
+/*******************************************************************************
+ * Copyright (c) 2019 BREDEX GmbH.
+ * All rights reserved. This program and the accompanying materials
+ * are 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
+ *
+ * Contributors:
+ * BREDEX GmbH - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+
+import org.eclipse.jubula.toolkit.base.components.handler.GraphicsComponentActionHandler;
+import org.eclipse.jubula.toolkit.concrete.components.ButtonComponent;
+import org.eclipse.jubula.toolkit.concrete.components.TextComponent;
+import org.eclipse.jubula.toolkit.concrete.components.TextInputComponent;
+import org.eclipse.jubula.toolkit.concrete.components.handler.TextComponentActionHandler;
+import org.eclipse.jubula.toolkit.concrete.components.handler.TextInputComponentActionHandler;
+import org.eclipse.jubula.toolkit.enums.ValueSets.InteractionMode;
+import org.eclipse.jubula.toolkit.enums.ValueSets.Operator;
+import org.eclipse.jubula.toolkit.swing.SwingComponents;
+import org.eclipse.jubula.tools.ComponentIdentifier;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+
+import extension.junit.JubulaJunitExtension;
+
+/** @author BREDEX GmbH */
+@ExtendWith(JubulaJunitExtension.class)
+public class SimpleAdder {
+ /** the value1 */
+ private static TextInputComponentActionHandler value1;
+ /** the value2 */
+ private static TextInputComponentActionHandler value2;
+ /** the button */
+ private static GraphicsComponentActionHandler button;
+ /** the result */
+ private static TextComponentActionHandler result;
+
+ /** global prepare */
+ @BeforeAll
+ public static void loadObjectMapping() throws Exception {
+ ComponentIdentifier<TextInputComponent> val1Id = OM.value1;
+ ComponentIdentifier<TextInputComponent> val2Id = OM.value2;
+ ComponentIdentifier<ButtonComponent> buttonId = OM.equalsButton;
+ ComponentIdentifier<TextComponent> sumId = OM.resultField;
+
+ value1 = SwingComponents.createJTextComponentActionHandler(val1Id);
+ value2 = SwingComponents.createJTextComponentActionHandler(val2Id);
+ button = SwingComponents.createAbstractButtonActionHandler(buttonId);
+ result = SwingComponents.createJLabelActionHandler(sumId);
+ }
+
+ /** the actual test method */
+ @Test
+ public void testTestFirstSimpleAdderSteps() throws Exception {
+
+ final int firstValue = 17;
+ for (int i = 1; i < 5; i++) {
+ value1.replaceText(String.valueOf(firstValue));
+ value2.replaceText(String.valueOf(i));
+ button.click(1, InteractionMode.primary);
+ result.checkText(String.valueOf(firstValue + i), Operator.equals);
+ }
+ }
+} \ No newline at end of file

Back to the top