Search in sources :

Example 1 with UserMappingDAO

use of org.wso2.carbon.apimgt.core.dao.UserMappingDAO in project carbon-apimgt by wso2.

the class UserDataMappingImplTestCase method testGetIdOfUser.

@Test
public void testGetIdOfUser() throws Exception {
    UserMappingDAO userMappingDAO = Mockito.mock(UserMappingDAO.class);
    Mockito.when(userMappingDAO.getPseudoNameByUserID("test_user")).thenReturn("XXXXX");
    UserNameMapper userNameMapper = new UserNameMapperImpl(userMappingDAO);
    String pseudoName = userNameMapper.getLoggedInPseudoNameFromUserID("test_user");
    Assert.assertNotNull(pseudoName);
    Assert.assertEquals("XXXXX", pseudoName);
    userNameMapper.getLoggedInUserIDFromPseudoName("XXXXX");
}
Also used : UserMappingDAO(org.wso2.carbon.apimgt.core.dao.UserMappingDAO) UserNameMapper(org.wso2.carbon.apimgt.core.api.UserNameMapper) Test(org.testng.annotations.Test)

Example 2 with UserMappingDAO

use of org.wso2.carbon.apimgt.core.dao.UserMappingDAO in project carbon-apimgt by wso2.

the class UserMappingDAOImplIT method testUserNameMapping.

@Test(description = "Get user name mapping test")
public void testUserNameMapping() throws APIManagementException {
    UserMappingDAO userMappingDAO = DAOFactory.getUserMappingDAO();
    String pseudoName = userMappingDAO.getPseudoNameByUserID("test_user");
    Assert.assertNotNull(pseudoName);
    Assert.assertTrue(userMappingDAO.getUserIDByPseudoName(pseudoName).equalsIgnoreCase("test_user"));
}
Also used : UserMappingDAO(org.wso2.carbon.apimgt.core.dao.UserMappingDAO) Test(org.testng.annotations.Test)

Aggregations

Test (org.testng.annotations.Test)2 UserMappingDAO (org.wso2.carbon.apimgt.core.dao.UserMappingDAO)2 UserNameMapper (org.wso2.carbon.apimgt.core.api.UserNameMapper)1