use of org.wso2.carbon.user.mgt.stub.types.carbon.UserRealmInfo in project carbon-identity-framework by wso2.
the class UserRealmProxyTest method testGetUserRealmInfo.
@Test
public void testGetUserRealmInfo() throws Exception {
Mockito.when(realm.getAuthorizationManager()).thenReturn(authorizationManager);
Mockito.when(realm.getClaimManager()).thenReturn(claimManager);
Mockito.when(authorizationManager.isUserAuthorized("admin", "/permission/admin/manage/identity", CarbonConstants.UI_PERMISSION_ACTION)).thenReturn(true);
Mockito.when(realm.getRealmConfiguration()).thenReturn(this.getSampleRelaimConfiguration());
Mockito.when(realm.getUserStoreManager()).thenReturn(userStoreManagerWithAb);
ClaimMapping claimMapping = new ClaimMapping();
claimMapping.setMappedAttribute("test1");
claimMapping.setMappedAttribute("test2");
claimMapping.setMappedAttribute("test3");
Claim claim = new Claim();
claim.setClaimUri("testURI");
claim.setValue("testClaim");
claimMapping.setClaim(claim);
Mockito.when(claimManager.getAllClaimMappings(UserCoreConstants.DEFAULT_CARBON_DIALECT)).thenReturn(new ClaimMapping[] { claimMapping });
Mockito.when(userStoreManagerWithAb.getRealmConfiguration()).thenReturn(this.getSampleRelaimConfiguration());
Mockito.when(userStoreManagerWithAb.isBulkImportSupported()).thenReturn(false);
UserRealmInfo realmInfo = userRealmProxy.getUserRealmInfo();
Assert.assertEquals(realmInfo.getEveryOneRole(), "everyone");
Assert.assertEquals(realmInfo.getAdminRole(), "admin");
}
Aggregations