use of com.cloud.api.ResponseGenerator in project cosmic by MissionCriticalCloud.
the class ListCfgCmdTest method setUp.
@Override
@Before
public void setUp() {
responseGenerator = Mockito.mock(ResponseGenerator.class);
mgr = Mockito.mock(ManagementService.class);
listCfgsByCmd = new ListCfgsByCmd();
}
use of com.cloud.api.ResponseGenerator in project cosmic by MissionCriticalCloud.
the class RegionCmdTest method testCreateSuccess.
@Test
public void testCreateSuccess() {
final RegionService regionService = Mockito.mock(RegionService.class);
final Region region = Mockito.mock(Region.class);
Mockito.when(regionService.addRegion(Matchers.anyInt(), Matchers.anyString(), Matchers.anyString())).thenReturn(region);
addRegionCmd._regionService = regionService;
responseGenerator = Mockito.mock(ResponseGenerator.class);
final RegionResponse regionResponse = Mockito.mock(RegionResponse.class);
Mockito.when(responseGenerator.createRegionResponse(region)).thenReturn(regionResponse);
addRegionCmd._responseGenerator = responseGenerator;
addRegionCmd.execute();
}
use of com.cloud.api.ResponseGenerator in project cosmic by MissionCriticalCloud.
the class ScaleVMCmdTest method testCreateSuccess.
@Test
public void testCreateSuccess() {
final UserVmService userVmService = Mockito.mock(UserVmService.class);
final UserVm userVm = Mockito.mock(UserVm.class);
try {
Mockito.when(userVmService.upgradeVirtualMachine(scaleVMCmd)).thenReturn(userVm);
} catch (final Exception e) {
Assert.fail("Received exception when success expected " + e.getMessage());
}
final ResponseGenerator responseGenerator = Mockito.mock(ResponseGenerator.class);
scaleVMCmd._responseGenerator = responseGenerator;
final UserVmResponse userVmResponse = Mockito.mock(UserVmResponse.class);
// List<UserVmResponse> list = Mockito.mock(UserVmResponse.class);
// list.add(userVmResponse);
// LinkedList<UserVmResponse> mockedList = Mockito.mock(LinkedList.class);
// Mockito.when(mockedList.get(0)).thenReturn(userVmResponse);
final List<UserVmResponse> list = new LinkedList<>();
list.add(userVmResponse);
Mockito.when(responseGenerator.createUserVmResponse(ResponseView.Restricted, "virtualmachine", userVm)).thenReturn(list);
scaleVMCmd._userVmService = userVmService;
scaleVMCmd.execute();
}
use of com.cloud.api.ResponseGenerator in project cosmic by MissionCriticalCloud.
the class UpdateHostPasswordCmdTest method setUp.
@Override
@Before
public void setUp() {
responseGenerator = Mockito.mock(ResponseGenerator.class);
managementServer = Mockito.mock(ManagementService.class);
resourceService = Mockito.mock(ResourceService.class);
updateHostPasswordCmd = new UpdateHostPasswordCmd();
}
use of com.cloud.api.ResponseGenerator in project cosmic by MissionCriticalCloud.
the class AddIpToVmNicTest method testCreateSuccess.
@Test
public void testCreateSuccess() throws ResourceAllocationException, ResourceUnavailableException, ConcurrentOperationException, InsufficientCapacityException {
final NetworkService networkService = Mockito.mock(NetworkService.class);
final AddIpToVmNicCmd ipTonicCmd = Mockito.mock(AddIpToVmNicCmd.class);
final NicSecondaryIp secIp = Mockito.mock(NicSecondaryIp.class);
Mockito.when(networkService.allocateSecondaryGuestIP(Matchers.anyLong(), Matchers.anyString())).thenReturn(secIp);
ipTonicCmd._networkService = networkService;
responseGenerator = Mockito.mock(ResponseGenerator.class);
final NicSecondaryIpResponse ipres = Mockito.mock(NicSecondaryIpResponse.class);
Mockito.when(responseGenerator.createSecondaryIPToNicResponse(secIp)).thenReturn(ipres);
ipTonicCmd._responseGenerator = responseGenerator;
ipTonicCmd.execute();
}
Aggregations