You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by al...@apache.org on 2015/04/27 22:04:07 UTC

[1/3] incubator-brooklyn git commit: Support concurrent web app deploy effectors

Repository: incubator-brooklyn
Updated Branches:
  refs/heads/master 6d1e7ea38 -> e38b4b757


Support concurrent web app deploy effectors


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/d9a77018
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/d9a77018
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/d9a77018

Branch: refs/heads/master
Commit: d9a770188f0437211af2d3e3f94e991d0901220a
Parents: 6d1e7ea
Author: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Authored: Wed Apr 22 17:23:41 2015 +0300
Committer: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Committed: Fri Apr 24 18:30:50 2015 +0300

----------------------------------------------------------------------
 .../entity/webapp/JavaWebAppSshDriver.java      |   3 +-
 .../webapp/WebAppConcurrentDeployTest.java      | 103 +++++++++++++++++++
 2 files changed, 105 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d9a77018/software/webapp/src/main/java/brooklyn/entity/webapp/JavaWebAppSshDriver.java
----------------------------------------------------------------------
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 da2af62..cd32b01 100644
--- a/software/webapp/src/main/java/brooklyn/entity/webapp/JavaWebAppSshDriver.java
+++ b/software/webapp/src/main/java/brooklyn/entity/webapp/JavaWebAppSshDriver.java
@@ -30,6 +30,7 @@ import brooklyn.location.basic.SshMachineLocation;
 import brooklyn.util.task.DynamicTasks;
 import brooklyn.util.task.Tasks;
 import brooklyn.util.task.ssh.SshTasks;
+import brooklyn.util.text.Strings;
 
 import com.google.common.collect.ImmutableList;
 
@@ -153,7 +154,7 @@ public abstract class JavaWebAppSshDriver extends JavaSoftwareProcessSshDriver i
         final String canonicalTargetName = getFilenameContextMapper().convertDeploymentTargetNameToFilename(targetName);
         final String dest = getDeployDir() + "/" + canonicalTargetName;
         //write to a .tmp so autodeploy is not triggered during upload
-        final String tmpDest = dest + ".tmp";
+        final String tmpDest = dest + "." + Strings.makeRandomId(8) + ".tmp";
         final String msg = String.format("deploying %s to %s:%s", new Object[]{url, getHostname(), dest});
         log.info(entity + " " + msg);
         Tasks.setBlockingDetails(msg);

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/d9a77018/software/webapp/src/test/java/brooklyn/entity/webapp/WebAppConcurrentDeployTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/WebAppConcurrentDeployTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/WebAppConcurrentDeployTest.java
new file mode 100644
index 0000000..72f36a8
--- /dev/null
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/WebAppConcurrentDeployTest.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;
+
+import static org.testng.Assert.assertEquals;
+
+import java.net.URI;
+import java.util.Collection;
+
+import org.apache.http.client.HttpClient;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import brooklyn.entity.BrooklynAppUnitTestSupport;
+import brooklyn.entity.basic.Attributes;
+import brooklyn.entity.basic.BrooklynConfigKeys;
+import brooklyn.entity.proxying.EntitySpec;
+import brooklyn.entity.webapp.jboss.JBoss7Server;
+import brooklyn.entity.webapp.tomcat.TomcatServer;
+import brooklyn.location.Location;
+import brooklyn.location.LocationSpec;
+import brooklyn.location.basic.LocalhostMachineProvisioningLocation;
+import brooklyn.management.Task;
+import brooklyn.test.Asserts;
+import brooklyn.test.EntityTestUtils;
+import brooklyn.test.TestResourceUnavailableException;
+import brooklyn.util.collections.MutableList;
+import brooklyn.util.collections.MutableMap;
+import brooklyn.util.http.HttpTool;
+import brooklyn.util.http.HttpToolResponse;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+
+public class WebAppConcurrentDeployTest extends BrooklynAppUnitTestSupport {
+    private Location loc;
+    
+    @Override
+    @BeforeMethod(alwaysRun=true)
+    public void setUp() throws Exception {
+        super.setUp();
+        app.config().set(BrooklynConfigKeys.SKIP_ON_BOX_BASE_DIR_RESOLUTION, false);
+//      tested on  loc = mgmt.getLocationRegistry().resolve("byon:(hosts=\"hostname\")");
+        loc = mgmt.getLocationManager().createLocation(LocationSpec.create(LocalhostMachineProvisioningLocation.class));
+    }
+    
+    @DataProvider(name = "basicEntities")
+    public Object[][] basicEntities() {
+        return new Object[][]{
+            {EntitySpec.create(TomcatServer.class)},
+            // Hot Deploy not enabled?
+            // {EntitySpec.create(JBoss6Server.class)},
+            {EntitySpec.create(JBoss7Server.class)},
+        };
+    }
+
+    @Test(groups = "Live", dataProvider="basicEntities")
+    public void testConcurrentDeploys(EntitySpec<? extends JavaWebAppSoftwareProcess> webServerSpec) throws Exception {
+        JavaWebAppSoftwareProcess server = app.createAndManageChild(webServerSpec);
+        app.start(ImmutableList.of(loc));
+        EntityTestUtils.assertAttributeEqualsEventually(server, Attributes.SERVICE_UP, Boolean.TRUE);
+        Collection<Task<Void>> deploys = MutableList.of();
+        for (int i = 0; i < 5; i++) {
+            deploys.add(server.invoke(TomcatServer.DEPLOY, MutableMap.of("url", getTestWar(), "targetName", "/")));
+        }
+        for(Task<Void> t : deploys) {
+            t.getUnchecked();
+        }
+
+        final HttpClient client = HttpTool.httpClientBuilder().build();
+        final URI warUrl = URI.create(server.getAttribute(JavaWebAppSoftwareProcess.ROOT_URL));
+        Asserts.succeedsEventually(new Runnable() {
+            @Override
+            public void run() {
+                HttpToolResponse resp = HttpTool.httpGet(client, warUrl, ImmutableMap.<String,String>of());
+                assertEquals(resp.getResponseCode(), 200);
+            }
+        });
+    }
+    
+    public String getTestWar() {
+        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/hello-world.war");
+        return "classpath://hello-world.war";
+    }
+
+}


