You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by al...@apache.org on 2016/11/04 16:41:44 UTC

[2/3] brooklyn-server git commit: Stop persitence before rebind attempt

Stop persitence before rebind attempt

This is an attempt to fix test failures on the Apache Jenkins Windows slaves. The tests would frequrently fail with "The process cannot access the file because it is being used by another process" when trying to read the persisted state. Persistence in the old management context wasn't being stopped before trying the rebind so there's a chance that it would try to overwrite the files while the new management context rebinds, leading to file locking errors. Stopping persistence before rebind should solve the locking failures.


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

Branch: refs/heads/master
Commit: ca9a7c9e425f888d76ef556a2c2c432a8672b8af
Parents: adb0173
Author: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Authored: Thu Nov 3 09:52:10 2016 +0200
Committer: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Committed: Thu Nov 3 09:52:10 2016 +0200

----------------------------------------------------------------------
 .../brooklyn/camp/brooklyn/DslAndRebindYamlTest.java     |  2 +-
 .../JavaWebAppWithDslYamlRebindIntegrationTest.java      |  2 +-
 .../core/mgmt/rebind/RebindCatalogEntityTest.java        |  2 +-
 .../mgmt/rebind/RebindEntityDynamicTypeInfoTest.java     |  2 +-
 .../brooklyn/core/mgmt/rebind/RebindEntityTest.java      |  4 ++--
 .../brooklyn/core/mgmt/rebind/RebindLocationTest.java    |  4 ++--
 .../brooklyn/core/mgmt/rebind/RebindPolicyTest.java      |  4 ++--
 .../brooklyn/core/mgmt/rebind/RebindTestFixture.java     |  2 +-
 .../brooklyn/core/mgmt/rebind/RebindTestUtils.java       | 11 +++++++++++
 .../mgmt/rebind/transformer/CompoundTransformerTest.java |  4 +++-
 .../FixedListMachineProvisioningLocationRebindTest.java  |  2 +-
 .../brooklyn/location/multi/MultiLocationRebindTest.java |  2 +-
 .../launcher/blueprints/AbstractBlueprintTest.java       |  2 +-
 .../JcloudsByonLocationResolverStubbedRebindTest.java    |  2 +-
 .../location/jclouds/RebindJcloudsLocationLiveTest.java  |  8 +++-----
 15 files changed, 32 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/ca9a7c9e/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/DslAndRebindYamlTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/DslAndRebindYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/DslAndRebindYamlTest.java
