Search in sources :

Example 1 with UsageService

use of org.apache.cloudstack.usage.UsageService in project cloudstack by apache.

the class UsageCmdTest method testExecuteEmptyResult.

@Test
public void testExecuteEmptyResult() {
    UsageService usageService = Mockito.mock(UsageService.class);
    Pair<List<? extends Usage>, Integer> usageRecords = new Pair<List<? extends Usage>, Integer>(new ArrayList<Usage>(), new Integer(0));
    Mockito.when(usageService.getUsageRecords(getUsageRecordsCmd)).thenReturn(usageRecords);
    getUsageRecordsCmd._usageService = usageService;
    getUsageRecordsCmd.execute();
}
Also used : Usage(org.apache.cloudstack.usage.Usage) UsageService(org.apache.cloudstack.usage.UsageService) ArrayList(java.util.ArrayList) List(java.util.List) Pair(com.cloud.utils.Pair) Test(org.junit.Test)

Example 2 with UsageService

use of org.apache.cloudstack.usage.UsageService in project cloudstack by apache.

the class UsageCmdTest method testExecuteSuccess.

@Test
public void testExecuteSuccess() {
    UsageService usageService = Mockito.mock(UsageService.class);
    getUsageRecordsCmd._usageService = usageService;
    getUsageRecordsCmd.execute();
}
Also used : UsageService(org.apache.cloudstack.usage.UsageService) Test(org.junit.Test)

Aggregations

UsageService (org.apache.cloudstack.usage.UsageService)2 Test (org.junit.Test)2 Pair (com.cloud.utils.Pair)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Usage (org.apache.cloudstack.usage.Usage)1