brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [3/7] git commit: add missing @EffectorParam for policy test; also tweak the test so build completes a bit faster
Date Mon, 27 Oct 2014 12:52:24 GMT
add missing @EffectorParam for policy test; also tweak the test so build completes a bit faster


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

Branch: refs/heads/master
Commit: cc5ac565051ab4a3673cbaa8124810f27b2b6574
Parents: 83dd703
Author: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Authored: Tue Oct 21 22:51:28 2014 +0100
Committer: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Committed: Tue Oct 21 23:13:03 2014 +0100

----------------------------------------------------------------------
 .../main/java/brooklyn/util/config/ConfigBag.java   |  2 +-
 .../AbstractFollowTheSunPolicyTest.java             |  7 ++++---
 .../followthesun/FollowTheSunPolicySoakTest.java    | 16 +++++++++++++++-
 .../policy/loadbalancing/MockContainerEntity.java   |  3 ++-
 .../loadbalancing/MockContainerEntityImpl.java      |  2 +-
 .../policy/loadbalancing/MockItemEntity.java        |  1 +
 6 files changed, 24 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/cc5ac565/core/src/main/java/brooklyn/util/config/ConfigBag.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/util/config/ConfigBag.java b/core/src/main/java/brooklyn/util/config/ConfigBag.java
