XmlMementoSerializerTest: destroy mgmt at end
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/ee3c578b Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/ee3c578b Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/ee3c578b Branch: refs/heads/master Commit: ee3c578b01feaf6fde613e93cc9dccb5630a61a7 Parents: cf49a6e Author: Aled Sage <[email protected]> Authored: Thu Mar 19 16:02:07 2015 +0000 Committer: Aled Sage <[email protected]> Committed: Thu Mar 26 10:09:41 2015 +0000 ---------------------------------------------------------------------- .../persister/XmlMementoSerializerTest.java | 24 ++++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ee3c578b/core/src/test/java/brooklyn/entity/rebind/persister/XmlMementoSerializerTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/brooklyn/entity/rebind/persister/XmlMementoSerializerTest.java b/core/src/test/java/brooklyn/entity/rebind/persister/XmlMementoSerializerTest.java index a57c9eb..316c549 100644 --- a/core/src/test/java/brooklyn/entity/rebind/persister/XmlMementoSerializerTest.java +++ b/core/src/test/java/brooklyn/entity/rebind/persister/XmlMementoSerializerTest.java @@ -198,16 +198,20 @@ public class XmlMementoSerializerTest { @Test public void testEntitySpecFromOsgi() throws Exception { ManagementContext mgmt = LocalManagementContextForTests.builder(true).disableOsgi(false).build(); - CatalogItem<?, ?> ci = OsgiVersionMoreEntityTest.addMoreEntityV1(mgmt, "1.0"); - - EntitySpec<DynamicCluster> spec = EntitySpec.create(DynamicCluster.class) - .configure(DynamicCluster.INITIAL_SIZE, 1) - .configure(DynamicCluster.MEMBER_SPEC, CatalogTestUtils.createEssentialEntitySpec(mgmt, ci)); - - serializer.setLookupContext(new LookupContextImpl(mgmt, - ImmutableList.<Entity>of(), ImmutableList.<Location>of(), ImmutableList.<Policy>of(), - ImmutableList.<Enricher>of(), ImmutableList.<Feed>of(), ImmutableList.<CatalogItem<?,?>>of(), true)); - assertSerializeAndDeserialize(spec); + try { + CatalogItem<?, ?> ci = OsgiVersionMoreEntityTest.addMoreEntityV1(mgmt, "1.0"); + + EntitySpec<DynamicCluster> spec = EntitySpec.create(DynamicCluster.class) + .configure(DynamicCluster.INITIAL_SIZE, 1) + .configure(DynamicCluster.MEMBER_SPEC, CatalogTestUtils.createEssentialEntitySpec(mgmt, ci)); + + serializer.setLookupContext(new LookupContextImpl(mgmt, + ImmutableList.<Entity>of(), ImmutableList.<Location>of(), ImmutableList.<Policy>of(), + ImmutableList.<Enricher>of(), ImmutableList.<Feed>of(), ImmutableList.<CatalogItem<?,?>>of(), true)); + assertSerializeAndDeserialize(spec); + } finally { + Entities.destroyAllCatching(mgmt); + } } @Test
