brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rich...@apache.org
Subject [03/16] git commit: RebindTestFixture.rebind: set newApp
Date Tue, 14 Oct 2014 10:04:53 GMT
RebindTestFixture.rebind: set newApp

- in rebind(boolean), set newApp and newManagementContext.
- previously, it was only set in 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/ab021c50
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/ab021c50
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/ab021c50

Branch: refs/heads/master
Commit: ab021c5099b6c18c335bcfb1b643f4446620e00b
Parents: 5d1d02a
Author: Aled Sage <aled.sage@gmail.com>
Authored: Sat Oct 11 23:57:24 2014 +0100
Committer: Aled Sage <aled.sage@gmail.com>
Committed: Sat Oct 11 23:57:24 2014 +0100

----------------------------------------------------------------------
 .../entity/rebind/RebindTestFixture.java        | 23 ++++++++++----------
 1 file changed, 11 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ab021c50/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 f2314f7..52b389c 100644
--- a/core/src/test/java/brooklyn/entity/rebind/RebindTestFixture.java
+++ b/core/src/test/java/brooklyn/entity/rebind/RebindTestFixture.java
@@ -28,10 +28,6 @@ import org.slf4j.LoggerFactory;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 
-import com.google.api.client.util.Sets;
-import com.google.common.collect.FluentIterable;
-import com.google.common.collect.Iterables;
-
 import brooklyn.catalog.BrooklynCatalog;
 import brooklyn.catalog.CatalogItem;
 import brooklyn.entity.basic.Entities;
@@ -45,10 +41,13 @@ import brooklyn.management.ha.HighAvailabilityMode;
 import brooklyn.management.internal.LocalManagementContext;
 import brooklyn.management.internal.ManagementContextInternal;
 import brooklyn.mementos.BrooklynMementoManifest;
-import brooklyn.test.entity.LocalManagementContextForTests;
 import brooklyn.util.os.Os;
 import brooklyn.util.time.Duration;
 
+import com.google.api.client.util.Sets;
+import com.google.common.collect.FluentIterable;
+import com.google.common.collect.Iterables;
+
 public abstract class RebindTestFixture<T extends StartableApplication> {
 
     private static final Logger LOG = LoggerFactory.getLogger(RebindTestFixture.class);
@@ -120,10 +119,7 @@ public abstract class RebindTestFixture<T extends StartableApplication>
{
 
     /** rebinds, and sets newApp */
     protected T rebind() throws Exception {
-        if (newApp!=null || newManagementContext!=null) throw new IllegalStateException("already
rebinded");
-        newApp = rebind(true);
-        newManagementContext = newApp.getManagementContext();
-        return newApp;
+        return rebind(true);
     }
 
     protected T rebind(boolean checkSerializable) throws Exception {
@@ -133,6 +129,8 @@ public abstract class RebindTestFixture<T extends StartableApplication>
{
     
     @SuppressWarnings("unchecked")
     protected T rebind(boolean checkSerializable, boolean terminateOrigManagementContext)
throws Exception {
+        if (newApp!=null || newManagementContext!=null) throw new IllegalStateException("already
rebinded");
+        
         RebindTestUtils.waitForPersisted(origApp);
         if (checkSerializable) {
             RebindTestUtils.checkCurrentMementoSerializable(origApp);
@@ -140,9 +138,10 @@ public abstract class RebindTestFixture<T extends StartableApplication>
{
         if (terminateOrigManagementContext) {
             origManagementContext.terminate();
         }
-        LocalManagementContext newManagementContext = createNewManagementContext();
-
-        return (T) RebindTestUtils.rebind(newManagementContext, classLoader);
+        
+        newManagementContext = createNewManagementContext();
+        newApp = (T) RebindTestUtils.rebind((LocalManagementContext)newManagementContext,
classLoader);
+        return newApp;
     }
 
     @SuppressWarnings("unchecked")


Mime
View raw message