use of org.jboss.resteasy.client.jaxrs.ResteasyClient in project keycloak by keycloak.
the class LoginPageTest method realmLocalizationMessagesAreNotCachedWithinTheTheme.
// KEYCLOAK-18590
@Test
public void realmLocalizationMessagesAreNotCachedWithinTheTheme() throws IOException {
final String locale = Locale.ENGLISH.toLanguageTag();
final String realmLocalizationMessageKey = "loginAccountTitle";
final String realmLocalizationMessageValue = "Localization Test";
try (CloseableHttpClient httpClient = (CloseableHttpClient) new HttpClientBuilder().build()) {
ApacheHttpClient4Engine engine = new ApacheHttpClient4Engine(httpClient);
testRealm().localization().saveRealmLocalizationText(locale, realmLocalizationMessageKey, realmLocalizationMessageValue);
ResteasyClient client = new ResteasyClientBuilder().httpEngine(engine).build();
loginPage.open();
try (Response responseWithLocalization = client.target(driver.getCurrentUrl()).request().acceptLanguage(locale).get()) {
assertThat(responseWithLocalization.readEntity(String.class), Matchers.containsString(realmLocalizationMessageValue));
testRealm().localization().deleteRealmLocalizationText(locale, realmLocalizationMessageKey);
loginPage.open();
try (Response responseWithoutLocalization = client.target(driver.getCurrentUrl()).request().acceptLanguage(locale).get()) {
assertThat(responseWithoutLocalization.readEntity(String.class), Matchers.not(Matchers.containsString(realmLocalizationMessageValue)));
}
}
client.close();
}
}
Aggregations