aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOInfrastructureBPMN/src
diff options
context:
space:
mode:
authorSeshu Kumar M <seshu.kumar.m@huawei.com>2018-05-22 10:03:01 +0000
committerGerrit Code Review <gerrit@onap.org>2018-05-22 10:03:01 +0000
commit41e5bdb09cf638de2320eeed43c3f2c28ca645a7 (patch)
tree9dfd4024110fd065dd8aa1cb46ad4340699abf40 /bpmn/MSOInfrastructureBPMN/src
parent51561d7bd318444d44565fa27ad095ddefb6c761 (diff)
parentac9c52250c1e013f61dc922a8f27a1bd274976a8 (diff)
Merge "Added setting pnf name in pnf-pnp"
Diffstat (limited to 'bpmn/MSOInfrastructureBPMN/src')
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegate.java1
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java8
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegateTest.java47
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/bpmn/CreateAndActivatePnfResourceTest.java2
4 files changed, 54 insertions, 4 deletions
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegate.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegate.java
index bc424fd347..62b806eae8 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegate.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegate.java
@@ -49,6 +49,7 @@ public class CreateAaiEntryWithPnfIdDelegate implements JavaDelegate {
Pnf pnf = new Pnf();
pnf.setInMaint(true);
pnf.setPnfId(correlationId);
+ pnf.setPnfName(correlationId);
aaiConnection.createEntry(correlationId, pnf);
}
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java
index 1ad1f9e5a4..bffae8d892 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java
@@ -21,8 +21,10 @@
package org.openecomp.mso.bpmn.infrastructure.pnf.delegate;
import java.io.IOException;
+import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
+import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import org.onap.aai.domain.yang.Pnf;
@@ -37,7 +39,7 @@ public class AaiConnectionTestImpl implements AaiConnection {
public static final String DEFAULT_IP = "1.2.3.4";
public static final String DEFAULT_IP_V6 = "2001:db8::ff00:42:8329";
- private List<String> created = new LinkedList<>();
+ private Map<String, Pnf> created = new HashMap<>();
@Override
public Optional<Pnf> getEntryFor(String correlationId) throws IOException {
@@ -58,10 +60,10 @@ public class AaiConnectionTestImpl implements AaiConnection {
@Override
public void createEntry(String correlationId, Pnf entry) throws IOException {
- created.add(correlationId);
+ created.put(correlationId, entry);
}
- public List<String> getCreated() {
+ public Map<String, Pnf> getCreated() {
return created;
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegateTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegateTest.java
new file mode 100644
index 0000000000..3a65eaf531
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegateTest.java
@@ -0,0 +1,47 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.mso.bpmn.infrastructure.pnf.delegate;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.junit.Test;
+
+public class CreateAaiEntryWithPnfIdDelegateTest {
+
+ @Test
+ public void shouldSetPnfIdAndPnfName() throws Exception {
+ // given
+ CreateAaiEntryWithPnfIdDelegate delegate = new CreateAaiEntryWithPnfIdDelegate();
+ AaiConnectionTestImpl aaiConnection = new AaiConnectionTestImpl();
+ delegate.setAaiConnection(aaiConnection);
+ DelegateExecution execution = mock(DelegateExecution.class);
+ when(execution.getVariable(eq(CORRELATION_ID))).thenReturn("testCorrelationId");
+ // when
+ delegate.execute(execution);
+ // then
+ assertThat(aaiConnection.getCreated().get("testCorrelationId").getPnfId()).isEqualTo("testCorrelationId");
+ assertThat(aaiConnection.getCreated().get("testCorrelationId").getPnfName()).isEqualTo("testCorrelationId");
+ }
+} \ No newline at end of file
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/bpmn/CreateAndActivatePnfResourceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/bpmn/CreateAndActivatePnfResourceTest.java
index cceb271778..ada5a902a7 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/bpmn/CreateAndActivatePnfResourceTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/bpmn/CreateAndActivatePnfResourceTest.java
@@ -136,7 +136,7 @@ public class CreateAndActivatePnfResourceTest {
"WaitForDmaapPnfReadyNotification",
"AaiEntryUpdated"
);
- assertThat(aaiConnection.getCreated()).containsExactly(ID_WITHOUT_ENTRY);
+ assertThat(aaiConnection.getCreated()).containsOnlyKeys(ID_WITHOUT_ENTRY);
}
private List<HistoricVariableInstance> getVariables(ProcessInstance instance) {