Search in sources :

Example 1 with ListNetworkOfferingsCmd

use of org.apache.cloudstack.api.command.user.network.ListNetworkOfferingsCmd in project cloudstack by apache.

the class ConfigurationManagerTest method searchForNetworkOfferingsTest.

@Test
public void searchForNetworkOfferingsTest() {
    NetworkOfferingJoinVO forVpcOfferingJoinVO = new NetworkOfferingJoinVO();
    forVpcOfferingJoinVO.setForVpc(true);
    List<NetworkOfferingJoinVO> offerings = Arrays.asList(new NetworkOfferingJoinVO(), new NetworkOfferingJoinVO(), forVpcOfferingJoinVO);
    Mockito.when(networkOfferingJoinDao.createSearchCriteria()).thenReturn(Mockito.mock(SearchCriteria.class));
    Mockito.when(networkOfferingJoinDao.search(Mockito.any(SearchCriteria.class), Mockito.any(Filter.class))).thenReturn(offerings);
    ListNetworkOfferingsCmd cmd = Mockito.spy(ListNetworkOfferingsCmd.class);
    Mockito.when(cmd.getPageSize()).thenReturn(10);
    assertThat(configurationMgr.searchForNetworkOfferings(cmd).second(), is(3));
    Mockito.when(cmd.getForVpc()).thenReturn(Boolean.FALSE);
    assertThat(configurationMgr.searchForNetworkOfferings(cmd).second(), is(2));
}
Also used : Filter(com.cloud.utils.db.Filter) NetworkOfferingJoinVO(com.cloud.api.query.vo.NetworkOfferingJoinVO) ListNetworkOfferingsCmd(org.apache.cloudstack.api.command.user.network.ListNetworkOfferingsCmd) SearchCriteria(com.cloud.utils.db.SearchCriteria) Test(org.junit.Test)

Aggregations

NetworkOfferingJoinVO (com.cloud.api.query.vo.NetworkOfferingJoinVO)1 Filter (com.cloud.utils.db.Filter)1 SearchCriteria (com.cloud.utils.db.SearchCriteria)1 ListNetworkOfferingsCmd (org.apache.cloudstack.api.command.user.network.ListNetworkOfferingsCmd)1 Test (org.junit.Test)1