Skip to content

Commit

Permalink
Update testng and arquilian version to work with JDK8
Browse files Browse the repository at this point in the history
Signed-off-by: Jorge Bescos Gascon <jorge.bescos.gascon@oracle.com>
  • Loading branch information
jbescos committed Oct 12, 2022
1 parent f4214e3 commit 7a8d538
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2162,7 +2162,7 @@
<gae.version>1.9.59</gae.version>
<guava.version>31.1-jre</guava.version>
<hamcrest.version>2.2</hamcrest.version>
<testng.version>7.6.1</testng.version>
<testng.version>6.14.3</testng.version>
<helidon.version>1.0.3</helidon.version>
<xmlunit.version>1.6</xmlunit.version>
<httpclient.version>4.5.13</httpclient.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package org.glassfish.jersey.tests.e2e.client.connector.ssl;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
Expand All @@ -29,7 +30,6 @@
import org.glassfish.jersey.client.spi.ConnectorProvider;
import org.glassfish.jersey.grizzly.connector.GrizzlyConnectorProvider;
import org.glassfish.jersey.jetty.connector.JettyConnectorProvider;

import org.junit.After;
import org.junit.Before;
import org.junit.runner.RunWith;
Expand Down Expand Up @@ -96,14 +96,24 @@ protected SSLContext getSslContext() throws IOException {
try (InputStream trustStore = SslConnectorConfigurationTest.class.getResourceAsStream(clientTrustStore());
InputStream keyStore = SslConnectorConfigurationTest.class.getResourceAsStream(CLIENT_KEY_STORE);) {
return SslConfigurator.newInstance()
.trustStoreBytes(trustStore.readAllBytes())
.trustStoreBytes(toBytes(trustStore))
.trustStorePassword("asdfgh")
.keyStoreBytes(keyStore.readAllBytes())
.keyStoreBytes(toBytes(keyStore))
.keyPassword("asdfgh")
.createSSLContext();
}
}

public static byte[] toBytes(InputStream is) throws IOException {
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
int nRead;
byte[] data = new byte[16384];
while ((nRead = is.read(data, 0, data.length)) != -1) {
buffer.write(data, 0, nRead);
}
return buffer.toByteArray();
}

protected String serverKeyStore() {
return SERVER_KEY_STORE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ public static Server start(String keystore) throws IOException {
SSLContextConfigurator sslContext = new SSLContextConfigurator();

// set up security context
sslContext.setKeyStoreBytes(keyStore.readAllBytes()); // contains server key pair
sslContext.setKeyStoreBytes(AbstractConnectorServerTest.toBytes(keyStore)); // contains server key pair
sslContext.setKeyStorePass("asdfgh");
sslContext.setTrustStoreBytes(trustStore.readAllBytes()); // contains client certificate
sslContext.setTrustStoreBytes(AbstractConnectorServerTest.toBytes(trustStore)); // contains client certificate
sslContext.setTrustStorePass("asdfgh");

ResourceConfig rc = new ResourceConfig();
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/microprofile/rest-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@
<dependency>
<groupId>org.jboss.arquillian.testng</groupId>
<artifactId>arquillian-testng-container</artifactId>
<version>1.7.0.Alpha12</version>
<version>1.6.0.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-container-test-spi</artifactId>
<version>1.4.1.Final</version>
<version>1.6.0.Final</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down

0 comments on commit 7a8d538

Please sign in to comment.