Search in sources :

Example 16 with UserStoreDTO

use of org.wso2.carbon.identity.user.store.configuration.stub.dto.UserStoreDTO in project product-is by wso2.

the class ClaimMappingsOnSecondaryUserStoreTestCase method testAddJDBCUserStore.

@Test(groups = "wso2.is", description = "Check add user store via DTO")
private void testAddJDBCUserStore() throws Exception {
    UserStoreDTO userStoreDTO = userStoreConfigAdminServiceClient.createUserStoreDTO(JDBC_CLASS, DOMAIN_ID, userStoreConfigUtils.getJDBCUserStoreProperties(USER_STORE_DB_NAME));
    userStoreConfigAdminServiceClient.addUserStore(userStoreDTO);
    Thread.sleep(5000);
    Assert.assertTrue(userStoreConfigUtils.waitForUserStoreDeployment(userStoreConfigAdminServiceClient, DOMAIN_ID), "Domain addition via DTO has failed.");
}
Also used : UserStoreDTO(org.wso2.carbon.identity.user.store.configuration.stub.dto.UserStoreDTO) ISIntegrationTest(org.wso2.identity.integration.common.utils.ISIntegrationTest) Test(org.testng.annotations.Test)

Example 17 with UserStoreDTO

use of org.wso2.carbon.identity.user.store.configuration.stub.dto.UserStoreDTO in project product-is by wso2.

the class JDBCUserStoreAddingTestCase method testAddJDBCUserStore.

@Test(groups = "wso2.is", description = "Check add user store via DTO", dependsOnMethods = "testAvailableUserStoreClasses")
private void testAddJDBCUserStore() throws Exception {
    UserStoreDTO userStoreDTO = userStoreConfigAdminServiceClient.createUserStoreDTO(jdbcClass, domainId, userStoreConfigUtils.getJDBCUserStoreProperties(USER_STORE_DB_NAME));
    userStoreConfigAdminServiceClient.addUserStore(userStoreDTO);
    Thread.sleep(5000);
    Assert.assertTrue(userStoreConfigUtils.waitForUserStoreDeployment(userStoreConfigAdminServiceClient, domainId), "Domain addition via DTO has failed.");
}
Also used : UserStoreDTO(org.wso2.carbon.identity.user.store.configuration.stub.dto.UserStoreDTO) ISIntegrationTest(org.wso2.identity.integration.common.utils.ISIntegrationTest) Test(org.testng.annotations.Test)

Example 18 with UserStoreDTO

use of org.wso2.carbon.identity.user.store.configuration.stub.dto.UserStoreDTO in project product-is by wso2.

the class UserStoreConfigAdminTestCase method testAddDuplicateUserStore.

@Test(expectedExceptions = UserStoreConfigAdminServiceIdentityUserStoreMgtException.class, groups = "wso2.is", description = "Check add user store via DTO", dependsOnMethods = "testAddUserStore")
public void testAddDuplicateUserStore() throws Exception {
    Property[] properties = (new JDBCUserStoreManager()).getDefaultUserStoreProperties().getMandatoryProperties();
    PropertyDTO[] propertyDTOs = new PropertyDTO[properties.length];
    for (int i = 0; i < properties.length; i++) {
        PropertyDTO propertyDTO = new PropertyDTO();
        propertyDTO.setName(properties[i].getName());
        propertyDTO.setValue(properties[i].getValue());
        propertyDTOs[i] = propertyDTO;
    }
    UserStoreDTO userStoreDTO = userStoreConfigurationClient.createUserStoreDTO(jdbcClass, "lanka.com", propertyDTOs);
    userStoreConfigurationClient.addUserStore(userStoreDTO);
}
Also used : JDBCUserStoreManager(org.wso2.carbon.user.core.jdbc.JDBCUserStoreManager) UserStoreDTO(org.wso2.carbon.identity.user.store.configuration.stub.dto.UserStoreDTO) Property(org.wso2.carbon.user.api.Property) PropertyDTO(org.wso2.carbon.identity.user.store.configuration.stub.dto.PropertyDTO) ISIntegrationTest(org.wso2.identity.integration.common.utils.ISIntegrationTest) Test(org.testng.annotations.Test)

Example 19 with UserStoreDTO

use of org.wso2.carbon.identity.user.store.configuration.stub.dto.UserStoreDTO in project product-is by wso2.

the class UserStoreDeployerTestCase method testChangeUserStoreState.

