Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Struckmann2014-10-14 13:17:27 +0000
committerMarkus Tiede2014-10-15 07:18:20 +0000
commitea155cf80a1a3b7b0b53621cc04c385d2701e395 (patch)
tree3e397470a812bae579fc238abb78b2e60b8315d7 /org.eclipse.jubula.client.api
parent3c2fb36f048d37d0905fffbfe3bbc86b4a79973b (diff)
downloadorg.eclipse.jubula.core-ea155cf80a1a3b7b0b53621cc04c385d2701e395.tar.gz
org.eclipse.jubula.core-ea155cf80a1a3b7b0b53621cc04c385d2701e395.tar.xz
org.eclipse.jubula.core-ea155cf80a1a3b7b0b53621cc04c385d2701e395.zip
Sprint task - Java API - Define public API via (mostly empty) interfaces for MessageCAP, AutIdentifier and IComponentIdentifier
Diffstat (limited to 'org.eclipse.jubula.client.api')
-rw-r--r--org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/AUT.java8
-rw-r--r--org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/AUTAgent.java11
-rw-r--r--org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/MakeR.java8
-rw-r--r--org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/OM.java29
-rw-r--r--org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/internal/impl/AUTAgentImpl.java16
-rw-r--r--org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/internal/impl/AUTImpl.java8
-rw-r--r--org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/internal/impl/ObjectMappingLoader.java (renamed from org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/ObjectMappingLoader.java)33
7 files changed, 73 insertions, 40 deletions
diff --git a/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/AUT.java b/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/AUT.java
index 19dc0c64e..f070603da 100644
--- a/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/AUT.java
+++ b/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/AUT.java
@@ -12,15 +12,15 @@ package org.eclipse.jubula.client;
import java.util.Map;
-import org.eclipse.jubula.communication.internal.message.MessageCap;
-import org.eclipse.jubula.tools.internal.registration.AutIdentifier;
+import org.eclipse.jubula.communication.CAP;
+import org.eclipse.jubula.tools.AUTIdentifier;
/** @author BREDEX GmbH */
public interface AUT extends Remote {
/**
* @return the identifier of this AUT
*/
- AutIdentifier getIdentifier();
+ AUTIdentifier getIdentifier();
/**
* @param typeMapping
@@ -32,5 +32,5 @@ public interface AUT extends Remote {
* @param cap
* the CAP to execute on the AUT
*/
- void execute(MessageCap cap);
+ void execute(CAP cap);
} \ No newline at end of file
diff --git a/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/AUTAgent.java b/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/AUTAgent.java
index 4337cc64e..22021011e 100644
--- a/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/AUTAgent.java
+++ b/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/AUTAgent.java
@@ -13,7 +13,7 @@ package org.eclipse.jubula.client;
import java.util.List;
import org.eclipse.jubula.client.launch.AUTConfiguration;
-import org.eclipse.jubula.tools.internal.registration.AutIdentifier;
+import org.eclipse.jubula.tools.AUTIdentifier;
/** @author BREDEX GmbH */
public interface AUTAgent extends Remote {
@@ -24,7 +24,7 @@ public interface AUTAgent extends Remote {
* an AUT configuration to launch the AUT
* @return a reference to the running AUT
*/
- AutIdentifier startAUT(AUTConfiguration configuration) throws Exception;
+ AUTIdentifier startAUT(AUTConfiguration configuration) throws Exception;
/**
* stop an AUT
@@ -32,18 +32,19 @@ public interface AUTAgent extends Remote {
* @param aut
* a reference to the AUT to stop
*/
- void stopAUT(AutIdentifier aut) throws Exception;
+ void stopAUT(AUTIdentifier aut) throws Exception;
/**
* @return an unmodifiable list of currently known / registered AUT IDs
* @throws Exception
* in case of a communication problem
*/
- List<AutIdentifier> getAllRegisteredAUTIdentifier() throws Exception;
+ List<AUTIdentifier> getAllRegisteredAUTIdentifier() throws Exception;
/**
* @param autID the autID to get an AUT for
* @return an AUT
*/
- AUT getAUT(AutIdentifier autID);
+ AUT getAUT(AUTIdentifier autID);
+
} \ No newline at end of file
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 1ca49231a..50e8cf6f6 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
@@ -11,6 +11,7 @@
package org.eclipse.jubula.client;
import org.eclipse.jubula.client.internal.impl.AUTAgentImpl;
+import org.eclipse.jubula.client.internal.impl.ObjectMappingLoader;
/** @author BREDEX GmbH */
public final class MakeR {
@@ -29,4 +30,11 @@ public final class MakeR {
public static AUTAgent createAUTAgent(final String hostname, int port) {
return new AUTAgentImpl(hostname, port);
}
+
+ /**
+ * @return a new Object Mapping instance
+ */
+ public static OM createOM() {
+ return new ObjectMappingLoader();
+ }
} \ 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/OM.java
new file mode 100644
index 000000000..1b6bda834
--- /dev/null
+++ b/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/OM.java
@@ -0,0 +1,29 @@
+package org.eclipse.jubula.client;
+
+import java.net.URL;
+
+import org.eclipse.jubula.tools.ComponentIdentifier;
+
+/**
+ * Utility class for loading object mapping associations
+ * @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);
+
+ /**
+ * Returns the component identifier for a component name from the cache
+ *
+ * @param compName
+ * the component name
+ * @return the component identifier or <code>null</code> if no identifier
+ * was found
+ */
+ public ComponentIdentifier get(String compName);
+}
diff --git a/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/internal/impl/AUTAgentImpl.java b/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/internal/impl/AUTAgentImpl.java
index fb2e5ef04..4bf3608a0 100644
--- a/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/internal/impl/AUTAgentImpl.java
+++ b/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/internal/impl/AUTAgentImpl.java
@@ -24,6 +24,7 @@ import org.eclipse.jubula.communication.internal.Communicator;
import org.eclipse.jubula.communication.internal.message.GetRegisteredAutListMessage;
import org.eclipse.jubula.communication.internal.message.StartAUTServerMessage;
import org.eclipse.jubula.communication.internal.message.StopAUTServerMessage;
+import org.eclipse.jubula.tools.AUTIdentifier;
import org.eclipse.jubula.tools.internal.constants.AUTStartResponse;
import org.eclipse.jubula.tools.internal.constants.AutConfigConstants;
import org.eclipse.jubula.tools.internal.constants.ToolkitConstants;
@@ -74,7 +75,7 @@ public class AUTAgentImpl implements AUTAgent {
}
/** {@inheritDoc} */
- public AutIdentifier startAUT(AUTConfiguration configuration)
+ public AUTIdentifier startAUT(AUTConfiguration configuration)
throws Exception {
Map<String, String> autConfigMap = configuration.getLaunchInformation();
@@ -124,19 +125,20 @@ public class AUTAgentImpl implements AUTAgent {
/** {@inheritDoc} */
- public void stopAUT(final AutIdentifier aut) throws Exception {
- m_agent.send(new StopAUTServerMessage(aut));
+ public void stopAUT(final AUTIdentifier aut) throws Exception {
+ m_agent.send(new StopAUTServerMessage(
+ (AutIdentifier)aut));
}
/** {@inheritDoc} */
- public List<AutIdentifier> getAllRegisteredAUTIdentifier()
+ public List<AUTIdentifier> getAllRegisteredAUTIdentifier()
throws Exception {
m_agent.send(new GetRegisteredAutListMessage());
Object arrayOfAutIdentifier = Synchronizer.instance().exchange(null);
if (arrayOfAutIdentifier instanceof AutIdentifier[]) {
return Collections.unmodifiableList(Arrays
- .asList((AutIdentifier[]) arrayOfAutIdentifier));
+ .asList((AUTIdentifier[]) arrayOfAutIdentifier));
}
log.error("Unexpected AUT identifiers received: " //$NON-NLS-1$
+ String.valueOf(arrayOfAutIdentifier));
@@ -145,7 +147,7 @@ public class AUTAgentImpl implements AUTAgent {
}
/** {@inheritDoc} */
- public AUT getAUT(AutIdentifier autID) {
- return new AUTImpl(autID);
+ public AUT getAUT(AUTIdentifier autID) {
+ return new AUTImpl((AutIdentifier) autID);
}
} \ No newline at end of file
diff --git a/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/internal/impl/AUTImpl.java b/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/internal/impl/AUTImpl.java
index 2a47bb661..219ce8e98 100644
--- a/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/internal/impl/AUTImpl.java
+++ b/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/internal/impl/AUTImpl.java
@@ -15,10 +15,12 @@ import java.util.Map;
import org.eclipse.jubula.client.AUT;
import org.eclipse.jubula.client.internal.AUTConnection;
import org.eclipse.jubula.client.internal.BaseConnection.NotConnectedException;
+import org.eclipse.jubula.communication.CAP;
import org.eclipse.jubula.communication.internal.message.CAPTestMessage;
import org.eclipse.jubula.communication.internal.message.CAPTestMessageFactory;
import org.eclipse.jubula.communication.internal.message.MessageCap;
import org.eclipse.jubula.communication.internal.message.UnknownMessageException;
+import org.eclipse.jubula.tools.AUTIdentifier;
import org.eclipse.jubula.tools.internal.exception.Assert;
import org.eclipse.jubula.tools.internal.exception.CommunicationException;
import org.eclipse.jubula.tools.internal.registration.AutIdentifier;
@@ -67,7 +69,7 @@ public class AUTImpl implements AUT {
}
/** {@inheritDoc} */
- public AutIdentifier getIdentifier() {
+ public AUTIdentifier getIdentifier() {
return m_autID;
}
@@ -86,11 +88,11 @@ public class AUTImpl implements AUT {
}
/** {@inheritDoc} */
- public void execute(MessageCap cap) {
+ public void execute(CAP cap) {
try {
// TODO MT: fixme
CAPTestMessage capTestMessage = CAPTestMessageFactory
- .getCAPTestMessage(cap,
+ .getCAPTestMessage((MessageCap) cap,
"com.bredexsw.guidancer.SwtToolkitPlugin"); //$NON-NLS-1$
m_instance.send(capTestMessage);
diff --git a/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/ObjectMappingLoader.java b/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/internal/impl/ObjectMappingLoader.java
index c117aae7a..a528791c1 100644
--- a/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/ObjectMappingLoader.java
+++ b/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/internal/impl/ObjectMappingLoader.java
@@ -8,7 +8,7 @@
* Contributors:
* BREDEX GmbH - initial API and implementation and/or initial documentation
*******************************************************************************/
-package org.eclipse.jubula.client;
+package org.eclipse.jubula.client.internal.impl;
import java.io.IOException;
import java.net.URL;
@@ -16,9 +16,10 @@ import java.util.Map;
import java.util.Properties;
import java.util.TreeMap;
+import org.eclipse.jubula.client.OM;
import org.eclipse.jubula.client.exceptions.LoadResourceException;
import org.eclipse.jubula.client.internal.utils.SerilizationUtils;
-import org.eclipse.jubula.tools.internal.objects.IComponentIdentifier;
+import org.eclipse.jubula.tools.ComponentIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -27,7 +28,7 @@ import org.slf4j.LoggerFactory;
* @author BREDEX GmbH
* @created Oct 09, 2014
*/
-public class ObjectMappingLoader {
+public class ObjectMappingLoader implements OM {
/** the logger */
private static Logger log = LoggerFactory.getLogger(
ObjectMappingLoader.class);
@@ -36,8 +37,8 @@ public class ObjectMappingLoader {
private Properties m_objectMappingAssociations = new Properties();
/** object mapping associations */
- private Map<String, IComponentIdentifier> m_map =
- new TreeMap<String, IComponentIdentifier>();
+ private Map<String, ComponentIdentifier> m_map =
+ new TreeMap<String, ComponentIdentifier>();
/**
* Utility class for loading object mapping association
@@ -46,10 +47,7 @@ public class ObjectMappingLoader {
super();
}
- /**
- * Initializes the object mapping associations
- * @param resourceURL the URL to the resource properties file
- */
+ /** {@inheritDoc} */
public void init (URL resourceURL) {
try {
m_objectMappingAssociations.load(resourceURL.openStream());
@@ -73,15 +71,8 @@ public class ObjectMappingLoader {
}
}
- /**
- * Returns the component identifier for a component name from the cache
- *
- * @param compName
- * the component name
- * @return the component identifier or <code>null</code> if no identifier
- * was found
- */
- public IComponentIdentifier get(String compName) {
+ /** {@inheritDoc} */
+ public ComponentIdentifier get(String compName) {
return m_map.get(compName);
}
@@ -94,15 +85,15 @@ public class ObjectMappingLoader {
* was found
* @throws LoadResourceException
*/
- private IComponentIdentifier getIdentifier(String compName) throws
+ private ComponentIdentifier getIdentifier(String compName) throws
LoadResourceException {
try {
String encodedString =
m_objectMappingAssociations.getProperty(compName);
if (encodedString != null) {
Object decodedObject = SerilizationUtils.decode(encodedString);
- if (decodedObject instanceof IComponentIdentifier) {
- return (IComponentIdentifier) decodedObject;
+ if (decodedObject instanceof ComponentIdentifier) {
+ return (ComponentIdentifier) decodedObject;
}
throw new LoadResourceException("The decoded object is " //$NON-NLS-1$
+ "not of type 'IComponentIdentfier'."); //$NON-NLS-1$

Back to the top