aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorromaingimbert <romain.gimbert@orange.com>2018-09-14 14:52:20 +0200
committerromaingimbert <romain.gimbert@orange.com>2018-09-14 14:52:20 +0200
commit8f141d17f3ea7720df479f4ae51b5a2e169548cb (patch)
tree4d309f3d24202153d6ad50dfa41c2d8ee99b70c2 /src/main/java
parent956d451af5e5ad5b5f0bbca34c5462455cc6d0ad (diff)
Add API Documentation for Casablanca
-update docs -update version related code -change properties MSB Change-Id: I7fb2a257ec035c53e93666d7571a2c74a0624524 Issue-ID: EXTAPI-141 Signed-off-by: romaingimbert <romain.gimbert@orange.com>
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/onap/nbi/ServiceRegisterRunner.java6
-rw-r--r--src/main/java/org/onap/nbi/apis/status/StatusResource.java13
2 files changed, 11 insertions, 8 deletions
diff --git a/src/main/java/org/onap/nbi/ServiceRegisterRunner.java b/src/main/java/org/onap/nbi/ServiceRegisterRunner.java
index a30be98..5e0c711 100644
--- a/src/main/java/org/onap/nbi/ServiceRegisterRunner.java
+++ b/src/main/java/org/onap/nbi/ServiceRegisterRunner.java
@@ -49,16 +49,16 @@ public class ServiceRegisterRunner implements CommandLineRunner {
@Value("${msb.service.host}")
private String SERVICE_HOST;
- @Value("${msb.service.port}")
+ @Value("${server.port}")
private String SERVICE_PORT;
@Value("${msb.service.name}")
private String SERVICE_NAME;
- @Value("${msb.service.version}")
+ @Value("${nbi.version}")
private String SERVICE_VERSION;
- @Value("${msb.service.url}")
+ @Value("${server.contextPath}")
private String SERVICE_URL;
@Value("${msb.service.custom_path}")
diff --git a/src/main/java/org/onap/nbi/apis/status/StatusResource.java b/src/main/java/org/onap/nbi/apis/status/StatusResource.java
index 96332ec..4fead09 100644
--- a/src/main/java/org/onap/nbi/apis/status/StatusResource.java
+++ b/src/main/java/org/onap/nbi/apis/status/StatusResource.java
@@ -20,6 +20,7 @@ import org.onap.nbi.apis.status.model.StatusType;
import org.onap.nbi.commons.JsonRepresentation;
import org.onap.nbi.commons.ResourceManagement;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
@@ -36,8 +37,11 @@ public class StatusResource extends ResourceManagement {
@Autowired
private StatusService statusService;
+ @Value("${nbi.version}")
+ private String version;
+
private JsonRepresentation fullRepresentation = new JsonRepresentation().add("name").add("status").add("version")
- .add("components.name").add("components.status");
+ .add("components.name").add("components.status");
@GetMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Object> status(HttpServletRequest request) {
@@ -47,13 +51,12 @@ public class StatusResource extends ResourceManagement {
final String[] splitPath = request.getRequestURI().split("/");
final String applicationName = splitPath[1];
- final String applicationVersion = splitPath[3];
- final ApplicationStatus applicationStatus = this.statusService.get(applicationName, applicationVersion);
+ final ApplicationStatus applicationStatus = this.statusService.get(applicationName, version);
final boolean isServiceFullyFunctional =
- StatusType.OK.equals(applicationStatus.getStatus()) ? applicationStatus.getComponents().stream()
- .allMatch(componentStatus -> StatusType.OK.equals(componentStatus.getStatus())) : false;
+ StatusType.OK.equals(applicationStatus.getStatus()) ? applicationStatus.getComponents().stream()
+ .allMatch(componentStatus -> StatusType.OK.equals(componentStatus.getStatus())) : false;
// filter object
Object response = this.getEntity(applicationStatus, fullRepresentation);