Skip to content

Commit

Permalink
Allow configuration of DATASOURCE provider suppression for tck test
Browse files Browse the repository at this point in the history
  • Loading branch information
barchetta committed Dec 19, 2024
1 parent be56db7 commit a72065d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class JaxRsService implements HttpService {
* If set to {@code "true"}, Jersey will ignore responses in exceptions.
*/
static final String IGNORE_EXCEPTION_RESPONSE = "jersey.config.client.ignoreExceptionResponse";
static final String SUPPRESS_DATASOURCE_PROVIDER = "jersey.config.server.suppressDataSourceProvider";

private static final System.Logger LOGGER = System.getLogger(JaxRsService.class.getName());
private static final Type REQUEST_TYPE = (new GenericType<Ref<ServerRequest>>() { }).getType();
Expand All @@ -97,8 +98,11 @@ private JaxRsService(ResourceConfig resourceConfig,

static JaxRsService create(ResourceConfig resourceConfig, InjectionManager injectionManager) {

// Silence warnings from Jersey. See 9019
if (!resourceConfig.hasProperty(CommonProperties.PROVIDER_DEFAULT_DISABLE)) {
Config config = ConfigProvider.getConfig();

// Silence warnings from Jersey. See 9019. Allow overriding to pass tck
Boolean suppressDatasourceProvider = config.getOptionalValue(SUPPRESS_DATASOURCE_PROVIDER, Boolean.class).orElse(true);
if (!resourceConfig.hasProperty(CommonProperties.PROVIDER_DEFAULT_DISABLE) && suppressDatasourceProvider) {
resourceConfig.addProperties(Map.of(CommonProperties.PROVIDER_DEFAULT_DISABLE, "DATASOURCE"));
}
if (!resourceConfig.hasProperty(ServerProperties.WADL_FEATURE_DISABLE)) {
Expand All @@ -110,7 +114,6 @@ static JaxRsService create(ResourceConfig resourceConfig, InjectionManager injec
new WebServerBinder(),
ij);
Container container = new HelidonJerseyContainer(appHandler);
Config config = ConfigProvider.getConfig();

// This configuration via system properties is for the Jersey Client API. Any
// response in an exception will be mapped to an empty one to prevent data leaks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@
#

jersey.config.client.ignoreExceptionResponse=false
jersey.config.server.suppressDataSourceProvider=false

0 comments on commit a72065d

Please sign in to comment.