Skip to content

Commit

Permalink
Merge pull request #249 from jGauravGupta/FISH-10014-P7
Browse files Browse the repository at this point in the history
FISH-10014 Arquillian HTTPS Support
  • Loading branch information
jGauravGupta authored Nov 22, 2024
2 parents 8922d92 + bce7f8a commit d4fc8e7
Show file tree
Hide file tree
Showing 17 changed files with 93 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/verify_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:

- name: Archive logs on failure
if: failure()
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: logs
path: "**/*.log"
2 changes: 1 addition & 1 deletion environment-setup/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>fish.payara.arquillian</groupId>
<artifactId>parent-payara-containers</artifactId>
<version>4.0.alpha2-SNAPSHOT</version>
<version>4.0.alpha3-SNAPSHOT</version>
</parent>

<artifactId>environment-setup</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<parent>
<artifactId>parent-payara-containers</artifactId>
<groupId>fish.payara.arquillian</groupId>
<version>4.0.alpha2-SNAPSHOT</version>
<version>4.0.alpha3-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>integration-tests</artifactId>
Expand Down
10 changes: 5 additions & 5 deletions payara-client-ee11/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

<groupId>fish.payara.arquillian</groupId>
<artifactId>payara-client-ee11</artifactId>
<version>4.0.alpha2-SNAPSHOT</version>
<version>4.0.alpha3-SNAPSHOT</version>
<name>Payara EE 11 client libs</name>

<description>
Expand Down Expand Up @@ -80,7 +80,7 @@
</developers>

<properties>
<version.jersey>3.0.4</version.jersey>
<version.jersey>4.0.0-M1</version.jersey>
<gpg.keyname>Payara-CI</gpg.keyname>
</properties>
<build>
Expand Down Expand Up @@ -109,12 +109,12 @@
<dependency>
<groupId>org.glassfish.tyrus</groupId>
<artifactId>tyrus-client</artifactId>
<version>2.2.0-M1</version>
<version>2.2.0</version>
</dependency>
<dependency>
<groupId>org.glassfish.tyrus</groupId>
<artifactId>tyrus-container-grizzly-client</artifactId>
<version>2.2.0-M1</version>
<version>2.2.0</version>
</dependency>

<!-- JAX-RS client API dependencies -->
Expand Down Expand Up @@ -194,7 +194,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.1.0</version>
<version>3.2.7</version>
<configuration>
<keyname>${gpg.keyname}</keyname>
<passphraseServerId>${gpg.keyname}</passphraseServerId>
Expand Down
2 changes: 1 addition & 1 deletion payara-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<parent>
<groupId>fish.payara.arquillian</groupId>
<artifactId>parent-payara-containers</artifactId>
<version>4.0.alpha2-SNAPSHOT</version>
<version>4.0.alpha3-SNAPSHOT</version>
</parent>

