You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@batchee.apache.org by st...@apache.org on 2014/08/09 20:34:54 UTC
[2/2] git commit: BATCHEE-51 fix unit test
BATCHEE-51 fix unit test
Project: http://git-wip-us.apache.org/repos/asf/incubator-batchee/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-batchee/commit/50c23cf5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-batchee/tree/50c23cf5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-batchee/diff/50c23cf5
Branch: refs/heads/master
Commit: 50c23cf53b68276bfedad6b98ed03fea9e19565d
Parents: 209a8d4
Author: Mark Struberg <st...@apache.org>
Authored: Sat Aug 9 17:09:00 2014 +0200
Committer: Mark Struberg <st...@apache.org>
Committed: Sat Aug 9 17:09:00 2014 +0200
----------------------------------------------------------------------
.../org/apache/batchee/servlet/ServletTest.java | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/50c23cf5/gui/servlet/embedded/src/test/java/org/apache/batchee/servlet/ServletTest.java
----------------------------------------------------------------------
diff --git a/gui/servlet/embedded/src/test/java/org/apache/batchee/servlet/ServletTest.java b/gui/servlet/embedded/src/test/java/org/apache/batchee/servlet/ServletTest.java
index d6ed626..c992e94 100644
--- a/gui/servlet/embedded/src/test/java/org/apache/batchee/servlet/ServletTest.java
+++ b/gui/servlet/embedded/src/test/java/org/apache/batchee/servlet/ServletTest.java
@@ -43,6 +43,7 @@ import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
@RunWith(Arquillian.class)
public class ServletTest {
@@ -122,6 +123,23 @@ public class ServletTest {
String[] parms = textContent.split("\n");
assertTrue(parms.length == 3);
assertEquals(BatchStatus.STARTED.toString(), parms[2]);
+
+ boolean stopped = false;
+ for (int i = 0; i < 11; i++) {
+ textContent = executeSimpleRest("status/" + executionId);
+ parms = textContent.split("\n");
+ assertTrue(parms.length == 3);
+ if (BatchStatus.COMPLETED.toString().equals(parms[2])) {
+ stopped = true;
+ break;
+ }
+
+ Thread.sleep(200L);
+ }
+
+ if (!stopped) {
+ fail("failed to properly stop the batch. Last status = " + parms[2]);
+ }
}
private String executeSimpleRest(String command) throws IOException {
@@ -152,7 +170,7 @@ public class ServletTest {
final HtmlPage page = webClient.getPage(url);
final List<?> byXPath = page.getByXPath("//div[@id=\"content\"]" + xpath);
- assertEquals(1, byXPath.size());
+ assertTrue(byXPath.size() >= 1);
final Object next = byXPath.iterator().next();
if (!DomNode.class.isInstance(next)) {