use of io.quarkus.deployment.builditem.StaticInitConfigSourceProviderBuildItem in project keycloak by keycloak.
the class KeycloakProcessor method prepareTestEnvironment.
@BuildStep(onlyIf = IsIntegrationTest.class)
void prepareTestEnvironment(BuildProducer<StaticInitConfigSourceProviderBuildItem> configSources, DevServicesDatasourceResultBuildItem dbConfig) {
configSources.produce(new StaticInitConfigSourceProviderBuildItem("org.keycloak.quarkus.runtime.configuration.test.TestKeycloakConfigSourceProvider"));
// this might be too sensitive and break if Quarkus changes the behavior
if (dbConfig != null && dbConfig.getDefaultDatasource() != null) {
Map<String, String> configProperties = dbConfig.getDefaultDatasource().getConfigProperties();
for (Entry<String, String> dbConfigProperty : configProperties.entrySet()) {
PropertyMapper mapper = PropertyMappers.getMapper(dbConfigProperty.getKey());
if (mapper == null) {
continue;
}
String kcProperty = mapper.getFrom();
if (kcProperty.endsWith("db")) {
// db kind set when running tests
continue;
}
System.setProperty(kcProperty, dbConfigProperty.getValue());
}
}
}
Aggregations