use of org.apache.cloudstack.api.ResponseGenerator in project cloudstack by apache.
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 org.apache.cloudstack.api.ResponseGenerator in project cloudstack by apache.
the class AddHostCmdTest method setUp.
@Override
@Before
public void setUp() {
resourceService = Mockito.mock(ResourceService.class);
responseGenerator = Mockito.mock(ResponseGenerator.class);
addHostCmd = new AddHostCmd() {
};
}
use of org.apache.cloudstack.api.ResponseGenerator in project cloudstack by apache.
the class AddSecondaryStorageCmdTest method testExecuteForResult.
@Test
public void testExecuteForResult() throws Exception {
StorageService resourceService = Mockito.mock(StorageService.class);
addImageStoreCmd._storageService = resourceService;
ImageStore store = Mockito.mock(ImageStore.class);
Mockito.when(resourceService.discoverImageStore(anyString(), anyString(), anyString(), anyLong(), (Map) anyObject())).thenReturn(store);
ResponseGenerator responseGenerator = Mockito.mock(ResponseGenerator.class);
addImageStoreCmd._responseGenerator = responseGenerator;
ImageStoreResponse responseHost = new ImageStoreResponse();
responseHost.setName("Test");
Mockito.when(responseGenerator.createImageStoreResponse(store)).thenReturn(responseHost);
addImageStoreCmd.execute();
Mockito.verify(responseGenerator).createImageStoreResponse(store);
ImageStoreResponse actualResponse = (ImageStoreResponse) addImageStoreCmd.getResponseObject();
Assert.assertEquals(responseHost, actualResponse);
Assert.assertEquals("addimagestoreresponse", actualResponse.getResponseName());
}
use of org.apache.cloudstack.api.ResponseGenerator in project cloudstack by apache.
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 org.apache.cloudstack.api.ResponseGenerator in project cloudstack by apache.
the class RegionCmdTest method testCreateSuccess.
@Test
public void testCreateSuccess() {
RegionService regionService = Mockito.mock(RegionService.class);
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);
RegionResponse regionResponse = Mockito.mock(RegionResponse.class);
Mockito.when(responseGenerator.createRegionResponse(region)).thenReturn(regionResponse);
addRegionCmd._responseGenerator = responseGenerator;
addRegionCmd.execute();
}
Aggregations