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 2014/11/03 15:24:53 UTC

[1/9] git commit: Fix ApplicationResourceIntegrationTest.testTriggerRedisStopEffector

Repository: incubator-brooklyn
Updated Branches:
  refs/heads/master aa20ae71b -> 1f73dcf10


Fix ApplicationResourceIntegrationTest.testTriggerRedisStopEffector

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

Branch: refs/heads/master
Commit: 91ca4d2d566702c0f0761485389a39002578ce91
Parents: e830251
Author: Aled Sage <al...@gmail.com>
Authored: Mon Nov 3 10:55:11 2014 +0000
Committer: Aled Sage <al...@gmail.com>
Committed: Mon Nov 3 10:55:11 2014 +0000

----------------------------------------------------------------------
 .../rest/resources/ApplicationResourceIntegrationTest.java     | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/91ca4d2d/usage/rest-server/src/test/java/brooklyn/rest/resources/ApplicationResourceIntegrationTest.java
----------------------------------------------------------------------
diff --git a/usage/rest-server/src/test/java/brooklyn/rest/resources/ApplicationResourceIntegrationTest.java b/usage/rest-server/src/test/java/brooklyn/rest/resources/ApplicationResourceIntegrationTest.java
index 7cf761f..d8074b3 100644
--- a/usage/rest-server/src/test/java/brooklyn/rest/resources/ApplicationResourceIntegrationTest.java
+++ b/usage/rest-server/src/test/java/brooklyn/rest/resources/ApplicationResourceIntegrationTest.java
@@ -25,6 +25,7 @@ import java.net.URI;
 import java.util.Set;
 import java.util.concurrent.TimeoutException;
 
+import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
 import org.slf4j.Logger;
@@ -102,15 +103,16 @@ public class ApplicationResourceIntegrationTest extends BrooklynRestResourceTest
     @Test(groups="Integration", dependsOnMethods = { "testListSensorsRedis", "testListEntities" })
     public void testTriggerRedisStopEffector() throws InterruptedException {
         ClientResponse response = client().resource("/v1/applications/redis-app/entities/redis-ent/effectors/stop")
+                .type(MediaType.APPLICATION_JSON_TYPE)
                 .post(ClientResponse.class, ImmutableMap.of());
-
         assertEquals(response.getStatus(), Response.Status.ACCEPTED.getStatusCode());
 
         final URI stateSensor = URI.create("/v1/applications/redis-app/entities/redis-ent/sensors/service.state");
         final String expectedStatus = String.format("\"%s\"", Lifecycle.STOPPED.toString());
         Asserts.succeedsEventually(MutableMap.of("timeout", 60 * 1000), new Runnable() {
             public void run() {
-                assertEquals(client().resource(stateSensor).get(String.class), expectedStatus);
+                String val = client().resource(stateSensor).get(String.class);
+                assertTrue(expectedStatus.equalsIgnoreCase(val));
             }
         });
     }


[8/9] git commit: Add comment about RebindTestFixture checkSerializable

Posted by al...@apache.org.
Add comment about RebindTestFixture checkSerializable

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

Branch: refs/heads/master
Commit: 8b69ff7bd56e7a088e9d1ee101c1fac11b902236
Parents: bb28e29
Author: Aled Sage <al...@gmail.com>
Authored: Mon Nov 3 14:23:48 2014 +0000
Committer: Aled Sage <al...@gmail.com>
Committed: Mon Nov 3 14:23:48 2014 +0000

----------------------------------------------------------------------
 .../test/java/brooklyn/entity/rebind/RebindTestFixture.java   | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/8b69ff7b/core/src/test/java/brooklyn/entity/rebind/RebindTestFixture.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/brooklyn/entity/rebind/RebindTestFixture.java b/core/src/test/java/brooklyn/entity/rebind/RebindTestFixture.java
index d4e47dd..1466405 100644
--- a/core/src/test/java/brooklyn/entity/rebind/RebindTestFixture.java
+++ b/core/src/test/java/brooklyn/entity/rebind/RebindTestFixture.java
@@ -122,6 +122,13 @@ public abstract class RebindTestFixture<T extends StartableApplication> {
         return rebind(true);
     }
 
