Search in sources :

Example 11 with VXStringList

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

the class TestXUserREST method test105deleteUsersByUserNameNull.

@Test
public void test105deleteUsersByUserNameNull() {
    HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
    String TestforceDeleteStr = "true";
    Mockito.when(request.getParameter("forceDelete")).thenReturn(TestforceDeleteStr);
    VXString testVXString = new VXString();
    testVXString.setValue(null);
    VXStringList vxStringList = createVXStringList();
    List<VXString> testVXStrings = new ArrayList<VXString>();
    testVXStrings.add(testVXString);
    vxStringList.setVXStrings(testVXStrings);
    xUserRest.deleteUsersByUserName(request, vxStringList);
    Mockito.verify(request).getParameter("forceDelete");
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) VXString(org.apache.ranger.view.VXString) VXStringList(org.apache.ranger.view.VXStringList) ArrayList(java.util.ArrayList) VXString(org.apache.ranger.view.VXString) Test(org.junit.Test)

Example 12 with VXStringList

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

the class TestXUserREST method test111deleteUsersByUserNameListGetListNull.

@Test
public void test111deleteUsersByUserNameListGetListNull() {
    HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
    String TestforceDeleteStr = "false";
    Mockito.when(request.getParameter("forceDelete")).thenReturn(TestforceDeleteStr);
    VXStringList vxStringList = createVXStringList();
    vxStringList.setVXStrings(null);
    xUserRest.deleteGroupsByGroupName(request, vxStringList);
    Mockito.verify(request).getParameter("forceDelete");
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) VXStringList(org.apache.ranger.view.VXStringList) VXString(org.apache.ranger.view.VXString) Test(org.junit.Test)

Example 13 with VXStringList

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

the class TestXUserREST method test97getUserRolesByExternalID.

@Test
public void test97getUserRolesByExternalID() {
    VXStringList testVXStringList = createVXStringList();
    Mockito.when(xUserMgr.getUserRolesByExternalID(id)).thenReturn(testVXStringList);
    VXStringList retVXStringList = xUserRest.getUserRolesByExternalID(id);
    Mockito.verify(xUserMgr).getUserRolesByExternalID(id);
    assertNotNull(retVXStringList);
    assertEquals(testVXStringList.getTotalCount(), retVXStringList.getTotalCount());
    assertEquals(testVXStringList.getClass(), retVXStringList.getClass());
}
Also used : VXStringList(org.apache.ranger.view.VXStringList) Test(org.junit.Test)

Example 14 with VXStringList

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

the class TestXUserREST method createVXStringList.

private VXStringList createVXStringList() {
    VXStringList testVXStringList = new VXStringList();
    VXString testVXString = new VXString();
    testVXString.setValue("User1");
    List<VXString> testVXStrings = new ArrayList<VXString>();
    testVXStrings.add(testVXString);
    testVXStringList.setVXStrings(testVXStrings);
    testVXStringList.setResultSize(1);
    testVXStringList.setPageSize(1);
    testVXStringList.setSortBy("Id");
    testVXStringList.setStartIndex(1);
    testVXStringList.setTotalCount(1);
    return testVXStringList;
}
Also used : VXString(org.apache.ranger.view.VXString) VXStringList(org.apache.ranger.view.VXStringList) ArrayList(java.util.ArrayList)

Example 15 with VXStringList

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

the class RangerBizUtil method mapStringListToVStringList.

public VXStringList mapStringListToVStringList(List<String> stringList) {
    if (stringList == null) {
        return null;
    }
    List<VXString> vStringList = new ArrayList<VXString>();
    for (String str : stringList) {
        VXString vXString = new VXString();
        vXString.setValue(str);
        vStringList.add(vXString);
    }
    return new VXStringList(vStringList);
}
Also used : VXString(org.apache.ranger.view.VXString) VXStringList(org.apache.ranger.view.VXStringList) ArrayList(java.util.ArrayList) VXString(org.apache.ranger.view.VXString)

Aggregations

VXStringList (org.apache.ranger.view.VXStringList)24 Test (org.junit.Test)21 VXString (org.apache.ranger.view.VXString)19 HttpServletRequest (javax.servlet.http.HttpServletRequest)12 ArrayList (java.util.ArrayList)9 VXUser (org.apache.ranger.view.VXUser)6 Date (java.util.Date)4 XXPortalUserRoleDao (org.apache.ranger.db.XXPortalUserRoleDao)4 XXGroupPermission (org.apache.ranger.entity.XXGroupPermission)4 XXModuleDef (org.apache.ranger.entity.XXModuleDef)4 XXPortalUser (org.apache.ranger.entity.XXPortalUser)4 XXPortalUserRole (org.apache.ranger.entity.XXPortalUserRole)4 XXUserPermission (org.apache.ranger.entity.XXUserPermission)4 VXGroup (org.apache.ranger.view.VXGroup)4 VXGroupPermission (org.apache.ranger.view.VXGroupPermission)4 VXPortalUser (org.apache.ranger.view.VXPortalUser)4 VXUserPermission (org.apache.ranger.view.VXUserPermission)4 VXResponse (org.apache.ranger.view.VXResponse)1