@Test(groups = "wso2.is", description = "Test enable/disable user stores", dependsOnMethods = "testMultipleUserStores")
public void testChangeUserStoreState() throws Exception {
    Boolean isDisabled = false;
    userStoreConfigurationClient.changeUserStoreState("wso2.com", true);
    Thread.sleep(30000);
    UserStoreDTO[] userStoreDTOs = userStoreConfigurationClient.getActiveDomains();
    if (userStoreDTOs[0] != null) {
        for (UserStoreDTO userStoreDTO : userStoreDTOs) {
            if (userStoreDTO.getDomainId().equalsIgnoreCase("wso2.com")) {
                isDisabled = userStoreDTO.getDisabled();
            }
        }
    }
    Assert.assertTrue("Disabling user store has failed", isDisabled);
}
Also used : UserStoreDTO(org.wso2.carbon.identity.user.store.configuration.stub.dto.UserStoreDTO) ISIntegrationTest(org.wso2.identity.integration.common.utils.ISIntegrationTest) Test(org.testng.annotations.Test)

Example 20 with UserStoreDTO

use of org.wso2.carbon.identity.user.store.configuration.stub.dto.UserStoreDTO in project identity-api-server by wso2.

the class ServerUserStoreService method getUserStoreList.

/**
 * To retrieve the configured user store lists.
 *
 * @param limit  items per page.
 * @param offset 0 based index to get the results starting from this index + 1.
 * @param filter to specify the filtering capabilities.
 * @param sort   to specify the sorting order.
 * @return List<UserStoreListResponse>.
 */
public List<UserStoreListResponse> getUserStoreList(Integer limit, Integer offset, String filter, String sort, String requiredAttributes) {
    handleNotImplementedBehaviour(limit, offset, filter, sort);
    UserStoreConfigService userStoreConfigService = UserStoreConfigServiceHolder.getInstance().getUserStoreConfigService();
    try {
        UserStoreDTO[] userStoreDTOS = userStoreConfigService.getUserStores();
        return buildUserStoreListResponse(userStoreDTOS, requiredAttributes);
    } catch (IdentityUserStoreMgtException e) {
        UserStoreConstants.ErrorMessage errorEnum = UserStoreConstants.ErrorMessage.ERROR_CODE_ERROR_RETRIEVING_USER_STORE;
        throw handleIdentityUserStoreMgtException(e, errorEnum);
    }
}
Also used : IdentityUserStoreMgtException(org.wso2.carbon.identity.user.store.configuration.utils.IdentityUserStoreMgtException) UserStoreDTO(org.wso2.carbon.identity.user.store.configuration.dto.UserStoreDTO) UserStoreConfigService(org.wso2.carbon.identity.user.store.configuration.UserStoreConfigService)

Aggregations

UserStoreDTO (org.wso2.carbon.identity.user.store.configuration.dto.UserStoreDTO)21 UserStoreDTO (org.wso2.carbon.identity.user.store.configuration.stub.dto.UserStoreDTO)14 IdentityUserStoreMgtException (org.wso2.carbon.identity.user.store.configuration.utils.IdentityUserStoreMgtException)13 UserStoreException (org.wso2.carbon.user.api.UserStoreException)11 ArrayList (java.util.ArrayList)9 AbstractUserStoreDAOFactory (org.wso2.carbon.identity.user.store.configuration.dao.AbstractUserStoreDAOFactory)8 Test (org.testng.annotations.Test)7 PropertyDTO (org.wso2.carbon.identity.user.store.configuration.stub.dto.PropertyDTO)7 ISIntegrationTest (org.wso2.identity.integration.common.utils.ISIntegrationTest)7 UserStorePersistanceDTO (org.wso2.carbon.identity.user.store.configuration.dto.UserStorePersistanceDTO)6 IdentityUserStoreClientException (org.wso2.carbon.identity.user.store.configuration.utils.IdentityUserStoreClientException)6 PropertyDTO (org.wso2.carbon.identity.user.store.configuration.dto.PropertyDTO)5 File (java.io.File)4 UserStoreConfigService (org.wso2.carbon.identity.user.store.configuration.UserStoreConfigService)4 UserStoreConfigListener (org.wso2.carbon.identity.user.store.configuration.listener.UserStoreConfigListener)4 SecondaryUserStoreConfigurationUtil.buildIdentityUserStoreClientException (org.wso2.carbon.identity.user.store.configuration.utils.SecondaryUserStoreConfigurationUtil.buildIdentityUserStoreClientException)4 UserStoreClientException (org.wso2.carbon.user.api.UserStoreClientException)4 H2DataBaseManager (org.wso2.carbon.automation.test.utils.dbutils.H2DataBaseManager)3 MaskedProperty (org.wso2.carbon.identity.user.store.configuration.beans.MaskedProperty)3 Property (org.wso2.carbon.user.api.Property)3