diff --git a/docs/guide/yaml/example_yaml/appserver-configured.yaml b/docs/guide/yaml/example_yaml/appserver-configured.yaml index 04ec858c8a..cd4f10201b 100644 --- a/docs/guide/yaml/example_yaml/appserver-configured.yaml +++ b/docs/guide/yaml/example_yaml/appserver-configured.yaml @@ -1,4 +1,5 @@ name: appserver-configured +location: localhost services: - type: brooklyn.entity.webapp.jboss.JBoss7Server war: http://search.maven.org/remotecontent?filepath=io/brooklyn/example/brooklyn-example-hello-world-sql-webapp/0.6.0/brooklyn-example-hello-world-sql-webapp-0.6.0.war diff --git a/software/webapp/pom.xml b/software/webapp/pom.xml index 08598144ad..55776d6079 100644 --- a/software/webapp/pom.xml +++ b/software/webapp/pom.xml @@ -47,6 +47,7 @@ perspective of the Brooklyn/Apache contribution. --> src/main/resources/brooklyn/entity/webapp/jboss/jboss7-standalone.xml + src/main/resources/brooklyn/entity/webapp/jboss/wildfly8-standalone.xml src/main/resources/brooklyn/entity/webapp/jetty/jetty-brooklyn.xml diff --git a/software/webapp/src/main/java/brooklyn/entity/webapp/JavaWebAppSshDriver.java b/software/webapp/src/main/java/brooklyn/entity/webapp/JavaWebAppSshDriver.java index da2af62f52..58dd9498b5 100644 --- a/software/webapp/src/main/java/brooklyn/entity/webapp/JavaWebAppSshDriver.java +++ b/software/webapp/src/main/java/brooklyn/entity/webapp/JavaWebAppSshDriver.java @@ -31,7 +31,10 @@ import brooklyn.util.task.Tasks; import brooklyn.util.task.ssh.SshTasks; +import com.google.common.base.Charsets; import com.google.common.collect.ImmutableList; +import com.google.common.hash.Hashing; +import com.google.common.io.BaseEncoding; public abstract class JavaWebAppSshDriver extends JavaSoftwareProcessSshDriver implements JavaWebAppDriver { @@ -197,4 +200,28 @@ public void undeploy(String targetName) { public FilenameToWebContextMapper getFilenameContextMapper() { return new FilenameToWebContextMapper(); } + + /** + * Creates a hash of a username, password and security realm that is suitable for use + * with AS7 and Wildfly 8. + *

+ * Although AS7 has an add-user.sh script it is unsuitable for use in + * non-interactive modes. (See AS7-5061 for details.) Versions 7.1.2+ (EAP) accept + * a --silent flag. When this entity is updated past 7.1.1 we should + * probably use that instead. + *

