brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [19/26] git commit: use initApp for apps to ensure enrichers get added, fixing tests and other misc tidies
Date Fri, 29 Aug 2014 23:01:19 GMT
use initApp for apps to ensure enrichers get added, fixing tests and other misc tidies


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

Branch: refs/heads/master
Commit: 5ec0a00b1c9deb4ff3b7ccc4dc7e7e6755fded26
Parents: b2daedf
Author: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Authored: Mon Aug 25 16:29:52 2014 -0500
Committer: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Committed: Wed Aug 27 02:17:18 2014 -0400

----------------------------------------------------------------------
 .../entity/basic/AbstractApplication.java       |  7 ++++
 .../entity/basic/BasicApplicationImpl.java      |  7 ----
 .../catalog/internal/MyCatalogItems.java        |  4 --
 .../basic/DependentConfigurationTest.java       | 35 +++++++++++++---
 .../entity/rebind/RebindTestFixtureWithApp.java |  3 +-
 .../test/entity/TestApplicationImpl.java        |  5 ---
 .../entity/TestApplicationNoEnrichersImpl.java  | 44 ++++++++++++++++++++
 .../brooklyn/demo/GlobalWebFabricExample.java   |  2 +-
 .../demo/StandaloneQpidBrokerExample.java       |  2 +-
 .../brooklyn/demo/CumulusRDFApplication.java    |  4 +-
 .../demo/HighAvailabilityCassandraCluster.java  |  2 +-
 .../java/brooklyn/demo/ResilientMongoDbApp.java |  2 +-
 .../java/brooklyn/demo/RiakClusterExample.java  |  2 +-
 .../brooklyn/demo/SimpleCassandraCluster.java   |  2 +-
 .../main/java/brooklyn/demo/StormSampleApp.java |  2 +-
 .../brooklyn/demo/WideAreaCassandraCluster.java |  2 +-
 .../brooklyn/demo/NodeJsTodoApplication.java    |  2 +-
 .../brooklyn/demo/SingleWebServerExample.java   |  2 +-
 .../demo/WebClusterDatabaseExample.java         |  4 +-
 .../demo/WebClusterDatabaseExampleApp.java      |  4 +-
 .../demo/WebClusterDatabaseExampleGroovy.groovy |  2 +-
 .../java/brooklyn/demo/WebClusterExample.java   |  2 +-
 .../entity/basic/lifecycle/MyEntityImpl.java    |  3 +-
 .../basic/lifecycle/NaiveScriptRunnerTest.java  |  3 ++
 .../basic/lifecycle/ScriptHelperTest.java       | 13 +++---
 .../brooklyn/entity/pool/ServerPoolTest.java    | 13 +++---
 .../qa/longevity/webcluster/WebClusterApp.java  |  2 +-
 .../rest/testing/mocks/RestMockApp.java         |  8 ----
 .../util/BrooklynRestResourceUtilsTest.java     |  4 --
 29 files changed, 113 insertions(+), 74 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/5ec0a00b/core/src/main/java/brooklyn/entity/basic/AbstractApplication.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/entity/basic/AbstractApplication.java b/core/src/main/java/brooklyn/entity/basic/AbstractApplication.java
index da33208..35e0083 100644
--- a/core/src/main/java/brooklyn/entity/basic/AbstractApplication.java
+++ b/core/src/main/java/brooklyn/entity/basic/AbstractApplication.java
@@ -57,6 +57,13 @@ public abstract class AbstractApplication extends AbstractEntity implements
Star
     public AbstractApplication() {
     }
 
