summaryrefslogtreecommitdiffstats
path: root/so-cnf-adapter-application/src
diff options
context:
space:
mode:
Diffstat (limited to 'so-cnf-adapter-application/src')
-rw-r--r--so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/rest/CnfAdapterRest.java3
-rw-r--r--so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/synchrornization/SynchronizationService.java3
-rw-r--r--so-cnf-adapter-application/src/test/java/org/onap/so/adapters/cnf/rest/CnfAdapterRestTest.java7
3 files changed, 10 insertions, 3 deletions
diff --git a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/rest/CnfAdapterRest.java b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/rest/CnfAdapterRest.java
index df674f8..afce775 100644
--- a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/rest/CnfAdapterRest.java
+++ b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/rest/CnfAdapterRest.java
@@ -183,7 +183,7 @@ public class CnfAdapterRest {
logger.info("Processing aai delete");
AaiCallbackResponse callbackResponse = new AaiCallbackResponse();
try {
- synchronizationService.deleteSubscriptionIfExists(aaiRequest);
+ synchronizationService.deleteSubscriptionIfExists(aaiRequest.getInstanceId());
aaiService.aaiDelete(aaiRequest);
callbackResponse.setCompletionStatus(AaiCallbackResponse.CompletionStatus.COMPLETED);
} catch (Exception e) {
@@ -306,6 +306,7 @@ public class CnfAdapterRest {
logger.warn("Undefined instance ID delete attempt. Skipping delete");
return "";
}
+ synchronizationService.deleteSubscriptionIfExists(instanceID);
return cnfAdapterService.deleteInstanceByInstanceId(instanceID);
}
diff --git a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/synchrornization/SynchronizationService.java b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/synchrornization/SynchronizationService.java
index c4e5968..5397e2a 100644
--- a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/synchrornization/SynchronizationService.java
+++ b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/synchrornization/SynchronizationService.java
@@ -99,9 +99,8 @@ public class SynchronizationService {
logger.debug("createSubscriptionIfNotExists- END");
}
- public void deleteSubscriptionIfExists(AaiRequest aaiRequest) throws BadResponseException {
+ public void deleteSubscriptionIfExists(String instanceId) throws BadResponseException {
logger.debug("deleteSubscriptionIfExists - START");
- String instanceId = aaiRequest.getInstanceId();
String subscriptionName = getSubscriptionName(instanceId);
if (isSubscriptionActive(subscriptionName)) {
diff --git a/so-cnf-adapter-application/src/test/java/org/onap/so/adapters/cnf/rest/CnfAdapterRestTest.java b/so-cnf-adapter-application/src/test/java/org/onap/so/adapters/cnf/rest/CnfAdapterRestTest.java
index 1b16580..8354121 100644
--- a/so-cnf-adapter-application/src/test/java/org/onap/so/adapters/cnf/rest/CnfAdapterRestTest.java
+++ b/so-cnf-adapter-application/src/test/java/org/onap/so/adapters/cnf/rest/CnfAdapterRestTest.java
@@ -52,6 +52,7 @@ import org.onap.so.adapters.cnf.service.CnfAdapterService;
import org.onap.so.adapters.cnf.service.aai.AaiService;
import org.onap.so.adapters.cnf.service.healthcheck.HealthCheckService;
import org.onap.so.adapters.cnf.service.statuscheck.SimpleStatusCheckService;
+import org.onap.so.adapters.cnf.service.synchrornization.SynchronizationService;
import org.onap.so.adapters.cnf.service.upgrade.InstanceUpgradeService;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.HttpStatus;
@@ -67,6 +68,7 @@ import java.util.Map;
import static org.assertj.core.api.Java6Assertions.assertThat;
import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.doCallRealMethod;
@SpringBootTest
@@ -80,6 +82,9 @@ public class CnfAdapterRestTest {
CnfAdapterService cnfAdapterService;
@Mock
+ SynchronizationService synchService;
+
+ @Mock
InstanceUpgradeService instanceUpgradeService;
@Mock
@@ -149,7 +154,9 @@ public class CnfAdapterRestTest {
String instanceId = "123";
ResponseEntity<String> response = new ResponseEntity<String>(HttpStatus.OK);
CnfAdapterService cnfAdapterService = Mockito.mock(CnfAdapterService.class);
+ SynchronizationService synchService = Mockito.mock(SynchronizationService.class);
Mockito.when(cnfAdapterService.deleteInstanceByInstanceId(instanceId)).thenReturn(String.valueOf(response));
+ doCallRealMethod().when(synchService).deleteSubscriptionIfExists(instanceId);
cnfAdapterRest.deleteInstanceByInstanceId(instanceId);
Assert.assertNotNull(response);
assertEquals(HttpStatus.OK, response.getStatusCode());