You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2014/11/13 13:44:16 UTC
[09/10] incubator-brooklyn git commit: fix a few https/tomcat issues
fix a few https/tomcat issues
add yaml example, making HttpsSslConfig coercible from a map, and misc tidy-up from #323 -
* use httpsPort when configuring (previously hard-coded 8443)
* fix integration test - parameters supplier, each entity needs its own app due to their lifecycle
also rename JbossXxxx things to JBossXxx (taking care to change names slightly to prevent case-insensitive collision errors)
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/7ef195f0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/7ef195f0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/7ef195f0
Branch: refs/heads/master
Commit: 7ef195f004bd7e4e718e1af744eaa31e5cf1015b
Parents: 49dad19
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Thu Nov 13 12:26:55 2014 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Thu Nov 13 12:43:34 2014 +0000
----------------------------------------------------------------------
.../java/brooklyn/event/feed/jmx/JmxFeed.java | 2 +-
.../brooklyn/entity/webapp/HttpsSslConfig.java | 21 ++
.../webapp/JavaWebAppSoftwareProcess.java | 10 +
.../webapp/JavaWebAppSoftwareProcessImpl.java | 2 +-
.../entity/webapp/sample-java-keystore.jks | Bin 0 -> 1355 bytes
.../entity/webapp/sample-java-keystore.txt | 22 +++
.../brooklyn/entity/webapp/tomcat/server.xml | 14 +-
.../AbstractWebAppFixtureIntegrationTest.java | 40 +---
...ElasticJavaWebAppServiceIntegrationTest.java | 9 +-
.../entity/webapp/HttpsSslConfigTest.java | 38 ++++
.../webapp/TomcatAutoScalerPolicyTest.java | 3 +-
.../jboss/JBoss6ServerAwsEc2LiveTest.java | 68 +++++++
...Boss6ServerNonInheritingIntegrationTest.java | 103 ++++++++++
.../jboss/JBoss7ServerAwsEc2LiveTest.java | 74 +++++++
.../jboss/JBoss7ServerDockerLiveTest.java | 70 +++++++
...Boss7ServerNonInheritingIntegrationTest.java | 184 ++++++++++++++++++
.../JBoss7ServerRebindingIntegrationTest.java | 122 ++++++++++++
...ultiVersionWebAppFixtureIntegrationTest.java | 106 ++++++++++
.../webapp/jboss/Jboss6ServerEc2LiveTest.java | 68 -------
.../jboss/Jboss6ServerIntegrationTest.java | 103 ----------
.../webapp/jboss/Jboss7DockerLiveTest.java | 70 -------
.../webapp/jboss/Jboss7ServerEc2LiveTest.java | 74 -------
.../jboss/Jboss7ServerIntegrationTest.java | 194 -------------------
.../Jboss7ServerRebindIntegrationTest.java | 126 ------------
...JbossServerWebAppFixtureIntegrationTest.java | 106 ----------
...omcatServerWebAppFixtureIntegrationTest.java | 29 +--
.../src/test/resources/test-tomcat-https.yaml | 29 +++
27 files changed, 886 insertions(+), 801 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/base/src/main/java/brooklyn/event/feed/jmx/JmxFeed.java
----------------------------------------------------------------------
diff --git a/software/base/src/main/java/brooklyn/event/feed/jmx/JmxFeed.java b/software/base/src/main/java/brooklyn/event/feed/jmx/JmxFeed.java
index 24d95b5..132740c 100644
--- a/software/base/src/main/java/brooklyn/event/feed/jmx/JmxFeed.java
+++ b/software/base/src/main/java/brooklyn/event/feed/jmx/JmxFeed.java
@@ -423,6 +423,6 @@ public class JmxFeed extends AbstractFeed {
@Override
public String toString() {
- return "JmxFeed["+getJmxUri()+"]";
+ return "JmxFeed["+(getManagementContext()!=null&&getManagementContext().isRunning()?getJmxUri():"mgmt-not-running")+"]";
}
}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/main/java/brooklyn/entity/webapp/HttpsSslConfig.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/java/brooklyn/entity/webapp/HttpsSslConfig.java b/software/webapp/src/main/java/brooklyn/entity/webapp/HttpsSslConfig.java
index 672cfb3..cca69d0 100644
--- a/software/webapp/src/main/java/brooklyn/entity/webapp/HttpsSslConfig.java
+++ b/software/webapp/src/main/java/brooklyn/entity/webapp/HttpsSslConfig.java
@@ -18,6 +18,10 @@
*/
package brooklyn.entity.webapp;
+import java.util.Map;
+
+import brooklyn.util.guava.Maybe;
+
public class HttpsSslConfig {
private String keystoreUrl;
@@ -50,4 +54,21 @@ public class HttpsSslConfig {
public String getKeyAlias() {
return keyAlias;
}
+
+ // method naming convention allows it to be used by TypeCoercions
+ public static HttpsSslConfig fromMap(Map<String,String> map) {
+ HttpsSslConfig result = new HttpsSslConfig();
+ result.keystoreUrl = first(map, "keystoreUrl", "url").orNull();
+ result.keystorePassword = first(map, "keystorePassword", "password").orNull();
+ result.keyAlias = first(map, "keyAlias", "alias", "key").orNull();
+ return result;
+ }
+
+ private static Maybe<String> first(Map<String,String> map, String ...keys) {
+ for (String key: keys) {
+ if (map.containsKey(key))
+ return Maybe.of(map.get(key));
+ }
+ return Maybe.<String>absent();
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/main/java/brooklyn/entity/webapp/JavaWebAppSoftwareProcess.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/java/brooklyn/entity/webapp/JavaWebAppSoftwareProcess.java b/software/webapp/src/main/java/brooklyn/entity/webapp/JavaWebAppSoftwareProcess.java
index 5460f79..bbeead2 100644
--- a/software/webapp/src/main/java/brooklyn/entity/webapp/JavaWebAppSoftwareProcess.java
+++ b/software/webapp/src/main/java/brooklyn/entity/webapp/JavaWebAppSoftwareProcess.java
@@ -21,4 +21,14 @@ package brooklyn.entity.webapp;
import brooklyn.entity.basic.SoftwareProcess;
public interface JavaWebAppSoftwareProcess extends SoftwareProcess, JavaWebAppService, JavaWebAppService.CanDeployAndUndeploy {
+
+ // exist on the interface for freemarker to pick it up
+
+ public boolean isHttpEnabled();
+ public boolean isHttpsEnabled();
+ public Integer getHttpPort();
+ public Integer getHttpsPort();
+ public String getHttpsSslKeyAlias();
+ public String getHttpsSslKeystorePassword();
+
}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/main/java/brooklyn/entity/webapp/JavaWebAppSoftwareProcessImpl.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/java/brooklyn/entity/webapp/JavaWebAppSoftwareProcessImpl.java b/software/webapp/src/main/java/brooklyn/entity/webapp/JavaWebAppSoftwareProcessImpl.java
index 165c206..209d3fe 100644
--- a/software/webapp/src/main/java/brooklyn/entity/webapp/JavaWebAppSoftwareProcessImpl.java
+++ b/software/webapp/src/main/java/brooklyn/entity/webapp/JavaWebAppSoftwareProcessImpl.java
@@ -200,7 +200,7 @@ public abstract class JavaWebAppSoftwareProcessImpl extends SoftwareProcessImpl
public String getHttpsSslKeystorePassword() {
HttpsSslConfig config = getAttribute(HTTPS_SSL_CONFIG);
- return (config == null) ? null : config.getKeystorePassword();
+ return (config == null) ? "" : config.getKeystorePassword();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/main/resources/brooklyn/entity/webapp/sample-java-keystore.jks
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/resources/brooklyn/entity/webapp/sample-java-keystore.jks b/software/webapp/src/main/resources/brooklyn/entity/webapp/sample-java-keystore.jks
new file mode 100644
index 0000000..ee18b1d
Binary files /dev/null and b/software/webapp/src/main/resources/brooklyn/entity/webapp/sample-java-keystore.jks differ
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/main/resources/brooklyn/entity/webapp/sample-java-keystore.txt
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/resources/brooklyn/entity/webapp/sample-java-keystore.txt b/software/webapp/src/main/resources/brooklyn/entity/webapp/sample-java-keystore.txt
new file mode 100644
index 0000000..53096b5
--- /dev/null
+++ b/software/webapp/src/main/resources/brooklyn/entity/webapp/sample-java-keystore.txt
@@ -0,0 +1,22 @@
+
+Keystore for use in tests and sample YAML, containing key with alias "myname" and password "mypass";
+created for this project using AbstractWebAppFixtureIntegrationTest.createTemporaryKeyStore .
+
+
+----
+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
+
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/main/resources/brooklyn/entity/webapp/tomcat/server.xml
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/resources/brooklyn/entity/webapp/tomcat/server.xml b/software/webapp/src/main/resources/brooklyn/entity/webapp/tomcat/server.xml
index 400598a..df1360c 100644
--- a/software/webapp/src/main/resources/brooklyn/entity/webapp/tomcat/server.xml
+++ b/software/webapp/src/main/resources/brooklyn/entity/webapp/tomcat/server.xml
@@ -68,36 +68,36 @@
Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
Java AJP Connector: /docs/config/ajp.html
APR (HTTP/AJP) Connector: /docs/apr.html
- Define a non-SSL HTTP/1.1 Connector on port 8080
+ Define a non-SSL HTTP/1.1 Connector on port ${driver.httpPort?c}
-->
[#if entity.httpEnabled]
<Connector port="${driver.httpPort?c}" protocol="HTTP/1.1"
connectionTimeout="20000"
- redirectPort="8443" />
+ redirectPort="${driver.httpsPort?c}" />
[/#if]
<!-- A "Connector" using the shared thread pool-->
<!--
<Connector executor="tomcatThreadPool"
- port="8080" protocol="HTTP/1.1"
+ port="${driver.httpPort?c}" protocol="HTTP/1.1"
connectionTimeout="20000"
- redirectPort="8443" />
+ redirectPort="${driver.httpsPort?c}" />
-->
- <!-- Define a SSL HTTP/1.1 Connector on port 8443
+ <!-- Define a SSL HTTP/1.1 Connector on port ${driver.httpPort?c}
This connector uses the BIO implementation that requires the JSSE
style configuration. When using the APR/native implementation, the
OpenSSL style configuration is required as described in the APR/native
documentation -->
[#if entity.httpsEnabled]
- <Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol"
+ <Connector port="${driver.httpsPort?c}" protocol="org.apache.coyote.http11.Http11Protocol"
maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
keystoreFile="${driver.httpsSslKeystoreFile}" keystorePass="${entity.httpsSslKeystorePassword}"
clientAuth="false" sslProtocol="TLS" />
[/#if]
<!-- Define an AJP 1.3 Connector on port 8009 -->
- <!-- <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> -->
+ <!-- <Connector port="8009" protocol="AJP/1.3" redirectPort="${driver.httpPort?c}" /> -->
<!-- An Engine represents the entry point (within Catalina) that processes
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/test/java/brooklyn/entity/webapp/AbstractWebAppFixtureIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/AbstractWebAppFixtureIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/AbstractWebAppFixtureIntegrationTest.java
index 478f913..cbfb436 100644
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/AbstractWebAppFixtureIntegrationTest.java
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/AbstractWebAppFixtureIntegrationTest.java
@@ -52,30 +52,24 @@ import brooklyn.entity.basic.Entities;
import brooklyn.entity.basic.EntityInternal;
import brooklyn.entity.basic.EntityLocal;
import brooklyn.entity.basic.SoftwareProcess;
-import brooklyn.entity.rebind.PersistenceExceptionHandlerImpl;
-import brooklyn.entity.rebind.dto.MementosGenerators;
-import brooklyn.entity.rebind.persister.BrooklynMementoPersisterToMultiFile;
+import brooklyn.entity.drivers.DriverDependentEntity;
import brooklyn.entity.trait.Startable;
import brooklyn.event.SensorEvent;
import brooklyn.event.SensorEventListener;
+import brooklyn.location.LocationSpec;
import brooklyn.location.basic.LocalhostMachineProvisioningLocation;
import brooklyn.management.ManagementContext;
import brooklyn.management.SubscriptionContext;
import brooklyn.management.SubscriptionHandle;
-import brooklyn.management.ha.ManagementNodeState;
import brooklyn.management.internal.LocalManagementContext;
-import brooklyn.management.internal.ManagementContextInternal;
-import brooklyn.mementos.BrooklynMemento;
import brooklyn.test.Asserts;
import brooklyn.test.EntityTestUtils;
import brooklyn.test.HttpTestUtils;
-import brooklyn.test.entity.LocalManagementContextForTests;
import brooklyn.test.entity.TestApplication;
import brooklyn.util.collections.MutableMap;
import brooklyn.util.crypto.FluentKeySigner;
import brooklyn.util.crypto.SecureKeys;
import brooklyn.util.net.Urls;
-import brooklyn.util.os.Os;
import brooklyn.util.stream.Streams;
import brooklyn.util.time.Time;
@@ -112,8 +106,8 @@ public abstract class AbstractWebAppFixtureIntegrationTest {
@BeforeMethod(alwaysRun=true)
public void setUp() throws Exception {
- loc = new LocalhostMachineProvisioningLocation(MutableMap.of("name", "london"));
- getMgmt().getLocationManager().manage(loc);
+ loc = getMgmt().getLocationManager().createLocation(LocationSpec.create(LocalhostMachineProvisioningLocation.class)
+ .configure("name", "london"));
}
/*
@@ -239,29 +233,9 @@ public abstract class AbstractWebAppFixtureIntegrationTest {
* Stop the given underlying entity, but without our entity instance being told!
*/
protected void killEntityBehindBack(Entity tokill) throws Exception {
- // Previously was calling entity.getDriver().kill(); but now our entity instance is a proxy so can't do that
- ManagementContext newManagementContext = null;
- File tempDir = Os.newTempDir(getClass());
- try {
- ManagementContext managementContext = ((EntityInternal)tokill).getManagementContext();
- BrooklynMemento brooklynMemento = MementosGenerators.newBrooklynMemento(managementContext);
-
- BrooklynMementoPersisterToMultiFile oldPersister = new BrooklynMementoPersisterToMultiFile(tempDir , getClass().getClassLoader());
- oldPersister.checkpoint(brooklynMemento, PersistenceExceptionHandlerImpl.builder().build());
- oldPersister.waitForWritesCompleted(30*1000, TimeUnit.MILLISECONDS);
-
- BrooklynMementoPersisterToMultiFile newPersister = new BrooklynMementoPersisterToMultiFile(tempDir , getClass().getClassLoader());
- newManagementContext = new LocalManagementContextForTests();
- newManagementContext.getRebindManager().setPersister(newPersister, PersistenceExceptionHandlerImpl.builder().build());
- newManagementContext.getRebindManager().rebind(getClass().getClassLoader(), null, ManagementNodeState.MASTER);
- newManagementContext.getRebindManager().startPersistence();
- SoftwareProcess entity2 = (SoftwareProcess) newManagementContext.getEntityManager().getEntity(tokill.getId());
- entity2.stop();
- } finally {
- if (newManagementContext != null) ((ManagementContextInternal)newManagementContext).terminate();
- Os.deleteRecursively(tempDir.getAbsolutePath());
- }
- log.info("called to stop {} in parallel mgmt universe", entity);
+ ((JavaWebAppDriver)((DriverDependentEntity<?>)Entities.deproxy(entity)).getDriver()).stop();
+ // old method of doing this did some dodgy legacy rebind and failed due to too many dangling refs; above is better in any case
+ // but TODO we should have some rebind tests for these!
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/test/java/brooklyn/entity/webapp/ElasticJavaWebAppServiceIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/ElasticJavaWebAppServiceIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/ElasticJavaWebAppServiceIntegrationTest.java
index eb90157..09535b7 100644
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/ElasticJavaWebAppServiceIntegrationTest.java
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/ElasticJavaWebAppServiceIntegrationTest.java
@@ -23,7 +23,6 @@ import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
-import brooklyn.entity.basic.ApplicationBuilder;
import brooklyn.entity.basic.Entities;
import brooklyn.location.basic.LocalhostMachineProvisioningLocation;
import brooklyn.test.HttpTestUtils;
@@ -39,8 +38,8 @@ public class ElasticJavaWebAppServiceIntegrationTest {
@BeforeMethod(alwaysRun=true)
public void setUp() throws Exception {
- loc = new LocalhostMachineProvisioningLocation();
- app = ApplicationBuilder.newManagedApp(TestApplication.class);
+ app = TestApplication.Factory.newManagedInstanceForTests();
+ loc = app.newLocalhostProvisioningLocation();
}
@AfterMethod(alwaysRun=true)
@@ -48,8 +47,10 @@ public class ElasticJavaWebAppServiceIntegrationTest {
if (app != null) Entities.destroyAll(app.getManagementContext());
}
+ @SuppressWarnings("deprecation")
@Test(groups = "Integration")
- public void testFactory() {
+ // TODO a new approach to what ElasticJavaWebAppService.Factory does, giving a different entity depending on location!
+ public void testLegacyFactory() {
ElasticJavaWebAppService svc =
new ElasticJavaWebAppService.Factory().newEntity(MutableMap.of("war", "classpath://hello-world.war"), app);
Entities.manage(svc);
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/test/java/brooklyn/entity/webapp/HttpsSslConfigTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/HttpsSslConfigTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/HttpsSslConfigTest.java
new file mode 100644
index 0000000..da4b0ce
--- /dev/null
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/HttpsSslConfigTest.java
@@ -0,0 +1,38 @@
+/*
+ * 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;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import brooklyn.util.collections.MutableMap;
+import brooklyn.util.flags.TypeCoercions;
+
+public class HttpsSslConfigTest {
+
+ @Test
+ public void testCoerce() {
+ HttpsSslConfig config = TypeCoercions.coerce(MutableMap.of("keystoreUrl", "http://foo", "keystorePassword", "b4r", "keyAlias", "baz"),
+ HttpsSslConfig.class);
+ Assert.assertEquals(config.getKeystoreUrl(), "http://foo");
+ Assert.assertEquals(config.getKeystorePassword(), "b4r");
+ Assert.assertEquals(config.getKeyAlias(), "baz");
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/test/java/brooklyn/entity/webapp/TomcatAutoScalerPolicyTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/TomcatAutoScalerPolicyTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/TomcatAutoScalerPolicyTest.java
index dc58557..7e41d75 100644
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/TomcatAutoScalerPolicyTest.java
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/TomcatAutoScalerPolicyTest.java
@@ -28,7 +28,6 @@ import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
-import brooklyn.entity.basic.ApplicationBuilder;
import brooklyn.entity.basic.Entities;
import brooklyn.entity.proxying.EntitySpec;
import brooklyn.entity.webapp.tomcat.TomcatServer;
@@ -60,7 +59,7 @@ public class TomcatAutoScalerPolicyTest {
@BeforeMethod(alwaysRun=true)
public void setUp() throws Exception {
- app = ApplicationBuilder.newManagedApp(TestApplication.class);
+ app = TestApplication.Factory.newManagedInstanceForTests();
managementContext = app.getManagementContext();
loc = managementContext.getLocationManager().createLocation(LocationSpec.create(LocalhostMachineProvisioningLocation.class)
.configure("name", "london"));
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss6ServerAwsEc2LiveTest.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..bc0f0d7
--- /dev/null
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss6ServerAwsEc2LiveTest.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 com.google.common.base.Preconditions.checkNotNull;
+import static org.testng.Assert.assertNotNull;
+
+import java.net.URL;
+
+import org.testng.annotations.Test;
+
+import brooklyn.entity.AbstractEc2LiveTest;
+import brooklyn.entity.proxying.EntitySpec;
+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.
+ */
+public class JBoss6ServerAwsEc2LiveTest extends AbstractEc2LiveTest {
+
+ private URL warUrl = checkNotNull(getClass().getClassLoader().getResource("hello-world.war"));
+
+ @Override
+ protected void doTest(Location loc) throws Exception {
+ final JBoss6Server server = app.createAndManageChild(EntitySpec.create(JBoss6Server.class)
+ .configure("war", warUrl.toString()));
+
+ 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));
+ }});
+ }
+
+ @Test(enabled=false)
+ public void testDummy() {} // Convince testng IDE integration that this really does have test methods
+}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss6ServerNonInheritingIntegrationTest.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..00686c5
--- /dev/null
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss6ServerNonInheritingIntegrationTest.java
@@ -0,0 +1,103 @@
+/*
+ * 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.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
+import java.net.URL;
+
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import brooklyn.entity.BrooklynAppLiveTestSupport;
+import brooklyn.entity.java.UsesJmx;
+import brooklyn.entity.proxying.EntitySpec;
+import brooklyn.location.basic.LocalhostMachineProvisioningLocation;
+import brooklyn.test.Asserts;
+import brooklyn.test.HttpTestUtils;
+
+import com.google.common.collect.ImmutableList;
+
+/**
+ * TODO re-write this like WebAppIntegrationTest, rather than being jboss6 specific.
+ */
+public class JBoss6ServerNonInheritingIntegrationTest extends BrooklynAppLiveTestSupport {
+
+ // FIXME Fails deploying hello-world.war
+ // 07:27:30,958 ERROR [AbstractKernelController] Error installing to Parse: name=vfs:///tmp/brooklyn-aled/apps/FJMcnSjO/entities/JBoss6Server_UZ2gA9HR/server/standard/deploy/ROOT.war state=PreParse mode=Manual requiredState=Parse: org.jboss.deployers.spi.DeploymentException: Error creating managed object for vfs:///tmp/brooklyn-aled/apps/FJMcnSjO/entities/JBoss6Server_UZ2gA9HR/server/standard/deploy/ROOT.war
+ // ...
+ // Caused by: org.xml.sax.SAXException: cvc-complex-type.2.4.d: Invalid content was found starting with element 'url-pattern'. No child element is expected at this point. @ vfs:///tmp/brooklyn-aled/apps/FJMcnSjO/entities/JBoss6Server_UZ2gA9HR/server/standard/deploy/ROOT.war/WEB-INF/web.xml[21,22]
+ // at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.error(SaxJBossXBParser.java:416) [jbossxb.jar:2.0.3.GA]
+
+ // Port increment for JBoss 6.
+ public static final int PORT_INCREMENT = 400;
+
+ private URL warUrl;
+ private LocalhostMachineProvisioningLocation localhostProvisioningLocation;
+
+ @BeforeMethod(alwaysRun=true)
+ public void setUp() throws Exception {
+ super.setUp();
+ String warPath = "hello-world-no-mapping.war";
+ warUrl = getClass().getClassLoader().getResource(warPath);
+
+ localhostProvisioningLocation = app.newLocalhostProvisioningLocation();
+ }
+
+ @Test(groups = "Integration")
+ public void testJmxmp() throws Exception {
+ runTest(UsesJmx.JmxAgentModes.JMXMP);
+ }
+
+ @Test(groups = "Integration")
+ public void testJmxRmi() throws Exception {
+ runTest(UsesJmx.JmxAgentModes.JMX_RMI_CUSTOM_AGENT);
+ }
+
+ @Test(groups = "Integration")
+ public void testJmxAutodetect() throws Exception {
+ runTest(UsesJmx.JmxAgentModes.AUTODETECT);
+ }
+
+ protected void runTest(UsesJmx.JmxAgentModes jmxAgentMode) throws Exception {
+ final JBoss6Server server = app.createAndManageChild(EntitySpec.create(JBoss6Server.class)
+ .configure(JBoss6Server.PORT_INCREMENT, PORT_INCREMENT)
+ .configure(UsesJmx.JMX_AGENT_MODE, jmxAgentMode)
+ .configure("war", warUrl.toString()));
+
+ app.start(ImmutableList.of(localhostProvisioningLocation));
+
+ String httpUrl = "http://"+server.getAttribute(JBoss6Server.HOSTNAME)+":"+server.getAttribute(JBoss6Server.HTTP_PORT)+"/";
+
+ assertEquals(server.getAttribute(JBoss6Server.ROOT_URL).toLowerCase(), httpUrl.toLowerCase());
+
+ HttpTestUtils.assertHttpStatusCodeEventuallyEquals(httpUrl, 200);
+ HttpTestUtils.assertContentContainsText(httpUrl, "Hello");
+
+
+ Asserts.succeedsEventually(new Runnable() {
+ @Override public void run() {
+ // TODO Could test other attributes as well; see jboss7 test
+ assertNotNull(server.getAttribute(JBoss6Server.REQUEST_COUNT));
+ assertNotNull(server.getAttribute(JBoss6Server.ERROR_COUNT));
+ assertNotNull(server.getAttribute(JBoss6Server.TOTAL_PROCESSING_TIME));
+ }});
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerAwsEc2LiveTest.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..575a708
--- /dev/null
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerAwsEc2LiveTest.java
@@ -0,0 +1,74 @@
+/*
+ * 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 com.google.common.base.Preconditions.checkNotNull;
+import static org.testng.Assert.assertNotNull;
+
+import java.net.URL;
+
+import org.testng.annotations.Test;
+
+import brooklyn.entity.AbstractEc2LiveTest;
+import brooklyn.entity.proxying.EntitySpec;
+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.
+ */
+public class JBoss7ServerAwsEc2LiveTest extends AbstractEc2LiveTest {
+
+ private URL warUrl = checkNotNull(getClass().getClassLoader().getResource("hello-world.war"));
+
+ @Override
+ protected void doTest(Location loc) throws Exception {
+ final JBoss7Server server = app.createAndManageChild(EntitySpec.create(JBoss7Server.class)
+ .configure("war", warUrl.toString()));
+
+ 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));
+ }});
+ }
+
+ @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
+}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerDockerLiveTest.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..1ac7fb3
--- /dev/null
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerDockerLiveTest.java
@@ -0,0 +1,70 @@
+/*
+ * 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.proxying.EntitySpec;
+import brooklyn.entity.software.AbstractDockerLiveTest;
+import brooklyn.location.Location;
+import brooklyn.test.Asserts;
+import brooklyn.test.HttpTestUtils;
+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;
+
+/**
+ * A simple test of installing+running on Docker, using various OS distros and versions.
+ */
+public class JBoss7ServerDockerLiveTest extends AbstractDockerLiveTest {
+
+ private URL warUrl = checkNotNull(getClass().getClassLoader().getResource("hello-world.war"));
+
+ @Override
+ protected void doTest(Location loc) throws Exception {
+ final JBoss7Server server = app.createAndManageChild(EntitySpec.create(JBoss7Server.class)
+ .configure("war", warUrl.toString()));
+
+ 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));
+ }
+ });
+ }
+
+ @Test(enabled = false)
+ public void testDummy() {
+ } // Convince testng IDE integration that this really does have test methods
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerNonInheritingIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerNonInheritingIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerNonInheritingIntegrationTest.java
new file mode 100644
index 0000000..04d5c7a
--- /dev/null
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerNonInheritingIntegrationTest.java
@@ -0,0 +1,184 @@
+/*
+ * 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.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
+import java.io.File;
+import java.net.URL;
+
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import brooklyn.entity.basic.Entities;
+import brooklyn.entity.proxying.EntitySpec;
+import brooklyn.entity.webapp.AbstractWebAppFixtureIntegrationTest;
+import brooklyn.entity.webapp.HttpsSslConfig;
+import brooklyn.location.basic.LocalhostMachineProvisioningLocation;
+import brooklyn.test.Asserts;
+import brooklyn.test.HttpTestUtils;
+import brooklyn.test.entity.TestApplication;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * TODO re-write this like WebAppIntegrationTest, inheriting, rather than being jboss7 specific.
+ */
+public class JBoss7ServerNonInheritingIntegrationTest {
+
+ private URL warUrl;
+ private LocalhostMachineProvisioningLocation localhostProvisioningLocation;
+ private TestApplication app;
+ private File keystoreFile;
+
+ @BeforeMethod(alwaysRun=true)
+ public void setUp() throws Exception {
+ String warPath = "hello-world.war";
+ warUrl = getClass().getClassLoader().getResource(warPath);
+
+ localhostProvisioningLocation = new LocalhostMachineProvisioningLocation();
+ app = TestApplication.Factory.newManagedInstanceForTests();
+ keystoreFile = AbstractWebAppFixtureIntegrationTest.createTemporaryKeyStore("myname", "mypass");
+ }
+
+ @AfterMethod(alwaysRun=true)
+ public void tearDown() throws Exception {
+ if (app != null) Entities.destroyAll(app.getManagementContext());
+ if (keystoreFile != null) keystoreFile.delete();
+ }
+
+ @Test(groups = "Integration")
+ public void testHttp() throws Exception {
+ final JBoss7Server server = app.createAndManageChild(EntitySpec.create(JBoss7Server.class)
+ .configure("war", warUrl.toString()));
+
+ app.start(ImmutableList.of(localhostProvisioningLocation));
+
+ String httpUrl = "http://"+server.getAttribute(JBoss7Server.HOSTNAME)+":"+server.getAttribute(JBoss7Server.HTTP_PORT)+"/";
+ String httpsUrl = "https://"+server.getAttribute(JBoss7Server.HOSTNAME)+":"+server.getAttribute(JBoss7Server.HTTPS_PORT)+"/";
+
+ assertEquals(server.getAttribute(JBoss7Server.ROOT_URL).toLowerCase(), httpUrl.toLowerCase());
+
+ HttpTestUtils.assertHttpStatusCodeEventuallyEquals(httpUrl, 200);
+ HttpTestUtils.assertContentContainsText(httpUrl, "Hello");
+
+ HttpTestUtils.assertUrlUnreachable(httpsUrl);
+
+ Asserts.succeedsEventually(new Runnable() {
+ 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));
+ }});
+ }
+
+ @Test(groups = {"Integration"})
+ public void testHttps() throws Exception {
+ final JBoss7Server server = app.createAndManageChild(EntitySpec.create(JBoss7Server.class)
+ .configure("war", warUrl.toString())
+ .configure(JBoss7Server.ENABLED_PROTOCOLS, ImmutableSet.of("https"))
+ .configure(JBoss7Server.HTTPS_SSL_CONFIG, new HttpsSslConfig().keyAlias("myname").keystorePassword("mypass").keystoreUrl(keystoreFile.getAbsolutePath())));
+
+ app.start(ImmutableList.of(localhostProvisioningLocation));
+
+ String httpUrl = "http://"+server.getAttribute(JBoss7Server.HOSTNAME)+":"+server.getAttribute(JBoss7Server.HTTP_PORT)+"/";
+ String httpsUrl = "https://"+server.getAttribute(JBoss7Server.HOSTNAME)+":"+server.getAttribute(JBoss7Server.HTTPS_PORT)+"/";
+
+ assertEquals(server.getAttribute(JBoss7Server.ROOT_URL).toLowerCase(), httpsUrl.toLowerCase());
+
+ HttpTestUtils.assertUrlUnreachable(httpUrl);
+
+ // FIXME HttpTestUtils isn't coping with https, giving
+ // javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
+ // Uncomment this as soon as HttpTestUtils is fixed
+ // Manual inspection with breakpoint and web-browser confirmed this was working
+// HttpTestUtils.assertHttpStatusCodeEventuallyEquals(httpsUrl, 200);
+// HttpTestUtils.assertContentContainsText(httpsUrl, "Hello");
+
+ // FIXME querying for http://localhost:9990/management/subsystem/web/connector/http/read-resource?include-runtime=true
+ // gives 500 when http is disabled, but if miss out "?include-runtime=true" then it works fine.
+ // So not getting these metrics!
+// TestUtils.executeUntilSucceeds(new Runnable() {
+// 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));
+// }});
+ }
+
+ @Test(groups = {"Integration"})
+ public void testHttpAndHttps() throws Exception {
+ final JBoss7Server server = app.createAndManageChild(EntitySpec.create(JBoss7Server.class)
+ .configure("war", warUrl.toString())
+ .configure(JBoss7Server.ENABLED_PROTOCOLS, ImmutableSet.of("http", "https"))
+ .configure(JBoss7Server.HTTPS_SSL_CONFIG, new HttpsSslConfig().keyAlias("myname").keystorePassword("mypass").keystoreUrl(keystoreFile.getAbsolutePath())));
+
+ app.start(ImmutableList.of(localhostProvisioningLocation));
+
+ String httpUrl = "http://"+server.getAttribute(JBoss7Server.HOSTNAME)+":"+server.getAttribute(JBoss7Server.HTTP_PORT)+"/";
+ String httpsUrl = "https://"+server.getAttribute(JBoss7Server.HOSTNAME)+":"+server.getAttribute(JBoss7Server.HTTPS_PORT)+"/";
+
+ assertEquals(server.getAttribute(JBoss7Server.ROOT_URL).toLowerCase(), httpsUrl.toLowerCase());
+
+ HttpTestUtils.assertHttpStatusCodeEventuallyEquals(httpUrl, 200);
+ HttpTestUtils.assertContentContainsText(httpUrl, "Hello");
+
+ // FIXME HttpTestUtils isn't coping with https, giving
+ // javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
+ // Uncomment this as soon as HttpTestUtils is fixed
+ // Manual inspection with breakpoint and web-browser confirmed this was working
+ //HttpTestUtils.assertHttpStatusCodeEventuallyEquals(httpsUrl, 200);
+ //HttpTestUtils.assertContentContainsText(httpsUrl, "Hello");
+
+ Asserts.succeedsEventually(new Runnable() {
+ 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));
+ }});
+ }
+
+ @Test(groups = {"Integration"})
+ public void testUsingPortOffsets() throws Exception {
+ final JBoss7Server serverA = app.createAndManageChild(EntitySpec.create(JBoss7Server.class)
+ .configure("portIncrement", 100));
+ final JBoss7Server serverB = app.createAndManageChild(EntitySpec.create(JBoss7Server.class)
+ .configure("portIncrement", 200));
+ app.start(ImmutableList.of(localhostProvisioningLocation));
+
+ Asserts.succeedsEventually(new Runnable() {
+ public void run() {
+ assertNotNull(serverA.getAttribute(JBoss7Server.BYTES_SENT));
+ assertNotNull(serverB.getAttribute(JBoss7Server.BYTES_SENT));
+ }});
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerRebindingIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerRebindingIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerRebindingIntegrationTest.java
new file mode 100644
index 0000000..12b0843
--- /dev/null
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBoss7ServerRebindingIntegrationTest.java
@@ -0,0 +1,122 @@
+/*
+ * 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.assertEquals;
+
+import java.net.URL;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import brooklyn.entity.basic.SoftwareProcess;
+import brooklyn.entity.proxying.EntitySpec;
+import brooklyn.entity.rebind.RebindTestFixtureWithApp;
+import brooklyn.location.basic.LocalhostMachineProvisioningLocation;
+import brooklyn.test.EntityTestUtils;
+import brooklyn.test.HttpTestUtils;
+import brooklyn.test.WebAppMonitor;
+import brooklyn.test.entity.TestApplication;
+
+import com.google.common.base.Predicates;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Iterables;
+
+public class JBoss7ServerRebindingIntegrationTest extends RebindTestFixtureWithApp {
+ private static final Logger LOG = LoggerFactory.getLogger(JBoss7ServerRebindingIntegrationTest.class);
+
+ private URL warUrl;
+ private LocalhostMachineProvisioningLocation localhostProvisioningLocation;
+ private TestApplication newApp;
+ private List<WebAppMonitor> webAppMonitors = new CopyOnWriteArrayList<WebAppMonitor>();
+ private ExecutorService executor;
+
+ @BeforeMethod(groups = "Integration")
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ String warPath = "hello-world.war";
+ warUrl = getClass().getClassLoader().getResource(warPath);
+ executor = Executors.newCachedThreadPool();
+ localhostProvisioningLocation = (LocalhostMachineProvisioningLocation) origManagementContext.getLocationRegistry().resolve("localhost");
+ }
+
+ @Override
+ @AfterMethod(alwaysRun=true)
+ public void tearDown() throws Exception {
+ for (WebAppMonitor monitor : webAppMonitors) {
+ monitor.terminate();
+ }
+ if (executor != null) executor.shutdownNow();
+ super.tearDown();
+ }
+
+ private WebAppMonitor newWebAppMonitor(String url) {
+ WebAppMonitor monitor = new WebAppMonitor(url)
+// .delayMillis(0)
+ .logFailures(LOG);
+ webAppMonitors.add(monitor);
+ executor.execute(monitor);
+ return monitor;
+ }
+
+ @Test(groups = "Integration")
+ public void testRebindsToRunningServer() throws Exception {
+ // Start an app-server, and wait for it to be fully up
+ JBoss7Server origServer = origApp.createAndManageChild(EntitySpec.create(JBoss7Server.class)
+ .configure("war", warUrl.toString()));
+
+ origApp.start(ImmutableList.of(localhostProvisioningLocation));
+
+ HttpTestUtils.assertHttpStatusCodeEventuallyEquals(origServer.getAttribute(JBoss7Server.ROOT_URL), 200);
+ WebAppMonitor monitor = newWebAppMonitor(origServer.getAttribute(JBoss7Server.ROOT_URL));
+
+ // Rebind
+ newApp = rebind(false, true);
+ JBoss7Server newServer = (JBoss7Server) Iterables.find(newApp.getChildren(), Predicates.instanceOf(JBoss7Server.class));
+ String newRootUrl = newServer.getAttribute(JBoss7Server.ROOT_URL);
+
+ assertEquals(newRootUrl, origServer.getAttribute(JBoss7Server.ROOT_URL));
+ assertEquals(newServer.getAttribute(JBoss7Server.MANAGEMENT_HTTP_PORT), origServer.getAttribute(JBoss7Server.MANAGEMENT_HTTP_PORT));
+ assertEquals(newServer.getAttribute(JBoss7Server.DEPLOYED_WARS), origServer.getAttribute(JBoss7Server.DEPLOYED_WARS));
+
+ EntityTestUtils.assertAttributeEqualsEventually(newServer, SoftwareProcess.SERVICE_UP, true);
+ HttpTestUtils.assertHttpStatusCodeEventuallyEquals(newRootUrl, 200);
+
+ // confirm that deploy() effector affects the correct jboss server
+ newServer.deploy(warUrl.toString(), "myhello.war");
+ HttpTestUtils.assertHttpStatusCodeEventuallyEquals(newRootUrl+"myhello", 200);
+
+ // check we see evidence of the enrichers and sensor-feeds having an effect.
+ // Relying on WebAppMonitor to cause these to change.
+ EntityTestUtils.assertAttributeChangesEventually(newServer, JBoss7Server.REQUEST_COUNT);
+ EntityTestUtils.assertAttributeChangesEventually(newServer, JBoss7Server.REQUESTS_PER_SECOND_IN_WINDOW);
+ EntityTestUtils.assertAttributeChangesEventually(newServer, JBoss7Server.REQUESTS_PER_SECOND_IN_WINDOW);
+ EntityTestUtils.assertAttributeChangesEventually(newServer, JBoss7Server.PROCESSING_TIME_FRACTION_IN_WINDOW);
+
+ assertEquals(monitor.getFailures(), 0);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBossServersMultiVersionWebAppFixtureIntegrationTest.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..cf576c3
--- /dev/null
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/JBossServersMultiVersionWebAppFixtureIntegrationTest.java
@@ -0,0 +1,106 @@
+/*
+ * 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.DataProvider;
+import org.testng.annotations.Test;
+
+import brooklyn.entity.basic.SoftwareProcess;
+import brooklyn.entity.proxying.EntitySpec;
+import brooklyn.entity.webapp.AbstractWebAppFixtureIntegrationTest;
+import brooklyn.entity.webapp.JavaWebAppSoftwareProcess;
+import brooklyn.location.basic.PortRanges;
+import brooklyn.test.entity.TestApplication;
+
+public class JBossServersMultiVersionWebAppFixtureIntegrationTest extends AbstractWebAppFixtureIntegrationTest {
+
+ @Test(groups = "Integration", dataProvider = "basicEntities")
+ public void testReportsServiceDownWhenKilled(final SoftwareProcess entity) throws Exception {
+ super.testReportsServiceDownWhenKilled(entity);
+ }
+
+ @DataProvider(name = "basicEntities")
+ public Object[][] basicEntities() {
+ TestApplication jboss6App = newTestApplication();
+ JBoss6Server jboss6 = jboss6App.createAndManageChild(EntitySpec.create(JBoss6Server.class)
+ .configure(JBoss6Server.PORT_INCREMENT, PORT_INCREMENT));
+
+ TestApplication jboss7App = newTestApplication();
+ JBoss7Server jboss7 = jboss7App.createAndManageChild(EntitySpec.create(JBoss7Server.class)
+ .configure(JBoss7Server.HTTP_PORT, PortRanges.fromString(DEFAULT_HTTP_PORT)));
+
+ return new JavaWebAppSoftwareProcess[][] {
+ new JavaWebAppSoftwareProcess[] {jboss6},
+ new JavaWebAppSoftwareProcess[] {jboss7}
+
+ };
+ }
+
+ // to be able to test on this class in Eclipse IDE
+ @Test(groups = "Integration", dataProvider = "basicEntities")
+ public void canStartAndStop(final SoftwareProcess entity) {
+ super.canStartAndStop(entity);
+ }
+
+// @Override
+// // TODO override parent and add seam-booking-as{6,7}
+// @DataProvider(name = "entitiesWithWarAndURL")
+// public Object[][] entitiesWithWar() {
+// List<Object[]> result = Lists.newArrayList();
+//
+// for (Object[] entity : basicEntities()) {
+// result.add(new Object[] {
+// entity[0],
+// "hello-world.war",
+// "hello-world/",
+// "" // no sub-page path
+// });
+// }
+//
+// TestApplication tomcatApp = newTestApplication();
+// TomcatServer tomcat = tomcatApp.createAndManageChild(EntitySpec.create(TomcatServer.class)
+// .configure(TomcatServer.HTTP_PORT, PortRanges.fromString(DEFAULT_HTTP_PORT)));
+// result.add(new Object[] {
+// tomcat,
+// "swf-booking-mvc.war",
+// "swf-booking-mvc/",
+// "spring/intro",
+// });
+// // FIXME seam-booking does not work
+//// [ new JBoss6ServerImpl(parent:application, portIncrement:PORT_INCREMENT),
+//// "seam-booking-as6.war",
+//// "seam-booking-as6/",
+//// ],
+//// [ new JBoss7ServerImpl(parent:application, httpPort:DEFAULT_HTTP_PORT),
+//// "seam-booking-as7.war",
+//// "seam-booking-as7/",
+//// ],
+//
+// return result.toArray(new Object[][] {});
+// }
+
+ public static void main(String ...args) throws Exception {
+ JBossServersMultiVersionWebAppFixtureIntegrationTest t = new JBossServersMultiVersionWebAppFixtureIntegrationTest();
+ t.setUp();
+ t.testReportsServiceDownWhenKilled((SoftwareProcess) t.basicEntities()[0][0]);
+ t.shutdownApp();
+ t.shutdownMgmt();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss6ServerEc2LiveTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss6ServerEc2LiveTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss6ServerEc2LiveTest.java
deleted file mode 100644
index 92d07c3..0000000
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss6ServerEc2LiveTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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 com.google.common.base.Preconditions.checkNotNull;
-import static org.testng.Assert.assertNotNull;
-
-import java.net.URL;
-
-import org.testng.annotations.Test;
-
-import brooklyn.entity.AbstractEc2LiveTest;
-import brooklyn.entity.proxying.EntitySpec;
-import brooklyn.location.Location;
-import brooklyn.test.HttpTestUtils;
-import brooklyn.test.TestUtils;
-
-import com.google.common.collect.ImmutableList;
-
-/**
- * A simple test of installing+running on AWS-EC2, using various OS distros and versions.
- */
-public class Jboss6ServerEc2LiveTest extends AbstractEc2LiveTest {
-
- private URL warUrl = checkNotNull(getClass().getClassLoader().getResource("hello-world.war"));
-
- @Override
- protected void doTest(Location loc) throws Exception {
- final JBoss6Server server = app.createAndManageChild(EntitySpec.create(JBoss6Server.class)
- .configure("war", warUrl.toString()));
-
- app.start(ImmutableList.of(loc));
-
- String url = server.getAttribute(JBoss6Server.ROOT_URL);
-
- HttpTestUtils.assertHttpStatusCodeEventuallyEquals(url, 200);
- HttpTestUtils.assertContentContainsText(url, "Hello");
-
- TestUtils.executeUntilSucceeds(new Runnable() {
- 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));
- }});
- }
-
- @Test(enabled=false)
- public void testDummy() {} // Convince testng IDE integration that this really does have test methods
-}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss6ServerIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss6ServerIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss6ServerIntegrationTest.java
deleted file mode 100644
index e3fd800..0000000
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss6ServerIntegrationTest.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * 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.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
-import java.net.URL;
-
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import brooklyn.entity.BrooklynAppLiveTestSupport;
-import brooklyn.entity.java.UsesJmx;
-import brooklyn.entity.proxying.EntitySpec;
-import brooklyn.location.basic.LocalhostMachineProvisioningLocation;
-import brooklyn.test.Asserts;
-import brooklyn.test.HttpTestUtils;
-
-import com.google.common.collect.ImmutableList;
-
-/**
- * TODO re-write this like WebAppIntegrationTest, rather than being jboss6 specific.
- */
-public class Jboss6ServerIntegrationTest extends BrooklynAppLiveTestSupport {
-
- // FIXME Fails deploying hello-world.war
- // 07:27:30,958 ERROR [AbstractKernelController] Error installing to Parse: name=vfs:///tmp/brooklyn-aled/apps/FJMcnSjO/entities/JBoss6Server_UZ2gA9HR/server/standard/deploy/ROOT.war state=PreParse mode=Manual requiredState=Parse: org.jboss.deployers.spi.DeploymentException: Error creating managed object for vfs:///tmp/brooklyn-aled/apps/FJMcnSjO/entities/JBoss6Server_UZ2gA9HR/server/standard/deploy/ROOT.war
- // ...
- // Caused by: org.xml.sax.SAXException: cvc-complex-type.2.4.d: Invalid content was found starting with element 'url-pattern'. No child element is expected at this point. @ vfs:///tmp/brooklyn-aled/apps/FJMcnSjO/entities/JBoss6Server_UZ2gA9HR/server/standard/deploy/ROOT.war/WEB-INF/web.xml[21,22]
- // at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.error(SaxJBossXBParser.java:416) [jbossxb.jar:2.0.3.GA]
-
- // Port increment for JBoss 6.
- public static final int PORT_INCREMENT = 400;
-
- private URL warUrl;
- private LocalhostMachineProvisioningLocation localhostProvisioningLocation;
-
- @BeforeMethod(alwaysRun=true)
- public void setUp() throws Exception {
- super.setUp();
- String warPath = "hello-world-no-mapping.war";
- warUrl = getClass().getClassLoader().getResource(warPath);
-
- localhostProvisioningLocation = app.newLocalhostProvisioningLocation();
- }
-
- @Test(groups = "Integration")
- public void testJmxmp() throws Exception {
- runTest(UsesJmx.JmxAgentModes.JMXMP);
- }
-
- @Test(groups = "Integration")
- public void testJmxRmi() throws Exception {
- runTest(UsesJmx.JmxAgentModes.JMX_RMI_CUSTOM_AGENT);
- }
-
- @Test(groups = "Integration")
- public void testJmxAutodetect() throws Exception {
- runTest(UsesJmx.JmxAgentModes.AUTODETECT);
- }
-
- protected void runTest(UsesJmx.JmxAgentModes jmxAgentMode) throws Exception {
- final JBoss6Server server = app.createAndManageChild(EntitySpec.create(JBoss6Server.class)
- .configure(JBoss6Server.PORT_INCREMENT, PORT_INCREMENT)
- .configure(UsesJmx.JMX_AGENT_MODE, jmxAgentMode)
- .configure("war", warUrl.toString()));
-
- app.start(ImmutableList.of(localhostProvisioningLocation));
-
- String httpUrl = "http://"+server.getAttribute(JBoss6Server.HOSTNAME)+":"+server.getAttribute(JBoss6Server.HTTP_PORT)+"/";
-
- assertEquals(server.getAttribute(JBoss6Server.ROOT_URL).toLowerCase(), httpUrl.toLowerCase());
-
- HttpTestUtils.assertHttpStatusCodeEventuallyEquals(httpUrl, 200);
- HttpTestUtils.assertContentContainsText(httpUrl, "Hello");
-
-
- Asserts.succeedsEventually(new Runnable() {
- @Override public void run() {
- // TODO Could test other attributes as well; see jboss7 test
- assertNotNull(server.getAttribute(JBoss6Server.REQUEST_COUNT));
- assertNotNull(server.getAttribute(JBoss6Server.ERROR_COUNT));
- assertNotNull(server.getAttribute(JBoss6Server.TOTAL_PROCESSING_TIME));
- }});
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7DockerLiveTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7DockerLiveTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7DockerLiveTest.java
deleted file mode 100644
index e29b9b7..0000000
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7DockerLiveTest.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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.proxying.EntitySpec;
-import brooklyn.entity.software.AbstractDockerLiveTest;
-import brooklyn.location.Location;
-import brooklyn.test.Asserts;
-import brooklyn.test.HttpTestUtils;
-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;
-
-/**
- * A simple test of installing+running on Docker, using various OS distros and versions.
- */
-public class Jboss7DockerLiveTest extends AbstractDockerLiveTest {
-
- private URL warUrl = checkNotNull(getClass().getClassLoader().getResource("hello-world.war"));
-
- @Override
- protected void doTest(Location loc) throws Exception {
- final JBoss7Server server = app.createAndManageChild(EntitySpec.create(JBoss7Server.class)
- .configure("war", warUrl.toString()));
-
- 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));
- }
- });
- }
-
- @Test(enabled = false)
- public void testDummy() {
- } // Convince testng IDE integration that this really does have test methods
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerEc2LiveTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerEc2LiveTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerEc2LiveTest.java
deleted file mode 100644
index d041e18..0000000
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerEc2LiveTest.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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 com.google.common.base.Preconditions.checkNotNull;
-import static org.testng.Assert.assertNotNull;
-
-import java.net.URL;
-
-import org.testng.annotations.Test;
-
-import brooklyn.entity.AbstractEc2LiveTest;
-import brooklyn.entity.proxying.EntitySpec;
-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.
- */
-public class Jboss7ServerEc2LiveTest extends AbstractEc2LiveTest {
-
- private URL warUrl = checkNotNull(getClass().getClassLoader().getResource("hello-world.war"));
-
- @Override
- protected void doTest(Location loc) throws Exception {
- final JBoss7Server server = app.createAndManageChild(EntitySpec.create(JBoss7Server.class)
- .configure("war", warUrl.toString()));
-
- 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));
- }});
- }
-
- @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
-}
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7ef195f0/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerIntegrationTest.java
deleted file mode 100644
index d486b21..0000000
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/jboss/Jboss7ServerIntegrationTest.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * 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.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.net.URL;
-import java.security.KeyStore;
-import java.security.cert.Certificate;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import brooklyn.entity.basic.ApplicationBuilder;
-import brooklyn.entity.basic.Entities;
-import brooklyn.entity.proxying.EntitySpec;
-import brooklyn.entity.webapp.AbstractWebAppFixtureIntegrationTest;
-import brooklyn.entity.webapp.HttpsSslConfig;
-import brooklyn.location.basic.LocalhostMachineProvisioningLocation;
-import brooklyn.test.Asserts;
-import brooklyn.test.HttpTestUtils;
-import brooklyn.test.entity.TestApplication;
-import brooklyn.util.crypto.FluentKeySigner;
-import brooklyn.util.crypto.SecureKeys;
-import brooklyn.util.stream.Streams;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-
-/**
- * TODO re-write this like WebAppIntegrationTest, rather than being jboss7 specific.
- */
-public class Jboss7ServerIntegrationTest {
- private static final Logger LOG = LoggerFactory.getLogger(Jboss7ServerIntegrationTest.class);
-
- private URL warUrl;
- private LocalhostMachineProvisioningLocation localhostProvisioningLocation;
- private TestApplication app;
- private File keystoreFile;
-
- @BeforeMethod(alwaysRun=true)
- public void setUp() throws Exception {
- String warPath = "hello-world.war";
- warUrl = getClass().getClassLoader().getResource(warPath);
-
- localhostProvisioningLocation = new LocalhostMachineProvisioningLocation();
- app = ApplicationBuilder.newManagedApp(TestApplication.class);
- keystoreFile = AbstractWebAppFixtureIntegrationTest.createTemporaryKeyStore("myname", "mypass");
- }
-
- @AfterMethod(alwaysRun=true)
- public void tearDown() throws Exception {
- if (app != null) Entities.destroyAll(app.getManagementContext());
- if (keystoreFile != null) keystoreFile.delete();
- }
-
- @Test(groups = "Integration")
- public void testHttp() throws Exception {
- final JBoss7Server server = app.createAndManageChild(EntitySpec.create(JBoss7Server.class)
- .configure("war", warUrl.toString()));
-
- app.start(ImmutableList.of(localhostProvisioningLocation));
-
- String httpUrl = "http://"+server.getAttribute(JBoss7Server.HOSTNAME)+":"+server.getAttribute(JBoss7Server.HTTP_PORT)+"/";
- String httpsUrl = "https://"+server.getAttribute(JBoss7Server.HOSTNAME)+":"+server.getAttribute(JBoss7Server.HTTPS_PORT)+"/";
-
- assertEquals(server.getAttribute(JBoss7Server.ROOT_URL).toLowerCase(), httpUrl.toLowerCase());
-
- HttpTestUtils.assertHttpStatusCodeEventuallyEquals(httpUrl, 200);
- HttpTestUtils.assertContentContainsText(httpUrl, "Hello");
-
- HttpTestUtils.assertUrlUnreachable(httpsUrl);
-
- Asserts.succeedsEventually(new Runnable() {
- 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));
- }});
- }
-
- @Test(groups = {"Integration"})
- public void testHttps() throws Exception {
- final JBoss7Server server = app.createAndManageChild(EntitySpec.create(JBoss7Server.class)
- .configure("war", warUrl.toString())
- .configure(JBoss7Server.ENABLED_PROTOCOLS, ImmutableSet.of("https"))
- .configure(JBoss7Server.HTTPS_SSL_CONFIG, new HttpsSslConfig().keyAlias("myname").keystorePassword("mypass").keystoreUrl(keystoreFile.getAbsolutePath())));
-
- app.start(ImmutableList.of(localhostProvisioningLocation));
-
- String httpUrl = "http://"+server.getAttribute(JBoss7Server.HOSTNAME)+":"+server.getAttribute(JBoss7Server.HTTP_PORT)+"/";
- String httpsUrl = "https://"+server.getAttribute(JBoss7Server.HOSTNAME)+":"+server.getAttribute(JBoss7Server.HTTPS_PORT)+"/";
-
- assertEquals(server.getAttribute(JBoss7Server.ROOT_URL).toLowerCase(), httpsUrl.toLowerCase());
-
- HttpTestUtils.assertUrlUnreachable(httpUrl);
-
- // FIXME HttpTestUtils isn't coping with https, giving
- // javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
- // Uncomment this as soon as HttpTestUtils is fixed
- // Manual inspection with breakpoint and web-browser confirmed this was working
-// HttpTestUtils.assertHttpStatusCodeEventuallyEquals(httpsUrl, 200);
-// HttpTestUtils.assertContentContainsText(httpsUrl, "Hello");
-
- // FIXME querying for http://localhost:9990/management/subsystem/web/connector/http/read-resource?include-runtime=true
- // gives 500 when http is disabled, but if miss out "?include-runtime=true" then it works fine.
- // So not getting these metrics!
-// TestUtils.executeUntilSucceeds(new Runnable() {
-// 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));
-// }});
- }
-
- @Test(groups = {"Integration"})
- public void testHttpAndHttps() throws Exception {
- final JBoss7Server server = app.createAndManageChild(EntitySpec.create(JBoss7Server.class)
- .configure("war", warUrl.toString())
- .configure(JBoss7Server.ENABLED_PROTOCOLS, ImmutableSet.of("http", "https"))
- .configure(JBoss7Server.HTTPS_SSL_CONFIG, new HttpsSslConfig().keyAlias("myname").keystorePassword("mypass").keystoreUrl(keystoreFile.getAbsolutePath())));
-
- app.start(ImmutableList.of(localhostProvisioningLocation));
-
- String httpUrl = "http://"+server.getAttribute(JBoss7Server.HOSTNAME)+":"+server.getAttribute(JBoss7Server.HTTP_PORT)+"/";
- String httpsUrl = "https://"+server.getAttribute(JBoss7Server.HOSTNAME)+":"+server.getAttribute(JBoss7Server.HTTPS_PORT)+"/";
-
- assertEquals(server.getAttribute(JBoss7Server.ROOT_URL).toLowerCase(), httpsUrl.toLowerCase());
-
- HttpTestUtils.assertHttpStatusCodeEventuallyEquals(httpUrl, 200);
- HttpTestUtils.assertContentContainsText(httpUrl, "Hello");
-
- // FIXME HttpTestUtils isn't coping with https, giving
- // javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
- // Uncomment this as soon as HttpTestUtils is fixed
- // Manual inspection with breakpoint and web-browser confirmed this was working
- //HttpTestUtils.assertHttpStatusCodeEventuallyEquals(httpsUrl, 200);
- //HttpTestUtils.assertContentContainsText(httpsUrl, "Hello");
-
- Asserts.succeedsEventually(new Runnable() {
- 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));
- }});
- }
-
- @Test(groups = {"Integration"})
- public void testUsingPortOffsets() throws Exception {
- final JBoss7Server serverA = app.createAndManageChild(EntitySpec.create(JBoss7Server.class)
- .configure("portIncrement", 100));
- final JBoss7Server serverB = app.createAndManageChild(EntitySpec.create(JBoss7Server.class)
- .configure("portIncrement", 200));
- app.start(ImmutableList.of(localhostProvisioningLocation));
-
- Asserts.succeedsEventually(new Runnable() {
- public void run() {
- assertNotNull(serverA.getAttribute(JBoss7Server.BYTES_SENT));
- assertNotNull(serverB.getAttribute(JBoss7Server.BYTES_SENT));
- }});
- }
-
-}