Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Tiede2014-11-06 12:58:13 +0000
committerMarkus Tiede2014-11-06 12:58:19 +0000
commit52cbc6541d06bcd2ae5dcd3f67c21df8be33d600 (patch)
treec039c1ff149e4a219f981bd8156b52d7f1f4ccb0 /org.eclipse.jubula.client.api
parent32b747eb000290041117ce6314fedbffaf86327c (diff)
downloadorg.eclipse.jubula.core-52cbc6541d06bcd2ae5dcd3f67c21df8be33d600.tar.gz
org.eclipse.jubula.core-52cbc6541d06bcd2ae5dcd3f67c21df8be33d600.tar.xz
org.eclipse.jubula.core-52cbc6541d06bcd2ae5dcd3f67c21df8be33d600.zip
Sprint task - add exception handling for remote communication problems - part 1.
Diffstat (limited to 'org.eclipse.jubula.client.api')
-rw-r--r--org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/AUT.java15
-rw-r--r--org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/AUTAgent.java42
-rw-r--r--org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/MakeR.java13
-rw-r--r--org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/Remote.java15
-rw-r--r--org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/Result.java10
-rw-r--r--org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/exceptions/CommunicationException.java29
-rw-r--r--org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/internal/impl/AUTAgentImpl.java144
-rw-r--r--org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/internal/impl/AUTImpl.java54
-rw-r--r--org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/internal/impl/ObjectMappingImpl.java4
-rw-r--r--org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/internal/impl/ResultImpl.java14
-rw-r--r--org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/launch/AUTConfiguration.java5
11 files changed, 246 insertions, 99 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 d8b87131a..928fb8a9b 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,6 +12,7 @@ package org.eclipse.jubula.client;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.jubula.client.exceptions.CommunicationException;
import org.eclipse.jubula.client.exceptions.ExecutionException;
import org.eclipse.jubula.communication.CAP;
import org.eclipse.jubula.tools.AUTIdentifier;
@@ -24,8 +25,11 @@ import org.eclipse.jubula.tools.AUTIdentifier;
public interface AUT extends Remote {
/**
* @return the AUTIdentifier of this AUT
+ * @throws CommunicationException
+ * in case of communication problems with the remote side
*/
- @NonNull AUTIdentifier getIdentifier();
+ @NonNull
+ AUTIdentifier getIdentifier() throws CommunicationException;
/**
* @param cap
@@ -37,9 +41,10 @@ public interface AUT extends Remote {
* @return the result of the execution
* @throws ExecutionException
* in case of remote execution problems
+ * @throws CommunicationException
+ * in case of communication problems with the remote side
*/
- @NonNull <T> Result<T> execute(
- @NonNull CAP cap,
- @Nullable T payload)
- throws ExecutionException;
+ @NonNull
+ <T> Result<T> execute(@NonNull CAP cap, @Nullable T payload)
+ throws ExecutionException, CommunicationException;
} \ 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 de43a9a2b..4bf3e9f4f 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
@@ -14,11 +14,12 @@ import java.util.List;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.jubula.client.exceptions.CommunicationException;
import org.eclipse.jubula.client.launch.AUTConfiguration;
import org.eclipse.jubula.toolkit.ToolkitInfo;
import org.eclipse.jubula.tools.AUTIdentifier;
-/**
+/**
* @author BREDEX GmbH
* @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients.
@@ -30,37 +31,44 @@ public interface AUTAgent extends Remote {
* @param configuration
* an AUT configuration to launch the AUT
* @return an identifier for the running AUT
+ * @throws CommunicationException
+ * in case of communication problems with the remote side
*/
- @Nullable AUTIdentifier startAUT(
- @NonNull AUTConfiguration configuration)
- throws Exception;
+ @Nullable
+ AUTIdentifier startAUT(@NonNull AUTConfiguration configuration)
+ throws CommunicationException;
/**
* stop an AUT
*
* @param aut
* a reference to the AUT to stop
+ * @throws CommunicationException
+ * in case of communication problems with the remote side
*/
- void stopAUT(
- @NonNull AUTIdentifier aut)
- throws Exception;
-
+ void stopAUT(@NonNull AUTIdentifier aut) throws CommunicationException;
+
/**
* @return an unmodifiable list of currently known / registered AUT IDs
- * @throws Exception
- * in case of a communication problem
+ * @throws CommunicationException
+ * in case of communication problems with the remote side
*/
- @NonNull List<AUTIdentifier> getAllRegisteredAUTIdentifier()
- throws Exception;
-
+ @NonNull
+ List<AUTIdentifier> getAllRegisteredAUTIdentifier()
+ throws CommunicationException;
+
/**
* @param autID
* the autID to get an AUT for
* @param information
* the information about the toolkit
- * @return an AUT
+ * @return an AUT - note: currently the underlying implementation only
+ * supports <b>ONE</b> connection at a time to a remote running AUT;
+ * multiple connections may only be established sequentially!
+ * @throws CommunicationException
+ * in case of communication problems with the remote side
*/
- @NonNull AUT getAUT(
- @NonNull AUTIdentifier autID,
- @NonNull ToolkitInfo information);
+ @NonNull
+ AUT getAUT(@NonNull AUTIdentifier autID, @NonNull ToolkitInfo information)
+ throws CommunicationException;
} \ 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 0e668d682..13cf363a5 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
@@ -32,11 +32,13 @@ public final class MakeR {
* the hosts name the remote AUT-Agent is running on
* @param port
* the port number the remote AUT-Agent is running on
- * @return a new AUTAgent instance
+ * @return a new AUT-Agent instance - note: currently the underlying
+ * implementation only supports <b>ONE</b> connection at a time to a
+ * remote running AUT-Agent; multiple connections may only be
+ * established sequentially!
*/
- @NonNull public static AUTAgent createAUTAgent(
- @NonNull String hostname,
- int port) {
+ @NonNull
+ public static AUTAgent createAUTAgent(@NonNull String hostname, int port) {
return new AUTAgentImpl(hostname, port);
}
@@ -46,7 +48,8 @@ public final class MakeR {
* an input stream providing the exported object mapping
* properties
*/
- @NonNull public static ObjectMapping createObjectMapping(
+ @NonNull
+ public static ObjectMapping createObjectMapping(
@NonNull InputStream input) {
return new ObjectMappingImpl(input);
}
diff --git a/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/Remote.java b/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/Remote.java
index 1ff6fe240..bea410010 100644
--- a/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/Remote.java
+++ b/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/Remote.java
@@ -10,21 +10,28 @@
*******************************************************************************/
package org.eclipse.jubula.client;
-/**
+import org.eclipse.jubula.client.exceptions.CommunicationException;
+
+/**
* @author BREDEX GmbH
* @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface Remote {
/**
- * connect to the remote side
+ * connect to the remote side - note: currently the underlying
+ * implementation only supports <b>ONE</b> connection at a time to the
+ * remote side; multiple connections may only be established sequentially!
+ *
+ * @throws CommunicationException
+ * in case of communication problems with the remote side
*/
- void connect() throws Exception;
+ void connect() throws CommunicationException;
/**
* disconnect from the remote side
*/
- void disconnect() throws Exception;
+ void disconnect();
/**
* @return whether a connection to the remote side is currently established
diff --git a/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/Result.java b/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/Result.java
index 39a55c30c..2b3fafeae 100644
--- a/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/Result.java
+++ b/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/Result.java
@@ -27,13 +27,15 @@ public interface Result<T> {
/**
* @return the payload
*/
- @Nullable T getPayload();
-
+ @Nullable
+ T getPayload();
+
/**
* @return the CAP
*/
- @NonNull CAP getCAP();
-
+ @NonNull
+ CAP getCAP();
+
/**
* @return wheter the CAP has been executed successfully or not
*/
diff --git a/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/exceptions/CommunicationException.java b/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/exceptions/CommunicationException.java
new file mode 100644
index 000000000..cdb5d1219
--- /dev/null
+++ b/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/exceptions/CommunicationException.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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
+ *******************************************************************************/
+package org.eclipse.jubula.client.exceptions;
+
+/**
+ * Thrown in case of communication problems with the remote side
+ *
+ * @author BREDEX GmbH
+ */
+public class CommunicationException extends RuntimeException {
+
+ /**
+ * Constructor
+ *
+ * @param cause
+ * the cause
+ */
+ public CommunicationException(Throwable cause) {
+ super(cause);
+ }
+} \ No newline at end of file
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 e20944fd1..f50c4d1a2 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
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.jubula.client.internal.impl;
+import java.net.ConnectException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -20,8 +21,13 @@ import org.apache.commons.lang.Validate;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jubula.client.AUT;
import org.eclipse.jubula.client.AUTAgent;
+import org.eclipse.jubula.client.Remote;
+import org.eclipse.jubula.client.exceptions.CommunicationException;
import org.eclipse.jubula.client.internal.AutAgentConnection;
+import org.eclipse.jubula.client.internal.BaseConnection.AlreadyConnectedException;
+import org.eclipse.jubula.client.internal.BaseConnection.NotConnectedException;
import org.eclipse.jubula.client.internal.Synchronizer;
+import org.eclipse.jubula.client.internal.exceptions.ConnectionException;
import org.eclipse.jubula.client.launch.AUTConfiguration;
import org.eclipse.jubula.communication.internal.Communicator;
import org.eclipse.jubula.communication.internal.message.GetRegisteredAutListMessage;
@@ -32,6 +38,7 @@ 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;
+import org.eclipse.jubula.tools.internal.exception.JBVersionException;
import org.eclipse.jubula.tools.internal.registration.AutIdentifier;
import org.eclipse.jubula.tools.internal.utils.NetUtil;
import org.slf4j.Logger;
@@ -65,11 +72,25 @@ public class AUTAgentImpl implements AUTAgent {
}
/** {@inheritDoc} */
- public void connect() throws Exception {
+ public void connect() throws CommunicationException {
if (!isConnected()) {
- AutAgentConnection.createInstance(m_hostname, m_port);
- m_agent = AutAgentConnection.getInstance();
- m_agent.run();
+ try {
+ AutAgentConnection.createInstance(m_hostname, m_port);
+ m_agent = AutAgentConnection.getInstance();
+ m_agent.run();
+ if (!isConnected()) {
+ throw new CommunicationException(
+ new ConnectException(
+ "Could not connect to AUT-Agent: " //$NON-NLS-1$
+ + m_hostname + ":" + m_port)); //$NON-NLS-1$
+ }
+ } catch (ConnectionException e) {
+ throw new CommunicationException(e);
+ } catch (AlreadyConnectedException e) {
+ throw new CommunicationException(e);
+ } catch (JBVersionException e) {
+ throw new CommunicationException(e);
+ }
} else {
throw new IllegalStateException("AUT-Agent connection is already made"); //$NON-NLS-1$
}
@@ -92,8 +113,9 @@ public class AUTAgentImpl implements AUTAgent {
/** {@inheritDoc} */
public AUTIdentifier startAUT(
@NonNull AUTConfiguration configuration)
- throws Exception {
+ throws CommunicationException {
Validate.notNull(configuration, "The configuration must not be null."); //$NON-NLS-1$
+ checkConnected(this);
Map<String, String> autConfigMap = configuration.getLaunchInformation();
@@ -110,15 +132,25 @@ public class AUTAgentImpl implements AUTAgent {
StartAUTServerMessage startAUTMessage = new StartAUTServerMessage(
autConfigMap, toolkitID);
- m_agent.send(startAUTMessage);
-
- Object genericStartResponse = Synchronizer.instance().exchange(null);
- if (genericStartResponse instanceof Integer) {
- int startResponse = (Integer) genericStartResponse;
- return handleResponse(startResponse);
+ try {
+ m_agent.send(startAUTMessage);
+ Object genericStartResponse = Synchronizer.instance()
+ .exchange(null);
+ if (genericStartResponse instanceof Integer) {
+ int startResponse = (Integer) genericStartResponse;
+ return handleResponse(startResponse);
+ }
+ log.error("Unexpected start response code received: " //$NON-NLS-1$
+ + String.valueOf(genericStartResponse));
+ } catch (NotConnectedException e) {
+ throw new CommunicationException(e);
+ } catch (org.eclipse.jubula.tools.internal.
+ exception.CommunicationException e) {
+ throw new CommunicationException(e);
+ } catch (InterruptedException e) {
+ throw new CommunicationException(e);
}
- log.error("Unexpected start response code received: " //$NON-NLS-1$
- + String.valueOf(genericStartResponse));
+
return null;
}
@@ -128,14 +160,19 @@ public class AUTAgentImpl implements AUTAgent {
* @return the AUT or <code>null<code> if problem during start
*/
private AutIdentifier handleResponse(int startResponse)
- throws Exception {
+ throws CommunicationException {
if (startResponse == AUTStartResponse.OK) {
- Object autIdentifier = Synchronizer.instance().exchange(null);
- if (autIdentifier instanceof AutIdentifier) {
- return (AutIdentifier) autIdentifier;
+ Object autIdentifier;
+ try {
+ autIdentifier = Synchronizer.instance().exchange(null);
+ if (autIdentifier instanceof AutIdentifier) {
+ return (AutIdentifier) autIdentifier;
+ }
+ log.error("Unexpected AUT identifier received: " //$NON-NLS-1$
+ + String.valueOf(autIdentifier));
+ } catch (InterruptedException e) {
+ throw new CommunicationException(e);
}
- log.error("Unexpected AUT identifier received: " //$NON-NLS-1$
- + String.valueOf(autIdentifier));
}
return null;
@@ -144,40 +181,73 @@ public class AUTAgentImpl implements AUTAgent {
/** {@inheritDoc} */
public void stopAUT(
- @NonNull AUTIdentifier aut) throws Exception {
+ @NonNull AUTIdentifier aut)
+ throws CommunicationException {
Validate.notNull(aut, "The AUT-Identifier must not be null."); //$NON-NLS-1$
+ checkConnected(this);
- m_agent.send(new StopAUTServerMessage((AutIdentifier)aut));
+ try {
+ m_agent.send(new StopAUTServerMessage((AutIdentifier)aut));
+ } catch (NotConnectedException e) {
+ throw new CommunicationException(e);
+ } catch (org.eclipse.jubula.tools.internal.
+ exception.CommunicationException e) {
+ throw new CommunicationException(e);
+ }
}
/** {@inheritDoc} */
- @NonNull public List<AUTIdentifier> getAllRegisteredAUTIdentifier()
- throws Exception {
- m_agent.send(new GetRegisteredAutListMessage());
+ @NonNull
+ public List<AUTIdentifier> getAllRegisteredAUTIdentifier()
+ throws CommunicationException {
+ checkConnected(this);
- Object arrayOfAutIdentifier = Synchronizer.instance().exchange(null);
- if (arrayOfAutIdentifier instanceof AutIdentifier[]) {
- final List<AUTIdentifier> unmodifiableList =
- Collections.unmodifiableList(Arrays
- .asList((AUTIdentifier[]) arrayOfAutIdentifier));
- if (unmodifiableList != null) {
- return unmodifiableList;
+ try {
+ m_agent.send(new GetRegisteredAutListMessage());
+ Object arrayOfAutIdentifier = Synchronizer.instance()
+ .exchange(null);
+ if (arrayOfAutIdentifier instanceof AutIdentifier[]) {
+ final List<AUTIdentifier> unmodifiableList = Collections
+ .unmodifiableList(Arrays
+ .asList((AUTIdentifier[]) arrayOfAutIdentifier));
+ if (unmodifiableList != null) {
+ return unmodifiableList;
+ }
}
+
+ log.error("Unexpected AUT identifiers received: " //$NON-NLS-1$
+ + String.valueOf(arrayOfAutIdentifier));
+ } catch (NotConnectedException e) {
+ throw new CommunicationException(e);
+ } catch (org.eclipse.jubula.tools.internal.
+ exception.CommunicationException e) {
+ throw new CommunicationException(e);
+ } catch (InterruptedException e) {
+ throw new CommunicationException(e);
}
-
- log.error("Unexpected AUT identifiers received: " //$NON-NLS-1$
- + String.valueOf(arrayOfAutIdentifier));
-
+
return new ArrayList<AUTIdentifier>(0);
}
/** {@inheritDoc} */
- @NonNull public AUT getAUT(
+ @NonNull public AUT getAUT (
@NonNull AUTIdentifier autID,
- @NonNull ToolkitInfo information) {
+ @NonNull ToolkitInfo information)
+ throws CommunicationException {
Validate.notNull(autID, "The AUT-Identifier must not be null."); //$NON-NLS-1$
Validate.notNull(information, "The toolkit information must not be null."); //$NON-NLS-1$
+ checkConnected(this);
return new AUTImpl((AutIdentifier) autID, information);
}
+
+ /**
+ * @param side
+ * the side to check the connection state for
+ */
+ static void checkConnected(Remote side) {
+ if (!side.isConnected()) {
+ throw new IllegalStateException("There is currently no connection established to the remote side - call connect() first!"); //$NON-NLS-1$
+ }
+ }
} \ 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 6627c65b9..df855fe6f 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
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.jubula.client.internal.impl;
+import java.net.ConnectException;
import java.util.Map;
import org.apache.commons.lang.Validate;
@@ -19,11 +20,14 @@ import org.eclipse.jubula.client.AUT;
import org.eclipse.jubula.client.Result;
import org.eclipse.jubula.client.exceptions.ActionException;
import org.eclipse.jubula.client.exceptions.CheckFailedException;
+import org.eclipse.jubula.client.exceptions.CommunicationException;
import org.eclipse.jubula.client.exceptions.ComponentNotFoundException;
import org.eclipse.jubula.client.exceptions.ConfigurationException;
import org.eclipse.jubula.client.exceptions.ExecutionException;
import org.eclipse.jubula.client.internal.AUTConnection;
+import org.eclipse.jubula.client.internal.BaseConnection.NotConnectedException;
import org.eclipse.jubula.client.internal.Synchronizer;
+import org.eclipse.jubula.client.internal.exceptions.ConnectionException;
import org.eclipse.jubula.communication.CAP;
import org.eclipse.jubula.communication.internal.message.CAPTestMessage;
import org.eclipse.jubula.communication.internal.message.CAPTestMessageFactory;
@@ -33,7 +37,6 @@ import org.eclipse.jubula.communication.internal.message.UnknownMessageException
import org.eclipse.jubula.toolkit.ToolkitInfo;
import org.eclipse.jubula.toolkit.internal.AbstractToolkitInfo;
import org.eclipse.jubula.tools.AUTIdentifier;
-import org.eclipse.jubula.tools.internal.exception.CommunicationException;
import org.eclipse.jubula.tools.internal.i18n.I18n;
import org.eclipse.jubula.tools.internal.objects.event.TestErrorEvent;
import org.eclipse.jubula.tools.internal.registration.AutIdentifier;
@@ -57,7 +60,8 @@ public class AUTImpl implements AUT {
*
* @param autID
* the identifier to use for connection
- * @param information
+ * @param information
+ * the toolkit information
*/
public AUTImpl(
@NonNull AutIdentifier autID,
@@ -70,19 +74,29 @@ public class AUTImpl implements AUT {
}
/** {@inheritDoc} */
- public void connect() throws Exception {
+ public void connect() throws CommunicationException {
if (!isConnected()) {
final Map<ComponentClass, String> typeMapping =
getInformation().getTypeMapping();
- m_instance = AUTConnection.getInstance();
- m_instance.connectToAut(m_autID, typeMapping);
+ try {
+ m_instance = AUTConnection.getInstance();
+ m_instance.connectToAut(m_autID, typeMapping);
+ if (!isConnected()) {
+ throw new CommunicationException(
+ new ConnectException(
+ "Could not connect to AUT: " //$NON-NLS-1$
+ + m_autID.getID() + ".")); //$NON-NLS-1$
+ }
+ } catch (ConnectionException e) {
+ throw new CommunicationException(e);
+ }
} else {
throw new IllegalStateException("AUT connection is already made"); //$NON-NLS-1$
}
}
/** {@inheritDoc} */
- public void disconnect() throws Exception {
+ public void disconnect() {
if (isConnected()) {
m_instance.close();
} else {
@@ -96,7 +110,8 @@ public class AUTImpl implements AUT {
}
/** {@inheritDoc} */
- @NonNull public AUTIdentifier getIdentifier() {
+ @NonNull
+ public AUTIdentifier getIdentifier() {
return m_autID;
}
@@ -113,20 +128,19 @@ public class AUTImpl implements AUT {
}
/** {@inheritDoc} */
- @NonNull public <T> Result<T> execute(
- @NonNull CAP cap,
- @Nullable T payload)
- throws ExecutionException {
+ @NonNull
+ public <T> Result<T> execute(@NonNull CAP cap, @Nullable T payload)
+ throws ExecutionException, CommunicationException {
Validate.notNull(cap, "The CAP must not be null."); //$NON-NLS-1$
+ AUTAgentImpl.checkConnected(this);
final ResultImpl<T> result = new ResultImpl<T>(cap, payload);
try {
CAPTestMessage capTestMessage = CAPTestMessageFactory
- .getCAPTestMessage((MessageCap)cap,
- getInformation().getToolkitID());
+ .getCAPTestMessage((MessageCap) cap, getInformation()
+ .getToolkitID());
m_instance.send(capTestMessage);
-
Object exchange = Synchronizer.instance().exchange(null);
if (exchange instanceof CAPTestResponseMessage) {
CAPTestResponseMessage response =
@@ -137,13 +151,17 @@ public class AUTImpl implements AUT {
log.error("Unexpected response received: " //$NON-NLS-1$
+ String.valueOf(exchange));
}
-
+ } catch (NotConnectedException e) {
+ throw new CommunicationException(e);
} catch (UnknownMessageException e) {
- log.error(e.getLocalizedMessage(), e);
+ throw new CommunicationException(e);
+ } catch (org.eclipse.jubula.tools.internal.
+ exception.CommunicationException e) {
+ throw new CommunicationException(e);
} catch (CommunicationException e) {
- log.error(e.getLocalizedMessage(), e);
+ throw new CommunicationException(e);
} catch (InterruptedException e) {
- log.error(e.getLocalizedMessage(), e);
+ throw new CommunicationException(e);
}
return result;
}
diff --git a/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/internal/impl/ObjectMappingImpl.java b/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/internal/impl/ObjectMappingImpl.java
index 28a9f4c97..c88f86733 100644
--- a/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/internal/impl/ObjectMappingImpl.java
+++ b/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/internal/impl/ObjectMappingImpl.java
@@ -89,8 +89,8 @@ public class ObjectMappingImpl implements ObjectMapping {
* was found
* @throws LoadResourceException
*/
- private ComponentIdentifier getIdentifier(String compName) throws
- LoadResourceException {
+ private ComponentIdentifier getIdentifier(String compName)
+ throws LoadResourceException {
try {
String encodedString =
m_objectMappingAssociations.getProperty(compName);
diff --git a/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/internal/impl/ResultImpl.java b/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/internal/impl/ResultImpl.java
index 085c5b5f8..2c62bbb92 100644
--- a/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/internal/impl/ResultImpl.java
+++ b/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/internal/impl/ResultImpl.java
@@ -25,7 +25,8 @@ public class ResultImpl<T> implements Result<T> {
/** the payload */
private T m_payload;
/** the cap */
- @NonNull private CAP m_cap;
+ @NonNull
+ private CAP m_cap;
/** the result flag */
private boolean m_isOK = false;
@@ -39,18 +40,20 @@ public class ResultImpl<T> implements Result<T> {
*/
public ResultImpl(@NonNull CAP cap, @Nullable T payload) {
Validate.notNull(cap, "The CAP must not be null."); //$NON-NLS-1$
-
+
m_cap = cap;
m_payload = payload;
}
/** {@inheritDoc} */
- @Nullable public T getPayload() {
+ @Nullable
+ public T getPayload() {
return m_payload;
}
/** {@inheritDoc} */
- @NonNull public CAP getCAP() {
+ @NonNull
+ public CAP getCAP() {
return m_cap;
}
@@ -60,7 +63,8 @@ public class ResultImpl<T> implements Result<T> {
}
/**
- * @param isOK the isOK to set
+ * @param isOK
+ * the isOK to set
*/
void setOK(boolean isOK) {
m_isOK = isOK;
diff --git a/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/launch/AUTConfiguration.java b/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/launch/AUTConfiguration.java
index 1edbdbe39..260114b87 100644
--- a/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/launch/AUTConfiguration.java
+++ b/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/launch/AUTConfiguration.java
@@ -14,7 +14,7 @@ import java.util.Map;
import org.eclipse.jdt.annotation.NonNull;
-/**
+/**
* @author BREDEX GmbH
* @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients.
@@ -23,5 +23,6 @@ public interface AUTConfiguration {
/**
* @return a map of launch information
*/
- @NonNull Map<String, String> getLaunchInformation();
+ @NonNull
+ Map<String, String> getLaunchInformation();
} \ No newline at end of file

Back to the top