summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks
diff options
context:
space:
mode:
authorKuleshov, Elena <evn@att.com>2019-07-18 16:40:01 -0400
committerBenjamin, Max (mb388a) <mb388a@att.com>2019-07-18 16:40:02 -0400
commitdbcf6c1f4c76d7f6c417fb9cfa8782fc52b625de (patch)
tree35b55bc131cbf02766d17a0eae6ddb5d4e19b640 /bpmn/so-bpmn-tasks
parent98bbc90b0dc066627c8653ccf8982319a7103c1a (diff)
Set networkName value to the name from L3network
Set networkName value to the name from L3network object. Add JUnit argument captures for naming creates Fix formatting errors in the JUnit file. Issue-ID: SO-2123 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com> Change-Id: Ie4d2bd86f1a47bd5742aa7786dc9cba47fa11392
Diffstat (limited to 'bpmn/so-bpmn-tasks')
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasksTest.java26
2 files changed, 25 insertions, 3 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java
index 155455e654..ea0b408e41 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java
@@ -108,7 +108,7 @@ public class NamingServiceCreateTasks {
namingRequestObject.setNamingTypeValue(NamingServiceConstants.NAMING_TYPE_SERVICE);
namingRequestObject.setServiceModelNameValue(serviceInstance.getModelInfoServiceInstance().getModelName());
namingRequestObject.setModelVersionValue(serviceInstance.getModelInfoServiceInstance().getModelVersion());
- namingRequestObject.setNetworkNameValue(execution.getVariable(network.getNetworkName()));
+ namingRequestObject.setNetworkNameValue(network.getNetworkName());
namingRequestObject.setVpnNameValue(vpnBinding.getVpnName());
namingRequestObject.setResourceNameValue(NamingServiceConstants.RESOURCE_NAME_SERVICE_INSTANCE_NAME);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasksTest.java
index 44e5e0e707..609d2dabd8 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasksTest.java
@@ -21,6 +21,7 @@
package org.onap.so.bpmn.infrastructure.namingservice.tasks;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.doReturn;
@@ -31,6 +32,7 @@ import static org.mockito.Mockito.when;
import java.util.Optional;
import org.junit.Before;
import org.junit.Test;
+import org.mockito.ArgumentCaptor;
import org.mockito.ArgumentMatchers;
import org.mockito.InjectMocks;
import org.mockito.Mock;
@@ -47,6 +49,8 @@ import org.onap.so.client.aai.AAICommonObjectMapperProvider;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.Relationships;
import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.client.namingservice.NamingRequestObject;
+import org.onap.so.client.namingservice.NamingServiceConstants;
public class NamingServiceCreateTasksTest extends BaseTaskTest {
@InjectMocks
@@ -106,9 +110,17 @@ public class NamingServiceCreateTasksTest extends BaseTaskTest {
String generatedName = "generatedWanTransportServiceName";
doReturn(generatedName).when(namingServiceResources).generateServiceInstanceName(any());
NamingServiceCreateTasks spy = Mockito.spy(namingServiceCreateTasks);
+ ArgumentCaptor<NamingRequestObject> captor = ArgumentCaptor.forClass(NamingRequestObject.class);
spy.createWanTransportServiceName(execution);
- verify(namingServiceResources, times(1)).generateServiceInstanceName(any());
+ verify(namingServiceResources, times(1)).generateServiceInstanceName(captor.capture());
+ assertTrue(captor.getAllValues().get(0).getExternalKeyValue().startsWith("testServiceInstanceId"));
+ assertEquals(captor.getAllValues().get(0).getNamingTypeValue(), NamingServiceConstants.NAMING_TYPE_SERVICE);
+ assertEquals(captor.getAllValues().get(0).getResourceNameValue(),
+ NamingServiceConstants.RESOURCE_NAME_SERVICE_INSTANCE_NAME);
+ assertEquals(captor.getAllValues().get(0).getPolicyInstanceNameValue(), null);
+ assertTrue(captor.getAllValues().get(0).getServiceModelNameValue().startsWith("testModelName"));
+ assertTrue(captor.getAllValues().get(0).getModelVersionValue().startsWith("testModelVersion"));
assertEquals(generatedName, serviceInstance.getServiceInstanceName());
}
@@ -118,10 +130,20 @@ public class NamingServiceCreateTasksTest extends BaseTaskTest {
.thenReturn(buildL3Network());
when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VPN_ID)))
.thenReturn(buildVpnBinding());
+ ArgumentCaptor<NamingRequestObject> captor = ArgumentCaptor.forClass(NamingRequestObject.class);
String generatedName = "generatedWanTransportServiceName";
doReturn(generatedName).when(namingServiceResources).generateServiceInstanceName(any());
namingServiceCreateTasks.createVpnBondingServiceName(execution);
- verify(namingServiceResources, times(1)).generateServiceInstanceName(any());
+ verify(namingServiceResources, times(1)).generateServiceInstanceName(captor.capture());
+ assertTrue(captor.getAllValues().get(0).getExternalKeyValue().startsWith("testServiceInstanceId"));
+ assertEquals(captor.getAllValues().get(0).getPolicyInstanceNameValue(), null);
+ assertEquals(captor.getAllValues().get(0).getNamingTypeValue(), NamingServiceConstants.NAMING_TYPE_SERVICE);
+ assertTrue(captor.getAllValues().get(0).getServiceModelNameValue().startsWith("testModelName"));
+ assertTrue(captor.getAllValues().get(0).getModelVersionValue().startsWith("testModelVersion"));
+ assertTrue(captor.getAllValues().get(0).getNetworkNameValue().startsWith("testNetworkName"));
+ assertTrue(captor.getAllValues().get(0).getVpnNameValue().startsWith("testVpnName"));
+ assertEquals(captor.getAllValues().get(0).getResourceNameValue(),
+ NamingServiceConstants.RESOURCE_NAME_SERVICE_INSTANCE_NAME);
assertEquals(generatedName, serviceInstance.getServiceInstanceName());
}
}