brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [1/2] brooklyn-server git commit: Fix tests tearDown (to always stop management context)
Date Mon, 25 Sep 2017 09:32:02 GMT
Repository: brooklyn-server
Updated Branches:
  refs/heads/master 05ae90a71 -> df83d44c0


Fix tests tearDown (to always stop management context)

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

Branch: refs/heads/master
Commit: ac4616c9fa361bf7a4a328b299f0a470dbd07a76
Parents: 2a63d8e
Author: Aled Sage <aled.sage@gmail.com>
Authored: Thu Sep 21 09:15:31 2017 +0100
Committer: Aled Sage <aled.sage@gmail.com>
Committed: Thu Sep 21 09:15:31 2017 +0100

----------------------------------------------------------------------
 .../brooklyn/core/policy/basic/EnricherTypeTest.java      |  6 ------
 .../jclouds/JcloudsMaxConcurrencyStubbedTest.java         | 10 ++++++----
 .../loadbalancing/AbstractLoadBalancingPolicyTest.java    |  1 -
 3 files changed, 6 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/ac4616c9/core/src/test/java/org/apache/brooklyn/core/policy/basic/EnricherTypeTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/policy/basic/EnricherTypeTest.java
b/core/src/test/java/org/apache/brooklyn/core/policy/basic/EnricherTypeTest.java
index 8a8505f..2639549 100644
--- a/core/src/test/java/org/apache/brooklyn/core/policy/basic/EnricherTypeTest.java
+++ b/core/src/test/java/org/apache/brooklyn/core/policy/basic/EnricherTypeTest.java
@@ -25,7 +25,6 @@ import org.apache.brooklyn.api.sensor.EnricherType;
 import org.apache.brooklyn.core.config.BasicConfigKey;
 import org.apache.brooklyn.core.enricher.AbstractEnricher;
 import org.apache.brooklyn.core.test.BrooklynAppUnitTestSupport;
-import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
@@ -41,11 +40,6 @@ public class EnricherTypeTest extends BrooklynAppUnitTestSupport {
         enricher = app.enrichers().add(EnricherSpec.create(MyEnricher.class));
     }
 
-    @AfterMethod(alwaysRun=true)
-    public void tearDown() throws Exception {
-        // nothing to tear down; no management context not started
-    }
-    
     @Test
     public void testGetConfig() throws Exception {
         EnricherType enricherType = enricher.getEnricherType();

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/ac4616c9/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/JcloudsMaxConcurrencyStubbedTest.java
----------------------------------------------------------------------
diff --git a/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/JcloudsMaxConcurrencyStubbedTest.java
b/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/JcloudsMaxConcurrencyStubbedTest.java
index 880048a..78ccdca 100644
--- a/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/JcloudsMaxConcurrencyStubbedTest.java
+++ b/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/JcloudsMaxConcurrencyStubbedTest.java
@@ -40,6 +40,7 @@ import org.jclouds.compute.domain.Template;
 import org.jclouds.domain.LoginCredentials;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
@@ -109,6 +110,7 @@ public class JcloudsMaxConcurrencyStubbedTest extends AbstractJcloudsStubbedUnit
         deletionConcurrencyMonitor = new ConcurrencyMonitor();
     }
     
+    @AfterMethod(alwaysRun=true)
     @Override
     public void tearDown() throws Exception {
         try {
@@ -187,16 +189,16 @@ public class JcloudsMaxConcurrencyStubbedTest extends AbstractJcloudsStubbedUnit
         
         initNodeCreatorAndJcloudsLocation(newNodeCreator(), ImmutableMap.of(JcloudsLocation.MAX_CONCURRENT_MACHINE_DELETIONS,
2));
 
-        List<JcloudsSshMachineLocation> machines = new ArrayList<>();
         for (int i = 0; i < 3; i++) {
-            machines.add(obtainMachine());
+            obtainMachine();
         }
+        assertEquals(machines.size(), 3, "machines="+machines);
 
         List<ListenableFuture<?>> futures = new ArrayList<>();
-        for (final JcloudsSshMachineLocation machine : machines) {
+        for (final JcloudsMachineLocation machine : machines) {
             futures.add(executor.submit(new Callable<Void>() {
                 public Void call() throws Exception {
-                    jcloudsLocation.release(machine);
+                    releaseMachine(machine);
                     return null;
                 }}));
         }

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/ac4616c9/policy/src/test/java/org/apache/brooklyn/policy/loadbalancing/AbstractLoadBalancingPolicyTest.java
----------------------------------------------------------------------
diff --git a/policy/src/test/java/org/apache/brooklyn/policy/loadbalancing/AbstractLoadBalancingPolicyTest.java
b/policy/src/test/java/org/apache/brooklyn/policy/loadbalancing/AbstractLoadBalancingPolicyTest.java
index faf4fae..4e441ca 100644
--- a/policy/src/test/java/org/apache/brooklyn/policy/loadbalancing/AbstractLoadBalancingPolicyTest.java
+++ b/policy/src/test/java/org/apache/brooklyn/policy/loadbalancing/AbstractLoadBalancingPolicyTest.java
@@ -89,7 +89,6 @@ public abstract class AbstractLoadBalancingPolicyTest extends BrooklynAppUnitTes
         
         model = new DefaultBalanceablePoolModel<Entity, Entity>("pool-model");
         
-        app = TestApplication.Factory.newManagedInstanceForTests();
         containerGroup = app.createAndManageChild(EntitySpec.create(DynamicGroup.class)
                 .displayName("containerGroup")
                 .configure(DynamicGroup.ENTITY_FILTER, Predicates.instanceOf(MockContainerEntity.class)));


Mime
View raw message