use of org.onap.appc.client.lcm.model.Status in project so by onap.
the class ApplicationControllerTaskImplTest method testExcute_lock.
@Test
public void testExcute_lock() throws JsonProcessingException, ApplicationControllerOrchestratorException {
request.setAction(Action.Lock);
Mockito.when(applicationControllerClient.vnfCommand(request.getAction(), "testRequestId", request.getApplicationControllerVnf().getVnfId(), Optional.empty(), Optional.empty(), "testControllerType", listener, "testRequestorId")).thenReturn(new Status());
Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
Mockito.verify(applicationControllerClient).vnfCommand(request.getAction(), "testRequestId", request.getApplicationControllerVnf().getVnfId(), Optional.empty(), Optional.empty(), "testControllerType", listener, "testRequestorId");
}
use of org.onap.appc.client.lcm.model.Status in project so by onap.
the class ApplicationControllerTaskImplTest method testExcute_distributeTraffic.
@Test
public void testExcute_distributeTraffic() throws JsonProcessingException, ApplicationControllerOrchestratorException {
request.setAction(Action.DistributeTraffic);
Parameters parameters = new Parameters();
ConfigurationParameters configParams = new ConfigurationParameters();
configParams.setBookName(request.getBookName());
configParams.setNodeList(request.getNodeList());
configParams.setFileParameterContent(request.getFileParameters());
configParams.setVnfName(request.getApplicationControllerVnf().getVnfName());
parameters.setConfigurationParameters(configParams);
Optional<String> payload = Optional.of((mapper.getMapper().writeValueAsString(parameters)));
Mockito.when(applicationControllerClient.vnfCommand(request.getAction(), "testRequestId", request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType", listener, "testRequestorId")).thenReturn(new Status());
Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
Mockito.verify(applicationControllerClient).vnfCommand(request.getAction(), "testRequestId", request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType", listener, "testRequestorId");
}
use of org.onap.appc.client.lcm.model.Status in project so by onap.
the class ApplicationControllerTaskImplTest method testExcute_resumeTraffic.
@Test
public void testExcute_resumeTraffic() throws JsonProcessingException, ApplicationControllerOrchestratorException {
request.setAction(Action.ResumeTraffic);
Parameters parameters = new Parameters();
ConfigurationParameters configParams = new ConfigurationParameters();
configParams.setVnfName(request.getApplicationControllerVnf().getVnfName());
parameters.setConfigurationParameters(configParams);
Optional<String> payload = Optional.of((mapper.getMapper().writeValueAsString(parameters)));
Mockito.when(applicationControllerClient.vnfCommand(request.getAction(), "testRequestId", request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType", listener, "testRequestorId")).thenReturn(new Status());
Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
Mockito.verify(applicationControllerClient).vnfCommand(request.getAction(), "testRequestId", request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType", listener, "testRequestorId");
}
use of org.onap.appc.client.lcm.model.Status in project so by onap.
the class ApplicationControllerTaskImplTest method testExcute_upgradeBackup.
@Test
public void testExcute_upgradeBackup() throws JsonProcessingException, ApplicationControllerOrchestratorException {
request.setAction(Action.UpgradeBackup);
Parameters parameters = new Parameters();
parameters.setExistingSoftwareVersion(request.getExistingSoftwareVersion());
parameters.setNewSoftwareVersion(request.getNewSoftwareVersion());
Optional<String> payload = Optional.of((mapper.getMapper().writeValueAsString(parameters)));
Mockito.when(applicationControllerClient.vnfCommand(request.getAction(), "testRequestId", request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType", listener, "testRequestorId")).thenReturn(new Status());
Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
Mockito.verify(applicationControllerClient).vnfCommand(request.getAction(), "testRequestId", request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType", listener, "testRequestorId");
}
use of org.onap.appc.client.lcm.model.Status in project so by onap.
the class ApplicationControllerClient method runCommand.
public Status runCommand(Action action, org.onap.appc.client.lcm.model.ActionIdentifiers actionIdentifiers, org.onap.appc.client.lcm.model.Payload payload, String requestID, ApplicationControllerCallback listener, String requestorId) throws ApplicationControllerOrchestratorException {
Status status;
Object requestObject;
requestObject = createRequest(action, actionIdentifiers, payload, requestID, requestorId);
appCSupport.logLCMMessage(requestObject);
LifeCycleManagerStateful client = getAppCClient();
Method lcmMethod = appCSupport.getAPIMethod(action.name(), client, true);
try {
Object response = lcmMethod.invoke(client, requestObject, listener);
if (response != null) {
return appCSupport.getStatusFromGenericResponse(response);
} else {
return new Status();
}
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
throw new RuntimeException(String.format("%s : %s", "Unable to invoke action", action.toString()), e);
}
}
Aggregations