From 8a0ffc279f6346972fe1ed0540e1a12625f6225d Mon Sep 17 00:00:00 2001 From: James Perkins Date: Tue, 4 Aug 2020 15:06:37 -0700 Subject: [PATCH] [WFARQ-74] Switch around the abstracted container configurations so the bootable JAR does not allow the JBoss Home to be set as it's not used. https://issues.redhat.com/browse/WFARQ-74 --- .../CommonManagedContainerConfiguration.java | 22 +++++++++++++++- .../DistributionContainerConfiguration.java | 25 +------------------ container-bootable/pom.xml | 5 ++++ .../ManagedContainerConfiguration.java | 4 +-- 4 files changed, 29 insertions(+), 27 deletions(-) diff --git a/common/src/main/java/org/jboss/as/arquillian/container/CommonManagedContainerConfiguration.java b/common/src/main/java/org/jboss/as/arquillian/container/CommonManagedContainerConfiguration.java index a7814be4..98bdb4d0 100644 --- a/common/src/main/java/org/jboss/as/arquillian/container/CommonManagedContainerConfiguration.java +++ b/common/src/main/java/org/jboss/as/arquillian/container/CommonManagedContainerConfiguration.java @@ -19,6 +19,9 @@ import java.util.List; import java.util.Scanner; +import org.jboss.arquillian.container.spi.ConfigurationException; +import org.jboss.arquillian.container.spi.client.deployment.Validate; + /** * The container configuration for a managed WildFly based container. * @@ -27,13 +30,15 @@ * @since 3.0.0 */ @SuppressWarnings({"unused", "MagicNumber", "InstanceVariableMayNotBeInitialized"}) -public class CommonManagedContainerConfiguration extends DistributionContainerConfiguration { +public class CommonManagedContainerConfiguration extends CommonContainerConfiguration { /** * Default timeout value waiting on ports is 10 seconds */ private static final Integer DEFAULT_VALUE_WAIT_FOR_PORTS_TIMEOUT_SECONDS = 10; + private String javaHome = System.getenv("JAVA_HOME"); + private int startupTimeoutInSeconds = 60; private int stopTimeoutInSeconds = 60; @@ -46,6 +51,21 @@ public class CommonManagedContainerConfiguration extends DistributionContainerCo private Integer waitForPortsTimeoutInSeconds; + @Override + public void validate() throws ConfigurationException { + super.validate(); + if (javaHome != null) + Validate.configurationDirectoryExists(javaHome, "javaHome '" + javaHome + "' must exist"); + } + + public String getJavaHome() { + return javaHome; + } + + public void setJavaHome(String javaHome) { + this.javaHome = javaHome; + } + public void setStartupTimeoutInSeconds(int startupTimeoutInSeconds) { this.startupTimeoutInSeconds = startupTimeoutInSeconds; } diff --git a/common/src/main/java/org/jboss/as/arquillian/container/DistributionContainerConfiguration.java b/common/src/main/java/org/jboss/as/arquillian/container/DistributionContainerConfiguration.java index a9428f2b..f39b1dfe 100644 --- a/common/src/main/java/org/jboss/as/arquillian/container/DistributionContainerConfiguration.java +++ b/common/src/main/java/org/jboss/as/arquillian/container/DistributionContainerConfiguration.java @@ -23,21 +23,15 @@ * * @author Andrew Lee Rubinger */ -public class DistributionContainerConfiguration extends CommonContainerConfiguration { +public class DistributionContainerConfiguration extends CommonManagedContainerConfiguration { private String jbossHome = System.getenv("JBOSS_HOME"); - private String javaHome = System.getenv("JAVA_HOME"); - private String modulePath = System.getProperty("module.path"); private String bundlePath = System.getProperty("bundle.path"); public DistributionContainerConfiguration() { - // if no javaHome is set use java.home of already running jvm - if (javaHome == null || javaHome.isEmpty()) { - javaHome = System.getProperty("java.home"); - } // if no jbossHome is set use jboss.home of already running jvm if (jbossHome == null || jbossHome.isEmpty()) { jbossHome = System.getProperty("jboss.home"); @@ -59,21 +53,6 @@ public void setJbossHome(String jbossHome) { this.jbossHome = jbossHome; } - /** - * @return the javaHome - */ - public String getJavaHome() { - return javaHome; - } - - /** - * @param javaHome - * the javaHome to set - */ - public void setJavaHome(String javaHome) { - this.javaHome = javaHome; - } - public String getModulePath() { return modulePath; } @@ -97,7 +76,5 @@ public void validate() throws ConfigurationException { super.validate(); if (jbossHome != null) Validate.configurationDirectoryExists(jbossHome, "jbossHome '" + jbossHome + "' must exist"); - if (javaHome != null) - Validate.configurationDirectoryExists(javaHome, "javaHome '" + javaHome + "' must exist"); } } diff --git a/container-bootable/pom.xml b/container-bootable/pom.xml index 9ee758f2..b41d21f1 100644 --- a/container-bootable/pom.xml +++ b/container-bootable/pom.xml @@ -133,6 +133,11 @@ maven-surefire-plugin true + + + ${jboss.home} + diff --git a/container-managed/src/main/java/org/jboss/as/arquillian/container/managed/ManagedContainerConfiguration.java b/container-managed/src/main/java/org/jboss/as/arquillian/container/managed/ManagedContainerConfiguration.java index 52fdd0ac..10f7b92a 100644 --- a/container-managed/src/main/java/org/jboss/as/arquillian/container/managed/ManagedContainerConfiguration.java +++ b/container-managed/src/main/java/org/jboss/as/arquillian/container/managed/ManagedContainerConfiguration.java @@ -15,7 +15,7 @@ */ package org.jboss.as.arquillian.container.managed; -import org.jboss.as.arquillian.container.CommonManagedContainerConfiguration; +import org.jboss.as.arquillian.container.DistributionContainerConfiguration; /** * The managed container configuration @@ -23,7 +23,7 @@ * @author Aslak Knutsen * @author Thomas.Diesler@jboss.com */ -public class ManagedContainerConfiguration extends CommonManagedContainerConfiguration { +public class ManagedContainerConfiguration extends DistributionContainerConfiguration { private String javaVmArguments = System.getProperty("jboss.options");