Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Struckmann2014-10-16 07:13:36 +0000
committerSebastian Struckmann2014-10-16 07:20:46 +0000
commit9e7e73edeccf3d24773359e0e82681511b210af7 (patch)
treed7edcc2c32e0fc92155d1320328876cab3edd344
parentb09e2d60c6e32671329e5630993d4f1ae5a80c61 (diff)
downloadorg.eclipse.jubula.core-9e7e73edeccf3d24773359e0e82681511b210af7.tar.gz
org.eclipse.jubula.core-9e7e73edeccf3d24773359e0e82681511b210af7.tar.xz
org.eclipse.jubula.core-9e7e73edeccf3d24773359e0e82681511b210af7.zip
Sprint task - Java API - Moved initialization of ObjectMapping into constructor
-rw-r--r--org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/MakeR.java9
-rw-r--r--org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/ObjectMapping.java (renamed from org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/OM.java)11
-rw-r--r--org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/internal/impl/ObjectMappingImpl.java (renamed from org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/internal/impl/ObjectMappingLoader.java)17
-rw-r--r--org.eclipse.jubula.qa.api/src/main/java/org/eclipse/jubula/qa/api/TestSimpleAdderRCPAUT.java11
-rw-r--r--org.eclipse.jubula.qa.api/src/test/java/org/eclipse/jubula/qa/api/TestFactories.java18
5 files changed, 32 insertions, 34 deletions
diff --git a/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/MakeR.java b/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/MakeR.java
index 50e8cf6f6..874ac00b7 100644
--- a/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/MakeR.java
+++ b/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/MakeR.java
@@ -10,8 +10,10 @@
*******************************************************************************/
package org.eclipse.jubula.client;
+import java.io.InputStream;
+
import org.eclipse.jubula.client.internal.impl.AUTAgentImpl;
-import org.eclipse.jubula.client.internal.impl.ObjectMappingLoader;
+import org.eclipse.jubula.client.internal.impl.ObjectMappingImpl;
/** @author BREDEX GmbH */
public final class MakeR {
@@ -33,8 +35,9 @@ public final class MakeR {
/**
* @return a new Object Mapping instance
+ * @param input the input stream containing the encoded object mapping
*/
- public static OM createOM() {
- return new ObjectMappingLoader();
+ public static ObjectMapping createObjectMapping(InputStream input) {
+ return new ObjectMappingImpl(input);
}
} \ No newline at end of file
diff --git a/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/OM.java b/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/ObjectMapping.java
index 5cd85e4a1..479cbb294 100644
--- a/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/OM.java
+++ b/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/ObjectMapping.java
@@ -10,8 +10,6 @@
*******************************************************************************/
package org.eclipse.jubula.client;
-import java.net.URL;
-
import org.eclipse.jubula.tools.ComponentIdentifier;
/**
@@ -20,14 +18,7 @@ import org.eclipse.jubula.tools.ComponentIdentifier;
* @author BREDEX GmbH
* @created Oct 13, 2014
*/
-public interface OM {
- /**
- * Initializes the object mapping associations
- *
- * @param resourceURL
- * the URL to the resource properties file
- */
- public void init(URL resourceURL);
+public interface ObjectMapping {
/**
* Returns the component identifier for a component name from the cache
diff --git a/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/internal/impl/ObjectMappingLoader.java b/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/internal/impl/ObjectMappingImpl.java
index a528791c1..93a5c8cd6 100644
--- a/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/internal/impl/ObjectMappingLoader.java
+++ b/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/internal/impl/ObjectMappingImpl.java
@@ -11,12 +11,12 @@
package org.eclipse.jubula.client.internal.impl;
import java.io.IOException;
-import java.net.URL;
+import java.io.InputStream;
import java.util.Map;
import java.util.Properties;
import java.util.TreeMap;
-import org.eclipse.jubula.client.OM;
+import org.eclipse.jubula.client.ObjectMapping;
import org.eclipse.jubula.client.exceptions.LoadResourceException;
import org.eclipse.jubula.client.internal.utils.SerilizationUtils;
import org.eclipse.jubula.tools.ComponentIdentifier;
@@ -28,10 +28,10 @@ import org.slf4j.LoggerFactory;
* @author BREDEX GmbH
* @created Oct 09, 2014
*/
-public class ObjectMappingLoader implements OM {
+public class ObjectMappingImpl implements ObjectMapping {
/** the logger */
private static Logger log = LoggerFactory.getLogger(
- ObjectMappingLoader.class);
+ ObjectMappingImpl.class);
/** object mapping associations */
private Properties m_objectMappingAssociations = new Properties();
@@ -42,15 +42,12 @@ public class ObjectMappingLoader implements OM {
/**
* Utility class for loading object mapping association
+ * @param input the input stream containing the encoded object mapping
*/
- public ObjectMappingLoader() {
+ public ObjectMappingImpl(InputStream input) {
super();
- }
-
- /** {@inheritDoc} */
- public void init (URL resourceURL) {
try {
- m_objectMappingAssociations.load(resourceURL.openStream());
+ m_objectMappingAssociations.load(input);
for (Object obj : m_objectMappingAssociations.keySet()) {
if (obj instanceof String) {
String compName = (String) obj;
diff --git a/org.eclipse.jubula.qa.api/src/main/java/org/eclipse/jubula/qa/api/TestSimpleAdderRCPAUT.java b/org.eclipse.jubula.qa.api/src/main/java/org/eclipse/jubula/qa/api/TestSimpleAdderRCPAUT.java
index 1c3a6485c..48ebb7aeb 100644
--- a/org.eclipse.jubula.qa.api/src/main/java/org/eclipse/jubula/qa/api/TestSimpleAdderRCPAUT.java
+++ b/org.eclipse.jubula.qa.api/src/main/java/org/eclipse/jubula/qa/api/TestSimpleAdderRCPAUT.java
@@ -10,12 +10,13 @@
*******************************************************************************/
package org.eclipse.jubula.qa.api;
+import java.net.URL;
import java.util.Locale;
import org.eclipse.jubula.client.AUT;
import org.eclipse.jubula.client.AUTAgent;
import org.eclipse.jubula.client.MakeR;
-import org.eclipse.jubula.client.OM;
+import org.eclipse.jubula.client.ObjectMapping;
import org.eclipse.jubula.client.exceptions.CheckFailedException;
import org.eclipse.jubula.client.launch.AUTConfiguration;
import org.eclipse.jubula.toolkit.base.components.GraphicsComponent;
@@ -42,14 +43,14 @@ public class TestSimpleAdderRCPAUT {
/** the AUT */
private AUT m_aut;
/** the object mapping */
- private OM m_om;
+ private ObjectMapping m_om;
/** prepare */
@Before
public void setUp() throws Exception {
- m_om = MakeR.createOM();
- m_om.init(this.getClass().getClassLoader()
- .getResource("objectMapping_SimpleAdderRCP.properties")); //$NON-NLS-1$
+ URL input = this.getClass().getClassLoader()
+ .getResource("objectMapping_SimpleAdderRCP.properties"); //$NON-NLS-1$
+ m_om = MakeR.createObjectMapping(input.openStream());
m_agent = MakeR.createAUTAgent(AGENT_HOST, AGENT_PORT);
m_agent.connect();
diff --git a/org.eclipse.jubula.qa.api/src/test/java/org/eclipse/jubula/qa/api/TestFactories.java b/org.eclipse.jubula.qa.api/src/test/java/org/eclipse/jubula/qa/api/TestFactories.java
index 608d09f60..d960df5a2 100644
--- a/org.eclipse.jubula.qa.api/src/test/java/org/eclipse/jubula/qa/api/TestFactories.java
+++ b/org.eclipse.jubula.qa.api/src/test/java/org/eclipse/jubula/qa/api/TestFactories.java
@@ -1,5 +1,6 @@
package org.eclipse.jubula.qa.api;
+import java.io.IOException;
import java.net.URL;
import junit.framework.Assert;
@@ -11,7 +12,7 @@ import org.eclipse.jubula.toolkit.concrete.components.TextComponent;
import org.eclipse.jubula.toolkit.concrete.components.TextInputComponent;
import org.eclipse.jubula.toolkit.enums.ValueSets.Operator;
import org.eclipse.jubula.client.MakeR;
-import org.eclipse.jubula.client.OM;
+import org.eclipse.jubula.client.ObjectMapping;
import org.eclipse.jubula.tools.ComponentIdentifier;
import org.junit.Test;
@@ -20,19 +21,24 @@ import org.junit.Test;
*/
public class TestFactories {
+ /** the resource url */
+ private URL m_resourceURL = TestFactories.class.getClassLoader()
+ .getResource("objectMapping_SimpleAdder.properties"); //$NON-NLS-1$
+
/** object mapping loader */
- private OM m_omLoader = MakeR.createOM();
+ private ObjectMapping m_omLoader;
/**
* test method
*/
@Test
public void testFactories() {
-
- URL resourceURL = TestFactories.class.getClassLoader()
- .getResource("objectMapping_SimpleAdder.properties"); //$NON-NLS-1$
- m_omLoader.init(resourceURL);
+ try {
+ m_omLoader = MakeR.createObjectMapping(m_resourceURL.openStream());
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
Assert.assertNotNull(m_omLoader);
/** The first text field */

Back to the top