You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by sj...@apache.org on 2014/12/09 11:45:30 UTC

[1/5] incubator-brooklyn git commit: Move character set info with first 1024 bytes.

Repository: incubator-brooklyn
Updated Branches:
  refs/heads/master 404f145a6 -> f249da3de


Move character set info with first 1024 bytes.

Firefox expects the header within the first 1K


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

Branch: refs/heads/master
Commit: 24339cb2ec97f4eaa7390db61c724397125089b4
Parents: d767d78
Author: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Authored: Mon Dec 8 21:35:15 2014 +0200
Committer: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Committed: Mon Dec 8 21:35:15 2014 +0200

----------------------------------------------------------------------
 docs/_layouts/page.html | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/24339cb2/docs/_layouts/page.html
----------------------------------------------------------------------
diff --git a/docs/_layouts/page.html b/docs/_layouts/page.html
index fc92ffa..a8c2ae1 100644
--- a/docs/_layouts/page.html
+++ b/docs/_layouts/page.html
@@ -22,8 +22,8 @@ under the License.
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
 
 <head>
-  <title>{{ page.title }}</title>
   <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
+  <title>{{ page.title }}</title>
 
   <link rel="stylesheet" href="{{ site.url }}/style/style.css" type="text/css" media="screen" />
   <link rel="stylesheet" href="{{ site.url }}/style/toc.css" type="text/css" media="screen" />


[3/5] incubator-brooklyn git commit: Fix sharded-mongodb, with CoLocatedMongoDbRouter

Posted by sj...@apache.org.
Fix sharded-mongodb, with CoLocatedMongoDbRouter

- was getting NPE in CoLocatedMongoDbRouter.init, while trying to
  resolve config set in yam that pointed at another entity.


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

Branch: refs/heads/master
Commit: a46391e1671bd37460eaa5676badb87c4ba48463
Parents: 7051e6c
Author: Aled Sage <al...@gmail.com>
Authored: Tue Nov 18 22:05:26 2014 +0000
Committer: Sam Corbett <sa...@cloudsoftcorp.com>
Committed: Tue Dec 9 10:38:23 2014 +0000

----------------------------------------------------------------------
 .../sharding/CoLocatedMongoDBRouterImpl.java    | 33 ++++++++++++++++----
 1 file changed, 27 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a46391e1/software/nosql/src/main/java/brooklyn/entity/nosql/mongodb/sharding/CoLocatedMongoDBRouterImpl.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/brooklyn/entity/nosql/mongodb/sharding/CoLocatedMongoDBRouterImpl.java b/software/nosql/src/main/java/brooklyn/entity/nosql/mongodb/sharding/CoLocatedMongoDBRouterImpl.java
index d61478f..a8bec4e 100644
--- a/software/nosql/src/main/java/brooklyn/entity/nosql/mongodb/sharding/CoLocatedMongoDBRouterImpl.java
+++ b/software/nosql/src/main/java/brooklyn/entity/nosql/mongodb/sharding/CoLocatedMongoDBRouterImpl.java
@@ -21,12 +21,16 @@ package brooklyn.entity.nosql.mongodb.sharding;
 import java.util.Collection;
 
 import brooklyn.enricher.Enrichers;
+import brooklyn.entity.basic.Entities;
 import brooklyn.entity.basic.SameServerEntityImpl;
 import brooklyn.entity.proxying.EntitySpec;
 import brooklyn.entity.trait.Startable;
 import brooklyn.event.basic.DependentConfiguration;
 import brooklyn.location.Location;
 