index 14a3daa..a1147db 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/DslAndRebindYamlTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/DslAndRebindYamlTest.java
@@ -106,7 +106,7 @@ public class DslAndRebindYamlTest extends AbstractYamlTest {
     }
 
     protected Application rebind(Application app) throws Exception {
-        RebindTestUtils.waitForPersisted(app);
+        RebindTestUtils.stopPersistence(app);
         Application result = RebindTestUtils.rebind(mementoDir, getClass().getClassLoader());
         mgmtContexts.add(result.getManagementContext());
         return result;

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/ca9a7c9e/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/JavaWebAppWithDslYamlRebindIntegrationTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/JavaWebAppWithDslYamlRebindIntegrationTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/JavaWebAppWithDslYamlRebindIntegrationTest.java
index f379556..1b1d876 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/JavaWebAppWithDslYamlRebindIntegrationTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/JavaWebAppWithDslYamlRebindIntegrationTest.java
@@ -82,7 +82,7 @@ public class JavaWebAppWithDslYamlRebindIntegrationTest extends AbstractYamlTest
     }
 
     public Application rebind(Application app) throws Exception {
-        RebindTestUtils.waitForPersisted(app);
+        RebindTestUtils.stopPersistence(app);
         // optionally for good measure can also check this:
 //        RebindTestUtils.checkCurrentMementoSerializable(app);
         Application result = RebindTestUtils.rebind(mementoDir, getClass().getClassLoader());

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/ca9a7c9e/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindCatalogEntityTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindCatalogEntityTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindCatalogEntityTest.java
index 5cfa97a..ac53283 100644
--- a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindCatalogEntityTest.java
+++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindCatalogEntityTest.java
@@ -125,7 +125,7 @@ public class RebindCatalogEntityTest extends RebindTestFixture<StartableApplicat
     //      because that won't have right catalog classpath.
     //      How to reuse that code cleanly?
     protected StartableApplication rebindWithAppClass() throws Exception {
-        RebindTestUtils.waitForPersisted(origApp);
+        RebindTestUtils.stopPersistence(origApp);
         LocalManagementContext newManagementContext = RebindTestUtils.newPersistingManagementContextUnstarted(mementoDir, classLoader);
 
         UrlClassLoader ucl = new UrlClassLoader(url);

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/ca9a7c9e/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindEntityDynamicTypeInfoTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindEntityDynamicTypeInfoTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindEntityDynamicTypeInfoTest.java
index 8f3a795..102c63b 100644
--- a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindEntityDynamicTypeInfoTest.java
+++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindEntityDynamicTypeInfoTest.java
@@ -75,7 +75,7 @@ public class RebindEntityDynamicTypeInfoTest extends RebindTestFixtureWithApp {
         // dynamic effector
         origApp.getMutableEntityType().addEffector(SayHiBody.EFFECTOR);
         
-        RebindTestUtils.waitForPersisted(origApp);
+        RebindTestUtils.stopPersistence(origApp);
         
         File mementoFile = new File(new File(mementoDir, "entities"), origApp.getId());
         String memento = Streams.readFullyAndClose(new FileReader(mementoFile));

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/ca9a7c9e/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindEntityTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindEntityTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindEntityTest.java
index 62aed5e..a918e64 100644
--- a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindEntityTest.java
+++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindEntityTest.java
@@ -370,7 +370,7 @@ public class RebindEntityTest extends RebindTestFixtureWithApp {
         MyLatchingEntityImpl.latching = true;
         
         // Serialize and rebind, but don't yet manage the app
-        RebindTestUtils.waitForPersisted(origApp);
+        RebindTestUtils.stopPersistence(origApp);
         RebindTestUtils.checkCurrentMementoSerializable(origApp);
         newManagementContext = RebindTestUtils.newPersistingManagementContextUnstarted(mementoDir, classLoader);
         Thread thread = new Thread() {
@@ -421,7 +421,7 @@ public class RebindEntityTest extends RebindTestFixtureWithApp {
         MyLatchingEntityImpl.latching = true;
 
         // Serialize and rebind, but don't yet manage the app
-        RebindTestUtils.waitForPersisted(origApp);
+        RebindTestUtils.stopPersistence(origApp);
         RebindTestUtils.checkCurrentMementoSerializable(origApp);
         newManagementContext = new LocalManagementContext();
         Thread thread = new Thread() {

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/ca9a7c9e/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindLocationTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindLocationTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindLocationTest.java
index 7d13672..327dd96 100644
--- a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindLocationTest.java
+++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindLocationTest.java
@@ -177,7 +177,7 @@ public class RebindLocationTest extends RebindTestFixtureWithApp {
         MyLocation.myStaticFieldNotSetFromFlag = "myval";
         origApp.start(ImmutableList.of(origLoc));
 
-        RebindTestUtils.waitForPersisted(origApp);
+        RebindTestUtils.stopPersistence(origApp);
         MyLocation.myStaticFieldNotSetFromFlag = "mynewval";
         newApp = (TestApplication) RebindTestUtils.rebind(mementoDir, getClass().getClassLoader());
         MyLocation newLoc = (MyLocation) Iterables.get(newApp.getLocations(), 0);
@@ -192,7 +192,7 @@ public class RebindLocationTest extends RebindTestFixtureWithApp {
         MyLocation origLoc = new MyLocation(MutableMap.of("myStaticFieldSetFromFlag", "myval"));
         origApp.start(ImmutableList.of(origLoc));
 
-        RebindTestUtils.waitForPersisted(origApp);
+        RebindTestUtils.stopPersistence(origApp);
         MyLocation.myStaticFieldSetFromFlag = "mynewval"; // not auto-checkpointed
         newApp = (TestApplication) RebindTestUtils.rebind(mementoDir, getClass().getClassLoader());
         MyLocation newLoc = (MyLocation) Iterables.get(newApp.getLocations(), 0);

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/ca9a7c9e/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindPolicyTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindPolicyTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindPolicyTest.java
index 4ce7efe..1ddec1d 100644
--- a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindPolicyTest.java
+++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindPolicyTest.java
@@ -137,7 +137,7 @@ public class RebindPolicyTest extends RebindTestFixtureWithApp {
 
         Entities.unmanage(entity);
         Locations.unmanage(loc);
-        RebindTestUtils.waitForPersisted(origApp);
+        RebindTestUtils.stopPersistence(origApp);
         
         BrooklynMementoManifest manifest = loadMementoManifest();
         assertFalse(manifest.getEntityIdToManifest().containsKey(entity.getId()));
@@ -156,7 +156,7 @@ public class RebindPolicyTest extends RebindTestFixtureWithApp {
 
         entity.policies().remove(policy);
         entity.enrichers().remove(enricher);
-        RebindTestUtils.waitForPersisted(origApp);
+        RebindTestUtils.stopPersistence(origApp);
         
         BrooklynMementoManifest manifest = loadMementoManifest();
         assertFalse(manifest.getPolicyIdToType().containsKey(policy.getId()));

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/ca9a7c9e/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindTestFixture.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindTestFixture.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindTestFixture.java
index 7109b02..0e2c9fb 100644
--- a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindTestFixture.java
+++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindTestFixture.java
@@ -294,7 +294,7 @@ public abstract class RebindTestFixture<T extends StartableApplication> {
         if (options.origManagementContext == null) options.origManagementContext(origManagementContext);
         if (options.newManagementContext == null) options.newManagementContext(createNewManagementContext(options.mementoDir, options.additionalProperties));
         
-        RebindTestUtils.waitForPersisted(origApp);
+        RebindTestUtils.stopPersistence(origApp);
         
         newManagementContext = options.newManagementContext;
         newApp = (T) RebindTestUtils.rebind(options);

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/ca9a7c9e/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindTestUtils.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindTestUtils.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindTestUtils.java
index 2283b66..1d0f236 100644
--- a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindTestUtils.java
+++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindTestUtils.java
@@ -34,6 +34,7 @@ import org.apache.brooklyn.api.mgmt.ManagementContext;
 import org.apache.brooklyn.api.mgmt.ha.HighAvailabilityMode;
 import org.apache.brooklyn.api.mgmt.ha.ManagementNodeState;
 import org.apache.brooklyn.api.mgmt.rebind.RebindExceptionHandler;
+import org.apache.brooklyn.api.mgmt.rebind.RebindManager;
 import org.apache.brooklyn.api.mgmt.rebind.mementos.BrooklynMemento;
 import org.apache.brooklyn.api.mgmt.rebind.mementos.BrooklynMementoPersister;
 import org.apache.brooklyn.api.mgmt.rebind.mementos.BrooklynMementoRawData;
@@ -467,6 +468,16 @@ public class RebindTestUtils {
         managementContext.getRebindManager().waitForPendingComplete(TIMEOUT, true);
     }
 
+    public static void stopPersistence(Application origApp) throws InterruptedException, TimeoutException {
+        stopPersistence(origApp.getManagementContext());
+    }
+
+    public static void stopPersistence(ManagementContext managementContext) throws InterruptedException, TimeoutException {
+        RebindManager rebindManager = managementContext.getRebindManager();
+        rebindManager.waitForPendingComplete(TIMEOUT, true);
+        rebindManager.stop();
+    }
+
     public static void checkCurrentMementoSerializable(Application app) throws Exception {
         checkCurrentMementoSerializable(app.getManagementContext());
     }

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/ca9a7c9e/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/transformer/CompoundTransformerTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/transformer/CompoundTransformerTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/transformer/CompoundTransformerTest.java
index 2fbd74e..7187826 100644
--- a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/transformer/CompoundTransformerTest.java
+++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/transformer/CompoundTransformerTest.java
@@ -63,7 +63,6 @@ import com.google.common.base.Predicate;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Iterables;
 
-@SuppressWarnings("serial")
 public class CompoundTransformerTest extends RebindTestFixtureWithApp {
 
     private static final Logger LOG = LoggerFactory.getLogger(CompoundTransformerTest.class);
@@ -430,6 +429,7 @@ public class CompoundTransformerTest extends RebindTestFixtureWithApp {
     protected TestApplication transformAndRebind(CompoundTransformer transformer) throws Exception {
         RebindTestUtils.waitForPersisted(origApp);
         BrooklynMementoRawData newRawData = transform(origManagementContext, transformer);
+        RebindTestUtils.stopPersistence(origApp);
         newMementoDir = persist(newRawData);
         return rebind(newMementoDir);
     }
@@ -492,6 +492,7 @@ public class CompoundTransformerTest extends RebindTestFixtureWithApp {
     
     // Example method, similar to EntityPredicates where we want to move the annonymous inner class
     // to be a named inner class
+    @SuppressWarnings("serial")
     public static <T> Predicate<Entity> idEqualTo(final T paramVal) {
         return new SerializablePredicate<Entity>() {
             @Override
@@ -501,6 +502,7 @@ public class CompoundTransformerTest extends RebindTestFixtureWithApp {
         };
     }
 
+    @SuppressWarnings("serial")
     private static class RenamedIdEqualToPredicate implements SerializablePredicate<Entity> {
         private String val;
         

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/ca9a7c9e/core/src/test/java/org/apache/brooklyn/location/byon/FixedListMachineProvisioningLocationRebindTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/location/byon/FixedListMachineProvisioningLocationRebindTest.java b/core/src/test/java/org/apache/brooklyn/location/byon/FixedListMachineProvisioningLocationRebindTest.java
index 3a66266..caef64e 100644
--- a/core/src/test/java/org/apache/brooklyn/location/byon/FixedListMachineProvisioningLocationRebindTest.java
+++ b/core/src/test/java/org/apache/brooklyn/location/byon/FixedListMachineProvisioningLocationRebindTest.java
@@ -113,7 +113,7 @@ public class FixedListMachineProvisioningLocationRebindTest {
     }
 
     private TestApplication rebind() throws Exception {
-        RebindTestUtils.waitForPersisted(origApp);
+        RebindTestUtils.stopPersistence(origApp);
         return (TestApplication) RebindTestUtils.rebind(mementoDir, getClass().getClassLoader());
     }
     

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/ca9a7c9e/core/src/test/java/org/apache/brooklyn/location/multi/MultiLocationRebindTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/location/multi/MultiLocationRebindTest.java b/core/src/test/java/org/apache/brooklyn/location/multi/MultiLocationRebindTest.java
index 0170b5a..e26b210 100644
--- a/core/src/test/java/org/apache/brooklyn/location/multi/MultiLocationRebindTest.java
+++ b/core/src/test/java/org/apache/brooklyn/location/multi/MultiLocationRebindTest.java
@@ -113,7 +113,7 @@ public class MultiLocationRebindTest {
     }
     
     private TestApplication rebind(boolean checkSerializable) throws Exception {
-        RebindTestUtils.waitForPersisted(origApp);
+        RebindTestUtils.stopPersistence(origApp);
         if (checkSerializable) {
             RebindTestUtils.checkCurrentMementoSerializable(origApp);
         }

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/ca9a7c9e/launcher/src/test/java/org/apache/brooklyn/launcher/blueprints/AbstractBlueprintTest.java
----------------------------------------------------------------------
diff --git a/launcher/src/test/java/org/apache/brooklyn/launcher/blueprints/AbstractBlueprintTest.java b/launcher/src/test/java/org/apache/brooklyn/launcher/blueprints/AbstractBlueprintTest.java
index faab9fc..ab0b708 100644
--- a/launcher/src/test/java/org/apache/brooklyn/launcher/blueprints/AbstractBlueprintTest.java
+++ b/launcher/src/test/java/org/apache/brooklyn/launcher/blueprints/AbstractBlueprintTest.java
@@ -205,7 +205,7 @@ public abstract class AbstractBlueprintTest {
         if (options.newManagementContext == null) options.newManagementContext(newMgmt);
         
         for (Application origApp : origApps) {
-            RebindTestUtils.waitForPersisted(origApp);
+            RebindTestUtils.stopPersistence(origApp);
         }
         
         mgmt = options.newManagementContext;

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/ca9a7c9e/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/JcloudsByonLocationResolverStubbedRebindTest.java
----------------------------------------------------------------------
diff --git a/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/JcloudsByonLocationResolverStubbedRebindTest.java b/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/JcloudsByonLocationResolverStubbedRebindTest.java
index 6d9fabd..96b5786 100644
--- a/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/JcloudsByonLocationResolverStubbedRebindTest.java
+++ b/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/JcloudsByonLocationResolverStubbedRebindTest.java
@@ -188,7 +188,7 @@ public class JcloudsByonLocationResolverStubbedRebindTest extends AbstractJcloud
         if (options.origManagementContext == null) options.origManagementContext(origManagementContext);
         if (options.newManagementContext == null) options.newManagementContext(createNewManagementContext(options.mementoDir));
         
-        RebindTestUtils.waitForPersisted(origApp);
+        RebindTestUtils.stopPersistence(origApp);
         
         newManagementContext = options.newManagementContext;
         newApp = RebindTestUtils.rebind(options);

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/ca9a7c9e/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/RebindJcloudsLocationLiveTest.java
----------------------------------------------------------------------
diff --git a/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/RebindJcloudsLocationLiveTest.java b/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/RebindJcloudsLocationLiveTest.java
index 446aaa9..7f6e7c0 100644
--- a/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/RebindJcloudsLocationLiveTest.java
+++ b/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/RebindJcloudsLocationLiveTest.java
@@ -27,8 +27,6 @@ import java.io.File;
 
 import org.apache.brooklyn.api.entity.EntitySpec;
 import org.apache.brooklyn.api.location.OsDetails;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.factory.ApplicationBuilder;
 import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext;
 import org.apache.brooklyn.core.mgmt.rebind.RebindOptions;
 import org.apache.brooklyn.core.mgmt.rebind.RebindTestUtils;
@@ -175,7 +173,7 @@ public class RebindJcloudsLocationLiveTest extends AbstractJcloudsLiveTest {
         // Force it to be persisted again. Expect to pesist without the NodeMetadata and Template.
         app2.getManagementContext().getRebindManager().getChangeListener().onChanged(loc2);
         app2.getManagementContext().getRebindManager().getChangeListener().onChanged(machine2);
-        RebindTestUtils.waitForPersisted(app2);
+        RebindTestUtils.stopPersistence(app2);
         
         String newMachineXml = new String(java.nio.file.Files.readAllBytes(persistedMachineFile.toPath()));
         assertFalse(newMachineXml.contains("AWSEC2TemplateOptions"), newMachineXml);
@@ -241,7 +239,7 @@ public class RebindJcloudsLocationLiveTest extends AbstractJcloudsLiveTest {
         // Force it to be persisted again. Expect to pesist without the NodeMetadata and Template.
         app2.getManagementContext().getRebindManager().getChangeListener().onChanged(loc2);
         app2.getManagementContext().getRebindManager().getChangeListener().onChanged(machine2);
-        RebindTestUtils.waitForPersisted(app2);
+        RebindTestUtils.stopPersistence(app2);
         
         String newMachineXml = new String(java.nio.file.Files.readAllBytes(persistedMachineFile.toPath()));
         assertFalse(newMachineXml.contains("NodeMetadataImpl"), newMachineXml);
@@ -327,7 +325,7 @@ public class RebindJcloudsLocationLiveTest extends AbstractJcloudsLiveTest {
     }
     
     private TestApplication rebind(RebindOptions options) throws Exception {
-        RebindTestUtils.waitForPersisted(origApp);
+        RebindTestUtils.stopPersistence(origApp);
         return (TestApplication) RebindTestUtils.rebind(options);
     }
 }