<artifactId>payara-container-common</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017-2020 Payara Foundation and/or its affiliates. All rights reserved.
* Copyright (c) 2017-2024 Payara Foundation and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
Expand Down Expand Up @@ -72,7 +72,9 @@ public class CommonPayaraConfiguration implements ContainerConfiguration {
protected String adminHost = System.getProperty("adminHost", "localhost");
protected int adminPort = Integer.parseInt(System.getProperty("adminPort", "4848"));

@Deprecated
protected boolean adminHttps;
protected boolean adminHttpsEnabled = Boolean.getBoolean("adminHttpsEnabled");
private boolean authorisation;
private boolean ignoreCertificates;
private String adminUser;
Expand All @@ -83,6 +85,7 @@ public class CommonPayaraConfiguration implements ContainerConfiguration {
private String type;
private String domain;
protected boolean debug;
private boolean httpsEnabled = Boolean.getBoolean("httpsEnabled");

public CommonPayaraConfiguration() {
super();
Expand Down Expand Up @@ -112,17 +115,30 @@ public void setAdminPort(int adminPort) {
this.adminPort = adminPort;
}

public boolean isAdminHttps() {
return adminHttps;
public boolean isAdminHttpsEnabled() {
return adminHttps || adminHttpsEnabled;
}

/**
* @param adminHttps
* Flag indicating the administration url uses a secure connection. Used to build the URL for the REST
* request.
*/
public void setAdminHttps(boolean adminHttps) {
this.adminHttps = adminHttps;
public void setAdminHttpsEnabled(boolean adminHttps) {
this.adminHttpsEnabled = adminHttps;
}

public boolean isHttpsEnabled() {
return httpsEnabled;
}

/**
* @param httpsEnabled
* Flag indicating the application url uses a secure connection. Used to build the URL for the REST
* request.
*/
public void setHttpsEnabled(boolean httpsEnabled) {
this.httpsEnabled = httpsEnabled;
}

public boolean isAuthorisation() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,6 @@ public interface RemoteInstanceConnectionProvider {

Optional<String> getHttpHost();
Optional<Integer> getHttpPort();
Optional<Integer> getHttpsPort();

}
Original file line number Diff line number Diff line change
Expand Up @@ -180,4 +180,4 @@ public URI getURI(boolean secure) {
public static String getHttpProtocolPrefix(boolean secure) {
return secure ? HTTPS_PROTOCOL_PREFIX : HTTP_PROTOCOL_PREFIX;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017-2023 Payara Foundation and/or its affiliates. All rights reserved.
* Copyright (c) 2017-2024 Payara Foundation and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
Expand Down Expand Up @@ -72,7 +72,6 @@
import fish.payara.arquillian.container.payara.CommonPayaraConfiguration;
import jakarta.ws.rs.ProcessingException;
import fish.payara.arquillian.container.payara.RemoteInstanceConnectionProvider;
import org.glassfish.jersey.media.multipart.FormDataMultiPart;
import org.jboss.arquillian.container.spi.client.protocol.metadata.HTTPContext;
import org.jboss.arquillian.container.spi.client.protocol.metadata.Servlet;

Expand Down Expand Up @@ -171,7 +170,7 @@ public PayaraClientService(CommonPayaraConfiguration configuration) {
target = configuration.getTarget();

final StringBuilder adminUrlBuilder = new StringBuilder()
.append(getHttpProtocolPrefix(configuration.isAdminHttps()))
.append(getHttpProtocolPrefix(configuration.isAdminHttpsEnabled()))
.append(configuration.getAdminHost())
.append(":")
.append(configuration.getAdminPort());
Expand Down Expand Up @@ -337,20 +336,17 @@ public HTTPContext doDeploy(String name, MultiPart form) {

// Build up the HTTPContext object using the nodeAddress information
String host = nodeAddress.getHost();
int port = nodeAddress.getHttpPort();
int port = configuration.isHttpsEnabled() ? nodeAddress.getHttpsPort() : nodeAddress.getHttpPort();
// If this configuration is for a remote instance, a user might want to override port and/or host
if (configuration instanceof RemoteInstanceConnectionProvider) {
RemoteInstanceConnectionProvider provider = (RemoteInstanceConnectionProvider) configuration;

if (configuration instanceof RemoteInstanceConnectionProvider provider) {
if (provider.getHttpHost().isPresent()) {
host = provider.getHttpHost().get();
}
if (provider.getHttpPort().isPresent()) {
port = provider.getHttpPort().get();
port = configuration.isHttpsEnabled() ? provider.getHttpsPort().get() : provider.getHttpPort().get();
}
}
HTTPContext httpContext = new HTTPContext(host, port);

HTTPContext httpContext = new HTTPContext(host, port, configuration.isHttpsEnabled());

// Add the servlets to the HTTPContext
String contextRoot = getApplicationContextRoot(name);
Expand Down
2 changes: 1 addition & 1 deletion payara-embedded/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
<parent>
<groupId>fish.payara.arquillian</groupId>
<artifactId>parent-payara-containers</artifactId>
<version>4.0.alpha2-SNAPSHOT</version>
<version>4.0.alpha3-SNAPSHOT</version>
</parent>

<artifactId>arquillian-payara-server-embedded</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion payara-managed/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<parent>
<groupId>fish.payara.arquillian</groupId>
<artifactId>parent-payara-containers</artifactId>
<version>4.0.alpha2-SNAPSHOT</version>
<version>4.0.alpha3-SNAPSHOT</version>
</parent>

<artifactId>arquillian-payara-server-managed</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion payara-micro-deployer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<parent>
<artifactId>parent-payara-containers</artifactId>
<groupId>fish.payara.arquillian</groupId>
<version>4.0.alpha2-SNAPSHOT</version>
<version>4.0.alpha3-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion payara-micro-remote/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<parent>
<artifactId>parent-payara-containers</artifactId>
<groupId>fish.payara.arquillian</groupId>
<version>4.0.alpha2-SNAPSHOT</version>
<version>4.0.alpha3-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion payara-micro/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<parent>
<groupId>fish.payara.arquillian</groupId>
<artifactId>parent-payara-containers</artifactId>
<version>4.0.alpha2-SNAPSHOT</version>
<version>4.0.alpha3-SNAPSHOT</version>
</parent>

<artifactId>arquillian-payara-micro-managed</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion payara-remote/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<parent>
<groupId>fish.payara.arquillian</groupId>
<artifactId>parent-payara-containers</artifactId>
<version>4.0.alpha2-SNAPSHOT</version>
<version>4.0.alpha3-SNAPSHOT</version>
</parent>

<artifactId>arquillian-payara-server-remote</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017-2023 Payara Foundation and/or its affiliates. All rights reserved.
* Copyright (c) 2017-2024 Payara Foundation and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
Expand Down Expand Up @@ -63,7 +63,6 @@
import java.util.Optional;

import static fish.payara.arquillian.container.payara.clientutils.PayaraClient.ADMINSERVER;
import static org.jboss.arquillian.container.spi.client.deployment.Validate.notNullOrEmpty;

/**
* Configuration for Remote Payara containers.
Expand All @@ -76,7 +75,9 @@ public class PayaraRemoteContainerConfiguration extends CommonPayaraConfiguratio

private String httpHost;
private Integer httpPort;
private Integer httpsPort;

@Override
public Optional<String> getHttpHost() {
return Optional.ofNullable(httpHost);
}
Expand All @@ -87,18 +88,31 @@ public Optional<String> getHttpHost() {
public void setHttpHost(String httpHost) {
this.httpHost = httpHost;
}


@Override
public Optional<Integer> getHttpPort() {
return Optional.ofNullable(httpPort);
}

/**
* @param httpPort The port where the remote HTTP end can be reached
*/
public void setHttpPort(int httpPort) {
this.httpPort = httpPort;
}

@Override
public Optional<Integer> getHttpsPort() {
return Optional.ofNullable(httpsPort);
}

/**
* @param httpsPort The port where the remote HTTPS end can be reached
*/
public void setHttpsPort(int httpsPort) {
this.httpsPort = httpsPort;
}

@Override
public String getTarget() {
return ADMINSERVER;
Expand Down
37 changes: 31 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@

<groupId>fish.payara.arquillian</groupId>
<artifactId>parent-payara-containers</artifactId>
<version>4.0.alpha2-SNAPSHOT</version>
<version>4.0.alpha3-SNAPSHOT</version>
<packaging>pom</packaging>

<name>Arquillian Container Parent Payara</name>
Expand All @@ -75,14 +75,15 @@
<url>https://github.com/payara/Payara</url>

<properties>
<version.arquillian_core>1.8.1.Final</version.arquillian_core>
<version.arquillian_core>1.9.1.Final</version.arquillian_core>
<version.arquillian_testenricher>10.0.0.Final</version.arquillian_testenricher>
<version.jersey>4.0.0-M1</version.jersey>
<version.jakartaee>11</version.jakartaee>
<version.jakartaee.api>11.0.0-M4</version.jakartaee.api>
<version.maven.surefire.plugin>3.3.1</version.maven.surefire.plugin>
<version.maven.surefire.plugin>3.5.2</version.maven.surefire.plugin>
<version.maven.source.plugin>3.3.1</version.maven.source.plugin>
<version.maven.jar.plugin>3.4.2</version.maven.jar.plugin>
<version.maven.gpg.plugin>3.2.4</version.maven.gpg.plugin>
<version.maven.gpg.plugin>3.2.7</version.maven.gpg.plugin>
<version.maven.javadoc.plugin>3.7.0</version.maven.javadoc.plugin>
<version.maven.shade.plugin>3.6.0</version.maven.shade.plugin>
<version.maven.enforcer.plugin>3.5.0</version.maven.enforcer.plugin>
Expand All @@ -96,8 +97,8 @@
<version.maven.enforcer.java.limit>22</version.maven.enforcer.java.limit>
<docs.phase>deploy</docs.phase>

<version.payara>7.2024.1.Alpha1</version.payara>
<version.payara.embedded>6.2024.6</version.payara.embedded>
<version.payara>7.2024.1.Alpha2</version.payara>
<version.payara.embedded>7.2024.1.Alpha2</version.payara.embedded>
<payara.home>payara7</payara.home>

<gpg.keyname>Payara-CI</gpg.keyname>
Expand Down Expand Up @@ -274,6 +275,30 @@
<scope>import</scope>
</dependency>

<dependency>
<groupId>org.jboss.arquillian.protocol</groupId>
<artifactId>arquillian-protocol-servlet-jakarta</artifactId>
<version>${version.arquillian_testenricher}</version>
</dependency>

<dependency>
<groupId>org.jboss.arquillian.testenricher</groupId>
<artifactId>arquillian-testenricher-cdi-jakarta</artifactId>
<version>${version.arquillian_testenricher}</version>
</dependency>

<dependency>
<groupId>org.jboss.arquillian.testenricher</groupId>
<artifactId>arquillian-testenricher-ejb-jakarta</artifactId>
<version>${version.arquillian_testenricher}</version>
</dependency>

<dependency>
<groupId>org.jboss.arquillian.testenricher</groupId>
<artifactId>arquillian-testenricher-resource-jakarta</artifactId>
<version>${version.arquillian_testenricher}</version>
</dependency>

<dependency>
<groupId>org.eclipse.microprofile.fault-tolerance</groupId>
<artifactId>microprofile-fault-tolerance-api</artifactId>
Expand Down

0 comments on commit d4fc8e7

Please sign in to comment.