Search in sources :

Example 1 with UserStoreConfigUtils

use of org.wso2.identity.integration.common.utils.UserStoreConfigUtils in project product-is by wso2.

the class UserStoreConfigUtils method getJDBCUserStoreProperties.

/**
 * Sets properties for the JDBC Userstore.
 *
 * @throws IOException            throws if an error occurs when setting JDBC userstore properties.
 * @throws SQLException           throws if an error occurs when perfomring a db action.
 * @throws ClassNotFoundException throws if it fails to find the relevant java class.
 * @deprecated This method uses a common user store database name. When multiple test cases reuse the same database,
 * there can be transient connection exceptions due to database not properly closed. Thus please use the utility
 * method {@link UserStoreConfigUtils#getJDBCUserStoreProperties(String)} with a test case specific user database
 * name instead.
 */
public PropertyDTO[] getJDBCUserStoreProperties() throws IOException, SQLException, ClassNotFoundException {
    propertyDTOs = new PropertyDTO[11];
    for (int i = 0; i < 11; i++) {
        propertyDTOs[i] = new PropertyDTO();
    }
    // creating database
    H2DataBaseManager dbmanager = new H2DataBaseManager("jdbc:h2:" + ServerConfigurationManager.getCarbonHome() + "/repository/database/" + userStoreDBName, dbUserName, dbUserPassword);
    dbmanager.executeUpdate(new File(ServerConfigurationManager.getCarbonHome() + "/dbscripts/h2.sql"));
    dbmanager.disconnect();
    propertyDTOs[0].setName("driverName");
    propertyDTOs[0].setValue("org.h2.Driver");
    propertyDTOs[1].setName("url");
    propertyDTOs[1].setValue("jdbc:h2:./repository/database/" + userStoreDBName);
    propertyDTOs[2].setName("userName");
    propertyDTOs[2].setValue(dbUserName);
    propertyDTOs[3].setName("password");
    propertyDTOs[3].setValue(dbUserPassword);
    propertyDTOs[4].setName("PasswordJavaRegEx");
    propertyDTOs[4].setValue("^[\\S]{5,30}$");
    propertyDTOs[5].setName("UsernameJavaRegEx");
    propertyDTOs[5].setValue("^[\\S]{5,30}$");
    propertyDTOs[6].setName("Disabled");
    propertyDTOs[6].setValue("false");
    propertyDTOs[7].setName("PasswordDigest");
    propertyDTOs[7].setValue("SHA-256");
    propertyDTOs[8].setName("StoreSaltedPassword");
    propertyDTOs[8].setValue("true");
    propertyDTOs[9].setName("SCIMEnabled");
    propertyDTOs[9].setValue("true");
    propertyDTOs[9].setName("CountRetrieverClass");
    propertyDTOs[9].setValue("org.wso2.carbon.identity.user.store.count.jdbc.JDBCUserStoreCountRetriever");
    propertyDTOs[10].setName("UserIDEnabled");
    propertyDTOs[10].setValue("true");
    return propertyDTOs;
}
Also used : H2DataBaseManager(org.wso2.carbon.automation.test.utils.dbutils.H2DataBaseManager) File(java.io.File) PropertyDTO(org.wso2.carbon.identity.user.store.configuration.stub.dto.PropertyDTO)

Example 2 with UserStoreConfigUtils

use of org.wso2.identity.integration.common.utils.UserStoreConfigUtils in project product-is by wso2.

the class UserStoreSuccessTest method init.

@BeforeClass(alwaysRun = true)
public void init() throws Exception {
    super.testInit(API_VERSION, swaggerDefinition, tenant);
    userStoreConfigAdminServiceClient = new UserStoreConfigAdminServiceClient(backendURL, sessionCookie);
    userStoreConfigUtils = new UserStoreConfigUtils();
}
Also used : UserStoreConfigUtils(org.wso2.identity.integration.common.utils.UserStoreConfigUtils) UserStoreConfigAdminServiceClient(org.wso2.identity.integration.common.clients.user.store.config.UserStoreConfigAdminServiceClient) BeforeClass(org.testng.annotations.BeforeClass)

Aggregations

File (java.io.File)1 BeforeClass (org.testng.annotations.BeforeClass)1 H2DataBaseManager (org.wso2.carbon.automation.test.utils.dbutils.H2DataBaseManager)1 PropertyDTO (org.wso2.carbon.identity.user.store.configuration.stub.dto.PropertyDTO)1 UserStoreConfigAdminServiceClient (org.wso2.identity.integration.common.clients.user.store.config.UserStoreConfigAdminServiceClient)1 UserStoreConfigUtils (org.wso2.identity.integration.common.utils.UserStoreConfigUtils)1