+    public void init() { 
+        initApp();
+        super.init();
+    }
+    
+    protected void initApp() {}
+    
     /**
      * 
      * @deprecated since 0.6; use EntitySpec so no-arg constructor

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/5ec0a00b/core/src/main/java/brooklyn/entity/basic/BasicApplicationImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/entity/basic/BasicApplicationImpl.java b/core/src/main/java/brooklyn/entity/basic/BasicApplicationImpl.java
index 1dfc7bc..6915556 100644
--- a/core/src/main/java/brooklyn/entity/basic/BasicApplicationImpl.java
+++ b/core/src/main/java/brooklyn/entity/basic/BasicApplicationImpl.java
@@ -19,11 +19,4 @@
 package brooklyn.entity.basic;
 
 public class BasicApplicationImpl extends AbstractApplication implements BasicApplication
{
-    public BasicApplicationImpl() {
-    }
-    
-    @Override
-    public void init() {
-        // no-op
-    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/5ec0a00b/core/src/test/java/brooklyn/catalog/internal/MyCatalogItems.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/brooklyn/catalog/internal/MyCatalogItems.java b/core/src/test/java/brooklyn/catalog/internal/MyCatalogItems.java
index 66fe0e6..3506d49 100644
--- a/core/src/test/java/brooklyn/catalog/internal/MyCatalogItems.java
+++ b/core/src/test/java/brooklyn/catalog/internal/MyCatalogItems.java
@@ -26,10 +26,6 @@ public class MyCatalogItems {
 
     @Catalog(description="Some silly app test")
     public static class MySillyAppTemplate extends AbstractApplication {
-        @Override
-        public void init() {
-            // no-op
-        }
     }
     
     @Catalog(description="Some silly app builder test")

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/5ec0a00b/core/src/test/java/brooklyn/entity/basic/DependentConfigurationTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/brooklyn/entity/basic/DependentConfigurationTest.java b/core/src/test/java/brooklyn/entity/basic/DependentConfigurationTest.java
index f6096a4..433d677 100644
--- a/core/src/test/java/brooklyn/entity/basic/DependentConfigurationTest.java
+++ b/core/src/test/java/brooklyn/entity/basic/DependentConfigurationTest.java
@@ -29,6 +29,8 @@ import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 import java.util.concurrent.atomic.AtomicReference;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.testng.Assert;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
@@ -38,8 +40,12 @@ import brooklyn.entity.proxying.EntitySpec;
 import brooklyn.event.basic.DependentConfiguration;
 import brooklyn.management.Task;
 import brooklyn.test.Asserts;
+import brooklyn.test.EntityTestUtils;
 import brooklyn.test.entity.TestEntity;
 import brooklyn.util.collections.MutableList;
+import brooklyn.util.collections.MutableMap;
+import brooklyn.util.exceptions.Exceptions;
+import brooklyn.util.javalang.JavaClassNames;
 import brooklyn.util.task.BasicTask;
 import brooklyn.util.text.StringPredicates;
 import brooklyn.util.time.Duration;
@@ -58,6 +64,8 @@ import com.google.common.util.concurrent.Callables;
  */
 public class DependentConfigurationTest extends BrooklynAppUnitTestSupport {
 
+    private static final Logger log = LoggerFactory.getLogger(DependentConfigurationTest.class);
+    
     public static final int SHORT_WAIT_MS = 100;
     public static final int TIMEOUT_MS = 30*1000;
     
@@ -187,23 +195,38 @@ public class DependentConfigurationTest extends BrooklynAppUnitTestSupport
{
     }
 
     @Test
-    public void testAttributeWhenReadyAbortsWhenOnfireByDefault() throws Exception {
+    public void testAttributeWhenReadyAbortsWhenOnFireByDefault() {
+        log.info("starting test "+JavaClassNames.niceClassAndMethod());
         final Task<String> t = submit(DependentConfiguration.builder()
                 .attributeWhenReady(entity, TestEntity.NAME)
                 .build());
 
         ServiceStateLogic.setExpectedState(entity, Lifecycle.ON_FIRE);
+        EntityTestUtils.assertAttributeEqualsEventually(entity, Attributes.SERVICE_STATE_ACTUAL,
Lifecycle.ON_FIRE);
+        
         try {
             assertDoneEventually(t);
-            fail();
-        } catch (Exception e) {
-            if (!e.toString().contains("Aborted waiting for ready")) throw e;
+            fail("Should have failed already!");
+        } catch (Throwable e) {
+            if (e.toString().contains("Aborted waiting for ready")) 
+                return;
+            
+            log.warn("Did not abort as expected: "+e, e);
+            Entities.dumpInfo(entity);
+            
+            throw Exceptions.propagate(e);
         }
     }
 
+    @Test(invocationCount=100, groups = "Integration")
+    public void testAttributeWhenReadyAbortsWhenOnfireByDefaultManyTimes() {
+        testAttributeWhenReadyAbortsWhenOnFireByDefault();
+    }
+    
     @Test
-    public void testAttributeWhenReadyAbortsWhenAlreadyOnfireByDefault() throws Exception
{
+    public void testAttributeWhenReadyAbortsWhenAlreadyOnFireByDefault() throws Exception
{
         ServiceStateLogic.setExpectedState(entity, Lifecycle.ON_FIRE);
+        EntityTestUtils.assertAttributeEqualsEventually(entity, Attributes.SERVICE_STATE_ACTUAL,
Lifecycle.ON_FIRE);
         
         final Task<String> t = submit(DependentConfiguration.builder()
                 .attributeWhenReady(entity, TestEntity.NAME)
@@ -281,7 +304,7 @@ public class DependentConfigurationTest extends BrooklynAppUnitTestSupport
{
     
     private <T> T assertDoneEventually(final Task<T> t) throws Exception {
         final AtomicReference<ExecutionException> exception = new AtomicReference<ExecutionException>();
-        T result = Asserts.succeedsEventually(new Callable<T>() {
+        T result = Asserts.succeedsEventually(MutableMap.of("timeout", Duration.FIVE_SECONDS),
new Callable<T>() {
             @Override public T call() throws InterruptedException, TimeoutException {
                 try {
                     return t.get(Duration.ONE_SECOND);

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/5ec0a00b/core/src/test/java/brooklyn/entity/rebind/RebindTestFixtureWithApp.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/brooklyn/entity/rebind/RebindTestFixtureWithApp.java b/core/src/test/java/brooklyn/entity/rebind/RebindTestFixtureWithApp.java
index 1d54199..81ca411 100644
--- a/core/src/test/java/brooklyn/entity/rebind/RebindTestFixtureWithApp.java
+++ b/core/src/test/java/brooklyn/entity/rebind/RebindTestFixtureWithApp.java
@@ -21,11 +21,12 @@ package brooklyn.entity.rebind;
 import brooklyn.entity.basic.ApplicationBuilder;
 import brooklyn.entity.proxying.EntitySpec;
 import brooklyn.test.entity.TestApplication;
+import brooklyn.test.entity.TestApplicationNoEnrichersImpl;
 
 public class RebindTestFixtureWithApp extends RebindTestFixture<TestApplication> {
 
     protected TestApplication createApp() {
-        return ApplicationBuilder.newManagedApp(EntitySpec.create(TestApplication.class),
origManagementContext);
+        return ApplicationBuilder.newManagedApp(EntitySpec.create(TestApplication.class,
TestApplicationNoEnrichersImpl.class), origManagementContext);
     }
     
 }

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/5ec0a00b/core/src/test/java/brooklyn/test/entity/TestApplicationImpl.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/brooklyn/test/entity/TestApplicationImpl.java b/core/src/test/java/brooklyn/test/entity/TestApplicationImpl.java
index ae5c963..8c7d844 100644
--- a/core/src/test/java/brooklyn/test/entity/TestApplicationImpl.java
+++ b/core/src/test/java/brooklyn/test/entity/TestApplicationImpl.java
@@ -54,11 +54,6 @@ public class TestApplicationImpl extends AbstractApplication implements
TestAppl
     }
 
     @Override
-    public void init() {
-        // no-op
-    }
-    
-    @Override
     public <T extends Entity> T createAndManageChild(EntitySpec<T> spec) {
         if (!getManagementSupport().isDeployed()) throw new IllegalStateException("Entity
"+this+" not managed");
         T child = addChild(spec);

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/5ec0a00b/core/src/test/java/brooklyn/test/entity/TestApplicationNoEnrichersImpl.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/brooklyn/test/entity/TestApplicationNoEnrichersImpl.java b/core/src/test/java/brooklyn/test/entity/TestApplicationNoEnrichersImpl.java
new file mode 100644
index 0000000..1435443
--- /dev/null
+++ b/core/src/test/java/brooklyn/test/entity/TestApplicationNoEnrichersImpl.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package brooklyn.test.entity;
+
+import java.util.Map;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import brooklyn.entity.Entity;
+import brooklyn.entity.Group;
+import brooklyn.entity.basic.AbstractApplication;
+import brooklyn.entity.proxying.EntitySpec;
+import brooklyn.event.Sensor;
+import brooklyn.event.SensorEventListener;
+import brooklyn.location.LocationSpec;
+import brooklyn.location.basic.LocalhostMachineProvisioningLocation;
+import brooklyn.management.SubscriptionHandle;
+import brooklyn.util.logging.LoggingSetup;
+
+/**
+ * Mock application for testing.
+ */
+public class TestApplicationNoEnrichersImpl extends TestApplicationImpl {
+    
+    protected void initEnrichers() { /* none */ }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/5ec0a00b/examples/global-web-fabric/src/main/java/brooklyn/demo/GlobalWebFabricExample.java
----------------------------------------------------------------------
diff --git a/examples/global-web-fabric/src/main/java/brooklyn/demo/GlobalWebFabricExample.java
b/examples/global-web-fabric/src/main/java/brooklyn/demo/GlobalWebFabricExample.java
index 004f118..cf4fa24 100644
--- a/examples/global-web-fabric/src/main/java/brooklyn/demo/GlobalWebFabricExample.java
+++ b/examples/global-web-fabric/src/main/java/brooklyn/demo/GlobalWebFabricExample.java
@@ -82,7 +82,7 @@ public class GlobalWebFabricExample extends AbstractApplication {
         new PortAttributeSensorAndConfigKey(AbstractController.PROXY_HTTP_PORT, PortRanges.fromInteger(80));
     
     @Override
-    public void init() {
+    public void initApp() {
         StringConfigMap config = getManagementContext().getConfig();
         
         GeoscalingDnsService geoDns = addChild(EntitySpec.create(GeoscalingDnsService.class)

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/5ec0a00b/examples/simple-messaging-pubsub/src/main/java/brooklyn/demo/StandaloneQpidBrokerExample.java
----------------------------------------------------------------------
diff --git a/examples/simple-messaging-pubsub/src/main/java/brooklyn/demo/StandaloneQpidBrokerExample.java
b/examples/simple-messaging-pubsub/src/main/java/brooklyn/demo/StandaloneQpidBrokerExample.java
index e042e0d..57400e3 100644
--- a/examples/simple-messaging-pubsub/src/main/java/brooklyn/demo/StandaloneQpidBrokerExample.java
+++ b/examples/simple-messaging-pubsub/src/main/java/brooklyn/demo/StandaloneQpidBrokerExample.java
@@ -43,7 +43,7 @@ public class StandaloneQpidBrokerExample extends AbstractApplication {
     public static final String DEFAULT_LOCATION = "localhost";
     
     @Override
-    public void init() {
+    public void initApp() {
         // Configure the Qpid broker entity
     	QpidBroker broker = addChild(EntitySpec.create(QpidBroker.class)
     	        .configure("amqpPort", 5672)

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/5ec0a00b/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/CumulusRDFApplication.java
----------------------------------------------------------------------
diff --git a/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/CumulusRDFApplication.java
b/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/CumulusRDFApplication.java
index eaabaff..c560ca5 100644
--- a/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/CumulusRDFApplication.java
+++ b/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/CumulusRDFApplication.java
@@ -114,9 +114,7 @@ public class CumulusRDFApplication extends AbstractApplication {
      * </ul>
      */
     @Override
-    public void init() {
-        super.init();
-        
+    public void initApp() {
         // Cassandra cluster
         EntitySpec<CassandraDatacenter> clusterSpec = EntitySpec.create(CassandraDatacenter.class)
                 .configure(CassandraDatacenter.MEMBER_SPEC, EntitySpec.create(CassandraNode.class)

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/5ec0a00b/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/HighAvailabilityCassandraCluster.java
----------------------------------------------------------------------
diff --git a/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/HighAvailabilityCassandraCluster.java
b/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/HighAvailabilityCassandraCluster.java
index c21c4cf..a105783 100644
--- a/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/HighAvailabilityCassandraCluster.java
+++ b/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/HighAvailabilityCassandraCluster.java
@@ -55,7 +55,7 @@ public class HighAvailabilityCassandraCluster extends AbstractApplication
{
     
     
     @Override
-    public void init() {
+    public void initApp() {
         addChild(EntitySpec.create(CassandraDatacenter.class)
                 .configure(CassandraDatacenter.CLUSTER_NAME, "Brooklyn")
                 .configure(CassandraDatacenter.INITIAL_SIZE, getConfig(CASSANDRA_CLUSTER_SIZE))

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/5ec0a00b/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/ResilientMongoDbApp.java
----------------------------------------------------------------------
diff --git a/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/ResilientMongoDbApp.java
b/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/ResilientMongoDbApp.java
index 290f25e..4acbbea 100644
--- a/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/ResilientMongoDbApp.java
+++ b/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/ResilientMongoDbApp.java
@@ -55,7 +55,7 @@ public class ResilientMongoDbApp extends AbstractApplication implements
Startabl
     public static final String DEFAULT_LOCATION = "named:gce-europe-west1";
 
     @Override
-    public void init() {
+    public void initApp() {
         MongoDBReplicaSet rs = addChild(
                 EntitySpec.create(MongoDBReplicaSet.class)
                         .configure(MongoDBReplicaSet.INITIAL_SIZE, 3));

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/5ec0a00b/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/RiakClusterExample.java
----------------------------------------------------------------------
diff --git a/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/RiakClusterExample.java
b/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/RiakClusterExample.java
index 0134e27..58b6f60 100644
--- a/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/RiakClusterExample.java
+++ b/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/RiakClusterExample.java
@@ -64,7 +64,7 @@ public class RiakClusterExample extends AbstractApplication {
         Entities.dumpInfo(launcher.getApplications());
     }
 
-    public void init() {
+    public void initApp() {
         addChild(EntitySpec.create(RiakCluster.class)
                 .configure(RiakCluster.INITIAL_SIZE, getConfig(RIAK_RING_SIZE))
                 .configure(RiakCluster.MEMBER_SPEC, EntitySpec.create(RiakNode.class)

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/5ec0a00b/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/SimpleCassandraCluster.java
----------------------------------------------------------------------
diff --git a/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/SimpleCassandraCluster.java
b/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/SimpleCassandraCluster.java
index 577a9dc..94f792c 100644
--- a/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/SimpleCassandraCluster.java
+++ b/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/SimpleCassandraCluster.java
@@ -35,7 +35,7 @@ public class SimpleCassandraCluster extends AbstractApplication {
     private static final String DEFAULT_LOCATION = "localhost";
 
     @Override
-    public void init() {
+    public void initApp() {
         addChild(EntitySpec.create(CassandraDatacenter.class)
                 .configure(CassandraDatacenter.INITIAL_SIZE, 1)
                 .configure(CassandraDatacenter.CLUSTER_NAME, "Brooklyn"));

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/5ec0a00b/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/StormSampleApp.java
----------------------------------------------------------------------
diff --git a/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/StormSampleApp.java
b/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/StormSampleApp.java
index cb70578..732ccd5 100644
--- a/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/StormSampleApp.java
+++ b/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/StormSampleApp.java
@@ -47,7 +47,7 @@ public class StormSampleApp extends AbstractApplication implements StartableAppl
     public static final String DEFAULT_LOCATION = "named:gce-europe-west1";
 
     @Override
-    public void init() {
+    public void initApp() {
         addChild(EntitySpec.create(StormDeployment.class)
             .configure(StormDeployment.SUPERVISORS_COUNT, 2)
             .configure(StormDeployment.ZOOKEEPERS_COUNT, 1));

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/5ec0a00b/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/WideAreaCassandraCluster.java
----------------------------------------------------------------------
diff --git a/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/WideAreaCassandraCluster.java
b/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/WideAreaCassandraCluster.java
index 8e30fc4..325502f 100644
--- a/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/WideAreaCassandraCluster.java
+++ b/examples/simple-nosql-cluster/src/main/java/brooklyn/demo/WideAreaCassandraCluster.java
@@ -54,7 +54,7 @@ public class WideAreaCassandraCluster extends AbstractApplication {
     
 	
     @Override
-    public void init() {
+    public void initApp() {
         addChild(EntitySpec.create(CassandraFabric.class)
                 .configure(CassandraDatacenter.CLUSTER_NAME, "Brooklyn")
                 .configure(CassandraDatacenter.INITIAL_SIZE, getConfig(CASSANDRA_CLUSTER_SIZE))
// per location

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/5ec0a00b/examples/simple-web-cluster/src/main/java/brooklyn/demo/NodeJsTodoApplication.java
----------------------------------------------------------------------
diff --git a/examples/simple-web-cluster/src/main/java/brooklyn/demo/NodeJsTodoApplication.java
b/examples/simple-web-cluster/src/main/java/brooklyn/demo/NodeJsTodoApplication.java
index 54eb008..2eef128 100644
--- a/examples/simple-web-cluster/src/main/java/brooklyn/demo/NodeJsTodoApplication.java
+++ b/examples/simple-web-cluster/src/main/java/brooklyn/demo/NodeJsTodoApplication.java
@@ -42,7 +42,7 @@ import com.google.common.collect.ImmutableMap;
 public class NodeJsTodoApplication extends AbstractApplication implements StartableApplication
{
 
     @Override
-    public void init() {
+    public void initApp() {
         RedisStore redis = addChild(EntitySpec.create(RedisStore.class));
 
         addChild(EntitySpec.create(NodeJsWebAppService.class)

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/5ec0a00b/examples/simple-web-cluster/src/main/java/brooklyn/demo/SingleWebServerExample.java
----------------------------------------------------------------------
diff --git a/examples/simple-web-cluster/src/main/java/brooklyn/demo/SingleWebServerExample.java
b/examples/simple-web-cluster/src/main/java/brooklyn/demo/SingleWebServerExample.java
index 9cf027f..d974e35 100644
--- a/examples/simple-web-cluster/src/main/java/brooklyn/demo/SingleWebServerExample.java
+++ b/examples/simple-web-cluster/src/main/java/brooklyn/demo/SingleWebServerExample.java
@@ -44,7 +44,7 @@ public class SingleWebServerExample extends AbstractApplication {
     private static final String WAR_PATH = "classpath://hello-world-webapp.war";
 
     @Override
-    public void init() {
+    public void initApp() {
         addChild(EntitySpec.create(JBoss7Server.class)
                 .configure(JavaWebAppService.ROOT_WAR, WAR_PATH)
                 .configure(Attributes.HTTP_PORT, PortRanges.fromString("8080+")));

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/5ec0a00b/examples/simple-web-cluster/src/main/java/brooklyn/demo/WebClusterDatabaseExample.java
----------------------------------------------------------------------
diff --git a/examples/simple-web-cluster/src/main/java/brooklyn/demo/WebClusterDatabaseExample.java
b/examples/simple-web-cluster/src/main/java/brooklyn/demo/WebClusterDatabaseExample.java
index bfd3a1c..fd7c9ae 100644
--- a/examples/simple-web-cluster/src/main/java/brooklyn/demo/WebClusterDatabaseExample.java
+++ b/examples/simple-web-cluster/src/main/java/brooklyn/demo/WebClusterDatabaseExample.java
@@ -69,9 +69,7 @@ public class WebClusterDatabaseExample extends AbstractApplication {
             "appservers.count", "Number of app servers deployed");
 
     @Override
-    public void init() {
-        super.init();
-        
+    public void initApp() {
         MySqlNode mysql = addChild(EntitySpec.create(MySqlNode.class)
                 .configure("creationScriptUrl", DB_SETUP_SQL_URL));
         

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/5ec0a00b/examples/simple-web-cluster/src/main/java/brooklyn/demo/WebClusterDatabaseExampleApp.java
----------------------------------------------------------------------
diff --git a/examples/simple-web-cluster/src/main/java/brooklyn/demo/WebClusterDatabaseExampleApp.java
b/examples/simple-web-cluster/src/main/java/brooklyn/demo/WebClusterDatabaseExampleApp.java
index b1d3915..706445f 100644
--- a/examples/simple-web-cluster/src/main/java/brooklyn/demo/WebClusterDatabaseExampleApp.java
+++ b/examples/simple-web-cluster/src/main/java/brooklyn/demo/WebClusterDatabaseExampleApp.java
@@ -117,9 +117,7 @@ public class WebClusterDatabaseExampleApp extends AbstractApplication
implements
     public static final AttributeSensor<String> ROOT_URL = WebAppServiceConstants.ROOT_URL;
 
     @Override
-    public void init() {
-        super.init();
-        
+    public void initApp() {
         MySqlNode mysql = addChild(
                 EntitySpec.create(MySqlNode.class)
                         .configure(MySqlNode.CREATION_SCRIPT_URL, Entities.getRequiredUrlConfig(this,
DB_SETUP_SQL_URL)));

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/5ec0a00b/examples/simple-web-cluster/src/main/java/brooklyn/demo/WebClusterDatabaseExampleGroovy.groovy
----------------------------------------------------------------------
diff --git a/examples/simple-web-cluster/src/main/java/brooklyn/demo/WebClusterDatabaseExampleGroovy.groovy
b/examples/simple-web-cluster/src/main/java/brooklyn/demo/WebClusterDatabaseExampleGroovy.groovy
index fc58a02..c3f6cc7 100644
--- a/examples/simple-web-cluster/src/main/java/brooklyn/demo/WebClusterDatabaseExampleGroovy.groovy
+++ b/examples/simple-web-cluster/src/main/java/brooklyn/demo/WebClusterDatabaseExampleGroovy.groovy
@@ -57,7 +57,7 @@ public class WebClusterDatabaseExampleGroovy extends AbstractApplication
{
     public static final String DB_PASSWORD = "br00k11n";
     
     @Override
-    public void init() {
+    public void initApp() {
         MySqlNode mysql = addChild(MySqlNode,
                 creationScriptUrl: DB_SETUP_SQL_URL);
         

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/5ec0a00b/examples/simple-web-cluster/src/main/java/brooklyn/demo/WebClusterExample.java
----------------------------------------------------------------------
diff --git a/examples/simple-web-cluster/src/main/java/brooklyn/demo/WebClusterExample.java
b/examples/simple-web-cluster/src/main/java/brooklyn/demo/WebClusterExample.java
index 28dab20..6a5d064 100644
--- a/examples/simple-web-cluster/src/main/java/brooklyn/demo/WebClusterExample.java
+++ b/examples/simple-web-cluster/src/main/java/brooklyn/demo/WebClusterExample.java
@@ -59,7 +59,7 @@ public class WebClusterExample extends AbstractApplication {
     private ControlledDynamicWebAppCluster web;
     
     @Override
-    public void init() {
+    public void initApp() {
         nginxController = addChild(EntitySpec.create(NginxController.class)
                 //.configure("domain", "webclusterexample.brooklyn.local")
                 .configure("port", "8000+"));

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/5ec0a00b/software/base/src/test/java/brooklyn/entity/basic/lifecycle/MyEntityImpl.java
----------------------------------------------------------------------
diff --git a/software/base/src/test/java/brooklyn/entity/basic/lifecycle/MyEntityImpl.java
b/software/base/src/test/java/brooklyn/entity/basic/lifecycle/MyEntityImpl.java
index fcafc19..aa57e19 100644
--- a/software/base/src/test/java/brooklyn/entity/basic/lifecycle/MyEntityImpl.java
+++ b/software/base/src/test/java/brooklyn/entity/basic/lifecycle/MyEntityImpl.java
@@ -26,7 +26,6 @@ import brooklyn.entity.basic.SoftwareProcess;
 import brooklyn.entity.basic.SoftwareProcessDriver;
 import brooklyn.entity.basic.SoftwareProcessImpl;
 import brooklyn.entity.java.JavaSoftwareProcessSshDriver;
-import brooklyn.event.basic.BasicConfigKey;
 import brooklyn.location.basic.SshMachineLocation;
 import brooklyn.util.ResourceUtils;
 import brooklyn.util.collections.MutableList;
@@ -36,7 +35,7 @@ import brooklyn.util.text.Identifiers;
 
 public class MyEntityImpl extends SoftwareProcessImpl implements MyEntity {
     @Override
-    public Class getDriverInterface() {
+    public Class<?> getDriverInterface() {
         return MyEntityDriver.class;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/5ec0a00b/software/base/src/test/java/brooklyn/entity/basic/lifecycle/NaiveScriptRunnerTest.java
----------------------------------------------------------------------
diff --git a/software/base/src/test/java/brooklyn/entity/basic/lifecycle/NaiveScriptRunnerTest.java
b/software/base/src/test/java/brooklyn/entity/basic/lifecycle/NaiveScriptRunnerTest.java
index eda5cbd..15f4fd4 100644
--- a/software/base/src/test/java/brooklyn/entity/basic/lifecycle/NaiveScriptRunnerTest.java
+++ b/software/base/src/test/java/brooklyn/entity/basic/lifecycle/NaiveScriptRunnerTest.java
@@ -54,6 +54,7 @@ public class NaiveScriptRunnerTest {
     @BeforeMethod
     private void setup() { commands.clear(); }
     
+    @SuppressWarnings("rawtypes")
     private NaiveScriptRunner newMockRunner(final int result) {
         return new NaiveScriptRunner() {
             @Override
@@ -68,6 +69,7 @@ public class NaiveScriptRunnerTest {
         };
     }
 
+    @SuppressWarnings("rawtypes")
     public static NaiveScriptRunner newLocalhostRunner() {
         return new NaiveScriptRunner() {
             LocalhostMachineProvisioningLocation location = new LocalhostMachineProvisioningLocation();
@@ -75,6 +77,7 @@ public class NaiveScriptRunnerTest {
             public int execute(List<String> script, String summaryForLogging) {
                 return execute(new MutableMap(), script, summaryForLogging);
             }
+            @SuppressWarnings("unchecked")
             @Override
             public int execute(Map flags, List<String> script, String summaryForLogging)
{
                 try {

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/5ec0a00b/software/base/src/test/java/brooklyn/entity/basic/lifecycle/ScriptHelperTest.java
----------------------------------------------------------------------
diff --git a/software/base/src/test/java/brooklyn/entity/basic/lifecycle/ScriptHelperTest.java
b/software/base/src/test/java/brooklyn/entity/basic/lifecycle/ScriptHelperTest.java
index daa6109..bdb49b7 100644
--- a/software/base/src/test/java/brooklyn/entity/basic/lifecycle/ScriptHelperTest.java
+++ b/software/base/src/test/java/brooklyn/entity/basic/lifecycle/ScriptHelperTest.java
@@ -30,8 +30,6 @@ import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
 import brooklyn.entity.BrooklynAppUnitTestSupport;
-import brooklyn.entity.Entity;
-import brooklyn.entity.basic.Entities;
 import brooklyn.entity.basic.EntityLocal;
 import brooklyn.entity.basic.SoftwareProcess;
 import brooklyn.entity.basic.SoftwareProcessEntityTest;
@@ -83,16 +81,16 @@ public class ScriptHelperTest extends BrooklynAppUnitTestSupport {
         // currently, is initially set true after successful start
         Assert.assertTrue(entity.getAttribute(Startable.SERVICE_UP));
         
-//        entity.connectServiceUpIsRunning();
-        
         EntityTestUtils.assertAttributeEqualsEventually(entity, SoftwareProcess.SERVICE_PROCESS_IS_RUNNING,
true);
-        log.info("XXX F");
         EntityTestUtils.assertAttributeEqualsEventually(entity, Startable.SERVICE_UP, true);
+        
+        log.debug("up, now cause failure");
+        
         driver.setFailExecution(true);
-        log.info("XXX G");
         EntityTestUtils.assertAttributeEqualsEventually(entity, SoftwareProcess.SERVICE_PROCESS_IS_RUNNING,
false);
-        log.info("XXX H");
         EntityTestUtils.assertAttributeEqualsEventually(entity, Startable.SERVICE_UP, false);
+        
+        log.debug("caught failure, now clear");
         driver.setFailExecution(false);
         EntityTestUtils.assertAttributeEqualsEventually(entity, SoftwareProcess.SERVICE_PROCESS_IS_RUNNING,
true);
         EntityTestUtils.assertAttributeEqualsEventually(entity, Startable.SERVICE_UP, true);
@@ -117,7 +115,6 @@ public class ScriptHelperTest extends BrooklynAppUnitTestSupport {
             FunctionFeed.builder()
                 .entity(this)
                 .period(Duration.millis(10))
-                .onlyIfServiceUp()
                 .poll(new FunctionPollConfig<Boolean, Boolean>(SERVICE_PROCESS_IS_RUNNING)
                     .onException(Functions.constant(Boolean.FALSE))
                     .callable(new Callable<Boolean>() {

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/5ec0a00b/software/base/src/test/java/brooklyn/entity/pool/ServerPoolTest.java
----------------------------------------------------------------------
diff --git a/software/base/src/test/java/brooklyn/entity/pool/ServerPoolTest.java b/software/base/src/test/java/brooklyn/entity/pool/ServerPoolTest.java
index f565c54..584fbfe 100644
--- a/software/base/src/test/java/brooklyn/entity/pool/ServerPoolTest.java
+++ b/software/base/src/test/java/brooklyn/entity/pool/ServerPoolTest.java
@@ -29,18 +29,18 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.annotations.Test;
 
-import com.google.common.base.Joiner;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-
 import brooklyn.entity.Entity;
 import brooklyn.entity.basic.Attributes;
+import brooklyn.entity.basic.Lifecycle;
 import brooklyn.location.LocationSpec;
 import brooklyn.location.basic.LocalhostMachineProvisioningLocation.LocalhostMachine;
-import brooklyn.test.Asserts;
 import brooklyn.test.EntityTestUtils;
 import brooklyn.test.entity.TestApplication;
 
+import com.google.common.base.Joiner;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Iterables;
+
 public class ServerPoolTest extends AbstractServerPoolTest {
 
     private static final Logger LOG = LoggerFactory.getLogger(ServerPoolTest.class);
@@ -59,8 +59,7 @@ public class ServerPoolTest extends AbstractServerPoolTest {
     public void testFailureWhenNotEnoughServersAvailable() {
         TestApplication app = createAppWithChildren(getInitialPoolSize() + 1);
         assertNoMachinesAvailableForApp(app);
-        // Not asserting attr = true because the sensor will probably be null
-        assertFalse(Boolean.TRUE.equals(app.getAttribute(Attributes.SERVICE_UP)));
+        EntityTestUtils.assertAttributeEqualsEventually(app, Attributes.SERVICE_STATE_ACTUAL,
Lifecycle.ON_FIRE);
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/5ec0a00b/usage/qa/src/main/java/brooklyn/qa/longevity/webcluster/WebClusterApp.java
----------------------------------------------------------------------
diff --git a/usage/qa/src/main/java/brooklyn/qa/longevity/webcluster/WebClusterApp.java b/usage/qa/src/main/java/brooklyn/qa/longevity/webcluster/WebClusterApp.java
index 143dcbc..a223861 100644
--- a/usage/qa/src/main/java/brooklyn/qa/longevity/webcluster/WebClusterApp.java
+++ b/usage/qa/src/main/java/brooklyn/qa/longevity/webcluster/WebClusterApp.java
@@ -47,7 +47,7 @@ public class WebClusterApp extends AbstractApplication {
     private static final long loadCyclePeriodMs = 2 * 60 * 1000L;
 
     @Override
-    public void init() {
+    public void initApp() {
         final AttributeSensor<Double> sinusoidalLoad =
                 Sensors.newDoubleSensor("brooklyn.qa.sinusoidalLoad", "Sinusoidal server
load");
         AttributeSensor<Double> averageLoad =

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/5ec0a00b/usage/rest-server/src/test/java/brooklyn/rest/testing/mocks/RestMockApp.java
----------------------------------------------------------------------
diff --git a/usage/rest-server/src/test/java/brooklyn/rest/testing/mocks/RestMockApp.java
b/usage/rest-server/src/test/java/brooklyn/rest/testing/mocks/RestMockApp.java
index 97915c9..186ca76 100644
--- a/usage/rest-server/src/test/java/brooklyn/rest/testing/mocks/RestMockApp.java
+++ b/usage/rest-server/src/test/java/brooklyn/rest/testing/mocks/RestMockApp.java
@@ -21,12 +21,4 @@ package brooklyn.rest.testing.mocks;
 import brooklyn.entity.basic.AbstractApplication;
 
 public class RestMockApp extends AbstractApplication {
-    
-    public RestMockApp() {
-    }
-
-    @Override
-    public void init() {
-        // no-op
-    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/5ec0a00b/usage/rest-server/src/test/java/brooklyn/rest/util/BrooklynRestResourceUtilsTest.java
----------------------------------------------------------------------
diff --git a/usage/rest-server/src/test/java/brooklyn/rest/util/BrooklynRestResourceUtilsTest.java
b/usage/rest-server/src/test/java/brooklyn/rest/util/BrooklynRestResourceUtilsTest.java
index 58419bb..4c7d16b 100644
--- a/usage/rest-server/src/test/java/brooklyn/rest/util/BrooklynRestResourceUtilsTest.java
+++ b/usage/rest-server/src/test/java/brooklyn/rest/util/BrooklynRestResourceUtilsTest.java
@@ -110,10 +110,6 @@ public class BrooklynRestResourceUtilsTest {
             description="Application which does nothing, included only as part of the test
cases.",
             iconUrl="")
     public static class SampleNoOpApplication extends AbstractApplication implements MyInterface
{
-        @Override
-        public void init() {
-            // no-op
-        }
     }
     
     public static class MyPolicy extends AbstractPolicy {


Mime
View raw message