+import com.google.common.base.Predicates;
+import com.google.common.collect.Iterables;
+
 public class CoLocatedMongoDBRouterImpl extends SameServerEntityImpl implements CoLocatedMongoDBRouter {
     @Override
     public void init() {
@@ -35,15 +39,32 @@ public class CoLocatedMongoDBRouterImpl extends SameServerEntityImpl implements
         for (EntitySpec<?> siblingSpec : getConfig(CoLocatedMongoDBRouter.SIBLING_SPECS)) {
             addChild(siblingSpec);
         }
-        setAttribute(ROUTER, addChild(EntitySpec.create(MongoDBRouter.class)
-                .configure(MongoDBRouter.CONFIG_SERVERS,
-                        DependentConfiguration.attributeWhenReady(getConfig(CoLocatedMongoDBRouter.SHARDED_DEPLOYMENT), MongoDBConfigServerCluster.CONFIG_SERVER_ADDRESSES))));
-        addEnricher(Enrichers.builder().propagating(MongoDBRouter.PORT).from(getAttribute(ROUTER)).build());
     }
-    
+
     @Override
     protected void doStart(Collection<? extends Location> locations) {
-        super.start(locations);
+        // TODO Changed to create the router child after init as a workaround.
+        // When we use `mongo-sharded.yaml`, and we call 
+        // `getConfig(CoLocatedMongoDBRouter.SHARDED_DEPLOYMENT)`,
+        // the value is `$brooklyn:component("shardeddeployment")`.
+        // To look up the component, it tries to do `entity().getApplication()` to
+        // search the entities for one with the correct id. However if being done
+        // during `init()`, then this (which is returned by `entity()`) has not had its parent
+        // set, so `entity().getApplication()` returns null.
+        //
+        // We should move this code back to `init()` once we have a solution for that.
+        // We can also remove the call to Entities.manage() once this is in init() again.
+        
+        MongoDBRouter router = addChild(EntitySpec.create(MongoDBRouter.class)
+                .configure(MongoDBRouter.CONFIG_SERVERS,
+                        DependentConfiguration.attributeWhenReady(
+                                getConfig(CoLocatedMongoDBRouter.SHARDED_DEPLOYMENT), 
+                                MongoDBConfigServerCluster.CONFIG_SERVER_ADDRESSES)));
+        Entities.manage(router);
+        setAttribute(ROUTER, (MongoDBRouter) Iterables.tryFind(getChildren(), Predicates.instanceOf(MongoDBRouter.class)).get());
+        addEnricher(Enrichers.builder().propagating(MongoDBRouter.PORT).from(router).build());
+        
+        super.doStart(locations);
         setAttribute(Startable.SERVICE_UP, true);
     }
 }


[2/5] incubator-brooklyn git commit: Adds tests for MongoDB yaml blueprints

Posted by sj...@apache.org.
Adds tests for MongoDB yaml blueprints


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

Branch: refs/heads/master
Commit: 7051e6c740ac9e9f5a9c7847f8e2e984dd5a00f4
Parents: 404f145
Author: Aled Sage <al...@gmail.com>
Authored: Tue Nov 18 21:57:05 2014 +0000
Committer: Sam Corbett <sa...@cloudsoftcorp.com>
Committed: Tue Dec 9 10:38:22 2014 +0000

----------------------------------------------------------------------
 .../blueprints/MongoDbBlueprintTest.java        | 98 ++++++++++++++++++++
 1 file changed, 98 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7051e6c7/usage/launcher/src/test/java/brooklyn/launcher/blueprints/MongoDbBlueprintTest.java
