use of com.cloud.api.response.ConfigurationResponse in project CloudStack-archive by CloudStack-extras.
the class ListCfgsByCmd method execute.
@Override
public void execute() {
List<? extends Configuration> result = _mgr.searchForConfigurations(this);
ListResponse<ConfigurationResponse> response = new ListResponse<ConfigurationResponse>();
List<ConfigurationResponse> configResponses = new ArrayList<ConfigurationResponse>();
for (Configuration cfg : result) {
ConfigurationResponse cfgResponse = _responseGenerator.createConfigurationResponse(cfg);
cfgResponse.setObjectName("configuration");
configResponses.add(cfgResponse);
}
response.setResponses(configResponses);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
use of com.cloud.api.response.ConfigurationResponse in project cosmic by MissionCriticalCloud.
the class UpdateCfgCmdTest method testCreateSuccess.
@Test
public void testCreateSuccess() {
final Configuration cfg = Mockito.mock(Configuration.class);
updateCfgCmd._configService = configService;
updateCfgCmd._responseGenerator = responseGenerator;
try {
Mockito.when(configService.updateConfiguration(updateCfgCmd)).thenReturn(cfg);
} catch (final Exception e) {
Assert.fail("Received exception when success expected " + e.getMessage());
}
final ConfigurationResponse response = new ConfigurationResponse();
response.setName("Test case");
Mockito.when(responseGenerator.createConfigurationResponse(cfg)).thenReturn(response);
updateCfgCmd.execute();
Mockito.verify(responseGenerator).createConfigurationResponse(cfg);
final ConfigurationResponse actualResponse = (ConfigurationResponse) updateCfgCmd.getResponseObject();
Assert.assertEquals(response, actualResponse);
Assert.assertEquals("updateconfigurationresponse", response.getResponseName());
}
Aggregations