/** * Create an instance of test {@link Client} using the client configuration provided by the configured * {@link org.glassfish.jersey.test.spi.TestContainer}. * <p> * If the {@code TestContainer} does not provide any client configuration (passed {@code clientConfig} is {@code null}), * the default implementation of this method first creates an empty new {@link org.glassfish.jersey.client.ClientConfig} * instance. The client configuration (provided by test container or created) is then passed to * {@link #configureClient(org.glassfish.jersey.client.ClientConfig)} which can be overridden in the {@code JerseyTest} * subclass to provide custom client configuration. At last, new JAX-RS {@link Client} instance is created based on the * resulting client configuration. * </p> * * @param clientConfig test client default configuration. May be {@code null}. * @return A Client instance. */ private Client getClient(ClientConfig clientConfig) { if (clientConfig == null) { clientConfig = new ClientConfig(); } //check if logging is required if (isEnabled(TestProperties.LOG_TRAFFIC)) { clientConfig.register(new LoggingFeature(LOGGER, isEnabled(TestProperties.DUMP_ENTITY) ? LoggingFeature.Verbosity.PAYLOAD_ANY : LoggingFeature.Verbosity.HEADERS_ONLY)); } configureClient(clientConfig); return ClientBuilder.newClient(clientConfig); }
/** * Create an instance of test {@link Client} using the client configuration provided by the configured * {@link org.glassfish.jersey.test.spi.TestContainer}. * <p> * If the {@code TestContainer} does not provide any client configuration (passed {@code clientConfig} is {@code null}), * the default implementation of this method first creates an empty new {@link org.glassfish.jersey.client.ClientConfig} * instance. The client configuration (provided by test container or created) is then passed to * {@link #configureClient(org.glassfish.jersey.client.ClientConfig)} which can be overridden in the {@code JerseyTest} * subclass to provide custom client configuration. At last, new JAX-RS {@link Client} instance is created based on the * resulting client configuration. * </p> * * @param clientConfig test client default configuration. May be {@code null}. * @return A Client instance. */ private Client getClient(ClientConfig clientConfig) { if (clientConfig == null) { clientConfig = new ClientConfig(); } //check if logging is required if (isEnabled(TestProperties.LOG_TRAFFIC)) { clientConfig.register(new LoggingFeature(LOGGER, isEnabled(TestProperties.DUMP_ENTITY) ? LoggingFeature.Verbosity.PAYLOAD_ANY : LoggingFeature.Verbosity.HEADERS_ONLY)); } configureClient(clientConfig); return ClientBuilder.newClient(clientConfig); }