summaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorromaingimbert <romain.gimbert@orange.com>2019-01-24 11:01:03 +0100
committerromaingimbert <romain.gimbert@orange.com>2019-01-24 12:28:42 +0100
commit69197a8abc78ee825d38908cd46690b3c150caa1 (patch)
treecd6db2a41e42ca5b7204851ccd8c34c76527a381 /src/main/java
parent05733ab5105f440e44eb56dc37e6d14615c36454 (diff)
hub resource format date
-fix code -add listener for testing -add karate test Change-Id: Ife2d7812c77316b75c55e86056f59d838e117069 Issue-ID: EXTAPI-180 Signed-off-by: romaingimbert <romain.gimbert@orange.com>
Diffstat (limited to 'src/main/java')
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/hub/HubResource.java29
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/hub/model/Event.java22
-rw-r--r--src/main/java/org/onap/nbi/apis/hub/service/EventFactory.java29
-rwxr-xr-xsrc/main/java/org/onap/nbi/apis/hub/service/NotifierService.java33
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceorder/SoClient.java162
5 files changed, 143 insertions, 132 deletions
diff --git a/src/main/java/org/onap/nbi/apis/hub/HubResource.java b/src/main/java/org/onap/nbi/apis/hub/HubResource.java
index 9ef5235..cccd0a8 100755
--- a/src/main/java/org/onap/nbi/apis/hub/HubResource.java
+++ b/src/main/java/org/onap/nbi/apis/hub/HubResource.java
@@ -1,15 +1,14 @@
/**
* Copyright (c) 2018 Orange
*
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
*/
package org.onap.nbi.apis.hub;
@@ -44,10 +43,6 @@ import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
-import java.net.URI;
-import java.util.List;
-import java.util.stream.Collectors;
-
@RestController
@RequestMapping("/hub")
@EnableScheduling
@@ -71,10 +66,10 @@ public class HubResource extends ResourceManagement {
Subscriber subscriber = subscriptionService.createSubscription(subscription);
URI location = ServletUriComponentsBuilder
- .fromCurrentRequest()
- .path("/{id}")
- .buildAndExpand(subscriber.getId())
- .toUri();
+ .fromCurrentRequest()
+ .path("/{id}")
+ .buildAndExpand(subscriber.getId())
+ .toUri();
return ResponseEntity.created(location).build();
}
@@ -82,7 +77,7 @@ public class HubResource extends ResourceManagement {
@GetMapping(value = "/{subscriptionId}", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Subscription> getSubscription(@PathVariable String subscriptionId) {
- Subscriber subscriber = subscriptionService.findSubscriptionById(subscriptionId);
+ Subscriber subscriber = subscriptionService.findSubscriptionById(subscriptionId);
if (subscriber == null) {
return ResponseEntity.notFound().build();
}
@@ -100,8 +95,8 @@ public class HubResource extends ResourceManagement {
headers.add("X-Total-Count", String.valueOf(totalCount));
headers.add("X-Result-Count", String.valueOf(subscribers.size()));
List<Subscription> subscriptions = subscribers.stream()
- .map(Subscription::createFromSubscriber)
- .collect(Collectors.toList());
+ .map(Subscription::createFromSubscriber)
+ .collect(Collectors.toList());
return this.findResponse(subscriptions, filter, headers);
diff --git a/src/main/java/org/onap/nbi/apis/hub/model/Event.java b/src/main/java/org/onap/nbi/apis/hub/model/Event.java
index cf6c790..8540167 100755
--- a/src/main/java/org/onap/nbi/apis/hub/model/Event.java
+++ b/src/main/java/org/onap/nbi/apis/hub/model/Event.java
@@ -1,24 +1,21 @@
/**
- * Copyright (c) 2018 Orange
+ * Copyright (c) 2018 Orange
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
*/
package org.onap.nbi.apis.hub.model;
+import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.JsonNode;
-
-import javax.validation.constraints.NotNull;
import java.util.Date;
+import javax.validation.constraints.NotNull;
public class Event {
@@ -40,6 +37,7 @@ public class Event {
this.eventId = eventId;
}
+ @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
public Date getEventDate() {
return eventDate;
}
diff --git a/src/main/java/org/onap/nbi/apis/hub/service/EventFactory.java b/src/main/java/org/onap/nbi/apis/hub/service/EventFactory.java
index 3e04b84..e935a1c 100644
--- a/src/main/java/org/onap/nbi/apis/hub/service/EventFactory.java
+++ b/src/main/java/org/onap/nbi/apis/hub/service/EventFactory.java
@@ -1,17 +1,14 @@
/**
- * Copyright (c) 2018 Orange
+ * Copyright (c) 2018 Orange
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
*/
package org.onap.nbi.apis.hub.service;
@@ -19,6 +16,10 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.MappingJsonFactory;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.UUID;
import org.onap.nbi.apis.hub.model.Event;
import org.onap.nbi.apis.hub.model.EventType;
import org.onap.nbi.apis.serviceorder.model.ServiceOrder;
@@ -26,9 +27,6 @@ import org.onap.nbi.apis.serviceorder.model.ServiceOrderItem;
import org.onap.nbi.commons.JacksonFilter;
import org.onap.nbi.commons.JsonRepresentation;
-import java.util.Date;
-import java.util.UUID;
-
public class EventFactory {
private static final ObjectMapper mapper = new ObjectMapper(new MappingJsonFactory());
@@ -39,11 +37,14 @@ public class EventFactory {
event.setEventDate(new Date());
event.setEventType(eventType.value());
+ DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
+ mapper.setDateFormat(df);
+
JsonNode serviceOrderJson = mapper.valueToTree(filterServiceOrder(serviceOrder));
if (EventType.SERVICE_ORDER_ITEM_STATE_CHANGE.equals(eventType)) {
JsonNode serviceOrderItemJson = mapper.valueToTree(serviceOrderItem);
- ((ObjectNode)serviceOrderJson).putArray("orderItem").add(serviceOrderItemJson);
+ ((ObjectNode) serviceOrderJson).putArray("orderItem").add(serviceOrderItemJson);
}
event.setEvent(serviceOrderJson);
diff --git a/src/main/java/org/onap/nbi/apis/hub/service/NotifierService.java b/src/main/java/org/onap/nbi/apis/hub/service/NotifierService.java
index 4f7a549..90cc7a4 100755
--- a/src/main/java/org/onap/nbi/apis/hub/service/NotifierService.java
+++ b/src/main/java/org/onap/nbi/apis/hub/service/NotifierService.java
@@ -1,35 +1,31 @@
/**
- * Copyright (c) 2018 Orange
+ * Copyright (c) 2018 Orange
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
*/
package org.onap.nbi.apis.hub.service;
+import javax.validation.Valid;
import org.onap.nbi.apis.hub.model.Event;
import org.onap.nbi.apis.hub.model.Subscriber;
+import org.onap.nbi.exceptions.BackendFunctionalException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
-import javax.validation.Valid;
-
@Service
public class NotifierService {
+
private final Logger logger = LoggerFactory.getLogger(NotifierService.class);
@Autowired
@@ -37,7 +33,12 @@ public class NotifierService {
@Async
public void run(Subscriber subscriber, @Valid Event event) {
- ResponseEntity<String> re = restTemplate.postForEntity(subscriber.getCallback(), event, String.class);
- if (re.getStatusCode() == HttpStatus.OK) logger.debug("FAILED");
+ try {
+ restTemplate.postForEntity(subscriber.getCallback(), event, Object.class);
+ } catch (BackendFunctionalException e) {
+ logger.error(" unable to post event to {} , receive {}, {}", subscriber.getCallback(), e.getHttpStatus(),
+ e.getBodyResponse());
+ }
+
}
}
diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/SoClient.java b/src/main/java/org/onap/nbi/apis/serviceorder/SoClient.java
index 21bfbcd..0d863d1 100644
--- a/src/main/java/org/onap/nbi/apis/serviceorder/SoClient.java
+++ b/src/main/java/org/onap/nbi/apis/serviceorder/SoClient.java
@@ -70,19 +70,25 @@ public class SoClient {
@PostConstruct
private void setUpAndLogSOUrl() {
- createSoUrl = new StringBuilder().append(soHostname).append(OnapComponentsUrlPaths.MSO_CREATE_SERVICE_INSTANCE_PATH).toString();
- createE2ESoUrl = new StringBuilder().append(soHostname).append(OnapComponentsUrlPaths.MSO_CREATE_E2ESERVICE_INSTANCE_PATH).toString();
- deleteSoUrl= new StringBuilder().append(soHostname).append(OnapComponentsUrlPaths.MSO_DELETE_REQUEST_STATUS_PATH).toString();
- deleteE2ESoUrl= new StringBuilder().append(soHostname).append(OnapComponentsUrlPaths.MSO_DELETE_E2ESERVICE_INSTANCE_PATH).toString();
- getSoStatus= new StringBuilder().append(soHostname).append(OnapComponentsUrlPaths.MSO_GET_REQUEST_STATUS_PATH).toString();
- getE2ESoStatus= new StringBuilder().append(soHostname).append(OnapComponentsUrlPaths.MSO_GET_E2EREQUEST_STATUS_PATH).toString();
-
- LOGGER.info("SO create service url : "+ createSoUrl);
- LOGGER.info("SO create e2e service url : "+ createE2ESoUrl);
- LOGGER.info("SO delete service url : "+deleteSoUrl);
- LOGGER.info("SO delete e2e service url : "+deleteE2ESoUrl);
- LOGGER.info("SO get so status url : "+getSoStatus);
- LOGGER.info("SO get e2e so status url : "+getE2ESoStatus);
+ createSoUrl = new StringBuilder().append(soHostname)
+ .append(OnapComponentsUrlPaths.MSO_CREATE_SERVICE_INSTANCE_PATH).toString();
+ createE2ESoUrl = new StringBuilder().append(soHostname)
+ .append(OnapComponentsUrlPaths.MSO_CREATE_E2ESERVICE_INSTANCE_PATH).toString();
+ deleteSoUrl = new StringBuilder().append(soHostname)
+ .append(OnapComponentsUrlPaths.MSO_DELETE_REQUEST_STATUS_PATH).toString();
+ deleteE2ESoUrl = new StringBuilder().append(soHostname)
+ .append(OnapComponentsUrlPaths.MSO_DELETE_E2ESERVICE_INSTANCE_PATH).toString();
+ getSoStatus = new StringBuilder().append(soHostname).append(OnapComponentsUrlPaths.MSO_GET_REQUEST_STATUS_PATH)
+ .toString();
+ getE2ESoStatus = new StringBuilder().append(soHostname)
+ .append(OnapComponentsUrlPaths.MSO_GET_E2EREQUEST_STATUS_PATH).toString();
+
+ LOGGER.info("SO create service url : " + createSoUrl);
+ LOGGER.info("SO create e2e service url : " + createE2ESoUrl);
+ LOGGER.info("SO delete service url : " + deleteSoUrl);
+ LOGGER.info("SO delete e2e service url : " + deleteE2ESoUrl);
+ LOGGER.info("SO get so status url : " + getSoStatus);
+ LOGGER.info("SO get e2e so status url : " + getE2ESoStatus);
}
@@ -101,14 +107,14 @@ public class SoClient {
return response;
} catch (BackendFunctionalException e) {
- LOGGER.error(ERROR_ON_CALLING + createSoUrl + " ," + e);
- return new ResponseEntity(e.getBodyResponse(),e.getHttpStatus());
+ LOGGER.error(ERROR_ON_CALLING + createSoUrl + " ," + e.getHttpStatus() + " , " + e.getBodyResponse());
+ return new ResponseEntity(e.getBodyResponse(), e.getHttpStatus());
} catch (ResourceAccessException e) {
- LOGGER.error(ERROR_ON_CALLING + createSoUrl + " ," + e);
+ LOGGER.error(ERROR_ON_CALLING + createSoUrl + " ," + e.getMessage());
return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
-
+
public ResponseEntity<CreateE2EServiceInstanceResponse> callE2ECreateServiceInstance(MSOE2EPayload msoPayloadE2E) {
if (LOGGER.isDebugEnabled()) {
@@ -116,22 +122,24 @@ public class SoClient {
}
try {
- ResponseEntity<CreateE2EServiceInstanceResponse> response = restTemplate.exchange(createE2ESoUrl, HttpMethod.POST,
+ ResponseEntity<CreateE2EServiceInstanceResponse> response = restTemplate
+ .exchange(createE2ESoUrl, HttpMethod.POST,
new HttpEntity<>(msoPayloadE2E, buildRequestHeader()), CreateE2EServiceInstanceResponse.class);
logE2EResponsePost(createE2ESoUrl, response);
return response;
} catch (BackendFunctionalException e) {
- LOGGER.error(ERROR_ON_CALLING + createE2ESoUrl + " ," + e);
- return new ResponseEntity(e.getBodyResponse(),e.getHttpStatus());
+ LOGGER.error(ERROR_ON_CALLING + createSoUrl + " ," + e.getHttpStatus() + " , " + e.getBodyResponse());
+ return new ResponseEntity(e.getBodyResponse(), e.getHttpStatus());
} catch (ResourceAccessException e) {
- LOGGER.error(ERROR_ON_CALLING + createE2ESoUrl + " ," + e);
+ LOGGER.error(ERROR_ON_CALLING + createE2ESoUrl + " ," + e.getMessage());
return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
- public ResponseEntity<CreateServiceInstanceResponse> callDeleteServiceInstance(MSOPayload msoPayload, String serviceId) {
+ public ResponseEntity<CreateServiceInstanceResponse> callDeleteServiceInstance(MSOPayload msoPayload,
+ String serviceId) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Calling SO DeleteServiceInstance with msoPayload : " + msoPayload.toString());
@@ -156,42 +164,47 @@ public class SoClient {
}
- public ResponseEntity<CreateE2EServiceInstanceResponse> callE2EDeleteServiceInstance(String globalSubscriberId, String serviceType,
- String serviceInstanceId) {
+ public ResponseEntity<CreateE2EServiceInstanceResponse> callE2EDeleteServiceInstance(String globalSubscriberId,
+ String serviceType,
+ String serviceInstanceId) {
- String url = deleteE2ESoUrl + serviceInstanceId;
- MSODeleteE2EPayload msoDeleteE2EPayload = new MSODeleteE2EPayload();
- msoDeleteE2EPayload.setGlobalSubscriberId(globalSubscriberId);
- msoDeleteE2EPayload.setServiceType(serviceType);
-
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Calling SO DeleteE2EServiceInstance with url : " + url + " MSODeleteE2EPayload : " + msoDeleteE2EPayload.toString() );
- }
-
- try {
- ResponseEntity<DeleteE2EServiceInstanceResponse> deleteresponse = restTemplate.exchange(url, HttpMethod.DELETE,
- new HttpEntity<>(msoDeleteE2EPayload, buildRequestHeader()), DeleteE2EServiceInstanceResponse.class);
-
- // For E2E Services , Create and Delete Service responses are different, to maintain consistentcy with ServiceInstances
- // Copy contents of DeleteE2EServiceInstanceResponse to CreateE2EServiceInstanceResponse
- CreateE2EServiceInstanceResponse dummyresponse = new CreateE2EServiceInstanceResponse();
- ServiceResponse serviceResponse = new ServiceResponse();
- dummyresponse.setService(serviceResponse);
- dummyresponse.getService().setOperationId(deleteresponse.getBody().getOperationId());
- dummyresponse.getService().setServiceId(serviceInstanceId);
-
- ResponseEntity<CreateE2EServiceInstanceResponse> response = new ResponseEntity(dummyresponse, deleteresponse.getStatusCode());
- logE2EResponsePost(url, response);
- return response;
-
- } catch (BackendFunctionalException e) {
- LOGGER.error(ERROR_ON_CALLING + url + " ," + e);
- return new ResponseEntity<>(e.getHttpStatus());
- } catch (ResourceAccessException e) {
- LOGGER.error(ERROR_ON_CALLING + url + " ," + e);
- return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
- }
- }
+ String url = deleteE2ESoUrl + serviceInstanceId;
+ MSODeleteE2EPayload msoDeleteE2EPayload = new MSODeleteE2EPayload();
+ msoDeleteE2EPayload.setGlobalSubscriberId(globalSubscriberId);
+ msoDeleteE2EPayload.setServiceType(serviceType);
+
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("Calling SO DeleteE2EServiceInstance with url : " + url + " MSODeleteE2EPayload : "
+ + msoDeleteE2EPayload.toString());
+ }
+
+ try {
+ ResponseEntity<DeleteE2EServiceInstanceResponse> deleteresponse = restTemplate
+ .exchange(url, HttpMethod.DELETE,
+ new HttpEntity<>(msoDeleteE2EPayload, buildRequestHeader()),
+ DeleteE2EServiceInstanceResponse.class);
+
+ // For E2E Services , Create and Delete Service responses are different, to maintain consistentcy with ServiceInstances
+ // Copy contents of DeleteE2EServiceInstanceResponse to CreateE2EServiceInstanceResponse
+ CreateE2EServiceInstanceResponse dummyresponse = new CreateE2EServiceInstanceResponse();
+ ServiceResponse serviceResponse = new ServiceResponse();
+ dummyresponse.setService(serviceResponse);
+ dummyresponse.getService().setOperationId(deleteresponse.getBody().getOperationId());
+ dummyresponse.getService().setServiceId(serviceInstanceId);
+
+ ResponseEntity<CreateE2EServiceInstanceResponse> response = new ResponseEntity(dummyresponse,
+ deleteresponse.getStatusCode());
+ logE2EResponsePost(url, response);
+ return response;
+
+ } catch (BackendFunctionalException e) {
+ LOGGER.error(ERROR_ON_CALLING + url + " ," + e);
+ return new ResponseEntity<>(e.getHttpStatus());
+ } catch (ResourceAccessException e) {
+ LOGGER.error(ERROR_ON_CALLING + url + " ," + e);
+ return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
+ }
+ }
private void logResponsePost(String url, ResponseEntity<CreateServiceInstanceResponse> response) {
LOGGER.info(RESPONSE_STATUS + response.getStatusCodeValue());
@@ -225,10 +238,11 @@ public class SoClient {
ResponseEntity<GetRequestStatusResponse> response = restTemplate.exchange(url, HttpMethod.GET,
new HttpEntity<>(buildRequestHeader()), GetRequestStatusResponse.class);
logResponseGet(url, response);
- if (null == response)
+ if (null == response) {
return null;
- else
+ } else {
return response.getBody();
+ }
} catch (BackendFunctionalException | ResourceAccessException e) {
LOGGER.error(ERROR_ON_CALLING + url + " ," + e);
@@ -236,26 +250,28 @@ public class SoClient {
}
}
-public GetE2ERequestStatusResponse callE2EGetRequestStatus(String operationId, String serviceId) {
-
+ public GetE2ERequestStatusResponse callE2EGetRequestStatus(String operationId, String serviceId) {
+
String callUrlFormated = getE2ESoStatus.replace("$serviceId", serviceId);
callUrlFormated = callUrlFormated.replace("$operationId", operationId);
if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Calling SO callE2EGetRequestStatus with url : " + callUrlFormated );
+ LOGGER.debug("Calling SO callE2EGetRequestStatus with url : " + callUrlFormated);
}
-
+
try {
- ResponseEntity<GetE2ERequestStatusResponse> response = restTemplate.exchange(callUrlFormated, HttpMethod.GET,
- new HttpEntity<>(buildRequestHeader()), GetE2ERequestStatusResponse.class);
+ ResponseEntity<GetE2ERequestStatusResponse> response = restTemplate
+ .exchange(callUrlFormated, HttpMethod.GET,
+ new HttpEntity<>(buildRequestHeader()), GetE2ERequestStatusResponse.class);
logE2EResponseGet(callUrlFormated, response);
- if (null == response)
+ if (null == response) {
return null;
- else
+ } else {
return response.getBody();
+ }
- } catch (BackendFunctionalException|ResourceAccessException e) {
+ } catch (BackendFunctionalException | ResourceAccessException e) {
LOGGER.error(ERROR_ON_CALLING + callUrlFormated + " ," + e);
return null;
}
@@ -275,19 +291,19 @@ public GetE2ERequestStatusResponse callE2EGetRequestStatus(String operationId, S
LOGGER.info("no response calling url {}", url);
}
}
-
+
private void logE2EResponseGet(String url, ResponseEntity<GetE2ERequestStatusResponse> response) {
- if(response!=null){
- if (LOGGER.isDebugEnabled()) {
+ if (response != null) {
+ if (LOGGER.isDebugEnabled()) {
LOGGER.debug("response body : {}", response.getBody().toString());
}
- LOGGER.info("response status : {}", response.getStatusCodeValue());
+ LOGGER.info("response status : {}", response.getStatusCodeValue());
if (LOGGER.isWarnEnabled() && !response.getStatusCode().equals(HttpStatus.OK)) {
LOGGER.warn("HTTP call SO on {} returns {} , {}", url, response.getStatusCodeValue(),
response.getBody().toString());
}
} else {
- LOGGER.info("no response calling url {}",url);
+ LOGGER.info("no response calling url {}", url);
}
}