diff options
author | 2021-01-05 11:03:15 -0500 | |
---|---|---|
committer | 2021-01-05 11:03:15 -0500 | |
commit | c05a742002beefa826c60532c7cb110464ed4f16 (patch) | |
tree | c4f3dc1456b118e5a59695017d74f82678afd031 /graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client | |
parent | e036ebd43a0b58eda96b2546290bba2189bb3824 (diff) |
Change to not exception on delete when object
Change to not exception on delete when object doesnt exist
Added a new deleteIfExist method to the graph client and unit test
Issue-ID: SO-3464
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Change-Id: If73721cd83b94bd5a1db1af26aba212b12236fe1
Diffstat (limited to 'graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client')
-rw-r--r-- | graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIResourcesClientTest.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIResourcesClientTest.java b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIResourcesClientTest.java index 36ba1f3e76..03fd0acd4f 100644 --- a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIResourcesClientTest.java +++ b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIResourcesClientTest.java @@ -108,6 +108,27 @@ public class AAIResourcesClientTest { } @Test + public void verifyDeleteIfExists() { + AAIResourceUri path = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("test2")); + wireMockRule.stubFor(get(urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build())) + .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(404))); + AAIResourcesClient client = aaiClient; + client.deleteIfExists(path); + } + + @Test + public void verifyDeleteIfExists_exists() { + AAIResourceUri path = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("test2")); + wireMockRule.stubFor(get(urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build())) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("aai/resources/mockObject.json").withStatus(200))); + wireMockRule.stubFor(delete(urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build())) + .withQueryParam("resource-version", equalTo("1234")).willReturn(aResponse().withStatus(204))); + AAIResourcesClient client = aaiClient; + client.deleteIfExists(path); + } + + @Test public void verifyBasicAuth() { AAIResourceUri path = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("test3")); wireMockRule.stubFor(get(urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build().toString())) |