+ * This method mirrors AS7 and Wildfly 8's method of hashing user's passwords. Refer + * to its class UsernamePasswordHashUtil.generateHashedURP for their + * implementation. + * + * @see AS7-5061 + * @see + * UsernamePasswordHashUtil.generateHashedURP + * @return HEX(MD5(username ':' realm ':' password)) + */ + public static String hashPassword(String username, String password, String realm) { + String concat = username + ":" + realm + ":" + password; + byte[] hashed = Hashing.md5().hashString(concat, Charsets.UTF_8).asBytes(); + return BaseEncoding.base16().lowerCase().encode(hashed); + } } diff --git a/software/webapp/src/main/java/brooklyn/entity/webapp/jboss/JBoss7ServerImpl.java b/software/webapp/src/main/java/brooklyn/entity/webapp/jboss/JBoss7ServerImpl.java index 67fe9551d4..b901861c60 100644 --- a/software/webapp/src/main/java/brooklyn/entity/webapp/jboss/JBoss7ServerImpl.java +++ b/software/webapp/src/main/java/brooklyn/entity/webapp/jboss/JBoss7ServerImpl.java @@ -169,11 +169,6 @@ public String getManagementBindAddress() { public String getUnsecureBindAddress() { return getConfig(BIND_ADDRESS); } - - // If empty-string, disables Management security (!) by excluding the security-realm attribute - public String getHttpManagementInterfaceSecurityRealm() { - return ""; - } public int getDeploymentTimeoutSecs() { return getConfig(DEPLOYMENT_TIMEOUT); diff --git a/software/webapp/src/main/java/brooklyn/entity/webapp/jboss/JBoss7SshDriver.java b/software/webapp/src/main/java/brooklyn/entity/webapp/jboss/JBoss7SshDriver.java index 316cf6d3c3..29db1b124d 100644 --- a/software/webapp/src/main/java/brooklyn/entity/webapp/jboss/JBoss7SshDriver.java +++ b/software/webapp/src/main/java/brooklyn/entity/webapp/jboss/JBoss7SshDriver.java @@ -39,10 +39,7 @@ import brooklyn.util.ssh.BashCommands; import brooklyn.util.text.Strings; -import com.google.common.base.Charsets; import com.google.common.base.Preconditions; -import com.google.common.hash.Hashing; -import com.google.common.io.BaseEncoding; public class JBoss7SshDriver extends JavaWebAppSshDriver implements JBoss7Driver { @@ -249,28 +246,4 @@ protected List getCustomJavaConfigOptions() { .add("-XX:MaxPermSize=400m") .build(); } - - /** - * Creates a hash of a username, password and security realm that is suitable for use - * with AS7 and Wildfire. - *

- * Although AS7 has an add-user.sh script it is unsuitable for use in - * non-interactive modes. (See AS7-5061 for details.) Versions 7.1.2+ (EAP) accept - * a --silent flag. When this entity is updated past 7.1.1 we should - * probably use that instead. - *

- * This method mirrors AS7 and Wildfire's method of hashing user's passwords. Refer - * to its class UsernamePasswordHashUtil.generateHashedURP for their - * implementation. - * - * @see AS7-5061 - * @see - * UsernamePasswordHashUtil.generateHashedURP - * @return HEX(MD5(username ':' realm ':' password)) - */ - public static String hashPassword(String username, String password, String realm) { - String concat = username + ":" + realm + ":" + password; - byte[] hashed = Hashing.md5().hashString(concat, Charsets.UTF_8).asBytes(); - return BaseEncoding.base16().lowerCase().encode(hashed); - } } diff --git a/software/webapp/src/main/java/brooklyn/entity/webapp/jboss/Wildfly8Driver.java b/software/webapp/src/main/java/brooklyn/entity/webapp/jboss/Wildfly8Driver.java new file mode 100644 index 0000000000..0b1eb453ba --- /dev/null +++ b/software/webapp/src/main/java/brooklyn/entity/webapp/jboss/Wildfly8Driver.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 brooklyn.entity.webapp.jboss; + +import brooklyn.entity.webapp.JavaWebAppDriver; + +public interface Wildfly8Driver extends JavaWebAppDriver{ + + /** + * The path to the keystore file on the Wildfly 8 server machine. + * Result is undefined if SSL is not enabled/configured. + */ + public String getSslKeystoreFile(); +} diff --git a/software/webapp/src/main/java/brooklyn/entity/webapp/jboss/Wildfly8Server.java b/software/webapp/src/main/java/brooklyn/entity/webapp/jboss/Wildfly8Server.java new file mode 100644 index 0000000000..087c156c59 --- /dev/null +++ b/software/webapp/src/main/java/brooklyn/entity/webapp/jboss/Wildfly8Server.java @@ -0,0 +1,101 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 brooklyn.entity.webapp.jboss; + +import brooklyn.catalog.Catalog; +import brooklyn.config.ConfigKey; +import brooklyn.entity.basic.ConfigKeys; +import brooklyn.entity.basic.SoftwareProcess; +import brooklyn.entity.proxying.ImplementedBy; +import brooklyn.entity.trait.HasShortName; +import brooklyn.entity.webapp.JavaWebAppSoftwareProcess; +import brooklyn.event.AttributeSensor; +import brooklyn.event.basic.BasicAttributeSensorAndConfigKey; +import brooklyn.event.basic.BasicAttributeSensorAndConfigKey.StringAttributeSensorAndConfigKey; +import brooklyn.event.basic.PortAttributeSensorAndConfigKey; +import brooklyn.event.basic.Sensors; +import brooklyn.util.flags.SetFromFlag; +import brooklyn.util.javalang.JavaClassNames; + +@Catalog(name="Wildfly 8 Application Server", description="Wildfly: an open source Java application server from JBoss", iconUrl="classpath:///jboss-logo.png") +@ImplementedBy(Wildfly8ServerImpl.class) +public interface Wildfly8Server extends JavaWebAppSoftwareProcess, HasShortName { + + @SetFromFlag("version") + ConfigKey SUGGESTED_VERSION = + ConfigKeys.newConfigKeyWithDefault(SoftwareProcess.SUGGESTED_VERSION, "8.2.0.Final"); + + @SetFromFlag("downloadUrl") + BasicAttributeSensorAndConfigKey DOWNLOAD_URL = new StringAttributeSensorAndConfigKey( + SoftwareProcess.DOWNLOAD_URL, "http://download.jboss.org/wildfly/${version}/wildfly-${version}.tar.gz"); + + @SetFromFlag("bindAddress") + BasicAttributeSensorAndConfigKey BIND_ADDRESS = + new StringAttributeSensorAndConfigKey("jboss.bind.address", + "Address of interface JBoss should listen on, defaulting 0.0.0.0 (but could set e.g. to attributeWhenReady(HOSTNAME)", + "0.0.0.0"); + + @SetFromFlag("managementHttpPort") + PortAttributeSensorAndConfigKey MANAGEMENT_HTTP_PORT = + new PortAttributeSensorAndConfigKey("webapp.jboss.managementHttpPort", "Management port", "9990+"); + + @SetFromFlag("managementHttpsPort") + PortAttributeSensorAndConfigKey MANAGEMENT_HTTPS_PORT = + new PortAttributeSensorAndConfigKey("webapp.jboss.managementHttpsPort", "Management port", "9443+"); + + @SetFromFlag("managementNativePort") + PortAttributeSensorAndConfigKey MANAGEMENT_NATIVE_PORT = + new PortAttributeSensorAndConfigKey("webapp.jboss.managementNativePort", "Management native port", "10999+"); + + /** + * Port increments are the standard way to run multiple instances of Wildfly on the same machine. + */ + @SetFromFlag("portIncrement") + ConfigKey PORT_INCREMENT = + ConfigKeys.newConfigKey("webapp.jboss.portIncrement", "Port increment for all ports in config file", 0); + + @SetFromFlag("deploymentTimeout") + ConfigKey DEPLOYMENT_TIMEOUT = + ConfigKeys.newConfigKey("webapp.jboss.deploymentTimeout", "Deployment timeout, in seconds", 600); + + ConfigKey TEMPLATE_CONFIGURATION_URL = ConfigKeys.newConfigKey( + "webapp.jboss.templateConfigurationUrl", "Template file (in freemarker format) for the standalone.xml file", + JavaClassNames.resolveClasspathUrl(Wildfly8Server.class, "wildfly8-standalone.xml")); + + @SetFromFlag("managementUser") + ConfigKey MANAGEMENT_USER = ConfigKeys.newConfigKey("webapp.jboss.managementUser", + "A user to be placed in the management realm. Brooklyn will use this user to poll sensors", + "brooklyn"); + + @SetFromFlag("managementPassword") + ConfigKey MANAGEMENT_PASSWORD = + ConfigKeys.newStringConfigKey("webapp.jboss.managementPassword", "Password for MANAGEMENT_USER."); + + AttributeSensor MANAGEMENT_URL = + Sensors.newStringSensor("webapp.jboss.managementUrl", "URL where management endpoint is available"); + + AttributeSensor MANAGEMENT_STATUS = + Sensors.newIntegerSensor("webapp.jboss.managementStatus", "HTTP response code for the management server"); + + AttributeSensor MANAGEMENT_URL_UP = + Sensors.newBooleanSensor("webapp.jboss.managementUp", "Management server is responding with OK"); + + public static final AttributeSensor PID_FILE = Sensors.newStringSensor( "jboss.pid.file", "PID file"); + +} diff --git a/software/webapp/src/main/java/brooklyn/entity/webapp/jboss/Wildfly8ServerImpl.java b/software/webapp/src/main/java/brooklyn/entity/webapp/jboss/Wildfly8ServerImpl.java new file mode 100644 index 0000000000..cbb6cf5dfb --- /dev/null +++ b/software/webapp/src/main/java/brooklyn/entity/webapp/jboss/Wildfly8ServerImpl.java @@ -0,0 +1,193 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 brooklyn.entity.webapp.jboss; + +import java.util.Map; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import brooklyn.config.render.RendererHints; +import brooklyn.enricher.Enrichers; +import brooklyn.entity.Entity; +import brooklyn.entity.basic.Attributes; +import brooklyn.entity.webapp.JavaWebAppSoftwareProcessImpl; +import brooklyn.event.feed.http.HttpFeed; +import brooklyn.event.feed.http.HttpPollConfig; +import brooklyn.event.feed.http.HttpValueFunctions; +import brooklyn.location.access.BrooklynAccessUtils; +import brooklyn.util.guava.Functionals; + +import com.google.common.base.Functions; +import com.google.common.net.HostAndPort; + +public class Wildfly8ServerImpl extends JavaWebAppSoftwareProcessImpl implements Wildfly8Server { + + public static final Logger log = LoggerFactory.getLogger(Wildfly8ServerImpl.class); + + private volatile HttpFeed httpFeed; + + public Wildfly8ServerImpl(){ + super(); + } + + public Wildfly8ServerImpl(@SuppressWarnings("rawtypes") Map flags) { + this(flags, null); + } + + public Wildfly8ServerImpl(@SuppressWarnings("rawtypes") Map flags, Entity parent) { + super(flags, parent); + } + + @Override + public Class getDriverInterface() { + return Wildfly8Driver.class; + } + + @Override + public Wildfly8Driver getDriver() { + return (Wildfly8Driver) super.getDriver(); + } + + static { + RendererHints.register(MANAGEMENT_URL, RendererHints.namedActionWithUrl()); + } + + @Override + protected void connectSensors() { + super.connectSensors(); + + HostAndPort hp = BrooklynAccessUtils.getBrooklynAccessibleAddress(this, + getAttribute(MANAGEMENT_HTTP_PORT) + getConfig(PORT_INCREMENT)); + + String managementUri = String.format("http://%s:%s/management/subsystem/undertow/server/default-server/http-listener/default", + hp.getHostText(), hp.getPort()); + setAttribute(MANAGEMENT_URL, managementUri); + log.debug("JBoss sensors for "+this+" reading from "+managementUri); + +// Map includeRuntimeUriVars = ImmutableMap.of("include-runtime","true"); + + httpFeed = HttpFeed.builder() + .entity(this) + .period(200) + .baseUri(managementUri) + .credentials(getConfig(MANAGEMENT_USER), getConfig(MANAGEMENT_PASSWORD)) + .poll(new HttpPollConfig(MANAGEMENT_STATUS) + .onSuccess(HttpValueFunctions.responseCode())) + .poll(new HttpPollConfig(MANAGEMENT_URL_UP) + .onSuccess(HttpValueFunctions.responseCodeEquals(200)) + .onFailureOrException(Functions.constant(false))) + /* + * TODO Re-enable these metrics once they are supported by Wildfly. + * + * See: https://issues.jboss.org/browse/WFLY-3835 + */ + +// .poll(new HttpPollConfig(REQUEST_COUNT) +// .vars(includeRuntimeUriVars) +// .onSuccess(HttpValueFunctions.jsonContents("requestCount", Integer.class))) +// .poll(new HttpPollConfig(ERROR_COUNT) +// .vars(includeRuntimeUriVars) +// .onSuccess(HttpValueFunctions.jsonContents("errorCount", Integer.class))) +// .poll(new HttpPollConfig(TOTAL_PROCESSING_TIME) +// .vars(includeRuntimeUriVars) +// .onSuccess(HttpValueFunctions.jsonContents("processingTime", Integer.class))) +// .poll(new HttpPollConfig(MAX_PROCESSING_TIME) +// .vars(includeRuntimeUriVars) +// .onSuccess(HttpValueFunctions.jsonContents("maxTime", Integer.class))) +// .poll(new HttpPollConfig(BYTES_RECEIVED) +// .vars(includeRuntimeUriVars) +// // jboss seems to report 0 even if it has received lots of requests; dunno why. +// .onSuccess(HttpValueFunctions.jsonContents("bytesReceived", Long.class))) +// .poll(new HttpPollConfig(BYTES_SENT) +// .vars(includeRuntimeUriVars) +// .onSuccess(HttpValueFunctions.jsonContents("bytesSent", Long.class))) + + .build(); + + connectServiceUp(); + } + + protected void connectServiceUp() { + connectServiceUpIsRunning(); + + addEnricher(Enrichers.builder().updatingMap(Attributes.SERVICE_NOT_UP_INDICATORS) + .from(MANAGEMENT_URL_UP) + .computing(Functionals.ifNotEquals(true).value("Management URL not reachable") ) + .build()); + } + + protected void disconnectServiceUp() { + disconnectServiceUpIsRunning(); + } + + @Override + protected void disconnectSensors() { + super.disconnectSensors(); + + if (httpFeed != null) httpFeed.stop(); + disconnectServiceUp(); + } + + public int getManagementHttpsPort() { + return getAttribute(MANAGEMENT_HTTPS_PORT); + } + + public int getManagementHttpPort() { + return getAttribute(MANAGEMENT_HTTP_PORT); + } + + public int getManagementNativePort() { + return getAttribute(MANAGEMENT_NATIVE_PORT); + } + + public int getPortOffset() { + return getConfig(PORT_INCREMENT); + } + + public boolean isWelcomeRootEnabled() { + return false; + } + + public String getBindAddress() { + return getConfig(BIND_ADDRESS); + } + + public String getManagementBindAddress() { + return getConfig(BIND_ADDRESS); + } + + public String getUnsecureBindAddress() { + return getConfig(BIND_ADDRESS); + } + + public int getDeploymentTimeoutSecs() { + return getConfig(DEPLOYMENT_TIMEOUT); + } + + /** Path of the keystore file on the AS7 server */ + public String getHttpsSslKeystoreFile() { + return getDriver().getSslKeystoreFile(); + } + + @Override + public String getShortName() { + return "Wildfly8"; + } +} diff --git a/software/webapp/src/main/java/brooklyn/entity/webapp/jboss/Wildfly8SshDriver.java b/software/webapp/src/main/java/brooklyn/entity/webapp/jboss/Wildfly8SshDriver.java new file mode 100644 index 0000000000..1a28ab37c2 --- /dev/null +++ b/software/webapp/src/main/java/brooklyn/entity/webapp/jboss/Wildfly8SshDriver.java @@ -0,0 +1,249 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 brooklyn.entity.webapp.jboss; + +import static java.lang.String.format; + +import java.io.InputStream; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import brooklyn.entity.basic.Entities; +import brooklyn.entity.basic.SoftwareProcess; +import brooklyn.entity.webapp.JavaWebAppSshDriver; +import brooklyn.location.basic.SshMachineLocation; +import brooklyn.util.collections.MutableList; +import brooklyn.util.collections.MutableMap; +import brooklyn.util.net.Networking; +import brooklyn.util.os.Os; +import brooklyn.util.ssh.BashCommands; +import brooklyn.util.text.Strings; + +import com.google.common.base.Preconditions; + +public class Wildfly8SshDriver extends JavaWebAppSshDriver implements Wildfly8Driver { + + private static final Logger LOG = LoggerFactory.getLogger(Wildfly8SshDriver.class); + + // TODO more configurability of config files, java memory, etc + + public static final String SERVER_TYPE = "standalone"; + public static final String CONFIG_FILE = "standalone-brooklyn.xml"; + public static final String KEYSTORE_FILE = ".keystore"; + public static final String MANAGEMENT_REALM = "ManagementRealm"; + + public Wildfly8SshDriver(Wildfly8ServerImpl entity, SshMachineLocation machine) { + super(entity, machine); + } + + @Override + public Wildfly8ServerImpl getEntity() { + return (Wildfly8ServerImpl) super.getEntity(); + } + + @Override + public String getSslKeystoreFile() { + return Os.mergePathsUnix(getRunDir(), SERVER_TYPE, "configuration", KEYSTORE_FILE); + } + + protected String getTemplateConfigurationUrl() { + return entity.getConfig(Wildfly8Server.TEMPLATE_CONFIGURATION_URL); + } + + @Override + protected String getLogFileLocation() { + return Os.mergePathsUnix(getRunDir(), SERVER_TYPE, "log/server.log"); + } + + @Override + protected String getDeploySubdir() { + return Os.mergePathsUnix(SERVER_TYPE, "deployments"); + } + + private Integer getManagementHttpPort() { + return entity.getAttribute(Wildfly8Server.MANAGEMENT_HTTP_PORT); + } + + private Integer getManagementHttpsPort() { + return entity.getAttribute(Wildfly8Server.MANAGEMENT_HTTPS_PORT); + } + + private Integer getManagementNativePort() { + return entity.getAttribute(Wildfly8Server.MANAGEMENT_NATIVE_PORT); + } + + private String getManagementUsername() { + return entity.getConfig(Wildfly8Server.MANAGEMENT_USER); + } + + private String getManagementPassword() { + return entity.getConfig(Wildfly8Server.MANAGEMENT_PASSWORD); + } + + @Override + public void preInstall() { + resolver = Entities.newDownloader(this); + setExpandedInstallDir(Os.mergePaths(getInstallDir(), resolver.getUnpackedDirectoryName(format("wildfly-%s", getVersion())))); + } + + @Override + public void install() { + List urls = resolver.getTargets(); + String saveAs = resolver.getFilename(); + + List commands = new LinkedList(); + commands.addAll(BashCommands.commandsToDownloadUrlsAs(urls, saveAs)); + commands.add(BashCommands.INSTALL_TAR); + commands.add("tar xzfv " + saveAs); + + newScript(INSTALLING) + // don't set vars yet -- it resolves dependencies (e.g. DB) which we don't want until we start + .environmentVariablesReset() + .body.append(commands) + .execute(); + } + + /** + * AS7 config notes and TODOs: + * We're using the http management interface on port managementPort + * We're not using any JMX. + * - AS 7 simply doesn't boot with Sun JMX enabled (https://issues.jboss.org/browse/JBAS-7427) + * - 7.1 onwards uses Remoting 3, which we haven't configured + * - We have generic support for jmxmp, which one could configure + * We're completely disabling security on the management interface. + * - In the future we probably want to use the as7/bin/add-user.sh script using config keys for user and password + * - Or we could create our own security realm and use that. + * We disable the root welcome page, since we can't deploy our own root otherwise + * We bind all interfaces to entity.hostname, rather than 127.0.0.1. + */ + @Override + public void customize() { + // Check that a password was set for the management user + Preconditions.checkState(Strings.isNonBlank(getManagementUsername()), "User for management realm required"); + String managementPassword = getManagementPassword(); + if (Strings.isBlank(managementPassword)) { + LOG.debug(this+" has no password specified for "+Wildfly8Server.MANAGEMENT_PASSWORD.getName()+"; using a random string"); + entity.setConfig(Wildfly8Server.MANAGEMENT_PASSWORD, Strings.makeRandomId(8)); + } + String hashedPassword = hashPassword(getManagementUsername(), getManagementPassword(), MANAGEMENT_REALM); + + // Check that ports are all configured + Map ports = MutableMap.builder() + .put("managementHttpPort", getManagementHttpPort()) + .put("managementHttpsPort", getManagementHttpsPort()) + .put("managementNativePort", getManagementNativePort()) + .build(); + if (isProtocolEnabled("HTTP")) { + ports.put("httpPort", getHttpPort()); + } + if (isProtocolEnabled("HTTPS")) { + ports.put("httpsPort", getHttpsPort()); + } + Networking.checkPortsValid(ports); + + // Check hostname is defined + String hostname = entity.getAttribute(SoftwareProcess.HOSTNAME); + Preconditions.checkNotNull(hostname, "AS 7 entity must set hostname otherwise server will only be visible on localhost"); + + // Copy the install files to the run-dir and add the management user + newScript(CUSTOMIZING) + // don't set vars yet -- it resolves dependencies (e.g. DB) which we don't want until we start + .environmentVariablesReset() + .body.append( + format("cp -r %s/%s . || exit $!", getExpandedInstallDir(), SERVER_TYPE), + format("echo -e '\n%s=%s' >> %s/%s/configuration/mgmt-users.properties", + getManagementUsername(), hashedPassword, getRunDir(), SERVER_TYPE) + ) + .execute(); + + // Copy the keystore across, if there is one + if (isProtocolEnabled("HTTPS")) { + String keystoreUrl = Preconditions.checkNotNull(getSslKeystoreUrl(), "keystore URL must be specified if using HTTPS for "+entity); + String destinationSslKeystoreFile = getSslKeystoreFile(); + InputStream keystoreStream = resource.getResourceFromUrl(keystoreUrl); + getMachine().copyTo(keystoreStream, destinationSslKeystoreFile); + } + + // Copy the configuration file across + String destinationConfigFile = Os.mergePathsUnix(getRunDir(), SERVER_TYPE, "configuration", CONFIG_FILE); + copyTemplate(getTemplateConfigurationUrl(), destinationConfigFile); + + // Copy the initial wars to the deploys directory + getEntity().deployInitialWars(); + } + + @Override + public void launch() { + entity.setAttribute(Wildfly8Server.PID_FILE, Os.mergePathsUnix(getRunDir(), PID_FILENAME)); + + // We wait for evidence of JBoss running because, using + // brooklyn.ssh.config.tool.class=brooklyn.util.internal.ssh.cli.SshCliTool, + // we saw the ssh session return before the JBoss process was fully running + // so the process failed to start. + newScript(MutableMap.of(USE_PID_FILE, false), LAUNCHING) + .body.append( + "export LAUNCH_JBOSS_IN_BACKGROUND=true", + format("export JBOSS_HOME=%s", getExpandedInstallDir()), + format("export JBOSS_PIDFILE=%s/%s", getRunDir(), PID_FILENAME), + format("%s/bin/%s.sh ", getExpandedInstallDir(), SERVER_TYPE) + + format("--server-config %s ", CONFIG_FILE) + + format("-Djboss.server.base.dir=%s/%s ", getRunDir(), SERVER_TYPE) + + format("\"-Djboss.server.base.url=file://%s/%s\" ", getRunDir(), SERVER_TYPE) + + "-Djava.net.preferIPv4Stack=true " + + "-Djava.net.preferIPv6Addresses=false " + + format(" >> %s/console 2>&1 getCustomJavaConfigOptions() { + return MutableList.builder() + .addAll(super.getCustomJavaConfigOptions()) + .add("-Xms200m") + .add("-Xmx800m") + .add("-XX:MaxPermSize=400m") + .build(); + } +} diff --git a/software/webapp/src/main/resources/brooklyn/entity/webapp/jboss/jboss7-standalone.xml b/software/webapp/src/main/resources/brooklyn/entity/webapp/jboss/jboss7-standalone.xml index 1e0f6c1a57..947027400a 100644 --- a/software/webapp/src/main/resources/brooklyn/entity/webapp/jboss/jboss7-standalone.xml +++ b/software/webapp/src/main/resources/brooklyn/entity/webapp/jboss/jboss7-standalone.xml @@ -288,7 +288,7 @@ diff --git a/software/webapp/src/main/resources/brooklyn/entity/webapp/jboss/wildfly8-standalone.xml b/software/webapp/src/main/resources/brooklyn/entity/webapp/jboss/wildfly8-standalone.xml new file mode 100644 index 0000000000..01a1341df9 --- /dev/null +++ b/software/webapp/src/main/resources/brooklyn/entity/webapp/jboss/wildfly8-standalone.xml @@ -0,0 +1,469 @@ +[#ftl] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE + h2 + + sa + sa + + + + + org.h2.jdbcx.JdbcDataSource + + + + + + + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 102400 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + jms.queue.DLQ + jms.queue.ExpiryQueue + 10485760 + 2097152 + 10 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/WebAppLiveIntegrationTest.groovy b/software/webapp/src/test/java/brooklyn/entity/webapp/WebAppLiveIntegrationTest.groovy index 6fee1506d8..21a0c18092 100644 --- a/software/webapp/src/test/java/brooklyn/entity/webapp/WebAppLiveIntegrationTest.groovy +++ b/software/webapp/src/test/java/brooklyn/entity/webapp/WebAppLiveIntegrationTest.groovy @@ -35,13 +35,15 @@ import org.testng.annotations.Test import brooklyn.config.BrooklynProperties import brooklyn.entity.Application -import brooklyn.entity.basic.SoftwareProcess import brooklyn.entity.basic.Entities +import brooklyn.entity.basic.SoftwareProcess import brooklyn.entity.trait.Startable import brooklyn.entity.webapp.jboss.JBoss6Server import brooklyn.entity.webapp.jboss.JBoss6ServerImpl import brooklyn.entity.webapp.jboss.JBoss7Server import brooklyn.entity.webapp.jboss.JBoss7ServerImpl +import brooklyn.entity.webapp.jboss.Wildfly8Server +import brooklyn.entity.webapp.jboss.Wildfly8ServerImpl import brooklyn.entity.webapp.tomcat.TomcatServer import brooklyn.entity.webapp.tomcat.TomcatServerImpl import brooklyn.location.Location @@ -52,6 +54,8 @@ import brooklyn.util.internal.TimeExtras /** * This tests that we can run jboss entity on AWS. + * + * TODO Convert this class to Java and use EntitySpec to create server objects. */ public class WebAppLiveIntegrationTest { private static final Logger logger = LoggerFactory.getLogger(WebAppLiveIntegrationTest.class) @@ -81,7 +85,8 @@ public class WebAppLiveIntegrationTest { TomcatServer tomcat = new TomcatServerImpl(parent:application, httpPort:DEFAULT_HTTP_PORT, jmxPort:DEFAULT_JMX_PORT) JBoss6Server jboss6 = new JBoss6ServerImpl(parent:application, portIncrement:PORT_INCREMENT, jmxPort:DEFAULT_JMX_PORT) JBoss7Server jboss7 = new JBoss7ServerImpl(parent:application, httpPort:DEFAULT_HTTP_PORT, jmxPort:DEFAULT_JMX_PORT) - return [ [ tomcat ], [ jboss6 ], [ jboss7 ] ] + Wildfly8Server wildfly8 = new Wildfly8ServerImpl(parent:application, httpPort:DEFAULT_HTTP_PORT, jmxPort:DEFAULT_JMX_PORT) + return [ [ tomcat ], [ jboss6 ], [ jboss7 ], [ wildfly8 ] ] } private File getResource(String path) { diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/DynamicWebAppClusterRebindIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/DynamicWebAppClusterRebindIntegrationTest.java index c1624d9c15..846a0b14ab 100644 --- a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/DynamicWebAppClusterRebindIntegrationTest.java +++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/DynamicWebAppClusterRebindIntegrationTest.java @@ -24,13 +24,11 @@ import static org.testng.Assert.assertEquals; import java.io.File; -import java.net.URL; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import brooklyn.test.TestResourceUnavailableException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.annotations.AfterMethod; @@ -45,9 +43,9 @@ import brooklyn.entity.webapp.DynamicWebAppCluster; import brooklyn.location.basic.LocalhostMachineProvisioningLocation; import brooklyn.management.internal.LocalManagementContext; +import brooklyn.test.TestResourceUnavailableException; import brooklyn.test.WebAppMonitor; import brooklyn.test.entity.TestApplication; -import brooklyn.util.collections.MutableMap; import com.google.common.base.Predicates; import com.google.common.collect.ImmutableList; diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss6ServerAwsEc2LiveTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss6ServerAwsEc2LiveTest.java index fe53ef4c32..62abed69a9 100644 --- a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss6ServerAwsEc2LiveTest.java +++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss6ServerAwsEc2LiveTest.java @@ -18,55 +18,32 @@ */ package brooklyn.entity.webapp.jboss; -import static com.google.common.base.Preconditions.checkNotNull; -import static org.testng.Assert.assertNotNull; - -import java.net.URL; - -import brooklyn.test.TestResourceUnavailableException; import org.testng.annotations.Test; -import brooklyn.entity.AbstractEc2LiveTest; -import brooklyn.entity.proxying.EntitySpec; +import brooklyn.entity.webapp.JavaWebAppSoftwareProcess; import brooklyn.location.Location; -import brooklyn.test.Asserts; -import brooklyn.test.HttpTestUtils; - -import com.google.common.collect.ImmutableList; /** - * A simple test of installing+running on AWS-EC2, using various OS distros and versions. + * A simple test of installing+running JBoss AS6 on AWS-EC2, using various OS distros and versions. */ -public class JBoss6ServerAwsEc2LiveTest extends AbstractEc2LiveTest { - - public String getTestWar() { - TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/hello-world-no-mapping.war"); - return "classpath://hello-world-no-mapping.war"; - } +public class JBoss6ServerAwsEc2LiveTest extends JBossServerAwsEc2LiveTest { @Override protected void doTest(Location loc) throws Exception { - final JBoss6Server server = app.createAndManageChild(EntitySpec.create(JBoss6Server.class) - .configure("war", getTestWar())); - - app.start(ImmutableList.of(loc)); - - String url = server.getAttribute(JBoss6Server.ROOT_URL); - - HttpTestUtils.assertHttpStatusCodeEventuallyEquals(url, 200); - HttpTestUtils.assertContentContainsText(url, "Hello"); - - Asserts.succeedsEventually(new Runnable() { - @Override public void run() { - assertNotNull(server.getAttribute(JBoss6Server.REQUEST_COUNT)); - assertNotNull(server.getAttribute(JBoss6Server.ERROR_COUNT)); - assertNotNull(server.getAttribute(JBoss6Server.TOTAL_PROCESSING_TIME)); - assertNotNull(server.getAttribute(JBoss6Server.MAX_PROCESSING_TIME)); - assertNotNull(server.getAttribute(JBoss6Server.BYTES_RECEIVED)); - assertNotNull(server.getAttribute(JBoss6Server.BYTES_SENT)); - }}); + super.doTest(loc); + } + + @Test(groups = {"Live", "Live-sanity"}) + @Override + public void test_CentOS_6_3() throws Exception { + super.test_CentOS_6_3(); } @Test(enabled=false) public void testDummy() {} // Convince testng IDE integration that this really does have test methods + + @Override + protected Class getServerType() { + return JBoss6Server.class; + } } diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss6ServerNonInheritingIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss6ServerNonInheritingIntegrationTest.java index c3f5e5e0e0..b21f39a68a 100644 --- a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss6ServerNonInheritingIntegrationTest.java +++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss6ServerNonInheritingIntegrationTest.java @@ -21,9 +21,6 @@ import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; -import java.net.URL; - -import brooklyn.test.TestResourceUnavailableException; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; @@ -33,6 +30,7 @@ import brooklyn.location.basic.LocalhostMachineProvisioningLocation; import brooklyn.test.Asserts; import brooklyn.test.HttpTestUtils; +import brooklyn.test.TestResourceUnavailableException; import com.google.common.collect.ImmutableList; diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerAwsEc2LiveTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerAwsEc2LiveTest.java index 60db294311..827853d9c2 100644 --- a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerAwsEc2LiveTest.java +++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerAwsEc2LiveTest.java @@ -18,53 +18,19 @@ */ package brooklyn.entity.webapp.jboss; -import static com.google.common.base.Preconditions.checkNotNull; -import static org.testng.Assert.assertNotNull; - -import java.net.URL; - -import brooklyn.test.TestResourceUnavailableException; import org.testng.annotations.Test; -import brooklyn.entity.AbstractEc2LiveTest; -import brooklyn.entity.proxying.EntitySpec; +import brooklyn.entity.webapp.JavaWebAppSoftwareProcess; import brooklyn.location.Location; -import brooklyn.test.Asserts; -import brooklyn.test.HttpTestUtils; - -import com.google.common.collect.ImmutableList; /** - * A simple test of installing+running on AWS-EC2, using various OS distros and versions. + * A simple test of installing+running JBoss AS7 on AWS-EC2, using various OS distros and versions. */ -public class JBoss7ServerAwsEc2LiveTest extends AbstractEc2LiveTest { - - public String getTestWar() { - TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/hello-world.war"); - return "classpath://hello-world.war"; - } +public class JBoss7ServerAwsEc2LiveTest extends JBossServerAwsEc2LiveTest { @Override protected void doTest(Location loc) throws Exception { - final JBoss7Server server = app.createAndManageChild(EntitySpec.create(JBoss7Server.class) - .configure("war", getTestWar())); - - app.start(ImmutableList.of(loc)); - - String url = server.getAttribute(JBoss7Server.ROOT_URL); - - HttpTestUtils.assertHttpStatusCodeEventuallyEquals(url, 200); - HttpTestUtils.assertContentContainsText(url, "Hello"); - - Asserts.succeedsEventually(new Runnable() { - @Override public void run() { - assertNotNull(server.getAttribute(JBoss7Server.REQUEST_COUNT)); - assertNotNull(server.getAttribute(JBoss7Server.ERROR_COUNT)); - assertNotNull(server.getAttribute(JBoss7Server.TOTAL_PROCESSING_TIME)); - assertNotNull(server.getAttribute(JBoss7Server.MAX_PROCESSING_TIME)); - assertNotNull(server.getAttribute(JBoss7Server.BYTES_RECEIVED)); - assertNotNull(server.getAttribute(JBoss7Server.BYTES_SENT)); - }}); + super.doTest(loc); } @Test(groups = {"Live", "Live-sanity"}) @@ -75,4 +41,9 @@ public void test_CentOS_6_3() throws Exception { @Test(enabled=false) public void testDummy() {} // Convince testng IDE integration that this really does have test methods + + @Override + protected Class getServerType() { + return JBoss7Server.class; + } } diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerDockerLiveTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerDockerLiveTest.java index 69eca5f4f2..04c2582033 100644 --- a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerDockerLiveTest.java +++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerDockerLiveTest.java @@ -18,57 +18,27 @@ */ package brooklyn.entity.webapp.jboss; -import brooklyn.entity.proxying.EntitySpec; -import brooklyn.entity.software.AbstractDockerLiveTest; -import brooklyn.location.Location; -import brooklyn.test.Asserts; -import brooklyn.test.HttpTestUtils; -import brooklyn.test.TestResourceUnavailableException; -import com.google.common.collect.ImmutableList; import org.testng.annotations.Test; -import java.net.URL; - -import static com.google.common.base.Preconditions.checkNotNull; -import static org.testng.Assert.assertNotNull; +import brooklyn.entity.webapp.JavaWebAppSoftwareProcess; +import brooklyn.location.Location; /** - * A simple test of installing+running on Docker, using various OS distros and versions. + * A simple test of installing+running JBoss AS7 on Docker, using various OS distros and versions. */ -public class JBoss7ServerDockerLiveTest extends AbstractDockerLiveTest { - - public String getTestWar() { - TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/hello-world.war"); - return "classpath://hello-world.war"; - } +public class JBoss7ServerDockerLiveTest extends JBossServerDockerLiveTest { @Override protected void doTest(Location loc) throws Exception { - final JBoss7Server server = app.createAndManageChild(EntitySpec.create(JBoss7Server.class) - .configure("war", getTestWar())); - - app.start(ImmutableList.of(loc)); - - String url = server.getAttribute(JBoss7Server.ROOT_URL); - - HttpTestUtils.assertHttpStatusCodeEventuallyEquals(url, 200); - HttpTestUtils.assertContentContainsText(url, "Hello"); - - Asserts.succeedsEventually(new Runnable() { - @Override - public void run() { - assertNotNull(server.getAttribute(JBoss7Server.REQUEST_COUNT)); - assertNotNull(server.getAttribute(JBoss7Server.ERROR_COUNT)); - assertNotNull(server.getAttribute(JBoss7Server.TOTAL_PROCESSING_TIME)); - assertNotNull(server.getAttribute(JBoss7Server.MAX_PROCESSING_TIME)); - assertNotNull(server.getAttribute(JBoss7Server.BYTES_RECEIVED)); - assertNotNull(server.getAttribute(JBoss7Server.BYTES_SENT)); - } - }); + super.doTest(loc); } @Test(enabled = false) public void testDummy() { } // Convince testng IDE integration that this really does have test methods + @Override + protected Class getServerType() { + return JBoss7Server.class; + } } diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerGoogleComputeLiveTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerGoogleComputeLiveTest.java new file mode 100644 index 0000000000..4e2465611b --- /dev/null +++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerGoogleComputeLiveTest.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 brooklyn.entity.webapp.jboss; + +import org.testng.annotations.Test; + +import brooklyn.entity.webapp.JavaWebAppSoftwareProcess; +import brooklyn.location.Location; + +/** + * A simple test of installing+running JBoss AS7 on AWS-EC2, using various OS distros and versions. + */ +public class JBoss7ServerGoogleComputeLiveTest extends JBossServerGoogleComputeLiveTest { + + @Override + protected void doTest(Location loc) throws Exception { + super.doTest(loc); + } + + @Test(groups = {"Live"}) + @Override + public void test_DefaultImage() throws Exception { + super.test_DefaultImage(); + } + + @Test(enabled=false) + public void testDummy() {} // Convince testng IDE integration that this really does have test methods + + @Override + protected Class getServerType() { + return JBoss7Server.class; + } +} diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerSoftLayerLiveTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerSoftLayerLiveTest.java new file mode 100644 index 0000000000..58a42a260f --- /dev/null +++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerSoftLayerLiveTest.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 brooklyn.entity.webapp.jboss; + +import org.testng.annotations.Test; + +import brooklyn.entity.webapp.JavaWebAppSoftwareProcess; +import brooklyn.location.Location; + +/** + * A simple test of installing+running JBoss AS7 on SoftLayer, using various OS distros and versions. + */ +public class JBoss7ServerSoftLayerLiveTest extends JBossServerSoftLayerLiveTest { + + @Override + protected void doTest(Location loc) throws Exception { + super.doTest(loc); + } + + @Test(enabled = false) + public void testDummy() { + } // Convince testng IDE integration that this really does have test methods + + @Override + protected Class getServerType() { + return JBoss7Server.class; + } +} diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7PasswordHashingTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBossPasswordHashingTest.java similarity index 73% rename from software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7PasswordHashingTest.java rename to software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBossPasswordHashingTest.java index d77b706f30..fb727a62b7 100644 --- a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7PasswordHashingTest.java +++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBossPasswordHashingTest.java @@ -18,42 +18,44 @@ */ package brooklyn.entity.webapp.jboss; +import static org.testng.Assert.assertEquals; + import org.testng.annotations.Test; -import static org.testng.Assert.assertEquals; +import brooklyn.entity.webapp.JavaWebAppSshDriver; /** * Expected values in tests were generated by AS7's add-user.sh script and copied here. */ -public class JBoss7PasswordHashingTest { +public class JBossPasswordHashingTest { @Test public void testPasswordForManagementRealm() { assertEquals( - JBoss7SshDriver.hashPassword("username", "password", "ManagementRealm"), + JavaWebAppSshDriver.hashPassword("username", "password", "ManagementRealm"), "8959126dd54df47f694cd762a51a1a6f"); assertEquals( - JBoss7SshDriver.hashPassword("test", "123", "ManagementRealm"), + JavaWebAppSshDriver.hashPassword("test", "123", "ManagementRealm"), "090d846d31185e54a5e8811a2ccb43ee"); } - + @Test public void testPasswordForApplicationRealm() { assertEquals( - JBoss7SshDriver.hashPassword("username", "password", "ApplicationRealm"), + JavaWebAppSshDriver.hashPassword("username", "password", "ApplicationRealm"), "888a0504c559a34b1c3e919dcec6d941"); assertEquals( - JBoss7SshDriver.hashPassword("test", "321", "ApplicationRealm"), + JavaWebAppSshDriver.hashPassword("test", "321", "ApplicationRealm"), "a0fdaa45e2d509ac2d390ff6820e2a10"); } - + @Test public void testPasswordForCustomRealm() { assertEquals( - JBoss7SshDriver.hashPassword("abcdef", "ghijkl", "BrooklynRealm"), + JavaWebAppSshDriver.hashPassword("abcdef", "ghijkl", "BrooklynRealm"), "a65be1ba2eb88b9b9edc6a2a7105af72"); assertEquals( - JBoss7SshDriver.hashPassword("username", "password", "BrooklynRealm"), + JavaWebAppSshDriver.hashPassword("username", "password", "BrooklynRealm"), "161124b73591a1483330f496311b0692"); } diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerGoogleComputeLiveTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBossServerAwsEc2LiveTest.java similarity index 58% rename from software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerGoogleComputeLiveTest.java rename to software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBossServerAwsEc2LiveTest.java index e067c59bb9..6678506a27 100644 --- a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerGoogleComputeLiveTest.java +++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBossServerAwsEc2LiveTest.java @@ -18,26 +18,23 @@ */ package brooklyn.entity.webapp.jboss; -import static com.google.common.base.Preconditions.checkNotNull; import static org.testng.Assert.assertNotNull; - -import java.net.URL; - -import brooklyn.test.TestResourceUnavailableException; -import org.testng.annotations.Test; - -import brooklyn.entity.AbstractGoogleComputeLiveTest; +import brooklyn.entity.AbstractEc2LiveTest; import brooklyn.entity.proxying.EntitySpec; +import brooklyn.entity.webapp.JavaWebAppSoftwareProcess; +import brooklyn.entity.webapp.WebAppServiceConstants; +import brooklyn.entity.webapp.WebAppServiceMetrics; import brooklyn.location.Location; import brooklyn.test.Asserts; import brooklyn.test.HttpTestUtils; +import brooklyn.test.TestResourceUnavailableException; import com.google.common.collect.ImmutableList; /** - * A simple test of installing+running on AWS-EC2, using various OS distros and versions. + * A simple test of installing+running JBoss type servers on AWS-EC2, using various OS distros and versions. */ -public class Jboss7ServerGoogleComputeLiveTest extends AbstractGoogleComputeLiveTest { +public abstract class JBossServerAwsEc2LiveTest extends AbstractEc2LiveTest { public String getTestWar() { TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/hello-world.war"); @@ -46,33 +43,26 @@ public String getTestWar() { @Override protected void doTest(Location loc) throws Exception { - final JBoss7Server server = app.createAndManageChild(EntitySpec.create(JBoss7Server.class) + final JavaWebAppSoftwareProcess server = app.createAndManageChild(EntitySpec.create(getServerType()) .configure("war", getTestWar())); app.start(ImmutableList.of(loc)); - String url = server.getAttribute(JBoss7Server.ROOT_URL); + String url = server.getAttribute(WebAppServiceConstants.ROOT_URL); HttpTestUtils.assertHttpStatusCodeEventuallyEquals(url, 200); HttpTestUtils.assertContentContainsText(url, "Hello"); Asserts.succeedsEventually(new Runnable() { @Override public void run() { - assertNotNull(server.getAttribute(JBoss7Server.REQUEST_COUNT)); - assertNotNull(server.getAttribute(JBoss7Server.ERROR_COUNT)); - assertNotNull(server.getAttribute(JBoss7Server.TOTAL_PROCESSING_TIME)); - assertNotNull(server.getAttribute(JBoss7Server.MAX_PROCESSING_TIME)); - assertNotNull(server.getAttribute(JBoss7Server.BYTES_RECEIVED)); - assertNotNull(server.getAttribute(JBoss7Server.BYTES_SENT)); + assertNotNull(server.getAttribute(WebAppServiceMetrics.REQUEST_COUNT)); + assertNotNull(server.getAttribute(WebAppServiceMetrics.ERROR_COUNT)); + assertNotNull(server.getAttribute(WebAppServiceMetrics.TOTAL_PROCESSING_TIME)); + assertNotNull(server.getAttribute(WebAppServiceMetrics.MAX_PROCESSING_TIME)); + assertNotNull(server.getAttribute(WebAppServiceMetrics.BYTES_RECEIVED)); + assertNotNull(server.getAttribute(WebAppServiceMetrics.BYTES_SENT)); }}); } - @Test(groups = {"Live"}) - @Override - public void test_DefaultImage() throws Exception { - super.test_DefaultImage(); - } - - @Test(enabled=false) - public void testDummy() {} // Convince testng IDE integration that this really does have test methods + protected abstract Class getServerType(); } diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBossServerDockerLiveTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBossServerDockerLiveTest.java new file mode 100644 index 0000000000..8b01844d4a --- /dev/null +++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBossServerDockerLiveTest.java @@ -0,0 +1,68 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 brooklyn.entity.webapp.jboss; + +import static org.testng.Assert.assertNotNull; +import brooklyn.entity.proxying.EntitySpec; +import brooklyn.entity.software.AbstractDockerLiveTest; +import brooklyn.entity.webapp.JavaWebAppSoftwareProcess; +import brooklyn.entity.webapp.WebAppServiceConstants; +import brooklyn.entity.webapp.WebAppServiceMetrics; +import brooklyn.location.Location; +import brooklyn.test.Asserts; +import brooklyn.test.HttpTestUtils; +import brooklyn.test.TestResourceUnavailableException; + +import com.google.common.collect.ImmutableList; + +/** + * A simple test of installing+running JBoss type servers on Docker, using various OS distros and versions. + */ +public abstract class JBossServerDockerLiveTest extends AbstractDockerLiveTest { + + public String getTestWar() { + TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/hello-world.war"); + return "classpath://hello-world.war"; + } + + @Override + protected void doTest(Location loc) throws Exception { + final JavaWebAppSoftwareProcess server = app.createAndManageChild(EntitySpec.create(getServerType()) + .configure("war", getTestWar())); + + app.start(ImmutableList.of(loc)); + + String url = server.getAttribute(WebAppServiceConstants.ROOT_URL); + + HttpTestUtils.assertHttpStatusCodeEventuallyEquals(url, 200); + HttpTestUtils.assertContentContainsText(url, "Hello"); + + Asserts.succeedsEventually(new Runnable() { + @Override public void run() { + assertNotNull(server.getAttribute(WebAppServiceMetrics.REQUEST_COUNT)); + assertNotNull(server.getAttribute(WebAppServiceMetrics.ERROR_COUNT)); + assertNotNull(server.getAttribute(WebAppServiceMetrics.TOTAL_PROCESSING_TIME)); + assertNotNull(server.getAttribute(WebAppServiceMetrics.MAX_PROCESSING_TIME)); + assertNotNull(server.getAttribute(WebAppServiceMetrics.BYTES_RECEIVED)); + assertNotNull(server.getAttribute(WebAppServiceMetrics.BYTES_SENT)); + }}); + } + + protected abstract Class getServerType(); +} diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBossServerGoogleComputeLiveTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBossServerGoogleComputeLiveTest.java new file mode 100644 index 0000000000..9dc0a47492 --- /dev/null +++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBossServerGoogleComputeLiveTest.java @@ -0,0 +1,68 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 brooklyn.entity.webapp.jboss; + +import static org.testng.Assert.assertNotNull; +import brooklyn.entity.AbstractGoogleComputeLiveTest; +import brooklyn.entity.proxying.EntitySpec; +import brooklyn.entity.webapp.JavaWebAppSoftwareProcess; +import brooklyn.entity.webapp.WebAppServiceConstants; +import brooklyn.entity.webapp.WebAppServiceMetrics; +import brooklyn.location.Location; +import brooklyn.test.Asserts; +import brooklyn.test.HttpTestUtils; +import brooklyn.test.TestResourceUnavailableException; + +import com.google.common.collect.ImmutableList; + +/** + * A simple test of installing+running JBoss type servers on AWS-EC2, using various OS distros and versions. + */ +public abstract class JBossServerGoogleComputeLiveTest extends AbstractGoogleComputeLiveTest { + + public String getTestWar() { + TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/hello-world.war"); + return "classpath://hello-world.war"; + } + + @Override + protected void doTest(Location loc) throws Exception { + final JavaWebAppSoftwareProcess server = app.createAndManageChild(EntitySpec.create(getServerType()) + .configure("war", getTestWar())); + + app.start(ImmutableList.of(loc)); + + String url = server.getAttribute(WebAppServiceConstants.ROOT_URL); + + HttpTestUtils.assertHttpStatusCodeEventuallyEquals(url, 200); + HttpTestUtils.assertContentContainsText(url, "Hello"); + + Asserts.succeedsEventually(new Runnable() { + @Override public void run() { + assertNotNull(server.getAttribute(WebAppServiceMetrics.REQUEST_COUNT)); + assertNotNull(server.getAttribute(WebAppServiceMetrics.ERROR_COUNT)); + assertNotNull(server.getAttribute(WebAppServiceMetrics.TOTAL_PROCESSING_TIME)); + assertNotNull(server.getAttribute(WebAppServiceMetrics.MAX_PROCESSING_TIME)); + assertNotNull(server.getAttribute(WebAppServiceMetrics.BYTES_RECEIVED)); + assertNotNull(server.getAttribute(WebAppServiceMetrics.BYTES_SENT)); + }}); + } + + protected abstract Class getServerType(); +} diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBossServerSoftLayerLiveTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBossServerSoftLayerLiveTest.java new file mode 100644 index 0000000000..fa02c45ffa --- /dev/null +++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBossServerSoftLayerLiveTest.java @@ -0,0 +1,69 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 brooklyn.entity.webapp.jboss; + +import static org.testng.Assert.assertNotNull; +import brooklyn.entity.AbstractEc2LiveTest; +import brooklyn.entity.AbstractSoftlayerLiveTest; +import brooklyn.entity.proxying.EntitySpec; +import brooklyn.entity.webapp.JavaWebAppSoftwareProcess; +import brooklyn.entity.webapp.WebAppServiceConstants; +import brooklyn.entity.webapp.WebAppServiceMetrics; +import brooklyn.location.Location; +import brooklyn.test.Asserts; +import brooklyn.test.HttpTestUtils; +import brooklyn.test.TestResourceUnavailableException; + +import com.google.common.collect.ImmutableList; + +/** + * A simple test of installing+running JBoss type servers on SoftLayer, using various OS distros and versions. + */ +public abstract class JBossServerSoftLayerLiveTest extends AbstractSoftlayerLiveTest { + + public String getTestWar() { + TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/hello-world.war"); + return "classpath://hello-world.war"; + } + + @Override + protected void doTest(Location loc) throws Exception { + final JavaWebAppSoftwareProcess server = app.createAndManageChild(EntitySpec.create(getServerType()) + .configure("war", getTestWar())); + + app.start(ImmutableList.of(loc)); + + String url = server.getAttribute(WebAppServiceConstants.ROOT_URL); + + HttpTestUtils.assertHttpStatusCodeEventuallyEquals(url, 200); + HttpTestUtils.assertContentContainsText(url, "Hello"); + + Asserts.succeedsEventually(new Runnable() { + @Override public void run() { + assertNotNull(server.getAttribute(WebAppServiceMetrics.REQUEST_COUNT)); + assertNotNull(server.getAttribute(WebAppServiceMetrics.ERROR_COUNT)); + assertNotNull(server.getAttribute(WebAppServiceMetrics.TOTAL_PROCESSING_TIME)); + assertNotNull(server.getAttribute(WebAppServiceMetrics.MAX_PROCESSING_TIME)); + assertNotNull(server.getAttribute(WebAppServiceMetrics.BYTES_RECEIVED)); + assertNotNull(server.getAttribute(WebAppServiceMetrics.BYTES_SENT)); + }}); + } + + protected abstract Class getServerType(); +} diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBossServersMultiVersionWebAppFixtureIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBossServersMultiVersionWebAppFixtureIntegrationTest.java index cf576c3b00..5a1e8adaed 100644 --- a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBossServersMultiVersionWebAppFixtureIntegrationTest.java +++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBossServersMultiVersionWebAppFixtureIntegrationTest.java @@ -45,10 +45,14 @@ public Object[][] basicEntities() { JBoss7Server jboss7 = jboss7App.createAndManageChild(EntitySpec.create(JBoss7Server.class) .configure(JBoss7Server.HTTP_PORT, PortRanges.fromString(DEFAULT_HTTP_PORT))); + TestApplication wildfly8App = newTestApplication(); + Wildfly8Server wildfly8 = wildfly8App.createAndManageChild(EntitySpec.create(Wildfly8Server.class) + .configure(Wildfly8Server.HTTP_PORT, PortRanges.fromString(DEFAULT_HTTP_PORT))); + return new JavaWebAppSoftwareProcess[][] { new JavaWebAppSoftwareProcess[] {jboss6}, - new JavaWebAppSoftwareProcess[] {jboss7} - + new JavaWebAppSoftwareProcess[] {jboss7}, + new JavaWebAppSoftwareProcess[] {wildfly8} }; } diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Wildfly8ServerAwsEc2LiveTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Wildfly8ServerAwsEc2LiveTest.java new file mode 100644 index 0000000000..f847338080 --- /dev/null +++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Wildfly8ServerAwsEc2LiveTest.java @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 brooklyn.entity.webapp.jboss; + +import org.testng.annotations.Test; + +import brooklyn.entity.webapp.JavaWebAppSoftwareProcess; +import brooklyn.location.Location; + +/** + * A simple test of installing+running Wildfly 8 on AWS-EC2, using various OS distros and versions. + */ +public class Wildfly8ServerAwsEc2LiveTest extends JBossServerAwsEc2LiveTest { + + /** + * Wildfly8 does not yet support the metrics necessary for this test to pass. + * + * @see https://issues.apache.org/jira/browse/BROOKLYN-142 + */ + @Test(groups = "WIP") + @Override + protected void doTest(Location loc) throws Exception { + super.doTest(loc); + } + + /** + * Wildfly8 does not yet support the metrics necessary for this test to pass. + * + * @see https://issues.apache.org/jira/browse/BROOKLYN-142 + */ + @Test(groups = "WIP") + @Override + public void test_CentOS_6_3() throws Exception { + super.test_CentOS_6_3(); + } + + @Test(enabled=false) + public void testDummy() {} // Convince testng IDE integration that this really does have test methods + + @Override + protected Class getServerType() { + return Wildfly8Server.class; + } +} diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Wildfly8ServerDockerLiveTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Wildfly8ServerDockerLiveTest.java new file mode 100644 index 0000000000..01ac4770be --- /dev/null +++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Wildfly8ServerDockerLiveTest.java @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 brooklyn.entity.webapp.jboss; + +import org.testng.annotations.Test; + +import brooklyn.entity.webapp.JavaWebAppSoftwareProcess; +import brooklyn.location.Location; + +/** + * A simple test of installing+running Wildfly 8 on Docker, using various OS distros and versions. + */ +public class Wildfly8ServerDockerLiveTest extends JBossServerDockerLiveTest { + + /** + * Wildfly8 does not yet support the metrics necessary for this test to pass. + * + * @see https://issues.apache.org/jira/browse/BROOKLYN-142 + */ + @Test(groups = "WIP") + @Override + protected void doTest(Location loc) throws Exception { + super.doTest(loc); + } + + @Test(enabled = false) + public void testDummy() { + } // Convince testng IDE integration that this really does have test methods + + @Override + protected Class getServerType() { + return Wildfly8Server.class; + } +} diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Wildfly8ServerGoogleComputeLiveTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Wildfly8ServerGoogleComputeLiveTest.java new file mode 100644 index 0000000000..90d4f90b45 --- /dev/null +++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Wildfly8ServerGoogleComputeLiveTest.java @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 brooklyn.entity.webapp.jboss; + +import org.testng.annotations.Test; + +import brooklyn.entity.webapp.JavaWebAppSoftwareProcess; +import brooklyn.location.Location; + +/** + * A simple test of installing+running Wildfly 8 on AWS-EC2, using various OS distros and versions. + */ +public class Wildfly8ServerGoogleComputeLiveTest extends JBossServerGoogleComputeLiveTest { + + /** + * Wildfly8 does not yet support the metrics necessary for this test to pass. + * + * @see https://issues.apache.org/jira/browse/BROOKLYN-142 + */ + @Test(groups = "WIP") + @Override + protected void doTest(Location loc) throws Exception { + super.doTest(loc); + } + + /** + * Wildfly8 does not yet support the metrics necessary for this test to pass. + * + * @see https://issues.apache.org/jira/browse/BROOKLYN-142 + */ + @Test(groups = "WIP") + @Override + public void test_DefaultImage() throws Exception { + super.test_DefaultImage(); + } + + @Test(enabled=false) + public void testDummy() {} // Convince testng IDE integration that this really does have test methods + + @Override + protected Class getServerType() { + return Wildfly8Server.class; + } +} diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Wildfly8ServerSoftLayerLiveTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Wildfly8ServerSoftLayerLiveTest.java new file mode 100644 index 0000000000..5367be72af --- /dev/null +++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Wildfly8ServerSoftLayerLiveTest.java @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 brooklyn.entity.webapp.jboss; + +import org.testng.annotations.Test; + +import brooklyn.entity.webapp.JavaWebAppSoftwareProcess; +import brooklyn.location.Location; + +/** + * A simple test of installing+running JBoss AS7 on SoftLayer, using various OS distros and versions. + */ +public class Wildfly8ServerSoftLayerLiveTest extends JBossServerSoftLayerLiveTest { + + /** + * Wildfly8 does not yet support the metrics necessary for this test to pass. + * + * @see https://issues.apache.org/jira/browse/BROOKLYN-142 + */ + @Test(groups = "WIP") + @Override + protected void doTest(Location loc) throws Exception { + super.doTest(loc); + } + + @Test(enabled = false) + public void testDummy() { + } // Convince testng IDE integration that this really does have test methods + + @Override + protected Class getServerType() { + return Wildfly8Server.class; + } +}