From 32d2160da8478abcfae686747fba6296369e353c Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Sun, 24 Feb 2019 10:50:44 -0500 Subject: Add NETWORK_CORRELATOR on network updates async added verification for mocked BpmnError add unmarshal test missing in commit add junit for NetworkAdapter Callback success/failure Add NETWORK_CORRELATOR on network updates async etc Change-Id: Ib10709ddb61011aec247e9c020b7ee7c42949118 Issue-ID: SO-1568 Signed-off-by: Benjamin, Max (mb388a) --- .../adapter/network/tasks/NetworkAdapterRestV1.java | 4 ++++ .../org/onap/so/client/adapter/network/NetworkAdapterClient.java | 2 ++ .../onap/so/client/adapter/network/NetworkAdapterClientImpl.java | 9 +++++++++ .../onap/so/client/orchestration/NetworkAdapterResources.java | 5 +++++ 4 files changed, 20 insertions(+) (limited to 'bpmn/so-bpmn-tasks/src/main/java') diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java index fec7e8456f..4861257833 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java @@ -75,6 +75,10 @@ public class NetworkAdapterRestV1 { DeleteNetworkRequest deleteNetworkRequest = (DeleteNetworkRequest) networkAdapterRequest; execution.setVariable(NETWORK_CORRELATOR, deleteNetworkRequest.getMessageId()); response = networkAdapterResources.deleteNetworkAsync(deleteNetworkRequest); + } else if (networkAdapterRequest instanceof UpdateNetworkRequest) { + UpdateNetworkRequest updateNetworkRequest = (UpdateNetworkRequest) networkAdapterRequest; + execution.setVariable(NETWORK_CORRELATOR, updateNetworkRequest.getMessageId()); + response = networkAdapterResources.updateNetworkAsync(updateNetworkRequest); } if(response.isPresent()) { String statusCode = Integer.toString(response.get().getStatus()); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClient.java index cdb24401b3..350a6ae8d6 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClient.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClient.java @@ -52,4 +52,6 @@ public interface NetworkAdapterClient { Response deleteNetworkAsync(String aaiNetworkId, DeleteNetworkRequest req) throws NetworkAdapterClientException; Response rollbackNetworkAsync(String aaiNetworkId, RollbackNetworkRequest req) throws NetworkAdapterClientException; + + Response updateNetworkAsync(String aaiNetworkId, UpdateNetworkRequest req) throws NetworkAdapterClientException; } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClientImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClientImpl.java index 7092fe04c6..e8a5723e19 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClientImpl.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/NetworkAdapterClientImpl.java @@ -142,6 +142,15 @@ public class NetworkAdapterClientImpl implements NetworkAdapterClient { throw new NetworkAdapterClientException(e.getMessage()); } } + + @Override + public Response updateNetworkAsync(String aaiNetworkId, UpdateNetworkRequest req) throws NetworkAdapterClientException{ + try { + return new AdapterRestClient(this.props, this.getUri("/" + aaiNetworkId).build()).put(req); + } catch (InternalServerErrorException e) { + throw new NetworkAdapterClientException(e.getMessage()); + } + } protected UriBuilder getUri(String path) { return UriBuilder.fromPath(path); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NetworkAdapterResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NetworkAdapterResources.java index feb6ed4013..6867cb8ebb 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NetworkAdapterResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NetworkAdapterResources.java @@ -91,6 +91,11 @@ public class NetworkAdapterResources { return Optional.of(networkAdapterClient.deleteNetworkAsync(deleteNetworkRequest.getNetworkId(), deleteNetworkRequest)); } + + public Optional updateNetworkAsync(UpdateNetworkRequest updateNetworkRequest) throws UnsupportedEncodingException, NetworkAdapterClientException { + + return Optional.of(networkAdapterClient.updateNetworkAsync(updateNetworkRequest.getNetworkId(), updateNetworkRequest)); + } public Optional rollbackCreateNetwork(String networkId, RollbackNetworkRequest rollbackNetworkRequest) throws UnsupportedEncodingException, NetworkAdapterClientException { -- cgit 1.2.3-korg