Search in sources :

Example 16 with UserFieldDTO

use of org.wso2.carbon.identity.user.profile.stub.types.UserFieldDTO in project product-is by wso2.

the class UserProfileMgtTestCase method testGetUserProfile.

@Test(groups = "wso2.is", description = "Check get user profile")
public void testGetUserProfile() throws Exception {
    UserProfileDTO profile = userProfileMgtClient.getUserProfile(userId1, "default");
    UserFieldDTO[] fields = profile.getFieldValues();
    String displayValue = null;
    for (UserFieldDTO field : fields) {
        if ("Last Name".equals(field.getDisplayName())) {
            displayValue = field.getFieldValue();
            break;
        }
    }
    Assert.assertTrue(userId1.equals(displayValue), "Getting user profile has failed.");
}
Also used : UserFieldDTO(org.wso2.carbon.identity.user.profile.stub.types.UserFieldDTO) UserProfileDTO(org.wso2.carbon.identity.user.profile.stub.types.UserProfileDTO) ISIntegrationTest(org.wso2.identity.integration.common.utils.ISIntegrationTest) Test(org.testng.annotations.Test)

Example 17 with UserFieldDTO

use of org.wso2.carbon.identity.user.profile.stub.types.UserFieldDTO in project product-is by wso2.

the class AdminForcedPasswordResetTestCase method setUserClaim.

protected void setUserClaim(String claimURI, String calimValue) throws LogoutAuthenticationExceptionException, RemoteException, UserAdminUserAdminException, UserProfileMgtServiceUserProfileExceptionException {
    userProfileMgtClient = new UserProfileMgtServiceClient(backendURL, sessionCookie);
    UserProfileDTO profile = new UserProfileDTO();
    profile.setProfileName(PROFILE_NAME);
    UserFieldDTO passwordResetClaim = new UserFieldDTO();
    passwordResetClaim.setClaimUri(claimURI);
    passwordResetClaim.setFieldValue(calimValue);
    UserFieldDTO[] fields = new UserFieldDTO[1];
    fields[0] = passwordResetClaim;
    profile.setFieldValues(fields);
    userProfileMgtClient.setUserProfile(TEST_USER_USERNAME, profile);
}
Also used : UserProfileMgtServiceClient(org.wso2.identity.integration.common.clients.UserProfileMgtServiceClient) UserFieldDTO(org.wso2.carbon.identity.user.profile.stub.types.UserFieldDTO) UserProfileDTO(org.wso2.carbon.identity.user.profile.stub.types.UserProfileDTO)

Example 18 with UserFieldDTO

use of org.wso2.carbon.identity.user.profile.stub.types.UserFieldDTO in project product-is by wso2.

the class EntitlementServiceTestCase method testSetUserProfile.

@Test(groups = "wso2.is", description = "Check set user profile")
public void testSetUserProfile() throws RemoteException, UserProfileMgtServiceUserProfileExceptionException {
    UserProfileDTO profile = userProfileMgtClient.getUserProfile("admin", "default");
    UserFieldDTO country = new UserFieldDTO();
    country.setClaimUri("http://wso2.org/claims/country");
    country.setFieldValue("SL");
    UserFieldDTO[] fields = profile.getFieldValues();
    UserFieldDTO[] newfields = new UserFieldDTO[fields.length];
    for (int i = 0; i < fields.length; i++) {
        if (fields[i].getDisplayName().toString().equals("Country")) {
            newfields[i] = country;
        } else {
            newfields[i] = fields[i];
        }
    }
    profile.setFieldValues(newfields);
    userProfileMgtClient.setUserProfile("admin", profile);
}
Also used : UserFieldDTO(org.wso2.carbon.identity.user.profile.stub.types.UserFieldDTO) UserProfileDTO(org.wso2.carbon.identity.user.profile.stub.types.UserProfileDTO) ISIntegrationTest(org.wso2.identity.integration.common.utils.ISIntegrationTest) Test(org.testng.annotations.Test)

Aggregations

UserFieldDTO (org.wso2.carbon.identity.user.profile.stub.types.UserFieldDTO)9 UserProfileDTO (org.wso2.carbon.identity.user.profile.stub.types.UserProfileDTO)9 Test (org.testng.annotations.Test)7 ISIntegrationTest (org.wso2.identity.integration.common.utils.ISIntegrationTest)7 UserRealm (org.wso2.carbon.user.core.UserRealm)6 CarbonException (org.wso2.carbon.CarbonException)4 FederatedAssociationManagerException (org.wso2.carbon.identity.user.profile.mgt.association.federation.exception.FederatedAssociationManagerException)4 IdentityProviderManagementException (org.wso2.carbon.idp.mgt.IdentityProviderManagementException)4 UserStoreException (org.wso2.carbon.user.api.UserStoreException)4 UserProfileMgtServiceClient (org.wso2.identity.integration.common.clients.UserProfileMgtServiceClient)4 UserFieldDTO (org.wso2.carbon.identity.user.registration.dto.UserFieldDTO)3 Claim (org.wso2.carbon.user.api.Claim)3 UserStoreManager (org.wso2.carbon.user.api.UserStoreManager)3 AbstractUserStoreManager (org.wso2.carbon.user.core.common.AbstractUserStoreManager)3 ProfileConfigurationManager (org.wso2.carbon.user.core.profile.ProfileConfigurationManager)3 ArrayList (java.util.ArrayList)2 HttpServletRequest (javax.servlet.http.HttpServletRequest)2 MessageContext (org.apache.axis2.context.MessageContext)2 SetEnvironment (org.wso2.carbon.automation.engine.annotations.SetEnvironment)2 UserDTO (org.wso2.carbon.identity.user.registration.stub.dto.UserDTO)2