diff options
author | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-02-24 10:50:44 -0500 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-02-24 10:50:59 -0500 |
commit | 32d2160da8478abcfae686747fba6296369e353c (patch) | |
tree | 2e00bd3a6dda4bab9e0b89d479fc304b7d3c874d /bpmn/so-bpmn-tasks/src/main | |
parent | 57af0e334073b329ca9f48b353ab4cc3bd2027a8 (diff) |
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) <mb388a@us.att.com>
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main')
4 files changed, 20 insertions, 0 deletions
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<Response> updateNetworkAsync(UpdateNetworkRequest updateNetworkRequest) throws UnsupportedEncodingException, NetworkAdapterClientException { + + return Optional.of(networkAdapterClient.updateNetworkAsync(updateNetworkRequest.getNetworkId(), updateNetworkRequest)); + } public Optional<RollbackNetworkResponse> rollbackCreateNetwork(String networkId, RollbackNetworkRequest rollbackNetworkRequest) throws UnsupportedEncodingException, NetworkAdapterClientException { |