diff options
author | waynedunican <wayne.dunican@est.tech> | 2020-06-19 15:30:59 +0100 |
---|---|---|
committer | waynedunican <wayne.dunican@est.tech> | 2020-06-26 15:30:23 +0100 |
commit | f7da60fabf647665d61f142a0d6ba9a9fc940106 (patch) | |
tree | 93ddc1c8a089a847077ccc6c5a0ca7dee7737bf2 /models-interactions/model-impl/aai/src | |
parent | 93e2ba2e1756596323774398673736946b220090 (diff) |
Clean up of Pair classes - models
Removed Pair class from policy-models and replaced with Aoache Common
Pair class
Issue-ID: POLICY-2202
Change-Id: I786467ac02ecb2d433dba94deba45785be3dcf23
Signed-off-by: waynedunican <wayne.dunican@est.tech>
Diffstat (limited to 'models-interactions/model-impl/aai/src')
-rw-r--r-- | models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiManager.java | 24 | ||||
-rw-r--r-- | models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiManagerTest.java | 14 |
2 files changed, 19 insertions, 19 deletions
diff --git a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiManager.java b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiManager.java index 81aea9f98..76817dfc6 100644 --- a/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiManager.java +++ b/models-interactions/model-impl/aai/src/main/java/org/onap/policy/aai/AaiManager.java @@ -3,7 +3,7 @@ * aai * ================================================================================ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019-2020 Nordix Foundation. * Modifications Copyright (C) 2019 Samsung Electronics Co., Ltd. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -29,6 +29,7 @@ import java.util.HashMap; import java.util.Map; import java.util.UUID; import java.util.stream.Collectors; +import org.apache.commons.lang3.tuple.Pair; import org.json.JSONArray; import org.json.JSONObject; import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; @@ -37,7 +38,6 @@ import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; import org.onap.policy.rest.RestManager; -import org.onap.policy.rest.RestManager.Pair; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -154,17 +154,17 @@ public final class AaiManager { return null; } - int httpResponseCode = httpDetails.first; + int httpResponseCode = httpDetails.getLeft(); NetLoggerUtil.log(EventType.IN, CommInfrastructure.REST, url, "Response code: " + httpResponseCode); - NetLoggerUtil.getNetworkLogger().debug(httpDetails.second); + NetLoggerUtil.getNetworkLogger().debug(httpDetails.getRight()); logger.debug(url); logger.debug("{}", httpResponseCode); - logger.debug(httpDetails.second); + logger.debug(httpDetails.getRight()); - if (httpDetails.second != null) { - return new AaiCqResponse(httpDetails.second); + if (httpDetails.getRight() != null) { + return new AaiCqResponse(httpDetails.getRight()); } return null; } @@ -197,17 +197,17 @@ public final class AaiManager { return null; } - int httpResponseCode = httpDetailsGet.first; + int httpResponseCode = httpDetailsGet.getLeft(); NetLoggerUtil.log(EventType.IN, CommInfrastructure.REST, url, "Response code: " + httpResponseCode); - NetLoggerUtil.getNetworkLogger().debug(httpDetailsGet.second); + NetLoggerUtil.getNetworkLogger().debug(httpDetailsGet.getRight()); logger.debug(urlGet); logger.debug("{}", httpResponseCode); - logger.debug(httpDetailsGet.second); + logger.debug(httpDetailsGet.getRight()); - if (httpResponseCode == 200 && httpDetailsGet.second != null) { - return httpDetailsGet.second; + if (httpResponseCode == 200 && httpDetailsGet.getRight() != null) { + return httpDetailsGet.getRight(); } try { Thread.sleep(1000); diff --git a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiManagerTest.java b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiManagerTest.java index 8a007fb4a..33934d937 100644 --- a/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiManagerTest.java +++ b/models-interactions/model-impl/aai/src/test/java/org/onap/policy/aai/AaiManagerTest.java @@ -3,7 +3,7 @@ * aai * ================================================================================ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,10 +37,10 @@ import java.io.IOException; import java.nio.file.Files; import java.util.Map; import java.util.UUID; +import org.apache.commons.lang3.tuple.Pair; import org.junit.Before; import org.junit.Test; import org.onap.policy.rest.RestManager; -import org.onap.policy.rest.RestManager.Pair; public class AaiManagerTest { private static final String CQ_QUERY_URL = "http://testing.cq.query"; @@ -66,10 +66,10 @@ public class AaiManagerTest { String aaiCqResponse = new AaiCqResponseTest().getAaiCqResponse(); String tenantResponse = this.getTenantQueryResponse(); - httpCqResponseOk = restManagerMock.new Pair<>(200, aaiCqResponse); - httpTenantResponseOk = restManagerMock.new Pair<>(200, tenantResponse); - httpResponseErr0 = restManagerMock.new Pair<>(200, null); - httpResponseErr1 = restManagerMock.new Pair<>(200, "{"); + httpCqResponseOk = Pair.of(200, aaiCqResponse); + httpTenantResponseOk = Pair.of(200, tenantResponse); + httpResponseErr0 = Pair.of(200, null); + httpResponseErr1 = Pair.of(200, "{"); } @@ -128,7 +128,7 @@ public class AaiManagerTest { String pnfResponse = "{\"pnf-name\":" + pnfName + ",\"pnf-id\":\"123456\",\"in-maint\":false,\"ipaddress-v4-oam\":\"1.1.1.1\"}"; - Pair<Integer, String> pnfHttpResponse = restManagerMock.new Pair<>(200, pnfResponse); + Pair<Integer, String> pnfHttpResponse = Pair.of(200, pnfResponse); when(restManagerMock.get(contains(pnfName), eq(DOROTHY), eq("Gale"), anyMap())) .thenReturn(pnfHttpResponse); |