[2/3] incubator-brooklyn git commit: Address PR #609 comments

Posted by al...@apache.org.
Address PR #609 comments


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/a1fe61fd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/a1fe61fd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/a1fe61fd

Branch: refs/heads/master
Commit: a1fe61fd96cc0b8efb1622f1926b8df3ec7603d5
Parents: d9a7701
Author: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Authored: Fri Apr 24 15:58:16 2015 +0300
Committer: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Committed: Fri Apr 24 18:30:57 2015 +0300

----------------------------------------------------------------------
 .../java/brooklyn/entity/basic/ServiceStateLogicTest.java     | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1fe61fd/core/src/test/java/brooklyn/entity/basic/ServiceStateLogicTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/brooklyn/entity/basic/ServiceStateLogicTest.java b/core/src/test/java/brooklyn/entity/basic/ServiceStateLogicTest.java
index 0c16632..b39c585 100644
--- a/core/src/test/java/brooklyn/entity/basic/ServiceStateLogicTest.java
+++ b/core/src/test/java/brooklyn/entity/basic/ServiceStateLogicTest.java
@@ -24,7 +24,6 @@ import org.testng.annotations.Test;
 
 import brooklyn.entity.BrooklynAppUnitTestSupport;
 import brooklyn.entity.Entity;
-import brooklyn.entity.basic.EntitySubscriptionTest.RecordingSensorEventListener;
 import brooklyn.entity.basic.ServiceStateLogic.ComputeServiceIndicatorsFromChildrenAndMembers;
 import brooklyn.entity.basic.ServiceStateLogic.ServiceNotUpLogic;
 import brooklyn.entity.basic.ServiceStateLogic.ServiceProblemsLogic;
@@ -33,7 +32,6 @@ import brooklyn.entity.proxying.EntitySpec;
 import brooklyn.event.AttributeSensor;
 import brooklyn.event.basic.Sensors;
 import brooklyn.location.Location;
-import brooklyn.location.basic.SimulatedLocation;
 import brooklyn.policy.Enricher;
 import brooklyn.test.EntityTestUtils;
 import brooklyn.test.entity.TestEntity;
@@ -261,10 +259,7 @@ public class ServiceStateLogicTest extends BrooklynAppUnitTestSupport {
                 .configure(DynamicCluster.MEMBER_SPEC, EntitySpec.create(TestEntityWithoutEnrichers.class))
                 .configure(DynamicCluster.INITIAL_SIZE, 1));
 
-        RecordingSensorEventListener r = new RecordingSensorEventListener();
-        app.subscribe(cluster, Attributes.SERVICE_STATE_ACTUAL, r);
-
-        cluster.start(ImmutableList.of(new SimulatedLocation()));
+        cluster.start(ImmutableList.of(app.newSimulatedLocation()));
         EntityTestUtils.assertGroupSizeEqualsEventually(cluster, 1);
 
         //manually set state to healthy as enrichers are disabled


[3/3] incubator-brooklyn git commit: This closes #611

Posted by al...@apache.org.
This closes #611


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/e38b4b75
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/e38b4b75
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/e38b4b75

Branch: refs/heads/master
Commit: e38b4b7576fb593084171aa7f8f8c4b0646f7c3e
Parents: 6d1e7ea a1fe61f
Author: Aled Sage <al...@gmail.com>
Authored: Mon Apr 27 21:03:50 2015 +0100
Committer: Aled Sage <al...@gmail.com>
Committed: Mon Apr 27 21:03:50 2015 +0100

----------------------------------------------------------------------
 .../entity/basic/ServiceStateLogicTest.java     |   7 +-
 .../entity/webapp/JavaWebAppSshDriver.java      |   3 +-
 .../webapp/WebAppConcurrentDeployTest.java      | 103 +++++++++++++++++++
 3 files changed, 106 insertions(+), 7 deletions(-)
----------------------------------------------------------------------