use of org.onap.appc.client.lcm.model.Action in project so by onap.
the class ApplicationControllerActionTest method runAppCCommand_ConfigModify__PayloadPresent_Test.
@Test
public void runAppCCommand_ConfigModify__PayloadPresent_Test() throws ApplicationControllerOrchestratorException {
// Prepare method
Action action = Action.ConfigModify;
String msoRequestId = "testMsoRequestId";
String vnfId = "testVnfId";
Optional<String> payload = Optional.of("testPayload");
Optional<String> vserverId = Optional.empty();
HashMap<String, String> payloadInfo = new HashMap<String, String>();
String controllerType = "testControllerType";
// Prepare mocks
Status status = new Status();
doReturn(status).when(client).vnfCommand(action, msoRequestId, vnfId, vserverId, payload, controllerType);
// Run method
appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType);
// Verify call
verify(client, times(1)).vnfCommand(action, msoRequestId, vnfId, vserverId, payload, controllerType);
}
use of org.onap.appc.client.lcm.model.Action in project so by onap.
the class ApplicationControllerActionTest method runAppCCommand_InvalidAppCAction_Test.
@Test
public void runAppCCommand_InvalidAppCAction_Test() throws ApplicationControllerOrchestratorException {
// Prepare method
Action action = Action.ActionStatus;
String msoRequestId = "testMsoRequestId";
String vnfId = "testVnfId";
Optional<String> payload = Optional.empty();
HashMap<String, String> payloadInfo = new HashMap<String, String>();
String controllerType = "testControllerType";
// Run method
appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType);
// Verify non call
verify(client, times(0)).vnfCommand(any(), any(), any(), any(), any(), any());
// TODO For original author/architect: it appears that whoever coded this wanted the error message to be "Unable
// to idenify Action request for AppCClient" and this is not the case because of the
// ApplicationControllerSupport.getCategoryOf(appCStatus) call with a null appCStatus, so this may be something
// worth looking into
}
use of org.onap.appc.client.lcm.model.Action in project so by onap.
the class ApplicationControllerActionTest method runAppCCommand_Snapshot_vmId_null_Test.
@Test
public void runAppCCommand_Snapshot_vmId_null_Test() throws ApplicationControllerOrchestratorException, JsonProcessingException {
Action action = Action.Snapshot;
String msoRequestId = "testMsoRequestId";
String vnfId = "testVnfId";
Optional<String> payload = Optional.empty();
HashMap<String, String> payloadInfo = new HashMap<String, String>();
payloadInfo.put("identityUrl", "testIdentityUrl");
JSONObject vmIdListJson = new JSONObject();
payloadInfo.put("vmIdList", vmIdListJson.toString());
String controllerType = "testControllerType";
Status status = new Status();
Optional<String> otherPayloadVm = PayloadClient.snapshotFormat("", payloadInfo.get("identityUrl"));
doReturn(status).when(client).vnfCommand(action, msoRequestId, vnfId, null, otherPayloadVm, controllerType);
appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType);
verify(client, times(0)).vnfCommand(action, msoRequestId, vnfId, null, otherPayloadVm, controllerType);
}
use of org.onap.appc.client.lcm.model.Action in project so by onap.
the class ApplicationControllerActionTest method runAppCCommand_Snapshot_vserverId_null_Test.
@Test
public void runAppCCommand_Snapshot_vserverId_null_Test() throws ApplicationControllerOrchestratorException, JsonProcessingException {
Action action = Action.Snapshot;
String msoRequestId = "testMsoRequestId";
String vnfId = "testVnfId";
Optional<String> payload = Optional.empty();
HashMap<String, String> payloadInfo = new HashMap<String, String>();
payloadInfo.put("identityUrl", "testIdentityUrl");
ArrayList<String> vmIdList = new ArrayList<String>();
String vmId = "testlink:testVmId1";
vmIdList.add(vmId);
JSONObject vmIdListJson = new JSONObject();
vmIdListJson.put("vmIds", vmIdList);
payloadInfo.put("vmIdList", vmIdListJson.toString());
JSONObject vserverIdListJson = new JSONObject();
payloadInfo.put("vserverIdList", vserverIdListJson.toString());
String controllerType = "testControllerType";
Status status = new Status();
Optional<String> otherPayloadVm = PayloadClient.snapshotFormat(vmId, payloadInfo.get("identityUrl"));
doReturn(status).when(client).vnfCommand(action, msoRequestId, vnfId, null, otherPayloadVm, controllerType);
appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType);
verify(client, times(0)).vnfCommand(action, msoRequestId, vnfId, null, otherPayloadVm, controllerType);
}
use of org.onap.appc.client.lcm.model.Action in project so by onap.
the class ApplicationControllerActionTest method runAppCCommand_ResumeTraffic_Test.
@Test
public void runAppCCommand_ResumeTraffic_Test() throws ApplicationControllerOrchestratorException, JsonProcessingException {
// Prepare method
Action action = Action.ResumeTraffic;
String msoRequestId = "testMsoRequestId";
String vnfId = "testVnfId";
Optional<String> payload = Optional.empty();
Optional<String> vserverId = Optional.empty();
HashMap<String, String> payloadInfo = new HashMap<String, String>();
payloadInfo.put("vnfName", "testVnfName");
String controllerType = "testControllerType";
// Prepare mocks
Status status = new Status();
Optional<String> otherPayload = PayloadClient.resumeTrafficFormat(payloadInfo.get("vnfName"));
doReturn(status).when(client).vnfCommand(action, msoRequestId, vnfId, vserverId, otherPayload, controllerType);
// Run method
appCAction.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType);
// Verify call
verify(client, times(1)).vnfCommand(action, msoRequestId, vnfId, vserverId, otherPayload, controllerType);
}
Aggregations