Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarvin Mueller2015-09-10 04:31:33 -0400
committerMarkus Tiede2015-09-15 10:18:35 -0400
commit5a73c489375435b44f28f08d90b154c630c72334 (patch)
tree145cfcb203e1527329180e145ea66436d3a8cff9
parentd32373ab15ce803a7fc6c76918766752e5bb078a (diff)
downloadorg.eclipse.jubula.core-5a73c489375435b44f28f08d90b154c630c72334.tar.gz
org.eclipse.jubula.core-5a73c489375435b44f28f08d90b154c630c72334.tar.xz
org.eclipse.jubula.core-5a73c489375435b44f28f08d90b154c630c72334.zip
Sprint task - JUB-1298 timeout should not lead to no testresult written
Added a way that we are waiting for the testresult writing job if there is one running. Should fix http://eclip.se/458227
-rw-r--r--org.eclipse.jubula.app.testexec/src/org/eclipse/jubula/app/testexec/core/ExecutionController.java20
-rw-r--r--org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/ClientTestImpl.java13
-rw-r--r--org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/IClientTest.java5
-rw-r--r--org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/communication/AUTConnection.java3
-rw-r--r--org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/internal/constants/TimeoutConstants.java3
5 files changed, 43 insertions, 1 deletions
diff --git a/org.eclipse.jubula.app.testexec/src/org/eclipse/jubula/app/testexec/core/ExecutionController.java b/org.eclipse.jubula.app.testexec/src/org/eclipse/jubula/app/testexec/core/ExecutionController.java
index 9c0669ce3..5b403d457 100644
--- a/org.eclipse.jubula.app.testexec/src/org/eclipse/jubula/app/testexec/core/ExecutionController.java
+++ b/org.eclipse.jubula.app.testexec/src/org/eclipse/jubula/app/testexec/core/ExecutionController.java
@@ -76,6 +76,7 @@ import org.eclipse.jubula.client.internal.AutAgentConnection;
import org.eclipse.jubula.toolkit.common.exception.ToolkitPluginException;
import org.eclipse.jubula.tools.internal.constants.AutConfigConstants;
import org.eclipse.jubula.tools.internal.constants.StringConstants;
+import org.eclipse.jubula.tools.internal.constants.TimeoutConstants;
import org.eclipse.jubula.tools.internal.exception.CommunicationException;
import org.eclipse.jubula.tools.internal.exception.JBException;
import org.eclipse.jubula.tools.internal.i18n.I18n;
@@ -424,6 +425,8 @@ public class ExecutionController implements IAUTServerEventListener,
m_job.getNoRunOptMode(), null);
}
}
+ waitForReportingToFinish(TimeoutConstants
+ .CLIENT_REPORTING_AFTER_FAILURE_TIMEOUT);
}
/**
@@ -442,6 +445,8 @@ public class ExecutionController implements IAUTServerEventListener,
new Object[] { tjName,
executedTestSuites.size()}));
Iterator<INodePO> tsIterator = m_job.getTestJob().getNodeListIterator();
+ waitForReportingToFinish(TimeoutConstants
+ .CLIENT_REPORTING_AFTER_FAILURE_TIMEOUT);
while (tsIterator.hasNext()) {
INodePO testsuite = tsIterator.next();
if (!executedTestSuites.contains(testsuite)) {
@@ -451,9 +456,24 @@ public class ExecutionController implements IAUTServerEventListener,
testsuite.getName()}));
}
}
+
}
/**
+ * waits for the reporting job to finish.
+ * @param timeout timeout in milliseconds
+ */
+ private void waitForReportingToFinish(long timeout) {
+ long endtime = System.currentTimeMillis() + timeout;
+ while (ClientTest.instance().isReportingRunning()) {
+ TimeUtil.delay(250);
+ if (endtime - System.currentTimeMillis() < 0) {
+ return;
+ }
+ }
+ }
+
+ /**
* end processing and notify any waiting CLC service threads
*/
private void stopProcessing() {
diff --git a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/ClientTestImpl.java b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/ClientTestImpl.java
index c311f833a..5475965a0 100644
--- a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/ClientTestImpl.java
+++ b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/ClientTestImpl.java
@@ -202,6 +202,9 @@ public class ClientTestImpl implements IClientTest {
* name of the file which is overwriting the default behavior
*/
private String m_fileName;
+
+ /** true if the report testresult Job is running */
+ private AtomicBoolean m_isReportRunning = new AtomicBoolean(false);
/**
* empty default constructor
@@ -927,6 +930,7 @@ public class ClientTestImpl implements IClientTest {
return m_jobFamily.equals(family);
}
protected IStatus run(IProgressMonitor monitor) {
+ m_isReportRunning.set(true);
try {
monitor.beginTask(Messages.ClientWritingReportToDB,
IProgressMonitor.UNKNOWN);
@@ -937,11 +941,13 @@ public class ClientTestImpl implements IClientTest {
writeReportToFileSystem(result);
}
monitor.done();
+ m_isReportRunning.set(false);
return Status.OK_STATUS;
} catch (Throwable t) {
// this is due that everything that happens in the job
// will otherwise not be logged (like memory Exception)
log.error(Messages.ClientWritingReportError, t);
+ m_isReportRunning.set(false);
return Status.CANCEL_STATUS;
}
}
@@ -1411,4 +1417,11 @@ public class ClientTestImpl implements IClientTest {
AutAgentEvent.SERVER_CANNOT_CONNECTED));
}
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isReportingRunning() {
+ return m_isReportRunning.get();
+ }
} \ No newline at end of file
diff --git a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/IClientTest.java b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/IClientTest.java
index ba1b588a3..8a4d5527a 100644
--- a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/IClientTest.java
+++ b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/IClientTest.java
@@ -366,4 +366,9 @@ public interface IClientTest {
* @param fileName the name of the file
*/
public void setFileName(String fileName);
+
+ /**
+ * @return <code>true</code> if report testresults is running
+ */
+ public boolean isReportingRunning();
} \ No newline at end of file
diff --git a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/communication/AUTConnection.java b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/communication/AUTConnection.java
index 32b0cb9e2..59ff31e9c 100644
--- a/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/communication/AUTConnection.java
+++ b/org.eclipse.jubula.client.core/src/org/eclipse/jubula/client/core/communication/AUTConnection.java
@@ -238,7 +238,8 @@ public class AUTConnection extends BaseAUTConnection {
// Connection has failed
ded.fireAutServerConnectionChanged(ServerState.Disconnected);
TimeStatus s = new TimeStatus(IStatus.ERROR, Activator.PLUGIN_ID,
- responseCommand.getMessage().getErrorMessage());
+ IStatus.ERROR, responseCommand
+ .getMessage().getErrorMessage(), null);
pc.writeStatus(s, autId.encode());
return s;
}
diff --git a/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/internal/constants/TimeoutConstants.java b/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/internal/constants/TimeoutConstants.java
index 34adaec62..9e4f32d76 100644
--- a/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/internal/constants/TimeoutConstants.java
+++ b/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/internal/constants/TimeoutConstants.java
@@ -21,6 +21,9 @@ public interface TimeoutConstants {
/** The default timeout for cap-test-requests in MILLISECONDS! */
public static final int CLIENT_SERVER_TIMEOUT_DEFAULT_REQUEST = 600000;
+ /** timeout for reporting after a job aborting failure( cap test request timeout) */
+ public static final int CLIENT_REPORTING_AFTER_FAILURE_TIMEOUT = 1800000;
+
/**
* <code>CLIENT_SERVER_TIMEOUT_TAKE_SCREENSHOT</code>
*/

Back to the top