+    /**
+     * TODO We should (probably?!) change everywhere from asserting that they are serializable. 
+     * They only need to be xstream-serializable, which does not require `implements Serializable`. 
+     * Also, the xstream serializer has some special hooks that replaces an entity reference with 
+     * a marker for that entity, etc. Suggest we change the default {@link #rebind()} to use 
+     * {@code checkSerializable==false}, and deprecate this + the other overloaded methods?
+     */
     protected T rebind(boolean checkSerializable) throws Exception {
         // TODO What are sensible defaults?!
         return rebind(checkSerializable, false);


[6/9] git commit: Cassandra integration tests: better logging on port not available

Posted by al...@apache.org.
Cassandra integration tests: better logging on port not available

- In setup+tearDown of each integration test, check that the standard 
  Cassandra ports are available. If they are not then wait for 
  4 mins (in case of TIMED-WAIT state), and then fail.
- This will show us which Cassandra test left the port open, if any.

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

Branch: refs/heads/master
Commit: 5bef6866daf455e4abf2c69d02bb73b23ed36097
Parents: cc0980c
Author: Aled Sage <al...@gmail.com>
Authored: Mon Nov 3 12:10:37 2014 +0000
Committer: Aled Sage <al...@gmail.com>
Committed: Mon Nov 3 12:10:37 2014 +0000

----------------------------------------------------------------------
 .../CassandraDatacenterIntegrationTest.java     | 12 +++-
 ...assandraDatacenterRebindIntegrationTest.java | 12 +++-
 .../cassandra/CassandraNodeIntegrationTest.java | 70 +++++++++++++++++++-
 3 files changed, 89 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/5bef6866/software/nosql/src/test/java/brooklyn/entity/nosql/cassandra/CassandraDatacenterIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/test/java/brooklyn/entity/nosql/cassandra/CassandraDatacenterIntegrationTest.java b/software/nosql/src/test/java/brooklyn/entity/nosql/cassandra/CassandraDatacenterIntegrationTest.java
index 426c545..b74d5cd 100644
--- a/software/nosql/src/test/java/brooklyn/entity/nosql/cassandra/CassandraDatacenterIntegrationTest.java
+++ b/software/nosql/src/test/java/brooklyn/entity/nosql/cassandra/CassandraDatacenterIntegrationTest.java
@@ -26,6 +26,7 @@ import java.math.BigInteger;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
@@ -60,13 +61,22 @@ public class CassandraDatacenterIntegrationTest extends BrooklynAppLiveTestSuppo
     protected Location testLocation;
     protected CassandraDatacenter cluster;
 
-    @Override
     @BeforeMethod(alwaysRun = true)
+    @Override
     public void setUp() throws Exception {
+        CassandraNodeIntegrationTest.assertCassandraPortsAvailableEventually();
         super.setUp();
         testLocation = app.newLocalhostProvisioningLocation();
     }
 
+    @AfterMethod(alwaysRun=true)
+    @Override
+    public void tearDown() throws Exception {
+        super.tearDown();
+        CassandraNodeIntegrationTest.assertCassandraPortsAvailableEventually();
+    }
+    
+
     @Test(groups = "Integration")
     public void testStartAndShutdownClusterSizeOne() throws Exception {
         EntitySpec<CassandraDatacenter> spec = EntitySpec.create(CassandraDatacenter.class)

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/5bef6866/software/nosql/src/test/java/brooklyn/entity/nosql/cassandra/CassandraDatacenterRebindIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/test/java/brooklyn/entity/nosql/cassandra/CassandraDatacenterRebindIntegrationTest.java b/software/nosql/src/test/java/brooklyn/entity/nosql/cassandra/CassandraDatacenterRebindIntegrationTest.java
index eff0011..0b53216 100644
--- a/software/nosql/src/test/java/brooklyn/entity/nosql/cassandra/CassandraDatacenterRebindIntegrationTest.java
+++ b/software/nosql/src/test/java/brooklyn/entity/nosql/cassandra/CassandraDatacenterRebindIntegrationTest.java
@@ -25,7 +25,7 @@ import java.util.Set;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
@@ -35,8 +35,6 @@ import brooklyn.entity.rebind.RebindTestFixtureWithApp;
 import brooklyn.entity.trait.Startable;
 import brooklyn.location.basic.LocalhostMachineProvisioningLocation;
 import brooklyn.test.EntityTestUtils;
-import brooklyn.util.time.Duration;
-import brooklyn.util.time.Time;
 
 import com.google.common.base.Predicates;
 import com.google.common.collect.ImmutableList;
@@ -52,10 +50,18 @@ public class CassandraDatacenterRebindIntegrationTest extends RebindTestFixtureW
     
     @BeforeMethod(alwaysRun=true)
     public void setUp() throws Exception {
+        CassandraNodeIntegrationTest.assertCassandraPortsAvailableEventually();
         super.setUp();
         localhostProvisioningLocation = origApp.newLocalhostProvisioningLocation();
     }
 
+    @AfterMethod(alwaysRun=true)
+    @Override
+    public void tearDown() throws Exception {
+        super.tearDown();
+        CassandraNodeIntegrationTest.assertCassandraPortsAvailableEventually();
+    }
+    
     /**
      * Test that Brooklyn can rebind to a single node datacenter.
      */

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/5bef6866/software/nosql/src/test/java/brooklyn/entity/nosql/cassandra/CassandraNodeIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/test/java/brooklyn/entity/nosql/cassandra/CassandraNodeIntegrationTest.java b/software/nosql/src/test/java/brooklyn/entity/nosql/cassandra/CassandraNodeIntegrationTest.java
index 06686dd..fc15c7d 100644
--- a/software/nosql/src/test/java/brooklyn/entity/nosql/cassandra/CassandraNodeIntegrationTest.java
+++ b/software/nosql/src/test/java/brooklyn/entity/nosql/cassandra/CassandraNodeIntegrationTest.java
@@ -22,18 +22,30 @@ import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertTrue;
 
+import java.util.List;
+import java.util.Map;
+
+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.Entities;
 import brooklyn.entity.nosql.cassandra.AstyanaxSupport.AstyanaxSample;
 import brooklyn.entity.proxying.EntitySpec;
 import brooklyn.entity.trait.Startable;
+import brooklyn.event.basic.PortAttributeSensorAndConfigKey;
 import brooklyn.test.Asserts;
 import brooklyn.test.EntityTestUtils;
-import brooklyn.util.collections.MutableMap;
+import brooklyn.util.exceptions.Exceptions;
 import brooklyn.util.math.MathPredicates;
+import brooklyn.util.net.Networking;
+import brooklyn.util.time.Duration;
 
 import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Maps;
 
 /**
  * Cassandra integration tests.
@@ -42,6 +54,62 @@ import com.google.common.collect.ImmutableList;
  */
 public class CassandraNodeIntegrationTest extends AbstractCassandraNodeTest {
 
+    private static final Logger LOG = LoggerFactory.getLogger(CassandraNodeIntegrationTest.class);
+
+    public static void assertCassandraPortsAvailableEventually() {
+        // If we get into a TCP TIMED-WAIT state, it could take 4 minutes for the port to come available.
+        // Could that be causing our integration tests to fail sometimes when run in the suite?!
+        // Let's wait for the required ports in setup, rather than running+failing the test.
+        Asserts.succeedsEventually(ImmutableMap.of("timeout", Duration.minutes(4)), new Runnable() {
+            private boolean logged = false;
+            public void run() {
+                try {
+                    assertCassandraPortsAvailable();
+                } catch (Throwable t) {
+                    if (!logged) {
+                        LOG.warn("Cassandra Port(s) not available; waiting for up to 4 minutes ("+Exceptions.getFirstInteresting(t)+")");
+                        logged = true;
+                    }
+                    throw Exceptions.propagate(t);
+                }
+            }});
+    }
+    
+    public static void assertCassandraPortsAvailable() {
+        for (Map.Entry<PortAttributeSensorAndConfigKey, Integer> entry : getCassandraDefaultPorts().entrySet()) {
+            String errmsg = entry.getValue()+" not available for cassandra "+entry.getKey();
+            assertTrue(Networking.isPortAvailable(entry.getValue()), errmsg);
+        }
+    }
+    
+    public static Map<PortAttributeSensorAndConfigKey, Integer> getCassandraDefaultPorts() {
+        List<PortAttributeSensorAndConfigKey> ports = ImmutableList.of(
+                CassandraNode.GOSSIP_PORT, 
+                CassandraNode.SSL_GOSSIP_PORT, 
+                CassandraNode.THRIFT_PORT, 
+                CassandraNode.NATIVE_TRANSPORT_PORT, 
+                CassandraNode.RMI_REGISTRY_PORT);
+        Map<PortAttributeSensorAndConfigKey, Integer> result = Maps.newLinkedHashMap();
+        for (PortAttributeSensorAndConfigKey key : ports) {
+            result.put(key, key.getConfigKey().getDefaultValue().iterator().next());
+        }
+        return result;
+    }
+
+    @BeforeMethod(alwaysRun = true)
+    @Override
+    public void setUp() throws Exception {
+        assertCassandraPortsAvailableEventually();
+        super.setUp();
+    }
+    
+    @AfterMethod(alwaysRun=true)
+    @Override
+    public void tearDown() throws Exception {
+        super.tearDown();
+        assertCassandraPortsAvailableEventually();
+    }
+    
     /**
      * Test that a node starts and sets SERVICE_UP correctly.
      */


[3/9] git commit: Fix BindDnsServerIntegrationTest.rebind

Posted by al...@apache.org.
Fix BindDnsServerIntegrationTest.rebind

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

Branch: refs/heads/master
Commit: a9d97fa3d28ba5818a2d6ec3603bfc07cf062c33
Parents: 2004112
Author: Aled Sage <al...@gmail.com>
Authored: Mon Nov 3 10:55:41 2014 +0000
Committer: Aled Sage <al...@gmail.com>
Committed: Mon Nov 3 10:55:41 2014 +0000

----------------------------------------------------------------------
 .../brooklyn/entity/network/bind/BindDnsServerIntegrationTest.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a9d97fa3/software/network/src/test/java/brooklyn/entity/network/bind/BindDnsServerIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/network/src/test/java/brooklyn/entity/network/bind/BindDnsServerIntegrationTest.java b/software/network/src/test/java/brooklyn/entity/network/bind/BindDnsServerIntegrationTest.java
index 2ba4e43..4d785ba 100644
--- a/software/network/src/test/java/brooklyn/entity/network/bind/BindDnsServerIntegrationTest.java
+++ b/software/network/src/test/java/brooklyn/entity/network/bind/BindDnsServerIntegrationTest.java
@@ -74,7 +74,7 @@ public class BindDnsServerIntegrationTest extends RebindTestFixture {
         assertEquals(dns.getAttribute(BindDnsServer.ADDRESS_MAPPINGS).keySet().size(), 1);
         assertMapSizes(3, 1, 2, 1);
 
-        rebind();
+        rebind(false);
         dns = (BindDnsServer) Iterables.getOnlyElement(Iterables.filter(newApp.getChildren(), Predicates.instanceOf(BindDnsServer.class)));
         cluster = (DynamicCluster) Iterables.getOnlyElement(Iterables.filter(newApp.getChildren(), Predicates.instanceOf(DynamicCluster.class)));
 


[9/9] git commit: This closes #291

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


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

Branch: refs/heads/master
Commit: 1f73dcf10ed1c51296ab92dbc19c120904dc5900
Parents: aa20ae7 8b69ff7
Author: Aled Sage <al...@gmail.com>
Authored: Mon Nov 3 14:24:38 2014 +0000
Committer: Aled Sage <al...@gmail.com>
Committed: Mon Nov 3 14:24:38 2014 +0000

----------------------------------------------------------------------
 .../java/brooklyn/location/geo/HostGeoInfo.java |  4 ++
 .../entity/rebind/RebindTestFixture.java        |  7 ++
 .../bind/BindDnsServerIntegrationTest.java      |  2 +-
 .../entity/nosql/mongodb/MongoDBServerImpl.java | 11 ++-
 .../entity/nosql/redis/RedisStoreSshDriver.java |  3 +
 .../CassandraDatacenterIntegrationTest.java     | 12 +++-
 ...assandraDatacenterRebindIntegrationTest.java | 12 +++-
 .../cassandra/CassandraNodeIntegrationTest.java | 70 +++++++++++++++++++-
 .../geoscaling/GeoscalingIntegrationTest.java   | 15 +++--
 .../brooklyn/launcher/BrooklynWebServer.java    |  2 +-
 .../ApplicationResourceIntegrationTest.java     |  6 +-
 11 files changed, 125 insertions(+), 19 deletions(-)
----------------------------------------------------------------------



[7/9] git commit: Avoid NPE in BrooklynWebServer.stop

Posted by al...@apache.org.
Avoid NPE in BrooklynWebServer.stop

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

Branch: refs/heads/master
Commit: bb28e29cc0f6b1f4eeea1a26d018375ca5a14d33
Parents: 5bef686
Author: Aled Sage <al...@gmail.com>
Authored: Mon Nov 3 12:22:15 2014 +0000
Committer: Aled Sage <al...@gmail.com>
Committed: Mon Nov 3 12:22:15 2014 +0000

----------------------------------------------------------------------
 .../src/main/java/brooklyn/launcher/BrooklynWebServer.java         | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/bb28e29c/usage/launcher/src/main/java/brooklyn/launcher/BrooklynWebServer.java
----------------------------------------------------------------------
diff --git a/usage/launcher/src/main/java/brooklyn/launcher/BrooklynWebServer.java b/usage/launcher/src/main/java/brooklyn/launcher/BrooklynWebServer.java
index 1d62fad..f4bfacb 100644
--- a/usage/launcher/src/main/java/brooklyn/launcher/BrooklynWebServer.java
+++ b/usage/launcher/src/main/java/brooklyn/launcher/BrooklynWebServer.java
@@ -453,7 +453,7 @@ public class BrooklynWebServer {
     public synchronized void stop() throws Exception {
         if (server==null) return;
         String root = getRootUrl();
-        Threads.removeShutdownHook(shutdownHook);
+        if (shutdownHook != null) Threads.removeShutdownHook(shutdownHook);
         if (log.isDebugEnabled())
             log.debug("Stopping Brooklyn web console at "+root+ " (" + war + (wars != null ? " and " + wars.values() : "") + ")");
 


[2/9] git commit: Fix RedisStore.install on OS X

Posted by al...@apache.org.
Fix RedisStore.install on OS X

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

Branch: refs/heads/master
Commit: 200411205ba3d2bb42a3cf9a60e9005e87b2f4de
Parents: 91ca4d2
Author: Aled Sage <al...@gmail.com>
Authored: Mon Nov 3 10:55:25 2014 +0000
Committer: Aled Sage <al...@gmail.com>
Committed: Mon Nov 3 10:55:25 2014 +0000

----------------------------------------------------------------------
 .../java/brooklyn/entity/nosql/redis/RedisStoreSshDriver.java     | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/20041120/software/nosql/src/main/java/brooklyn/entity/nosql/redis/RedisStoreSshDriver.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/brooklyn/entity/nosql/redis/RedisStoreSshDriver.java b/software/nosql/src/main/java/brooklyn/entity/nosql/redis/RedisStoreSshDriver.java
index 0d20290..eece028 100644
--- a/software/nosql/src/main/java/brooklyn/entity/nosql/redis/RedisStoreSshDriver.java
+++ b/software/nosql/src/main/java/brooklyn/entity/nosql/redis/RedisStoreSshDriver.java
@@ -76,6 +76,9 @@ public class RedisStoreSshDriver extends AbstractSoftwareProcessSshDriver implem
                 .add(BashCommands.installPackage(installMakePackageFlags, "redis-prerequisites-make"))
                 .add("tar xzfv " + saveAs)
                 .add(format("cd redis-%s", getVersion()))
+                .add("pushd deps")
+                .add("make lua hiredis linenoise")
+                .add("popd")
                 .add("make clean && make")
                 .build();
 


[5/9] git commit: MongoDBServer: fix logging of consolePort != (port+1000)

Posted by al...@apache.org.
MongoDBServer: fix logging of consolePort != (port+1000)

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

Branch: refs/heads/master
Commit: cc0980c23cd354cc82bd419ee20b5344bccbd6a7
Parents: f579b76
Author: Aled Sage <al...@gmail.com>
Authored: Mon Nov 3 11:24:04 2014 +0000
Committer: Aled Sage <al...@gmail.com>
Committed: Mon Nov 3 11:24:04 2014 +0000

----------------------------------------------------------------------
 .../brooklyn/entity/nosql/mongodb/MongoDBServerImpl.java | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/cc0980c2/software/nosql/src/main/java/brooklyn/entity/nosql/mongodb/MongoDBServerImpl.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/brooklyn/entity/nosql/mongodb/MongoDBServerImpl.java b/software/nosql/src/main/java/brooklyn/entity/nosql/mongodb/MongoDBServerImpl.java
index 7aa992d..b606ecb 100644
--- a/software/nosql/src/main/java/brooklyn/entity/nosql/mongodb/MongoDBServerImpl.java
+++ b/software/nosql/src/main/java/brooklyn/entity/nosql/mongodb/MongoDBServerImpl.java
@@ -61,12 +61,17 @@ public class MongoDBServerImpl extends SoftwareProcessImpl implements MongoDBSer
         super.connectSensors();
         connectServiceUpIsRunning();
 
-        int httpConsolePort = getAttribute(PORT) + 1000;
-        if (httpConsolePort != getAttribute(HTTP_PORT)+1000) {
+        int port = getAttribute(PORT);
+        int httpConsolePort = getAttribute(HTTP_PORT);
+        if (httpConsolePort !=  port + 1000) {
             // see comment on HTTP_PORT
-            LOG.warn(this+" may not have opened HTTP_PORT correctly as the default was not available");
+            LOG.warn("{} may not have opened HTTP_PORT correctly as the default was not available: port={}; consolePort={}; resetting consolePort to {}", 
+                    new Object[] {this, port, httpConsolePort, port + 1000});
+            httpConsolePort = port + 1000;
             setAttribute(HTTP_PORT, httpConsolePort);
         }
+
+        
         setAttribute(HTTP_INTERFACE_URL, String.format("http://%s:%d", getAttribute(HOSTNAME), httpConsolePort));
         setAttribute(MONGO_SERVER_ENDPOINT, String.format("http://%s:%d", getAttribute(HOSTNAME), getAttribute(MongoDBServer.PORT)));
 


[4/9] git commit: Fix GeoscalingIntegrationTest

Posted by al...@apache.org.
Fix GeoscalingIntegrationTest

- need to clear HostGeoInfo.cachedLookup, otherwise will keep
  using previous HostGeoLookup rather than StubHostGeoLookup

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

Branch: refs/heads/master
Commit: f579b76f31b8d1124a8f7930e73a675a9e24d4c7
Parents: a9d97fa
Author: Aled Sage <al...@gmail.com>
Authored: Mon Nov 3 11:23:32 2014 +0000
Committer: Aled Sage <al...@gmail.com>
Committed: Mon Nov 3 11:23:32 2014 +0000

----------------------------------------------------------------------
 .../main/java/brooklyn/location/geo/HostGeoInfo.java |  4 ++++
 .../dns/geoscaling/GeoscalingIntegrationTest.java    | 15 ++++++++-------
 2 files changed, 12 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/f579b76f/core/src/main/java/brooklyn/location/geo/HostGeoInfo.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/location/geo/HostGeoInfo.java b/core/src/main/java/brooklyn/location/geo/HostGeoInfo.java
index 028dcc4..137f873 100644
--- a/core/src/main/java/brooklyn/location/geo/HostGeoInfo.java
+++ b/core/src/main/java/brooklyn/location/geo/HostGeoInfo.java
@@ -81,6 +81,10 @@ public class HostGeoInfo implements Serializable {
         return cachedLookup.get();
     }
     
+    public static void clearCachedLookup() {
+        cachedLookup = null;
+    }
+    
     /** returns null if cannot be set */
     public static HostGeoInfo fromLocation(Location l) {
         if (l==null) return null;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/f579b76f/software/webapp/src/test/java/brooklyn/entity/dns/geoscaling/GeoscalingIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/dns/geoscaling/GeoscalingIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/dns/geoscaling/GeoscalingIntegrationTest.java
index 89b5f5e..53961b4 100644
--- a/software/webapp/src/test/java/brooklyn/entity/dns/geoscaling/GeoscalingIntegrationTest.java
+++ b/software/webapp/src/test/java/brooklyn/entity/dns/geoscaling/GeoscalingIntegrationTest.java
@@ -76,7 +76,8 @@ public class GeoscalingIntegrationTest {
     @BeforeMethod(alwaysRun=true)
     public void setUp() throws Exception {
         origGeoLookupImpl = BrooklynSystemProperties.HOST_GEO_LOOKUP_IMPL.getValue();
-        
+        HostGeoInfo.clearCachedLookup();
+
         app = TestApplication.Factory.newManagedInstanceForTests();
         mgmt = app.getManagementContext();
         
@@ -113,6 +114,7 @@ public class GeoscalingIntegrationTest {
             System.clearProperty(BrooklynSystemProperties.HOST_GEO_LOOKUP_IMPL.getPropertyName());
         }
         if (mgmt != null) Entities.destroyAll(mgmt);
+        HostGeoInfo.clearCachedLookup();
     }
     
     @Test(groups={"Integration"})
@@ -130,13 +132,14 @@ public class GeoscalingIntegrationTest {
     }
     
     @Test(groups={"Integration"})
-    public void testIgnoresAddressWithoutGeography() {
+    public void testIgnoresAddressWithoutGeography() throws Exception {
         System.setProperty(BrooklynSystemProperties.HOST_GEO_LOOKUP_IMPL.getPropertyName(), StubHostGeoLookup.class.getName());
-        target.setAttribute(Attributes.HOSTNAME, StubHostGeoLookup.HOMELESS_IP);
+        ((EntityLocal)geoDns).setConfig(GeoscalingDnsService.INCLUDE_HOMELESS_ENTITIES, false); // false is default
         
         app.start(ImmutableList.of(locWithoutGeo));
+        target.setAttribute(Attributes.HOSTNAME, StubHostGeoLookup.HOMELESS_IP);
         
-        LOG.info("geo-scaling test, using {}.{}; expect to be wired to {}", new Object[] {subDomain, primaryDomain, addrWithoutGeo});
+        LOG.info("geo-scaling test, using {}.{}; expect not to be wired to {}", new Object[] {subDomain, primaryDomain, addrWithoutGeo});
         
         Asserts.succeedsContinually(MutableMap.of("timeout", 10*1000), new Runnable() {
             @Override public void run() {
@@ -149,14 +152,12 @@ public class GeoscalingIntegrationTest {
     public void testIncludesAddressWithoutGeography() {
         System.setProperty(BrooklynSystemProperties.HOST_GEO_LOOKUP_IMPL.getPropertyName(), StubHostGeoLookup.class.getName());
         ((EntityLocal)geoDns).setConfig(GeoscalingDnsService.INCLUDE_HOMELESS_ENTITIES, true);
-        //target.setAttribute(Attributes.HOSTNAME, StubHostGeoLookup.HOMELESS_IP);
         
         app.start(ImmutableList.of(locWithoutGeo));
+        target.setAttribute(Attributes.HOSTNAME, StubHostGeoLookup.HOMELESS_IP);
         
         LOG.info("geo-scaling test, using {}.{}; expect to be wired to {}", new Object[] {subDomain, primaryDomain, addrWithoutGeo});
         
-        target.setAttribute(Attributes.HOSTNAME, StubHostGeoLookup.HOMELESS_IP);
-        
         assertTargetHostsEventually(geoDns, 1);
     }