use of org.wso2.carbon.user.mgt.stub.types.carbon.ClaimValue in project identity-governance by wso2-extensions.
the class IdentityStoreEventListenerTest method testDoPreGetUserList.
@Test(dataProvider = "getuserlistHandler")
public void testDoPreGetUserList(String claimUri, String claimValue, final List<String> userList, String userStore) throws Exception {
userStoreManager = mock(UserStoreManager.class);
realmConfiguration = mock(RealmConfiguration.class);
userIdentityDataStore = mock(UserIdentityDataStore.class);
Field fieldIdentityStore = IdentityStoreEventListener.class.getDeclaredField("identityDataStore");
fieldIdentityStore.setAccessible(true);
fieldIdentityStore.set(identityStoreEventListener, userIdentityDataStore);
final List<String> userIds = new ArrayList<>();
userIds.add("PRIMARY/user1@carbon.super");
userIds.add("PRIMARY/user2@abc.com");
doAnswer(new Answer() {
@Override
public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
return userIds;
}
}).when(userIdentityDataStore).list(claimUri, claimValue, userStoreManager);
Mockito.when(userStoreManager.getRealmConfiguration()).thenReturn(realmConfiguration);
Mockito.when(UserCoreUtil.getDomainName(realmConfiguration)).thenReturn(userStore);
assertTrue(identityStoreEventListener.doPreGetUserList(claimUri, claimValue, userList, userStoreManager));
}
use of org.wso2.carbon.user.mgt.stub.types.carbon.ClaimValue in project product-is by wso2.
the class AccountLockEnabledTestCase method testSuccessfulEmailTemplateRetrieval.
@SetEnvironment(executionEnvironments = { ExecutionEnvironment.ALL })
@Test(groups = "wso2.is", description = "Check whether the user account lock email " + "template successfully retrieved when admin triggered account lock.", dependsOnMethods = "testSuccessfulLockedInitially")
public void testSuccessfulEmailTemplateRetrieval() throws Exception {
ClaimValue claimValue = new ClaimValue();
claimValue.setClaimURI(defaultLocalityClaimUri);
claimValue.setValue(defaultLocalityClaimValue);
ClaimValue[] claimvalues = { claimValue };
usmClient.addUser(testLockUser2, testLockUser2Password, new String[] { "admin" }, claimvalues, null, false);
String userLocale = usmClient.getUserClaimValue(testLockUser2, defaultLocalityClaimUri, "default");
String emailTemplateResourceName = accountLockTemplateWhenUserExceedsFailedAttempts + "/" + userLocale;
String emailTemplateResourceContent = resourceAdminServiceClient.getTextContent(registryResourcePath + emailTemplateResourceName);
Assert.assertTrue("Test Failure : Email Content applicable for account lock is not available.", StringUtils.isNotEmpty(emailTemplateResourceContent));
String emailTemplateResourceNameAdminTriggered = accountLockTemplateWhenAdminTriggered + "/" + userLocale;
String emailTemplateResourceContentAdminTriggered = resourceAdminServiceClient.getTextContent(registryResourcePath + emailTemplateResourceNameAdminTriggered);
Assert.assertTrue("Test Failure : Email Content applicable for account lock is not available.", StringUtils.isNotEmpty(emailTemplateResourceContentAdminTriggered));
}
use of org.wso2.carbon.user.mgt.stub.types.carbon.ClaimValue in project product-is by wso2.
the class AccountLockEnabledTestCase method testSuccessfulEmailTemplateRetrievalAccountUnLock.
@SetEnvironment(executionEnvironments = { ExecutionEnvironment.ALL })
@Test(groups = "wso2.is", description = "Check whether the user account unlocklock email " + "template successfully retrieved when admin triggered account lock.")
public void testSuccessfulEmailTemplateRetrievalAccountUnLock() throws Exception {
ClaimValue claimValue = new ClaimValue();
claimValue.setClaimURI(defaultLocalityClaimUri);
claimValue.setValue(defaultLocalityClaimValue);
ClaimValue[] claimvalues = { claimValue };
usmClient.addUser(testLockUser3, testLockUser3Password, new String[] { "admin" }, claimvalues, null, false);
String userLocale = usmClient.getUserClaimValue(testLockUser2, defaultLocalityClaimUri, "default");
String emailTemplateResourceName = accountUnlockTemplateTimeBased + "/" + userLocale;
String emailTemplateResourceContent = resourceAdminServiceClient.getTextContent(registryResourcePath + emailTemplateResourceName);
Assert.assertTrue("Test Failure : Email Content applicable for account unlock is not available.", StringUtils.isNotEmpty(emailTemplateResourceContent));
String emailTemplateResourceNameAdminTriggered = accountUnlockTemplateAdminTriggered + "/" + userLocale;
String emailTemplateResourceContentAdminTriggered = resourceAdminServiceClient.getTextContent(registryResourcePath + emailTemplateResourceNameAdminTriggered);
Assert.assertTrue("Test Failure : Email Content applicable for account unlock is not available.", StringUtils.isNotEmpty(emailTemplateResourceContentAdminTriggered));
}
use of org.wso2.carbon.user.mgt.stub.types.carbon.ClaimValue in project product-is by wso2.
the class AccountLockWhileCaseInsensitiveUserFalseTestCase method setAccountLockClaim.
private ClaimValue[] setAccountLockClaim() {
ClaimValue[] claimValues = new ClaimValue[1];
ClaimValue lockedClaim = new ClaimValue();
lockedClaim.setClaimURI(ACCOUNT_LOCK_CLAIM_URI);
lockedClaim.setValue(Boolean.TRUE.toString());
claimValues[0] = lockedClaim;
return claimValues;
}
use of org.wso2.carbon.user.mgt.stub.types.carbon.ClaimValue in project product-is by wso2.
the class EmailOTPTestCase method getUserClaims.
private ClaimValue[] getUserClaims() {
ClaimValue[] claimValues = new ClaimValue[3];
ClaimValue firstName = new ClaimValue();
firstName.setClaimURI(FIRST_NAME_CLAIM_URI);
firstName.setValue(config.getUsername());
claimValues[0] = firstName;
ClaimValue lastName = new ClaimValue();
lastName.setClaimURI(LAST_NAME_CLAIM_URI);
lastName.setValue(config.getUsername());
claimValues[1] = lastName;
ClaimValue email = new ClaimValue();
email.setClaimURI(EMAIL_CLAIM_URI);
email.setValue(config.getEmailAddress());
claimValues[2] = email;
return claimValues;
}
Aggregations