Search in sources :

Example 1 with VXCredentialStore

use of org.apache.ranger.view.VXCredentialStore in project ranger by apache.

the class TestAssetREST method vXCredentialStore.

private VXCredentialStore vXCredentialStore() {
    VXCredentialStore vXCredentialStore = new VXCredentialStore();
    vXCredentialStore.setId(Id);
    vXCredentialStore.setName("TestAssetRest");
    vXCredentialStore.setDescription("TestAssetRest");
    vXCredentialStore.setOwner("owner");
    return vXCredentialStore;
}
Also used : VXCredentialStore(org.apache.ranger.view.VXCredentialStore)

Example 2 with VXCredentialStore

use of org.apache.ranger.view.VXCredentialStore in project ranger by apache.

the class TestAssetREST method testGetXCredentialStore.

@Test
public void testGetXCredentialStore() {
    VXCredentialStore vXCredentialStore = vXCredentialStore();
    Mockito.when(assetMgr.getXCredentialStore(Id)).thenReturn(vXCredentialStore);
    VXCredentialStore actualvXCredentialStore = assetREST.getXCredentialStore(Id);
    Assert.assertNotNull(actualvXCredentialStore);
    Assert.assertEquals(vXCredentialStore, actualvXCredentialStore);
    Mockito.verify(assetMgr).getXCredentialStore(Id);
}
Also used : VXCredentialStore(org.apache.ranger.view.VXCredentialStore) Test(org.junit.Test)

Example 3 with VXCredentialStore

use of org.apache.ranger.view.VXCredentialStore in project ranger by apache.

the class TestAssetREST method testUpdateXCredentialStoree.

@Test
public void testUpdateXCredentialStoree() {
    VXCredentialStore vXCredentialStore = vXCredentialStore();
    Mockito.when(assetMgr.updateXCredentialStore(vXCredentialStore)).thenReturn(vXCredentialStore);
    VXCredentialStore actualvXCredentialStore = assetREST.updateXCredentialStore(vXCredentialStore);
    Assert.assertNotNull(actualvXCredentialStore);
    Assert.assertEquals(vXCredentialStore, actualvXCredentialStore);
    Mockito.verify(assetMgr).updateXCredentialStore(vXCredentialStore);
}
Also used : VXCredentialStore(org.apache.ranger.view.VXCredentialStore) Test(org.junit.Test)

Example 4 with VXCredentialStore

use of org.apache.ranger.view.VXCredentialStore in project ranger by apache.

the class XCredentialStoreServiceBase method searchXCredentialStores.

/**
 * @param searchCriteria
 * @return
 */
public VXCredentialStoreList searchXCredentialStores(SearchCriteria searchCriteria) {
    VXCredentialStoreList returnList = new VXCredentialStoreList();
    List<VXCredentialStore> xCredentialStoreList = new ArrayList<VXCredentialStore>();
    List<T> resultList = searchResources(searchCriteria, searchFields, sortFields, returnList);
    // Iterate over the result list and create the return list
    for (T gjXCredentialStore : resultList) {
        VXCredentialStore vXCredentialStore = populateViewBean(gjXCredentialStore);
        xCredentialStoreList.add(vXCredentialStore);
    }
    returnList.setVXCredentialStores(xCredentialStoreList);
    return returnList;
}
Also used : VXCredentialStoreList(org.apache.ranger.view.VXCredentialStoreList) ArrayList(java.util.ArrayList) VXCredentialStore(org.apache.ranger.view.VXCredentialStore)

Example 5 with VXCredentialStore

use of org.apache.ranger.view.VXCredentialStore in project ranger by apache.

the class TestAssetREST method testSearchXCredentialStores.

@Test
public void testSearchXCredentialStores() {
    VXCredentialStore vXCredentialStore = vXCredentialStore();
    List<VXCredentialStore> vXCredentialStores = Arrays.asList(vXCredentialStore);
    VXCredentialStoreList vXCredentialStoreList = new VXCredentialStoreList();
    vXCredentialStoreList.setVXCredentialStores(vXCredentialStores);
    SearchCriteria searchCriteria = new SearchCriteria();
    List<SortField> sortFields = null;
    Mockito.when(searchUtil.extractCommonCriterias(request, sortFields)).thenReturn(searchCriteria);
    Mockito.when(assetMgr.searchXCredentialStores(searchCriteria)).thenReturn(vXCredentialStoreList);
    VXCredentialStoreList actualvxCredentialStoreList = assetREST.searchXCredentialStores(request);
    Assert.assertEquals(vXCredentialStoreList.getVXCredentialStores(), actualvxCredentialStoreList.getVXCredentialStores());
    Mockito.verify(assetMgr).searchXCredentialStores(searchCriteria);
}
Also used : VXCredentialStoreList(org.apache.ranger.view.VXCredentialStoreList) VXCredentialStore(org.apache.ranger.view.VXCredentialStore) SortField(org.apache.ranger.common.SortField) SearchCriteria(org.apache.ranger.common.SearchCriteria) Test(org.junit.Test)

Aggregations

VXCredentialStore (org.apache.ranger.view.VXCredentialStore)6 Test (org.junit.Test)4 VXCredentialStoreList (org.apache.ranger.view.VXCredentialStoreList)2 ArrayList (java.util.ArrayList)1 SearchCriteria (org.apache.ranger.common.SearchCriteria)1 SortField (org.apache.ranger.common.SortField)1