Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Tiede2015-02-01 22:03:07 +0000
committerMarkus Tiede2015-02-01 22:03:07 +0000
commite936f7408ba06f0025aeeafa4341d6c753de1538 (patch)
tree90d098577a02cb4bc14fc3f63d4acd741c5581c1 /org.eclipse.jubula.examples.api.adder.rcp
parent19878d6c9d11c114f8f4d7773785b9fd41da35c3 (diff)
downloadorg.eclipse.jubula.core-e936f7408ba06f0025aeeafa4341d6c753de1538.tar.gz
org.eclipse.jubula.core-e936f7408ba06f0025aeeafa4341d6c753de1538.tar.xz
org.eclipse.jubula.core-e936f7408ba06f0025aeeafa4341d6c753de1538.zip
Non-sprint task - basic versatile API example project setups added.
Diffstat (limited to 'org.eclipse.jubula.examples.api.adder.rcp')
-rw-r--r--org.eclipse.jubula.examples.api.adder.rcp/.classpath3
-rw-r--r--org.eclipse.jubula.examples.api.adder.rcp/META-INF/MANIFEST.MF3
-rw-r--r--org.eclipse.jubula.examples.api.adder.rcp/build.properties4
-rw-r--r--org.eclipse.jubula.examples.api.adder.rcp/launch/SimpleAdder JUnit Test.launch16
-rw-r--r--org.eclipse.jubula.examples.api.adder.rcp/shared/resources/objectMapping_SimpleAdderRCP.properties (renamed from org.eclipse.jubula.examples.api.adder.rcp/resources/objectMapping_SimpleAdderRCP.properties)0
-rw-r--r--org.eclipse.jubula.examples.api.adder.rcp/shared/src/org/eclipse/jubula/examples/api/adder/rcp/SimpleAdder.java (renamed from org.eclipse.jubula.examples.api.adder.rcp/src/org/eclipse/jubula/examples/api/adder/rcp/SimpleAdder.java)95
6 files changed, 37 insertions, 84 deletions
diff --git a/org.eclipse.jubula.examples.api.adder.rcp/.classpath b/org.eclipse.jubula.examples.api.adder.rcp/.classpath
index f3f12776d..07880da82 100644
--- a/org.eclipse.jubula.examples.api.adder.rcp/.classpath
+++ b/org.eclipse.jubula.examples.api.adder.rcp/.classpath
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry exported="true" kind="lib" path="resources/"/>
+ <classpathentry kind="src" path="shared/src"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="output" path="bin"/>
diff --git a/org.eclipse.jubula.examples.api.adder.rcp/META-INF/MANIFEST.MF b/org.eclipse.jubula.examples.api.adder.rcp/META-INF/MANIFEST.MF
index fd602b9db..8dbc42b32 100644
--- a/org.eclipse.jubula.examples.api.adder.rcp/META-INF/MANIFEST.MF
+++ b/org.eclipse.jubula.examples.api.adder.rcp/META-INF/MANIFEST.MF
@@ -6,8 +6,7 @@ Bundle-Version: 3.0.0.qualifier
Bundle-Vendor: Eclipse Jubula
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
-Bundle-ClassPath: .,
- resources/
+Bundle-ClassPath: .
Require-Bundle: org.junit;bundle-version="[4.0.0,5.0.0)",
org.eclipse.jubula.tools;bundle-version="[3.0.0,3.1.0)",
org.eclipse.jubula.client.api;bundle-version="[3.0.0,3.1.0)",
diff --git a/org.eclipse.jubula.examples.api.adder.rcp/build.properties b/org.eclipse.jubula.examples.api.adder.rcp/build.properties
index a1d2e476c..e37d016de 100644
--- a/org.eclipse.jubula.examples.api.adder.rcp/build.properties
+++ b/org.eclipse.jubula.examples.api.adder.rcp/build.properties
@@ -5,13 +5,13 @@
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
###############################################################################
-source.. = src/
+source.. = shared/src/
output.. = bin/
jars.compile.order = .
bin.includes = about.html,\
META-INF/,\
.,\
- resources/,\
+ shared/resources/,\
plugin.properties
javacSource = 1.6
javacTarget = 1.6
diff --git a/org.eclipse.jubula.examples.api.adder.rcp/launch/SimpleAdder JUnit Test.launch b/org.eclipse.jubula.examples.api.adder.rcp/launch/SimpleAdder JUnit Test.launch
deleted file mode 100644
index b5e63b084..000000000
--- a/org.eclipse.jubula.examples.api.adder.rcp/launch/SimpleAdder JUnit Test.launch
+++ /dev/null
@@ -1,16 +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.rcp"/>
-</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.rcp"/>
-<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.MAIN_TYPE" value=""/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.jubula.examples.api.adder.rcp"/>
-</launchConfiguration>
diff --git a/org.eclipse.jubula.examples.api.adder.rcp/resources/objectMapping_SimpleAdderRCP.properties b/org.eclipse.jubula.examples.api.adder.rcp/shared/resources/objectMapping_SimpleAdderRCP.properties
index 0e2b95d9c..0e2b95d9c 100644
--- a/org.eclipse.jubula.examples.api.adder.rcp/resources/objectMapping_SimpleAdderRCP.properties
+++ b/org.eclipse.jubula.examples.api.adder.rcp/shared/resources/objectMapping_SimpleAdderRCP.properties
diff --git a/org.eclipse.jubula.examples.api.adder.rcp/src/org/eclipse/jubula/examples/api/adder/rcp/SimpleAdder.java b/org.eclipse.jubula.examples.api.adder.rcp/shared/src/org/eclipse/jubula/examples/api/adder/rcp/SimpleAdder.java
index 0a387554d..ddf7790a6 100644
--- a/org.eclipse.jubula.examples.api.adder.rcp/src/org/eclipse/jubula/examples/api/adder/rcp/SimpleAdder.java
+++ b/org.eclipse.jubula.examples.api.adder.rcp/shared/src/org/eclipse/jubula/examples/api/adder/rcp/SimpleAdder.java
@@ -12,7 +12,6 @@ package org.eclipse.jubula.examples.api.adder.rcp;
import java.net.URL;
import java.util.ArrayList;
-import java.util.Date;
import java.util.List;
import java.util.Locale;
@@ -23,7 +22,6 @@ import org.eclipse.jubula.client.ObjectMapping;
import org.eclipse.jubula.client.Result;
import org.eclipse.jubula.client.exceptions.CheckFailedException;
import org.eclipse.jubula.client.launch.AUTConfiguration;
-import org.eclipse.jubula.communication.CAP;
import org.eclipse.jubula.toolkit.base.components.GraphicsComponent;
import org.eclipse.jubula.toolkit.concrete.components.TextComponent;
import org.eclipse.jubula.toolkit.concrete.components.TextInputComponent;
@@ -62,51 +60,44 @@ public class SimpleAdder {
private AUT m_aut;
/** global prepare */
+ @SuppressWarnings("unchecked")
@BeforeClass
public static void loadObjectMapping() throws Exception {
- URL input = SimpleAdder.class
- .getClassLoader().getResource(
+ URL input = SimpleAdder.class.getClassLoader().getResource(
"objectMapping_SimpleAdderRCP.properties"); //$NON-NLS-1$
-
- ObjectMapping om = MakeR.createObjectMapping(
- input.openStream());
-
+
+ ObjectMapping om = MakeR.createObjectMapping(input.openStream());
+
ComponentIdentifier<Text> val1Id = om.get("value1"); //$NON-NLS-1$
ComponentIdentifier<Text> val2Id = om.get("value2"); //$NON-NLS-1$
ComponentIdentifier<Button> buttonId = om.get("equalsButton"); //$NON-NLS-1$
ComponentIdentifier<Label> sumId = om.get("sum"); //$NON-NLS-1$
-
- if (val1Id != null
- && val2Id != null
- && buttonId != null
- && sumId != null) {
+
+ if (val1Id != null && val2Id != null && buttonId != null
+ && sumId != null) {
value1 = SwtComponents.createText(val1Id);
value2 = SwtComponents.createText(val2Id);
button = SwtComponents.createButton(buttonId);
- result = SwtComponents.createTextComponent(sumId);
+ result = SwtComponents.createTextComponent(sumId);
}
}
-
+
/** prepare */
@Before
public void setUp() throws Exception {
m_agent = MakeR.createAUTAgent(AGENT_HOST, AGENT_PORT);
m_agent.connect();
-
- final String autID = "SimpleAdder_rcp"; //$NON-NLS-1$
+
+ final String autID = "SimpleAdder_rcp"; //$NON-NLS-1$
AUTConfiguration config = new RCPAUTConfiguration(
- "api.aut.conf.simple.adder.rcp", //$NON-NLS-1$
- autID,
- "SimpleAdder.exe", //$NON-NLS-1$
- "..\\examples\\AUTs\\SimpleAdder\\rcp\\win32\\win32\\x86\\", //$NON-NLS-1$
- null,
- Locale.getDefault(),
- Locale.getDefault());
-
+ "api.aut.conf.simple.adder.rcp", //$NON-NLS-1$
+ autID, "SimpleAdder.exe", //$NON-NLS-1$
+ "..\\examples\\AUTs\\SimpleAdder\\rcp\\win32\\win32\\x86\\", //$NON-NLS-1$
+ null, Locale.getDefault(), Locale.getDefault());
+
AUTIdentifier id = m_agent.startAUT(config);
if (id != null) {
- m_aut = m_agent.getAUT(id, SwtComponents
- .getToolkitInformation());
+ m_aut = m_agent.getAUT(id, SwtComponents.getToolkitInformation());
m_aut.connect();
} else {
Assert.fail("AUT start has failed!"); //$NON-NLS-1$
@@ -120,50 +111,30 @@ public class SimpleAdder {
m_agent.stopAUT(m_aut.getIdentifier());
m_agent.disconnect();
}
-
+
/** the actual test method */
- @SuppressWarnings("null")
@Test(expected = CheckFailedException.class)
public void testTestFirstSimpleAdderSteps() throws Exception {
-
+
final int firstValue = 17;
- List<Result> results = new ArrayList<Result>();
+ List<Result<String>> results = new ArrayList<Result<String>>();
try {
for (int i = 1; i < 5; i++) {
- exec(value1.replaceText(
- String.valueOf(firstValue)), results);
- exec(value2.replaceText(
- String.valueOf(i)), results);
- exec(button.click(
- 1, InteractionMode.primary), results);
- exec(result.checkText(
- String.valueOf(firstValue + i),
- Operator.equals), results);
+ results.add(m_aut.execute(
+ value1.replaceText(String.valueOf(firstValue)),
+ "Entering first value")); //$NON-NLS-1$
+ results.add(m_aut.execute(
+ value2.replaceText(String.valueOf(i)),
+ "Entering second value")); //$NON-NLS-1$
+ results.add(m_aut.execute(
+ button.click(1, InteractionMode.primary),
+ "Invoking calculation")); //$NON-NLS-1$
+ results.add(m_aut.execute(result.checkText(
+ String.valueOf(firstValue + i), Operator.equals),
+ "Checking result")); //$NON-NLS-1$
}
} finally {
Assert.assertTrue(results.size() == 15);
}
}
-
- /**
- * @param cap
- * the cap
- * @param r
- * the result
- */
- private void exec(CAP cap, List<Result> r) {
- Result<Date> execute = m_aut.execute(cap, new Date());
- if (r != null) {
- r.add(execute);
- }
- System.out.println("CAP executed: " + execute.getPayload()); //$NON-NLS-1$
- }
-
- /**
- * @param cap
- * the cap
- */
- private void exec(CAP cap) {
- exec(cap, null);
- }
} \ No newline at end of file

Back to the top