Search in sources :

Example 1 with SetDefaultProvider

use of org.keycloak.testsuite.arquillian.annotation.SetDefaultProvider in project keycloak by keycloak.

the class AuthServerTestEnricher method initializeTestContext.

public void initializeTestContext(@Observes(precedence = 2) BeforeClass event) throws Exception {
    TestContext testContext = new TestContext(suiteContext, event.getTestClass().getJavaClass());
    testContextProducer.set(testContext);
    if (!isAuthServerRemote()) {
        boolean wasUpdated = false;
        if (event.getTestClass().isAnnotationPresent(SetDefaultProvider.class)) {
            SetDefaultProvider defaultProvider = event.getTestClass().getAnnotation(SetDefaultProvider.class);
            if (defaultProvider.beforeEnableFeature()) {
                SpiProvidersSwitchingUtils.addProviderDefaultValue(suiteContext, defaultProvider);
                wasUpdated = true;
            }
        }
        if (event.getTestClass().isAnnotationPresent(EnableVault.class)) {
            VaultUtils.enableVault(suiteContext, event.getTestClass().getAnnotation(EnableVault.class).providerId());
            wasUpdated = true;
        }
        if (wasUpdated) {
            restartAuthServer();
            testContext.reconnectAdminClient();
        }
    }
}
Also used : SetDefaultProvider(org.keycloak.testsuite.arquillian.annotation.SetDefaultProvider)

Aggregations

SetDefaultProvider (org.keycloak.testsuite.arquillian.annotation.SetDefaultProvider)1