Permalink
Browse files

add polling start and end events

  • Loading branch information...
1 parent 7cbde55 commit 7f8e8c906c3513566a9701b9e72ff35b0258e42d @ryanbrainard ryanbrainard committed Jun 28, 2012
@@ -190,6 +190,7 @@ protected ClientResponse upload(DeployRequest deployRequest) throws DeploymentEx
}
protected Map<String, String> poll(DeployRequest deployRequest, ClientResponse uploadResponse) {
+ deployRequest.getEventSubscription().announce(POLL_START);
final List<String> locationHeaders = uploadResponse.getHeaders().get("Location");
if (locationHeaders == null || locationHeaders.get(0) == null) {
throw new DeploymentException("Location header not found");
@@ -201,7 +202,7 @@ protected ClientResponse upload(DeployRequest deployRequest) throws DeploymentEx
long pollingInterval = deployRequest.getPollingIntervalInit();
final long startTime = System.currentTimeMillis();
while (STATUS_IN_PROCESS.equals(response.get(STATUS))) {
- deployRequest.getEventSubscription().announce(POLL);
+ deployRequest.getEventSubscription().announce(POLLING);
response = stringify(pollingRequest.get(Map.class));
if (System.currentTimeMillis() - startTime > deployRequest.getPollingTimeout()) {
@@ -220,6 +221,7 @@ protected ClientResponse upload(DeployRequest deployRequest) throws DeploymentEx
throw new DeploymentException(unsuccessfulMsg, response.toString());
}
+ deployRequest.getEventSubscription().announce(POLL_END);
return response;
}
@@ -13,7 +13,9 @@
DEPLOY_START,
UPLOAD_START,
UPLOAD_END,
- POLL,
+ POLL_START,
+ POLLING,
+ POLL_END,
DEPLOY_END
}
@@ -36,7 +36,7 @@ public void handle(Event event) {
@Test
public void testDeploy() throws Exception {
assertEquals(STATUS_SUCCESS, client.deploy(new DeployRequest(WAR_PIPELINE, appName, warBundle).setEventSubscription(subscription)).get(STATUS));
- assertEquals(EnumSet.of(DEPLOY_START, UPLOAD_START, UPLOAD_END, POLL, DEPLOY_END), recordedEvents);
+ assertEquals(EnumSet.of(DEPLOY_START, UPLOAD_START, UPLOAD_END, POLL_START, POLLING, POLL_END, DEPLOY_END), recordedEvents);
}
@Test

0 comments on commit 7f8e8c9

Please sign in to comment.