index 72bd28c..e40329a 100644
--- a/core/src/main/java/brooklyn/util/config/ConfigBag.java
+++ b/core/src/main/java/brooklyn/util/config/ConfigBag.java
@@ -254,7 +254,7 @@ public class ConfigBag {
 
     protected void logInvalidKey(Object key) {
         String message = (key == null ? "Invalid key 'null'" : "Invalid key type "+key.getClass().getCanonicalName()+"
("+key+")") +
-                "being used for configuration, ignoring";
+                " being used for configuration, ignoring";
         log.debug(message, new Throwable("Source of "+message));
         log.warn(message);
     }

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/cc5ac565/policy/src/test/java/brooklyn/policy/followthesun/AbstractFollowTheSunPolicyTest.java
----------------------------------------------------------------------
diff --git a/policy/src/test/java/brooklyn/policy/followthesun/AbstractFollowTheSunPolicyTest.java
b/policy/src/test/java/brooklyn/policy/followthesun/AbstractFollowTheSunPolicyTest.java
index d0fdf44..9a79fa6 100644
--- a/policy/src/test/java/brooklyn/policy/followthesun/AbstractFollowTheSunPolicyTest.java
+++ b/policy/src/test/java/brooklyn/policy/followthesun/AbstractFollowTheSunPolicyTest.java
@@ -47,6 +47,7 @@ import brooklyn.policy.loadbalancing.MockItemEntity;
 import brooklyn.policy.loadbalancing.MockItemEntityImpl;
 import brooklyn.policy.loadbalancing.Movable;
 import brooklyn.test.Asserts;
+import brooklyn.test.entity.LocalManagementContextForTests;
 import brooklyn.test.entity.TestApplication;
 import brooklyn.util.collections.MutableMap;
 import brooklyn.util.time.Time;
@@ -85,8 +86,8 @@ public class AbstractFollowTheSunPolicyTest {
         MockItemEntityImpl.totalMoveCount.set(0);
         MockItemEntityImpl.lastMoveTime.set(0);
         
-        app = ApplicationBuilder.newManagedApp(TestApplication.class);
-        managementContext = app.getManagementContext();
+        managementContext = LocalManagementContextForTests.newInstance();
+        app = ApplicationBuilder.newManagedApp(TestApplication.class, managementContext);
         
         loc1 = managementContext.getLocationManager().createLocation(LocationSpec.create(SimulatedLocation.class).configure("name",
"loc1"));
         loc2 = managementContext.getLocationManager().createLocation(LocationSpec.create(SimulatedLocation.class).configure("name",
"loc2"));
@@ -219,7 +220,7 @@ public class AbstractFollowTheSunPolicyTest {
     protected static MockItemEntity newItem(TestApplication app, MockContainerEntity container,
String name) {
         MockItemEntity item = app.createAndManageChild(EntitySpec.create(MockItemEntity.class)
                 .displayName(name));
-        LOG.debug("Managed new item {}", container);
+        LOG.debug("Managed new item {} at {}", item, container);
         if (container != null) {
             item.move(container);
         }

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/cc5ac565/policy/src/test/java/brooklyn/policy/followthesun/FollowTheSunPolicySoakTest.java
----------------------------------------------------------------------
diff --git a/policy/src/test/java/brooklyn/policy/followthesun/FollowTheSunPolicySoakTest.java
b/policy/src/test/java/brooklyn/policy/followthesun/FollowTheSunPolicySoakTest.java
index 08ee5fc..51e5d8d 100644
--- a/policy/src/test/java/brooklyn/policy/followthesun/FollowTheSunPolicySoakTest.java
+++ b/policy/src/test/java/brooklyn/policy/followthesun/FollowTheSunPolicySoakTest.java
@@ -75,10 +75,24 @@ public class FollowTheSunPolicySoakTest extends AbstractFollowTheSunPolicyTest
{
     public void testLoadBalancingManyItemsQuickTest() {
         RunConfig config = new RunConfig();
         config.numCycles = 1;
+        config.numLocations=2;
+        config.numContainersPerLocation = 3;
+        config.numLockedItemsPerLocation = 2;
+        config.numMovableItems = 10;
+        config.numContainerStopsPerCycle = 1;
+        config.numItemStopsPerCycle = 1;
+    
+        runFollowTheSunSoakTest(config);
+    }
+    
+    @Test(groups={"Integration"}) // takes ~2s
+    public void testLoadBalancingManyItemsNotTooLongTest() {
+        RunConfig config = new RunConfig();
+        config.numCycles = 1;
         config.numLocations=3;
         config.numContainersPerLocation = 5;
         config.numLockedItemsPerLocation = 2;
-        config.numMovableItems = 100;
+        config.numMovableItems = 500;
         config.numContainerStopsPerCycle = 1;
         config.numItemStopsPerCycle = 1;
     

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/cc5ac565/policy/src/test/java/brooklyn/policy/loadbalancing/MockContainerEntity.java
----------------------------------------------------------------------
diff --git a/policy/src/test/java/brooklyn/policy/loadbalancing/MockContainerEntity.java b/policy/src/test/java/brooklyn/policy/loadbalancing/MockContainerEntity.java
index 2fba8f0..8e4a7c0 100644
--- a/policy/src/test/java/brooklyn/policy/loadbalancing/MockContainerEntity.java
+++ b/policy/src/test/java/brooklyn/policy/loadbalancing/MockContainerEntity.java
@@ -23,6 +23,7 @@ import java.util.Map;
 import brooklyn.config.ConfigKey;
 import brooklyn.entity.Effector;
 import brooklyn.entity.Entity;
+import brooklyn.entity.annotation.EffectorParam;
 import brooklyn.entity.basic.AbstractGroup;
 import brooklyn.entity.basic.MethodEffector;
 import brooklyn.entity.proxying.ImplementedBy;
@@ -55,5 +56,5 @@ public interface MockContainerEntity extends AbstractGroup, BalanceableContainer
 
     public void removeItem(Entity item);
 
-    public void offloadAndStop(MockContainerEntity otherContainer);
+    public void offloadAndStop(@EffectorParam(name="otherContianer") MockContainerEntity
otherContainer);
 }

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/cc5ac565/policy/src/test/java/brooklyn/policy/loadbalancing/MockContainerEntityImpl.java
----------------------------------------------------------------------
diff --git a/policy/src/test/java/brooklyn/policy/loadbalancing/MockContainerEntityImpl.java
b/policy/src/test/java/brooklyn/policy/loadbalancing/MockContainerEntityImpl.java
index 09906d0..aaee673 100644
--- a/policy/src/test/java/brooklyn/policy/loadbalancing/MockContainerEntityImpl.java
+++ b/policy/src/test/java/brooklyn/policy/loadbalancing/MockContainerEntityImpl.java
@@ -116,7 +116,7 @@ public class MockContainerEntityImpl extends AbstractGroupImpl implements
MockCo
         emit(BalanceableContainer.ITEM_REMOVED, item);
     }
 
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings({ "unchecked", "rawtypes" })
     @Override
     public Set<Movable> getBalanceableItems() {
         return (Set) Sets.newLinkedHashSet(getMembers());

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/cc5ac565/policy/src/test/java/brooklyn/policy/loadbalancing/MockItemEntity.java
----------------------------------------------------------------------
diff --git a/policy/src/test/java/brooklyn/policy/loadbalancing/MockItemEntity.java b/policy/src/test/java/brooklyn/policy/loadbalancing/MockItemEntity.java
index aa1098f..cd9a3fe 100644
--- a/policy/src/test/java/brooklyn/policy/loadbalancing/MockItemEntity.java
+++ b/policy/src/test/java/brooklyn/policy/loadbalancing/MockItemEntity.java
@@ -33,6 +33,7 @@ public interface MockItemEntity extends Entity, Movable {
     public static final AttributeSensor<Integer> TEST_METRIC = Sensors.newIntegerSensor(
             "test.metric", "Dummy workrate for test entities");
 
+    @SuppressWarnings("serial")
     public static final AttributeSensor<Map<Entity, Double>> ITEM_USAGE_METRIC
= Sensors.newSensor(
             new TypeToken<Map<Entity, Double>>() {}, "test.itemUsage.metric",
"Dummy item usage for test entities");
 


Mime
View raw message