Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Apache 5 connector to client tests #5059

Merged
merged 1 commit into from
May 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion bom/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

Copyright (c) 2013, 2021 Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved.

This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -63,6 +63,11 @@
<artifactId>jersey-apache-connector</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.connectors</groupId>
<artifactId>jersey-apache5-connector</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.connectors</groupId>
<artifactId>jersey-helidon-connector</artifactId>
Expand Down
5 changes: 5 additions & 0 deletions tests/e2e-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@
<artifactId>jersey-apache-connector</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.connectors</groupId>
<artifactId>jersey-apache5-connector</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.connectors</groupId>
<artifactId>jersey-grizzly-connector</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -29,6 +29,7 @@
import javax.ws.rs.core.UriBuilder;

import org.glassfish.jersey.apache.connector.ApacheConnectorProvider;
import org.glassfish.jersey.apache5.connector.Apache5ConnectorProvider;
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.client.ClientProperties;
import org.glassfish.jersey.client.RequestEntityProcessing;
Expand Down Expand Up @@ -73,6 +74,15 @@ public void testApacheConnector() {
testDefaultOption(getApacheConnectorConfig(), RequestEntityProcessing.CHUNKED);
}

@Test
public void testApache5Connector() {
testWithBuffering(getApache5ConnectorConfig());
testWithChunkEncodingWithoutPropertyDefinition(getApache5ConnectorConfig());
testWithChunkEncodingWithPropertyDefinition(getApache5ConnectorConfig());
testWithChunkEncodingPerRequest(getApache5ConnectorConfig());
testDefaultOption(getApache5ConnectorConfig(), RequestEntityProcessing.CHUNKED);
}

@Test
public void testGrizzlyConnector() {
testWithBuffering(getGrizzlyConnectorConfig());
Expand All @@ -95,6 +105,10 @@ private ClientConfig getApacheConnectorConfig() {
return new ClientConfig().connectorProvider(new ApacheConnectorProvider());
}

private ClientConfig getApache5ConnectorConfig() {
return new ClientConfig().connectorProvider(new Apache5ConnectorProvider());
}

private ClientConfig getGrizzlyConnectorConfig() {
return new ClientConfig().connectorProvider(new GrizzlyConnectorProvider());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2019 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -31,6 +31,7 @@
import javax.ws.rs.core.Response;

import org.glassfish.jersey.apache.connector.ApacheConnectorProvider;
import org.glassfish.jersey.apache5.connector.Apache5ConnectorProvider;
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.client.spi.ConnectorProvider;
import org.glassfish.jersey.grizzly.connector.GrizzlyConnectorProvider;
Expand All @@ -42,7 +43,6 @@
import org.glassfish.jersey.test.JerseyTest;
import org.glassfish.jersey.test.TestProperties;

import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
Expand All @@ -63,7 +63,7 @@ public static List<Object[]> testData() {
{GrizzlyConnectorProvider.class},
{JettyConnectorProvider.class}, // unstable.
{ApacheConnectorProvider.class},
{GrizzlyConnectorProvider.class},
{Apache5ConnectorProvider.class},
{NettyConnectorProvider.class},
{JdkConnectorProvider.class},
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2019 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -52,6 +52,7 @@
import javax.annotation.Priority;

import org.glassfish.jersey.apache.connector.ApacheConnectorProvider;
import org.glassfish.jersey.apache5.connector.Apache5ConnectorProvider;
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.client.HttpUrlConnectorProvider;
import org.glassfish.jersey.client.spi.ConnectorProvider;
Expand Down Expand Up @@ -103,10 +104,12 @@ public static List<Object[]> testData() {
{GrizzlyConnectorProvider.class, false, false}, // change to true when JERSEY-2341 fixed
{JettyConnectorProvider.class, false, false}, // change to true when JERSEY-2341 fixed
{ApacheConnectorProvider.class, false, false}, // change to true when JERSEY-2341 fixed
{Apache5ConnectorProvider.class, false, false}, // change to true when JERSEY-2341 fixed
{HttpUrlConnectorProvider.class, true, true},
{GrizzlyConnectorProvider.class, false, true}, // change to true when JERSEY-2341 fixed
{JettyConnectorProvider.class, false, true}, // change to true when JERSEY-2341 fixed
{ApacheConnectorProvider.class, false, true}, // change to true when JERSEY-2341 fixed
{Apache5ConnectorProvider.class, false, true}, // change to true when JERSEY-2341 fixed
});
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand All @@ -24,6 +24,7 @@

import org.glassfish.jersey.SslConfigurator;
import org.glassfish.jersey.apache.connector.ApacheConnectorProvider;
import org.glassfish.jersey.apache5.connector.Apache5ConnectorProvider;
import org.glassfish.jersey.client.HttpUrlConnectorProvider;
import org.glassfish.jersey.client.spi.ConnectorProvider;
import org.glassfish.jersey.grizzly.connector.GrizzlyConnectorProvider;
Expand Down Expand Up @@ -60,7 +61,8 @@ public static Iterable<Object[]> testData() {
{new HttpUrlConnectorProvider()},
{new GrizzlyConnectorProvider()},
{new JettyConnectorProvider()},
{new ApacheConnectorProvider()}
{new ApacheConnectorProvider()},
{new Apache5ConnectorProvider()}
});
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2019 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand All @@ -23,7 +23,6 @@

import javax.net.ssl.SSLContext;

import org.glassfish.jersey.apache.connector.ApacheConnectorProvider;
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
import org.glassfish.jersey.logging.LoggingFeature;
Expand Down Expand Up @@ -78,7 +77,7 @@ public void testSSLWithAuth() throws Exception {
public void testHTTPBasicAuth1() throws Exception {
final SSLContext sslContext = getSslContext();

final ClientConfig cc = new ClientConfig().connectorProvider(new ApacheConnectorProvider());
final ClientConfig cc = new ClientConfig().connectorProvider(connectorProvider);
final Client client = ClientBuilder.newBuilder()
.withConfig(cc)
.sslContext(sslContext)
Expand All @@ -101,7 +100,7 @@ public void testHTTPBasicAuth1() throws Exception {
public void testSSLAuth1() throws Exception {
final SSLContext sslContext = getSslContext();

final ClientConfig cc = new ClientConfig().connectorProvider(new ApacheConnectorProvider());
final ClientConfig cc = new ClientConfig().connectorProvider(connectorProvider);
final Client client = ClientBuilder.newBuilder()
.withConfig(cc)
.sslContext(sslContext)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -38,6 +38,8 @@
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory;

import org.glassfish.jersey.apache.connector.ApacheConnectorProvider;
import org.glassfish.jersey.apache5.connector.Apache5ConnectorProvider;
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.client.HttpUrlConnectorProvider;
import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
Expand Down Expand Up @@ -94,9 +96,16 @@ public HttpURLConnection getConnection(final URL url) throws IOException {
*/
@Test
public void testConcurrentRequestsWithCustomSSLContext() throws Exception {
if (HttpUrlConnectorProvider.class.isInstance(connectorProvider)
|| (ApacheConnectorProvider.class.isInstance(connectorProvider))
|| (Apache5ConnectorProvider.class.isInstance(connectorProvider))) {
return;
}
final SSLContext sslContext = getSslContext();

final ClientConfig cc = new ClientConfig().connectorProvider(connectorProvider);
final Client client = ClientBuilder.newBuilder()
.withConfig(cc)
.sslContext(sslContext)
.register(HttpAuthenticationFeature.basic("user", "password"))
.register(LoggingFeature.class)
Expand Down