use of com.cloud.agent.api.UnPlugNicAnswer in project cloudstack by apache.
the class ManagementServerMock method deleteVM.
public void deleteVM(UserVm vm, Network network) {
Answer<?> callback = new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocation) {
Object[] args = invocation.getArguments();
Commands cmds = (Commands) args[1];
if (cmds == null) {
return null;
}
UnPlugNicAnswer reply = new UnPlugNicAnswer(null, true, "PlugNic");
com.cloud.agent.api.Answer[] answers = { reply };
cmds.setAnswers(answers);
return null;
}
};
try {
Mockito.when(_agentMgr.send(Matchers.anyLong(), Matchers.any(Commands.class))).thenAnswer(callback);
} catch (AgentUnavailableException e) {
e.printStackTrace();
} catch (OperationTimedoutException e) {
e.printStackTrace();
}
_userVmDao.remove(vm.getId());
}
Aggregations