----------------------------------------------------------------------
diff --git a/usage/launcher/src/test/java/brooklyn/launcher/blueprints/MongoDbBlueprintTest.java b/usage/launcher/src/test/java/brooklyn/launcher/blueprints/MongoDbBlueprintTest.java
new file mode 100644
index 0000000..c3e6d18
--- /dev/null
+++ b/usage/launcher/src/test/java/brooklyn/launcher/blueprints/MongoDbBlueprintTest.java
@@ -0,0 +1,98 @@
+/*
+ * 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.launcher.blueprints;
+
+import static org.testng.Assert.assertNotEquals;
+
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import brooklyn.entity.Application;
+import brooklyn.entity.Entity;
+import brooklyn.entity.basic.Attributes;
+import brooklyn.entity.basic.Entities;
+import brooklyn.entity.basic.Lifecycle;
+import brooklyn.launcher.BrooklynLauncher;
+import brooklyn.launcher.SimpleYamlLauncherForTests;
+import brooklyn.test.Asserts;
+import brooklyn.test.EntityTestUtils;
+
+public class MongoDbBlueprintTest {
+
+    // TODO Some tests are failing! Needs investigated.
+    
+    private SimpleYamlLauncherForTests launcher;
+    
+    // The "viewer" is just for having a Brooklyn web-console available for visual inspection;
+    // could be removed without affecting behaviour
+    private BrooklynLauncher viewer;
+    
+    @BeforeMethod(alwaysRun=true)
+    public void setUp() throws Exception {
+        launcher = new SimpleYamlLauncherForTests();
+        viewer = BrooklynLauncher.newInstance().managementContext(launcher.getManagementContext()).start();
+    }
+    
+    @AfterMethod(alwaysRun=true)
+    public void tearDown() throws Exception {
+        if (launcher != null) launcher.destroyAll();
+        if (viewer != null) viewer.terminate();
+    }
+    
+    @Test(groups="Integration")
+    public void testMongoSharded() {
+        runAppAndAssertNoFires("mongo-sharded.yaml");
+    }
+
+    @Test(groups="Integration")
+    public void testMongoReplicaSet() {
+        runAppAndAssertNoFires("mongo-blueprint.yaml");
+    }
+
+    @Test(groups="Integration")
+    public void testMongoClientAndSingleServer() {
+        runAppAndAssertNoFires("mongo-client-single-server.yaml");
+    }
+
+    @Test(groups="Integration")
+    public void testMongoScripts() {
+        runAppAndAssertNoFires("mongo-scripts.yaml");
+    }
+
+    @Test(groups="Integration")
+    public void testMongoSingleServer() {
+        runAppAndAssertNoFires("mongo-single-server-blueprint.yaml");
+    }
+
+    protected void runAppAndAssertNoFires(String yamlFile) {
+        final Application app = launcher.launchAppYaml(yamlFile);
+
+        EntityTestUtils.assertAttributeEqualsEventually(app, Attributes.SERVICE_UP, true);
+        EntityTestUtils.assertAttributeEqualsEventually(app, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING);
+        
+        Asserts.succeedsEventually(new Runnable() {
+            public void run() {
+                for (Entity entity : Entities.descendants(app)) {
+                    assertNotEquals(entity.getAttribute(Attributes.SERVICE_STATE_ACTUAL), Lifecycle.ON_FIRE);
+                    assertNotEquals(entity.getAttribute(Attributes.SERVICE_UP), false);
+                }
+            }});
+    }
+}


[5/5] incubator-brooklyn git commit: This closes #377

Posted by sj...@apache.org.
This closes #377


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

Branch: refs/heads/master
Commit: f249da3de03b7b685202a41d683153cf9bbac0ff
Parents: 131c518 24339cb
Author: Sam Corbett <sa...@cloudsoftcorp.com>
Authored: Tue Dec 9 10:40:16 2014 +0000
Committer: Sam Corbett <sa...@cloudsoftcorp.com>
Committed: Tue Dec 9 10:40:16 2014 +0000

----------------------------------------------------------------------
 docs/_layouts/page.html | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/f249da3d/docs/_layouts/page.html
----------------------------------------------------------------------


[4/5] incubator-brooklyn git commit: EntityTestUtils: improve error messages

Posted by sj...@apache.org.
EntityTestUtils: improve error messages


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

Branch: refs/heads/master
Commit: 131c518832b47a6661195ac524cc9a6b356f00fc
Parents: a46391e
Author: Aled Sage <al...@gmail.com>
Authored: Tue Nov 18 22:05:49 2014 +0000
Committer: Sam Corbett <sa...@cloudsoftcorp.com>
Committed: Tue Dec 9 10:38:23 2014 +0000

----------------------------------------------------------------------
 .../src/main/java/brooklyn/test/EntityTestUtils.java             | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/131c5188/usage/test-support/src/main/java/brooklyn/test/EntityTestUtils.java
----------------------------------------------------------------------
diff --git a/usage/test-support/src/main/java/brooklyn/test/EntityTestUtils.java b/usage/test-support/src/main/java/brooklyn/test/EntityTestUtils.java
index 5332818..088f29c 100644
--- a/usage/test-support/src/main/java/brooklyn/test/EntityTestUtils.java
+++ b/usage/test-support/src/main/java/brooklyn/test/EntityTestUtils.java
@@ -51,11 +51,11 @@ public class EntityTestUtils {
     // and deprecate methods in TestUtils until deleted).
     
     public static <T> void assertAttributeEquals(Entity entity, AttributeSensor<T> attribute, T expected) {
-        assertEquals(entity.getAttribute(attribute), expected);
+        assertEquals(entity.getAttribute(attribute), expected, "entity="+entity+"; attribute="+attribute);
     }
     
     public static <T> void assertConfigEquals(Entity entity, ConfigKey<T> configKey, T expected) {
-        assertEquals(entity.getConfig(configKey), expected);
+        assertEquals(entity.getConfig(configKey), expected, "entity="+entity+"; configKey="+configKey);
     }
     
     public static <T> void assertAttributeEqualsEventually(final Entity entity, final AttributeSensor<T> attribute, final T expected) {