Skip to content

Commit

Permalink
Align status endpoint with UP/DOWN (#475)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasponce authored and jshaughn committed Sep 29, 2017
1 parent 92556fc commit ebb011f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Expand Up @@ -81,7 +81,7 @@ class AbstractITestBase {

def resp = client.get(path: "status")
def tries = 100
while (tries > 0 && resp.data.status != "STARTED") {
while (tries > 0 && resp.data.status != "UP") {
Thread.sleep(500);
resp = client.get(path: "status")
tries--
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2015-2016 Red Hat, Inc. and/or its affiliates
* Copyright 2015-2017 Red Hat, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -47,8 +47,8 @@
@TenantRequired(false)
public class StatusHandler {
private static final String STATUS = "status";
private static final String STARTED = "STARTED";
private static final String FAILED = "FAILED";
private static final String UP = "UP";
private static final String DOWN = "DOWN";
private static final String DISTRIBUTED = "distributed";

@EJB
Expand All @@ -64,7 +64,7 @@ public class StatusHandler {
notes = "Status fields:" +
" + \n" +
"{ + \n" +
"\"status\":\"<STARTED>|<FAILED>\", + \n" +
"\"status\":\"<UP>|<DOWN>\", + \n" +
"\"Implementation-Version\":\"<Version>\", + \n" +
"\"Built-From-Git-SHA1\":\"<Git-SHA1>\", + \n" +
"\"distributed\":\"<true|false>\", + \n" +
Expand All @@ -76,17 +76,17 @@ public Response status(@Context ServletContext servletContext) {
status.putAll(manifestUtil.getFrom(servletContext));
try {
if (statusService.isStarted()) {
status.put(STATUS, STARTED);
status.put(STATUS, UP);
} else {
status.put(STATUS, FAILED);
status.put(STATUS, DOWN);
}
boolean distributed = statusService.isDistributed();
status.put(DISTRIBUTED, Boolean.toString(distributed));
if (distributed) {
status.putAll(statusService.getDistributedStatus());
}
} catch (Exception e) {
status.put(STATUS, FAILED);
status.put(STATUS, DOWN);
}
return ResponseUtil.ok(status);
}
Expand Down

0 comments on commit ebb011f

Please sign in to comment.