KEYCLOAK-8793 Fix backward compatibility testing for adapters

This commit is contained in:
vmuzikar 2018-10-31 16:07:38 +01:00 committed by Pavel Drozd
parent 22d8fb17f5
commit 8c650f9f6a
2 changed files with 4 additions and 2 deletions

View file

@ -78,7 +78,7 @@ public class Keycloak {
.connectionPoolSize(10); .connectionPoolSize(10);
if (customJacksonProvider != null) { if (customJacksonProvider != null) {
clientBuilder.register(customJacksonProvider); clientBuilder.register(customJacksonProvider, 100);
} }
return new Keycloak(serverUrl, realm, username, password, clientId, clientSecret, PASSWORD, clientBuilder.build(), null); return new Keycloak(serverUrl, realm, username, password, clientId, clientSecret, PASSWORD, clientBuilder.build(), null);

View file

@ -64,7 +64,9 @@ public class AdminClientUtil {
// We need to ignore unknown JSON properties e.g. in the adapter configuration representation // We need to ignore unknown JSON properties e.g. in the adapter configuration representation
// during adapter backward compatibility testing // during adapter backward compatibility testing
if (ignoreUnknownProperties) { if (ignoreUnknownProperties) {
jacksonProvider = new ResteasyJackson2Provider(); // We need to use anonymous class to avoid the following error from RESTEasy:
// Provider class org.jboss.resteasy.plugins.providers.jackson.ResteasyJackson2Provider is already registered. 2nd registration is being ignored.
jacksonProvider = new ResteasyJackson2Provider() {};
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
jacksonProvider.setMapper(objectMapper); jacksonProvider.setMapper(objectMapper);