Search in sources :

Example 1 with DatabaseManager

use of org.wso2.ei.dashboard.core.db.manager.DatabaseManager in project product-is by wso2.

the class OIDCPasswordGrantTest method addSecondaryUserStore.

private void addSecondaryUserStore() throws Exception {
    String jdbcClass = "org.wso2.carbon.user.core.jdbc.UniqueIDJDBCUserStoreManager";
    H2DataBaseManager dataBaseManager = new H2DataBaseManager("jdbc:h2:" + ServerConfigurationManager.getCarbonHome() + "/repository/database/" + USER_STORE_DB_NAME, DB_USER_NAME, DB_USER_PASSWORD);
    dataBaseManager.executeUpdate(new File(ServerConfigurationManager.getCarbonHome() + "/dbscripts/h2.sql"));
    dataBaseManager.disconnect();
    PropertyDTO[] propertyDTOs = new PropertyDTO[10];
    for (int i = 0; i < 10; i++) {
        propertyDTOs[i] = new PropertyDTO();
    }
    propertyDTOs[0].setName("driverName");
    propertyDTOs[0].setValue("org.h2.Driver");
    propertyDTOs[1].setName("url");
    propertyDTOs[1].setValue("jdbc:h2:" + ServerConfigurationManager.getCarbonHome() + "/repository/database/" + USER_STORE_DB_NAME);
    propertyDTOs[2].setName("userName");
    propertyDTOs[2].setValue(DB_USER_NAME);
    propertyDTOs[3].setName("password");
    propertyDTOs[3].setValue(DB_USER_PASSWORD);
    propertyDTOs[4].setName("UserIDEnabled");
    propertyDTOs[4].setValue("true");
    UserStoreDTO userStoreDTO = userStoreConfigAdminServiceClient.createUserStoreDTO(jdbcClass, USER_STORE_DOMAIN, propertyDTOs);
    userStoreConfigAdminServiceClient.addUserStore(userStoreDTO);
    Thread.sleep(5000);
    userStoreConfigUtils.waitForUserStoreDeployment(userStoreConfigAdminServiceClient, USER_STORE_DOMAIN);
}
Also used : UserStoreDTO(org.wso2.carbon.identity.user.store.configuration.stub.dto.UserStoreDTO) 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 DatabaseManager

use of org.wso2.ei.dashboard.core.db.manager.DatabaseManager in project product-is by wso2.

the class SCIM2GroupTest method populateSecondaryUserStoreProperties.

private PropertyDTO[] populateSecondaryUserStoreProperties() throws SQLException, ClassNotFoundException, IOException {
    H2DataBaseManager dataBaseManager = new H2DataBaseManager("jdbc:h2:" + ServerConfigurationManager.getCarbonHome() + "/repository/database/JDBC_USER_STORE_DB", "wso2automation", "wso2automation");
    dataBaseManager.executeUpdate(new File(ServerConfigurationManager.getCarbonHome() + "/dbscripts/h2.sql"));
    dataBaseManager.disconnect();
    PropertyDTO[] userStoreProperties = new PropertyDTO[11];
    IntStream.range(0, userStoreProperties.length).forEach(index -> userStoreProperties[index] = new PropertyDTO());
    userStoreProperties[0].setName("driverName");
    userStoreProperties[0].setValue("org.h2.Driver");
    userStoreProperties[1].setName("url");
    userStoreProperties[1].setValue("jdbc:h2:./repository/database/JDBC_USER_STORE_DB");
    userStoreProperties[2].setName("userName");
    userStoreProperties[2].setValue("wso2automation");
    userStoreProperties[3].setName("password");
    userStoreProperties[3].setValue("wso2automation");
    userStoreProperties[4].setName("PasswordJavaRegEx");
    userStoreProperties[4].setValue("^[\\S]{5,30}$");
    userStoreProperties[5].setName("UsernameJavaRegEx");
    userStoreProperties[5].setValue("^[\\S]{5,30}$");
    userStoreProperties[6].setName("Disabled");
    userStoreProperties[6].setValue("false");
    userStoreProperties[7].setName("PasswordDigest");
    userStoreProperties[7].setValue("SHA-256");
    userStoreProperties[8].setName("StoreSaltedPassword");
    userStoreProperties[8].setValue("true");
    userStoreProperties[9].setName("SCIMEnabled");
    userStoreProperties[9].setValue("true");
    userStoreProperties[9].setName("CountRetrieverClass");
    userStoreProperties[9].setValue("org.wso2.carbon.identity.user.store.count.jdbc.JDBCUserStoreCountRetriever");
    userStoreProperties[10].setName("UserIDEnabled");
    userStoreProperties[10].setValue("true");
    return userStoreProperties;
}
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 3 with DatabaseManager

use of org.wso2.ei.dashboard.core.db.manager.DatabaseManager in project jaggery by wso2.

the class ShellUtilityService method initializeUtilityServices.

/**
 * Initialize utility services for command line client
 * @throws SQLException
 */
protected static void initializeUtilityServices() throws SQLException {
    // H2 database
    final H2DatabaseManager databaseManager = H2DatabaseManager.getInstance();
    databaseManager.initialize();
}
Also used : H2DatabaseManager(org.wso2.carbon.h2.osgi.console.H2DatabaseManager)

Example 4 with DatabaseManager

use of org.wso2.ei.dashboard.core.db.manager.DatabaseManager in project jaggery by wso2.

the class ShellUtilityService method destroyUtilityServices.

/**
 * Destroy utility services for command line client
 */
protected static void destroyUtilityServices() {
    // H2 database
    final H2DatabaseManager databaseManager = H2DatabaseManager.getInstance();
    databaseManager.terminate();
}
Also used : H2DatabaseManager(org.wso2.carbon.h2.osgi.console.H2DatabaseManager)

Aggregations

File (java.io.File)2 H2DataBaseManager (org.wso2.carbon.automation.test.utils.dbutils.H2DataBaseManager)2 H2DatabaseManager (org.wso2.carbon.h2.osgi.console.H2DatabaseManager)2 PropertyDTO (org.wso2.carbon.identity.user.store.configuration.stub.dto.PropertyDTO)2 UserStoreDTO (org.wso2.carbon.identity.user.store.configuration.stub.dto.UserStoreDTO)1