diff --git a/payara-client-ee7/pom.xml b/payara-client-ee7/pom.xml
index ccdfec22..77429a73 100644
--- a/payara-client-ee7/pom.xml
+++ b/payara-client-ee7/pom.xml
@@ -43,7 +43,7 @@
fish.payara.arquillian
payara-client-ee7
- 2.5-SNAPSHOT
+ 2.6-SNAPSHOT
Payara EE 7 client libs
diff --git a/payara-client-ee8/pom.xml b/payara-client-ee8/pom.xml
index 1d6e8de2..c8a48d9b 100644
--- a/payara-client-ee8/pom.xml
+++ b/payara-client-ee8/pom.xml
@@ -44,7 +44,7 @@
fish.payara.arquillian
payara-client-ee8
- 2.5-SNAPSHOT
+ 2.6-SNAPSHOT
Payara EE 8 client libs
diff --git a/payara-common/src/main/java/fish/payara/arquillian/container/payara/RemoteInstanceConnectionProvider.java b/payara-common/src/main/java/fish/payara/arquillian/container/payara/RemoteInstanceConnectionProvider.java
new file mode 100644
index 00000000..ee865e6d
--- /dev/null
+++ b/payara-common/src/main/java/fish/payara/arquillian/container/payara/RemoteInstanceConnectionProvider.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2023 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
+ * and Distribution License("CDDL") (collectively, the "License"). You
+ * may not use this file except in compliance with the License. You can
+ * obtain a copy of the License at
+ * https://github.com/payara/Payara/blob/master/LICENSE.txt
+ * See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at glassfish/legal/LICENSE.txt.
+ *
+ * GPL Classpath Exception:
+ * The Payara Foundation designates this particular file as subject to the "Classpath"
+ * exception as provided by the Payara Foundation in the GPL Version 2 section of the License
+ * file that accompanied this code.
+ *
+ * Modifications:
+ * If applicable, add the following below the License Header, with the fields
+ * enclosed by brackets [] replaced by your own identifying information:
+ * "Portions Copyright [year] [name of copyright owner]"
+ *
+ * Contributor(s):
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license." If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above. However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
+ *
+ *
+ * This file incorporates work covered by the following copyright and
+ * permission notice:
+ *
+ * JBoss, Home of Professional Open Source
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package fish.payara.arquillian.container.payara;
+
+import java.util.Optional;
+
+/**
+ * This interface abstracts getting details for a remote Payara instance configuration,
+ * which might override information retrieved from the instance via the admin API.
+ */
+public interface RemoteInstanceConnectionProvider {
+
+ Optional getHttpHost();
+ Optional getHttpPort();
+
+}
diff --git a/payara-common/src/main/java/fish/payara/arquillian/container/payara/clientutils/PayaraClientService.java b/payara-common/src/main/java/fish/payara/arquillian/container/payara/clientutils/PayaraClientService.java
index 081eca84..c8136ad2 100644
--- a/payara-common/src/main/java/fish/payara/arquillian/container/payara/clientutils/PayaraClientService.java
+++ b/payara-common/src/main/java/fish/payara/arquillian/container/payara/clientutils/PayaraClientService.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2021 Payara Foundation and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017-2023 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
@@ -73,6 +73,7 @@
import javax.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;
@@ -334,7 +335,21 @@ public HTTPContext doDeploy(String name, FormDataMultiPart form) {
Map subComponents = (Map) subComponentsResponse.get("properties");
// Build up the HTTPContext object using the nodeAddress information
- HTTPContext httpContext = new HTTPContext(nodeAddress.getHost(), nodeAddress.getHttpPort());
+ String host = nodeAddress.getHost();
+ int port = 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 (provider.getHttpHost().isPresent()) {
+ host = provider.getHttpHost().get();
+ }
+ if (provider.getHttpPort().isPresent()) {
+ port = provider.getHttpPort().get();
+ }
+ }
+ HTTPContext httpContext = new HTTPContext(host, port);
+
// Add the servlets to the HTTPContext
String contextRoot = getApplicationContextRoot(name);
diff --git a/payara-remote/src/main/java/fish/payara/arquillian/container/payara/remote/PayaraRemoteContainerConfiguration.java b/payara-remote/src/main/java/fish/payara/arquillian/container/payara/remote/PayaraRemoteContainerConfiguration.java
new file mode 100644
index 00000000..c69bf7a2
--- /dev/null
+++ b/payara-remote/src/main/java/fish/payara/arquillian/container/payara/remote/PayaraRemoteContainerConfiguration.java
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2017-2023 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
+ * and Distribution License("CDDL") (collectively, the "License"). You
+ * may not use this file except in compliance with the License. You can
+ * obtain a copy of the License at
+ * https://github.com/payara/Payara/blob/master/LICENSE.txt
+ * See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at glassfish/legal/LICENSE.txt.
+ *
+ * GPL Classpath Exception:
+ * The Payara Foundation designates this particular file as subject to the "Classpath"
+ * exception as provided by the Payara Foundation in the GPL Version 2 section of the License
+ * file that accompanied this code.
+ *
+ * Modifications:
+ * If applicable, add the following below the License Header, with the fields
+ * enclosed by brackets [] replaced by your own identifying information:
+ * "Portions Copyright [year] [name of copyright owner]"
+ *
+ * Contributor(s):
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license." If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above. However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
+ *
+ *
+ * This file incorporates work covered by the following copyright and
+ * permission notice:
+ *
+ * JBoss, Home of Professional Open Source
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package fish.payara.arquillian.container.payara.remote;
+
+import fish.payara.arquillian.container.payara.CommonPayaraConfiguration;
+import fish.payara.arquillian.container.payara.RemoteInstanceConnectionProvider;
+import org.jboss.arquillian.container.spi.ConfigurationException;
+
+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.
+ *
+ * @author Dan Allen
+ * @author Jason Porter
+ * @author Vineet Reynolds
+ */
+public class PayaraRemoteContainerConfiguration extends CommonPayaraConfiguration implements RemoteInstanceConnectionProvider {
+
+ private String httpHost;
+ private Integer httpPort;
+
+ public Optional getHttpHost() {
+ return Optional.ofNullable(httpHost);
+ }
+
+ /**
+ * @param httpHost The hostname or ip address where the remote HTTP end can be reached
+ */
+ public void setHttpHost(String httpHost) {
+ this.httpHost = httpHost;
+ }
+
+ public Optional 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 String getTarget() {
+ return ADMINSERVER;
+ }
+
+ /**
+ * Validates if current configuration is valid, that is if all required properties are set and
+ * have correct values
+ */
+ @Override
+ public void validate() throws ConfigurationException {
+ if (httpPort != null && (httpPort < 0 || httpPort > 65535)) {
+ throw new IllegalArgumentException("The arquillian.xml property httpPort must be between 1 and 65535");
+ }
+
+ if (httpHost != null && httpHost.isEmpty()) {
+ throw new IllegalArgumentException("The arquillian.xml property httpHost must be not null or empty");
+ }
+
+ super.validate();
+ }
+}
diff --git a/payara-remote/src/main/java/fish/payara/arquillian/container/payara/remote/PayaraExtension.java b/payara-remote/src/main/java/fish/payara/arquillian/container/payara/remote/PayaraRemoteContainerExtension.java
similarity index 95%
rename from payara-remote/src/main/java/fish/payara/arquillian/container/payara/remote/PayaraExtension.java
rename to payara-remote/src/main/java/fish/payara/arquillian/container/payara/remote/PayaraRemoteContainerExtension.java
index 107fc7a7..734654da 100644
--- a/payara-remote/src/main/java/fish/payara/arquillian/container/payara/remote/PayaraExtension.java
+++ b/payara-remote/src/main/java/fish/payara/arquillian/container/payara/remote/PayaraRemoteContainerExtension.java
@@ -63,10 +63,10 @@
* @author Aslak Knutsen
* @version $Revision: $
*/
-public class PayaraExtension implements LoadableExtension {
+public class PayaraRemoteContainerExtension implements LoadableExtension {
@Override
public void register(ExtensionBuilder builder) {
- builder.service(DeployableContainer.class, PayaraDeployableContainer.class);
+ builder.service(DeployableContainer.class, PayaraRemoteDeployableContainer.class);
}
}
diff --git a/payara-remote/src/main/java/fish/payara/arquillian/container/payara/remote/PayaraDeployableContainer.java b/payara-remote/src/main/java/fish/payara/arquillian/container/payara/remote/PayaraRemoteDeployableContainer.java
similarity index 93%
rename from payara-remote/src/main/java/fish/payara/arquillian/container/payara/remote/PayaraDeployableContainer.java
rename to payara-remote/src/main/java/fish/payara/arquillian/container/payara/remote/PayaraRemoteDeployableContainer.java
index 25ed2ad0..82c190e6 100644
--- a/payara-remote/src/main/java/fish/payara/arquillian/container/payara/remote/PayaraDeployableContainer.java
+++ b/payara-remote/src/main/java/fish/payara/arquillian/container/payara/remote/PayaraRemoteDeployableContainer.java
@@ -72,15 +72,15 @@
*
* @author Jason Porter
*/
-public class PayaraDeployableContainer implements DeployableContainer {
+public class PayaraRemoteDeployableContainer implements DeployableContainer {
private CommonPayaraManager payaraManager;
- public Class getConfigurationClass() {
- return CommonPayaraConfiguration.class;
+ public Class getConfigurationClass() {
+ return PayaraRemoteContainerConfiguration.class;
}
- public void setup(CommonPayaraConfiguration configuration) {
+ public void setup(PayaraRemoteContainerConfiguration configuration) {
if (configuration == null) {
throw new IllegalArgumentException("configuration must not be null");
}
diff --git a/payara-remote/src/main/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension b/payara-remote/src/main/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension
index 670d03e9..8d4282b9 100644
--- a/payara-remote/src/main/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension
+++ b/payara-remote/src/main/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension
@@ -1 +1 @@
-fish.payara.arquillian.container.payara.remote.PayaraExtension
\ No newline at end of file
+fish.payara.arquillian.container.payara.remote.PayaraRemoteContainerExtension