JAVA-16722 Upgrade and Fix unit tests of jersey module (#13193)

This commit is contained in:
anuragkumawat 2023-01-02 21:22:06 +05:30 committed by GitHub
parent a26acf8a0c
commit 1c8006a1df
3 changed files with 10 additions and 5 deletions

View File

@ -72,6 +72,11 @@
<version>${jersey.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.connectors</groupId>
<artifactId>jersey-apache-connector</artifactId>
<version>${jersey.version}</version>
</dependency>
</dependencies>
<build>
@ -95,7 +100,7 @@
</build>
<properties>
<jersey.version>2.26</jersey.version>
<jersey.version>2.38</jersey.version>
</properties>
</project>

View File

@ -1,6 +1,8 @@
package com.baeldung.jersey.client;
import com.baeldung.jersey.client.filter.AddHeaderOnRequestFilter;
import org.glassfish.jersey.apache.connector.ApacheConnectorProvider;
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
import org.glassfish.jersey.client.oauth1.AccessToken;
import org.glassfish.jersey.client.oauth1.ConsumerCredentials;
@ -155,7 +157,8 @@ public class JerseyClientHeaders {
}
public static Response sendRestrictedHeaderThroughDefaultTransportConnector(String headerKey, String headerValue) {
Client client = ClientBuilder.newClient();
ClientConfig clientConfig = new ClientConfig().connectorProvider(new ApacheConnectorProvider());
Client client = ClientBuilder.newClient(clientConfig);
System.setProperty("sun.net.http.allowRestrictedHeaders", "true");
return client.target(TARGET)

View File

@ -2,10 +2,8 @@ package com.baeldung.jersey.server;
import com.baeldung.jersey.client.JerseyClientHeaders;
import com.baeldung.jersey.client.filter.AddHeaderOnRequestFilter;
import org.glassfish.jersey.media.sse.SseFeature;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
import org.junit.Ignore;
import org.junit.Test;
import javax.ws.rs.core.Application;
@ -17,7 +15,6 @@ import java.util.Map;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
@Ignore
public class EchoHeadersUnitTest extends JerseyTest {
private static final String SIMPLE_HEADER_KEY = "my-header-key";