use of io.smallrye.config.SmallRyeConfig in project keycloak by keycloak.
the class ConfigurationTest method testResolveHealthOption.
public void testResolveHealthOption() {
System.setProperty(CLI_ARGS, "--health-enabled=true");
SmallRyeConfig config = createConfig();
assertEquals("true", config.getConfigValue("quarkus.datasource.health.enabled").getValue());
}
use of io.smallrye.config.SmallRyeConfig in project keycloak by keycloak.
the class ConfigurationTest method testDatabaseProperties.
@Test
public void testDatabaseProperties() {
System.setProperty("kc.db-url-properties", ";;test=test;test1=test1");
System.setProperty("kc.db-url-path", "test-dir");
System.setProperty(CLI_ARGS, "--db=dev-file");
SmallRyeConfig config = createConfig();
assertEquals(QuarkusH2Dialect.class.getName(), config.getConfigValue("quarkus.hibernate-orm.dialect").getValue());
assertEquals("jdbc:h2:file:test-dir" + File.separator + "data" + File.separator + "h2" + File.separator + "keycloakdb;;test=test;test1=test1", config.getConfigValue("quarkus.datasource.jdbc.url").getValue());
assertEquals("xa", config.getConfigValue("quarkus.datasource.jdbc.transactions").getValue());
System.setProperty(CLI_ARGS, "");
config = createConfig();
assertEquals(QuarkusH2Dialect.class.getName(), config.getConfigValue("quarkus.hibernate-orm.dialect").getValue());
assertEquals("jdbc:h2:file:test-dir" + File.separator + "data" + File.separator + "h2" + File.separator + "keycloakdb;;test=test;test1=test1", config.getConfigValue("quarkus.datasource.jdbc.url").getValue());
System.setProperty("kc.db-url-properties", "?test=test&test1=test1");
System.setProperty(CLI_ARGS, "--db=mariadb");
config = createConfig();
assertEquals("jdbc:mariadb://localhost/keycloak?test=test&test1=test1", config.getConfigValue("quarkus.datasource.jdbc.url").getValue());
assertEquals(MariaDBDialect.class.getName(), config.getConfigValue("quarkus.hibernate-orm.dialect").getValue());
assertEquals(MySQLDataSource.class.getName(), config.getConfigValue("quarkus.datasource.jdbc.driver").getValue());
System.setProperty(CLI_ARGS, "--db=postgres");
config = createConfig();
assertEquals("jdbc:postgresql://localhost/keycloak?test=test&test1=test1", config.getConfigValue("quarkus.datasource.jdbc.url").getValue());
assertEquals(QuarkusPostgreSQL10Dialect.class.getName(), config.getConfigValue("quarkus.hibernate-orm.dialect").getValue());
assertEquals(PGXADataSource.class.getName(), config.getConfigValue("quarkus.datasource.jdbc.driver").getValue());
System.setProperty(CLI_ARGS, "--db-schema=test-schema");
config = createConfig();
assertEquals("test-schema", config.getConfigValue("kc.db-schema").getValue());
assertEquals("test-schema", config.getConfigValue("quarkus.hibernate-orm.database.default-schema").getValue());
}
use of io.smallrye.config.SmallRyeConfig in project keycloak by keycloak.
the class ConfigurationTest method testDatabaseKindProperties.
@Test
public void testDatabaseKindProperties() {
System.setProperty(CLI_ARGS, "--db=postgres" + ARG_SEPARATOR + "--db-url=jdbc:postgresql://localhost/keycloak");
SmallRyeConfig config = createConfig();
assertEquals("io.quarkus.hibernate.orm.runtime.dialect.QuarkusPostgreSQL10Dialect", config.getConfigValue("quarkus.hibernate-orm.dialect").getValue());
assertEquals("jdbc:postgresql://localhost/keycloak", config.getConfigValue("quarkus.datasource.jdbc.url").getValue());
assertEquals("postgresql", config.getConfigValue("quarkus.datasource.db-kind").getValue());
}
use of io.smallrye.config.SmallRyeConfig in project keycloak by keycloak.
the class ConfigurationTest method testTransactionTypeChangesDriver.
@Test
public void testTransactionTypeChangesDriver() {
System.setProperty(CLI_ARGS, "--db=mssql" + ARG_SEPARATOR + "--transaction-xa-enabled=false");
assertTrue(System.getProperty(CLI_ARGS, "").contains("mssql"));
SmallRyeConfig config = createConfig();
assertEquals("com.microsoft.sqlserver.jdbc.SQLServerDriver", config.getConfigValue("quarkus.datasource.jdbc.driver").getValue());
assertEquals("enabled", config.getConfigValue("quarkus.datasource.jdbc.transactions").getValue());
System.setProperty(CLI_ARGS, "--db=mssql" + ARG_SEPARATOR + "--transaction-xa-enabled=true");
assertTrue(System.getProperty(CLI_ARGS, "").contains("mssql"));
SmallRyeConfig config2 = createConfig();
assertEquals("com.microsoft.sqlserver.jdbc.SQLServerXADataSource", config2.getConfigValue("quarkus.datasource.jdbc.driver").getValue());
assertEquals("xa", config2.getConfigValue("quarkus.datasource.jdbc.transactions").getValue());
}
use of io.smallrye.config.SmallRyeConfig in project keycloak by keycloak.
the class ConfigurationTest method testPropertyMapping.
@Test
public void testPropertyMapping() {
System.setProperty(CLI_ARGS, "--db=mariadb" + ARG_SEPARATOR + "--db-url=jdbc:mariadb://localhost/keycloak");
SmallRyeConfig config = createConfig();
assertEquals(MariaDBDialect.class.getName(), config.getConfigValue("quarkus.hibernate-orm.dialect").getValue());
assertEquals("jdbc:mariadb://localhost/keycloak", config.getConfigValue("quarkus.datasource.jdbc.url").getValue());
}
Aggregations