use of org.apache.cloudstack.api.response.QuotaStatementResponse in project cloudstack by apache.
the class QuotaStatementCmdTest method testQuotaStatementCmd.
@Test
public void testQuotaStatementCmd() throws NoSuchFieldException, IllegalAccessException {
QuotaStatementCmd cmd = new QuotaStatementCmd();
cmd.setAccountName("admin");
Field rbField = QuotaStatementCmd.class.getDeclaredField("_responseBuilder");
rbField.setAccessible(true);
rbField.set(cmd, responseBuilder);
List<QuotaUsageVO> quotaUsageVOList = new ArrayList<QuotaUsageVO>();
Mockito.when(responseBuilder.getQuotaUsage(Mockito.eq(cmd))).thenReturn(quotaUsageVOList);
Mockito.when(responseBuilder.createQuotaStatementResponse(Mockito.eq(quotaUsageVOList))).thenReturn(new QuotaStatementResponse());
cmd.execute();
Mockito.verify(responseBuilder, Mockito.times(1)).getQuotaUsage(Mockito.eq(cmd));
}
use of org.apache.cloudstack.api.response.QuotaStatementResponse in project cloudstack by apache.
the class QuotaStatementCmd method execute.
@Override
public void execute() {
List<QuotaUsageVO> quotaUsage = _responseBuilder.getQuotaUsage(this);
QuotaStatementResponse response = _responseBuilder.createQuotaStatementResponse(quotaUsage);
response.setStartDate(startDate == null ? null : new Date(startDate.getTime()));
response.setEndDate(endDate == null ? null : new Date(endDate.getTime()));
response.setResponseName(getCommandName());
setResponseObject(response);
}
Aggregations