brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [31/51] [abbrv] [partial] brooklyn-server git commit: move subdir from incubator up a level as it is promoted to its own repo (first non-incubator commit!)
Date Mon, 01 Feb 2016 17:51:13 GMT
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlEntityTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlEntityTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlEntityTest.java
deleted file mode 100644
index cfa88d4..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlEntityTest.java
+++ /dev/null
@@ -1,891 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.brooklyn.camp.brooklyn.catalog;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-
-import java.io.InputStream;
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.brooklyn.api.catalog.BrooklynCatalog;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.internal.AbstractBrooklynObjectSpec;
-import org.apache.brooklyn.api.typereg.BrooklynTypeRegistry;
-import org.apache.brooklyn.api.typereg.RegisteredType;
-import org.apache.brooklyn.camp.brooklyn.AbstractYamlTest;
-import org.apache.brooklyn.core.catalog.internal.CatalogUtils;
-import org.apache.brooklyn.core.mgmt.osgi.OsgiStandaloneTest;
-import org.apache.brooklyn.core.test.entity.TestEntity;
-import org.apache.brooklyn.core.test.entity.TestEntityImpl;
-import org.apache.brooklyn.core.typereg.RegisteredTypes;
-import org.apache.brooklyn.entity.stock.BasicEntity;
-import org.apache.brooklyn.test.support.TestResourceUnavailableException;
-import org.apache.brooklyn.util.collections.MutableList;
-import org.apache.brooklyn.util.core.ResourceUtils;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.osgi.OsgiTestResources;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.Iterables;
-
-
-public class CatalogYamlEntityTest extends AbstractYamlTest {
-    
-    private static final String SIMPLE_ENTITY_TYPE = OsgiTestResources.BROOKLYN_TEST_OSGI_ENTITIES_SIMPLE_ENTITY;
-
-    @Test
-    public void testAddCatalogItemVerySimple() throws Exception {
-        String symbolicName = "my.catalog.app.id.load";
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  id: " + symbolicName,
-            "  version: " + TEST_VERSION,
-            "  item:",
-            "    type: "+ BasicEntity.class.getName());
-
-        RegisteredType item = mgmt().getTypeRegistry().get(symbolicName, TEST_VERSION);
-        String planYaml = RegisteredTypes.getImplementationDataStringForSpec(item);
-        assertTrue(planYaml.indexOf("services:")>=0, "expected 'services:' block: "+item+"\n"+planYaml);
-
-        deleteCatalogEntity(symbolicName);
-    }
-    @Test
-    public void testAddCatalogItem() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String symbolicName = "my.catalog.app.id.load";
-        addCatalogOSGiEntity(symbolicName);
-        RegisteredType item = mgmt().getTypeRegistry().get(symbolicName, TEST_VERSION);
-        assertEquals(item.getSymbolicName(), symbolicName);
-
-        deleteCatalogEntity(symbolicName);
-    }
-
-    @Test
-    public void testAddCatalogItemTypeAsString() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String symbolicName = "my.catalog.app.id.load";
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  id: " + symbolicName,
-            "  name: My Catalog App",
-            "  description: My description",
-            "  icon_url: classpath://path/to/myicon.jpg",
-            "  version: " + TEST_VERSION,
-            "  libraries:",
-            "  - url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL,
-            "  item: " + SIMPLE_ENTITY_TYPE);
-
-        RegisteredType item = mgmt().getTypeRegistry().get(symbolicName, TEST_VERSION);
-        assertEquals(item.getSymbolicName(), symbolicName);
-
-        deleteCatalogEntity(symbolicName);
-    }
-
-    @Test
-    public void testAddCatalogItemTypeExplicitTypeAsString() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String symbolicName = "my.catalog.app.id.load";
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  id: " + symbolicName,
-            "  name: My Catalog App",
-            "  description: My description",
-            "  icon_url: classpath://path/to/myicon.jpg",
-            "  version: " + TEST_VERSION,
-            "  item_type: entity",
-            "  libraries:",
-            "  - url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL,
-            "  item: " + SIMPLE_ENTITY_TYPE);
-
-        RegisteredType item = mgmt().getTypeRegistry().get(symbolicName, TEST_VERSION);
-        assertEquals(item.getSymbolicName(), symbolicName);
-
-        deleteCatalogEntity(symbolicName);
-    }
-
-    @Test
-    public void testAddCatalogItemTopLevelSyntax() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String symbolicName = "my.catalog.app.id.load";
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  id: " + symbolicName,
-            "  name: My Catalog App",
-            "  description: My description",
-            "  icon_url: classpath://path/to/myicon.jpg",
-            "  version: " + TEST_VERSION,
-            "  libraries:",
-            "  - url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL,
-            "",
-            "services:",
-            "- type: " + SIMPLE_ENTITY_TYPE);
-
-        RegisteredType item = mgmt().getTypeRegistry().get(symbolicName, TEST_VERSION);
-        assertEquals(item.getSymbolicName(), symbolicName);
-
-        deleteCatalogEntity(symbolicName);
-    }
-
-    @Test
-    public void testAddCatalogItemWithoutVersion() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String id = "unversioned.app";
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  name: " + id,
-            "  libraries:",
-            "  - " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL,
-            "  item:",
-            "    type: "+ SIMPLE_ENTITY_TYPE);
-        RegisteredType catalogItem = mgmt().getTypeRegistry().get(id, BrooklynCatalog.DEFAULT_VERSION);
-        assertEquals(catalogItem.getVersion(), "0.0.0.SNAPSHOT");
-        mgmt().getCatalog().deleteCatalogItem(id, "0.0.0.SNAPSHOT");
-    }
-
-    @Test
-    public void testAddCatalogItemWithInlinedVersion() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String id = "inline_version.app";
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  name: " + id+":"+TEST_VERSION,
-            "  libraries:",
-            "  - " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL,
-            "services:",
-            "- type: " + SIMPLE_ENTITY_TYPE);
-        RegisteredType catalogItem = mgmt().getTypeRegistry().get(id, TEST_VERSION);
-        assertEquals(catalogItem.getVersion(), TEST_VERSION);
-        mgmt().getCatalog().deleteCatalogItem(id, TEST_VERSION);
-    }
-
-    @Test
-    public void testLaunchApplicationReferencingCatalog() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String symbolicName = "my.catalog.app.id.launch";
-        registerAndLaunchAndAssertSimpleEntity(symbolicName, SIMPLE_ENTITY_TYPE);
-    }
-
-    @Test
-    public void testLaunchApplicationUnversionedCatalogReference() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String symbolicName = "my.catalog.app.id.fail";
-        addCatalogOSGiEntity(symbolicName, SIMPLE_ENTITY_TYPE);
-        try {
-            String yaml = "name: simple-app-yaml\n" +
-                          "location: localhost\n" +
-                          "services: \n" +
-                          "  - serviceType: " + symbolicName;
-            createAndStartApplication(yaml);
-        } finally {
-            deleteCatalogEntity(symbolicName);
-        }
-    }
-
-    @Test
-    public void testLaunchApplicationWithCatalogReferencingOtherCatalog() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String referencedSymbolicName = "my.catalog.app.id.referenced";
-        String referrerSymbolicName = "my.catalog.app.id.referring";
-        addCatalogOSGiEntities(referencedSymbolicName, SIMPLE_ENTITY_TYPE, referrerSymbolicName, ver(referencedSymbolicName));
-
-        RegisteredType referrer = mgmt().getTypeRegistry().get(referrerSymbolicName, TEST_VERSION);
-        String planYaml = RegisteredTypes.getImplementationDataStringForSpec(referrer);
-        Assert.assertTrue(planYaml.indexOf("services")>=0, "expected services in: "+planYaml);
-        
-        String yaml = "name: simple-app-yaml\n" +
-                      "location: localhost\n" +
-                      "services: \n" +
-                      "  - type: " + ver(referrerSymbolicName);
-        Entity app = createAndStartApplication(yaml);
-
-        Entity simpleEntity = Iterables.getOnlyElement(app.getChildren());
-        assertEquals(simpleEntity.getEntityType().getName(), SIMPLE_ENTITY_TYPE);
-
-        deleteCatalogEntity(referencedSymbolicName);
-        deleteCatalogEntity(referrerSymbolicName);
-    }
-
-    @Test
-    public void testLaunchApplicationWithCatalogReferencingOtherCatalogInTwoSteps() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String referencedSymbolicName = "my.catalog.app.id.referenced";
-        String referrerSymbolicName = "my.catalog.app.id.referring";
-        addCatalogOSGiEntity(referencedSymbolicName, SIMPLE_ENTITY_TYPE);
-        addCatalogOSGiEntity(referrerSymbolicName, ver(referencedSymbolicName));
-
-        String yaml = "name: simple-app-yaml\n" +
-                      "location: localhost\n" +
-                      "services: \n" +
-                      "  - serviceType: " + ver(referrerSymbolicName);
-        Entity app = createAndStartApplication(yaml);
-
-        Entity simpleEntity = Iterables.getOnlyElement(app.getChildren());
-        assertEquals(simpleEntity.getEntityType().getName(), SIMPLE_ENTITY_TYPE);
-
-        deleteCatalogEntity(referencedSymbolicName);
-        deleteCatalogEntity(referrerSymbolicName);
-    }
-
-    @Test
-    public void testLaunchApplicationChildWithCatalogReferencingOtherCatalog() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String referencedSymbolicName = "my.catalog.app.id.child.referenced";
-        String referrerSymbolicName = "my.catalog.app.id.child.referring";
-        addCatalogOSGiEntity(referencedSymbolicName, SIMPLE_ENTITY_TYPE);
-        addCatalogChildOSGiEntity(referrerSymbolicName, ver(referencedSymbolicName));
-
-        Entity app = createAndStartApplication(
-            "name: simple-app-yaml",
-            "location: localhost",
-            "services:",
-            "- type: "+BasicEntity.class.getName(),
-            "  brooklyn.children:",
-            "  - type: " + ver(referrerSymbolicName));
-
-        Collection<Entity> children = app.getChildren();
-        assertEquals(children.size(), 1);
-        Entity child = Iterables.getOnlyElement(children);
-        assertEquals(child.getEntityType().getName(), BasicEntity.class.getName());
-        Collection<Entity> grandChildren = child.getChildren();
-        assertEquals(grandChildren.size(), 1);
-        Entity grandChild = Iterables.getOnlyElement(grandChildren);
-        assertEquals(grandChild.getEntityType().getName(), BasicEntity.class.getName());
-        Collection<Entity> grandGrandChildren = grandChild.getChildren();
-        assertEquals(grandGrandChildren.size(), 1);
-        Entity grandGrandChild = Iterables.getOnlyElement(grandGrandChildren);
-        assertEquals(grandGrandChild.getEntityType().getName(), SIMPLE_ENTITY_TYPE);
-
-        deleteCatalogEntity(referencedSymbolicName);
-        deleteCatalogEntity(referrerSymbolicName);
-    }
-
-    @Test
-    public void testLaunchApplicationChildWithCatalogReferencingOtherCatalogServicesBlock() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String referencedSymbolicName = "my.catalog.app.id.child.referenced";
-        String referrerSymbolicName = "my.catalog.app.id.child.referring";
-        addCatalogOSGiEntity(referencedSymbolicName, SIMPLE_ENTITY_TYPE);
-        addCatalogChildOSGiEntityWithServicesBlock(referrerSymbolicName, ver(referencedSymbolicName));
-
-        Entity app = createAndStartApplication(
-            "name: simple-app-yaml",
-            "location: localhost",
-            "services:",
-            "- serviceType: "+BasicEntity.class.getName(),
-            "  brooklyn.children:",
-            "  - type: " + ver(referrerSymbolicName));
-
-        Collection<Entity> children = app.getChildren();
-        assertEquals(children.size(), 1);
-        Entity child = Iterables.getOnlyElement(children);
-        assertEquals(child.getEntityType().getName(), BasicEntity.class.getName());
-        Collection<Entity> grandChildren = child.getChildren();
-        assertEquals(grandChildren.size(), 1);
-        Entity grandChild = Iterables.getOnlyElement(grandChildren);
-        assertEquals(grandChild.getEntityType().getName(), BasicEntity.class.getName());
-        Collection<Entity> grandGrandChildren = grandChild.getChildren();
-        assertEquals(grandGrandChildren.size(), 1);
-        Entity grandGrandChild = Iterables.getOnlyElement(grandGrandChildren);
-        assertEquals(grandGrandChild.getEntityType().getName(), SIMPLE_ENTITY_TYPE);
-
-        deleteCatalogEntity(referencedSymbolicName);
-        deleteCatalogEntity(referrerSymbolicName);
-    }
-    
-    @Test
-    public void testLaunchApplicationWithTypeUsingJavaColonPrefix() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String symbolicName = SIMPLE_ENTITY_TYPE;
-        String serviceName = "java:"+SIMPLE_ENTITY_TYPE;
-        registerAndLaunchAndAssertSimpleEntity(symbolicName, serviceName);
-    }
-
-    @Test
-    public void testLaunchApplicationLoopWithJavaTypeName() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String symbolicName = SIMPLE_ENTITY_TYPE;
-        String serviceName = SIMPLE_ENTITY_TYPE;
-        registerAndLaunchAndAssertSimpleEntity(symbolicName, serviceName);
-    }
-
-    @Test
-    public void testLaunchApplicationChildLoopCatalogIdFails() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String referrerSymbolicName = "my.catalog.app.id.child.referring";
-        try {
-            // TODO only fails if using 'services', because that forces plan parsing; should fail in all cases
-            addCatalogChildOSGiEntityWithServicesBlock(referrerSymbolicName, ver(referrerSymbolicName));
-            fail("Expected to throw");
-        } catch (Exception e) {
-            Exceptions.propagateIfFatal(e);
-            assertTrue(e.getMessage().contains(referrerSymbolicName), "message was: "+e);
-        }
-    }
-
-    @Test
-    public void testReferenceInstalledBundleByName() {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String firstItemId = "my.catalog.app.id.register_bundle";
-        String secondItemId = "my.catalog.app.id.reference_bundle";
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  id: " + firstItemId,
-            "  version: " + TEST_VERSION,
-            "  libraries:",
-            "  - url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL,
-            "",
-            "services:",
-            "- type: " + SIMPLE_ENTITY_TYPE);
-        deleteCatalogEntity(firstItemId);
-
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  id: " + secondItemId,
-            "  version: " + TEST_VERSION,
-            "  libraries:",
-            "  - name: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_NAME,
-            "    version: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_VERSION,
-            "",
-            "services:",
-            "- type: " + SIMPLE_ENTITY_TYPE);
-
-        deleteCatalogEntity(secondItemId);
-    }
-
-    @Test
-    public void testReferenceNonInstalledBundledByNameFails() {
-        String nonExistentId = "none-existent-id";
-        String nonExistentVersion = "9.9.9";
-        try {
-            addCatalogItems(
-                "brooklyn.catalog:",
-                "  id: my.catalog.app.id.non_existing.ref",
-                "  version: " + TEST_VERSION,
-                "  libraries:",
-                "  - name: " + nonExistentId,
-                "    version: " + nonExistentVersion,
-                "",
-                "services:",
-                "- type: " + SIMPLE_ENTITY_TYPE);
-            fail();
-        } catch (IllegalStateException e) {
-            Assert.assertEquals(e.getMessage(), "Bundle from null failed to install: Bundle CatalogBundleDto{symbolicName=" + nonExistentId + ", version=" + nonExistentVersion + ", url=null} not previously registered, but URL is empty.");
-        }
-    }
-
-    @Test
-    public void testPartialBundleReferenceFails() {
-        try {
-            addCatalogItems(
-                "brooklyn.catalog:",
-                "  id: my.catalog.app.id.non_existing.ref",
-                "  version: " + TEST_VERSION,
-                "  libraries:",
-                "  - name: io.brooklyn.brooklyn-test-osgi-entities",
-                "",
-                "services:",
-                "- type: " + SIMPLE_ENTITY_TYPE);
-            fail();
-        } catch (NullPointerException e) {
-            Assert.assertEquals(e.getMessage(), "both name and version are required");
-        }
-        try {
-            addCatalogItems(
-                "brooklyn.catalog:",
-                "  id: my.catalog.app.id.non_existing.ref",
-                "  version: " + TEST_VERSION,
-                "  libraries:",
-                "  - version: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_VERSION,
-                "",
-                "services:",
-                "- type: " + SIMPLE_ENTITY_TYPE);
-            fail();
-        } catch (NullPointerException e) {
-            Assert.assertEquals(e.getMessage(), "both name and version are required");
-        }
-    }
-
-    @Test
-    public void testFullBundleReference() {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String itemId = "my.catalog.app.id.full_ref";
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  id: " + itemId,
-            "  version: " + TEST_VERSION,
-            "  libraries:",
-            "  - name: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_NAME,
-            "    version: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_VERSION,
-            "    url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL,
-            "",
-            "services:",
-            "- type: " + SIMPLE_ENTITY_TYPE);
-        deleteCatalogEntity(itemId);
-    }
-
-    /**
-     * Test that the name:version contained in the OSGi bundle will
-     * override the values supplied in the YAML.
-     */
-    @Test
-    public void testFullBundleReferenceUrlMetaOverridesLocalNameVersion() {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String firstItemId = "my.catalog.app.id.register_bundle";
-        String nonExistentId = "non_existent_id";
-        String nonExistentVersion = "9.9.9";
-        try {
-            addCatalogItems(
-                "brooklyn.catalog:",
-                "  id: " + firstItemId,
-                "  version: " + TEST_VERSION,
-                "  libraries:",
-                "  - name: " + nonExistentId,
-                "    version: " + nonExistentVersion,
-                "    url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL,
-                "",
-                "services:",
-                "- type: " + SIMPLE_ENTITY_TYPE);
-            fail();
-        } catch (IllegalStateException e) {
-            assertEquals(e.getMessage(), "Bundle from " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL + " failed to install: " +
-                    "Bundle already installed as " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_NAME + ":" +
-                    OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_VERSION + " but user explicitly requested " +
-                    "CatalogBundleDto{symbolicName=" + nonExistentId + ", version=" + nonExistentVersion + ", url=" +
-                    OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL + "}");
-        }
-    }
-
-    @Test
-    public void testUpdatingItemAllowedIfSame() {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String id = "my.catalog.app.id.duplicate";
-        addCatalogOSGiEntity(id);
-        addCatalogOSGiEntity(id);
-    }
-    
-    @Test(expectedExceptions = IllegalStateException.class)
-    public void testUpdatingItemFailsIfDifferent() {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String id = "my.catalog.app.id.duplicate";
-        addCatalogOSGiEntity(id);
-        addCatalogOSGiEntity(id, SIMPLE_ENTITY_TYPE, true);
-    }
-
-    @Test
-    public void testForcedUpdatingItem() {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String id = "my.catalog.app.id.duplicate";
-        addCatalogOSGiEntity(id);
-        forceCatalogUpdate();
-        addCatalogOSGiEntity(id);
-        deleteCatalogEntity(id);
-    }
-
-    @Test
-    public void testCreateSpecFromCatalogItem() {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        String id = "my.catalog.app.id.create_spec";
-        addCatalogOSGiEntity(id);
-        BrooklynTypeRegistry catalog = mgmt().getTypeRegistry();
-        RegisteredType item = catalog.get(id, TEST_VERSION);
-        EntitySpec<?> spec = catalog.createSpec(item, null, EntitySpec.class);
-        Assert.assertNotNull(spec);
-        AbstractBrooklynObjectSpec<?,?> spec2 = catalog.createSpec(item, null, null);
-        Assert.assertNotNull(spec2);
-    }
-    
-    @Test
-    public void testLoadResourceFromBundle() throws Exception {
-        String id = "resource.test";
-        addCatalogOSGiEntity(id, SIMPLE_ENTITY_TYPE);
-        String yaml =
-                "services: \n" +
-                "  - serviceType: "+ver(id);
-        Entity app = createAndStartApplication(yaml);
-        Entity simpleEntity = Iterables.getOnlyElement(app.getChildren());
-        InputStream icon = new ResourceUtils(simpleEntity).getResourceFromUrl("classpath:/org/apache/brooklyn/test/osgi/entities/icon.gif");
-        assertTrue(icon != null);
-        icon.close();
-    }
-    
-    @Test
-    public void testMissingTypeDoesNotRecurse() {
-        String symbolicName = "my.catalog.app.id.basic";
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  id: " + symbolicName,
-            "  version: " + TEST_VERSION,
-            "",
-            "services:",
-            "- type: org.apache.brooklyn.entity.stock.BasicEntity");
-
-        try {
-            addCatalogItems(
-                    "brooklyn.catalog:",
-                    "  id: " + symbolicName,
-                    "  version: " + TEST_VERSION + "-update",
-                    "",
-                    "services:",
-                    "- type: " + symbolicName);
-            fail("Catalog addition expected to fail due to non-existent java type " + symbolicName);
-        } catch (IllegalStateException e) {
-            assertTrue(e.toString().contains("recursive"), "Unexpected error message: "+e);
-        }
-    }
-    
-    @Test
-    public void testVersionedTypeDoesNotRecurse() {
-        String symbolicName = "my.catalog.app.id.basic";
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  id: " + symbolicName,
-            "  version: " + TEST_VERSION,
-            "",
-            "services:",
-            "- type: org.apache.brooklyn.entity.stock.BasicEntity");
-
-        String versionedId = CatalogUtils.getVersionedId(symbolicName, TEST_VERSION);
-        try {
-            addCatalogItems(
-                "brooklyn.catalog:",
-                "  id: " + symbolicName,
-                "  version: " + TEST_VERSION + "-update",
-                "",
-                "services:",
-                "- type: " + versionedId);
-            fail("Catalog addition expected to fail due to non-existent java type " + versionedId);
-        } catch (IllegalStateException e) {
-            assertTrue(e.toString().contains("recursive"), "Unexpected error message: "+e);
-        }
-    }
-
-    @Test
-    public void testIndirectRecursionFails() throws Exception {
-        String symbolicName = "my.catalog.app.id.basic";
-        // Need to have a stand alone caller first so we can create an item to depend on it.
-        // After that replace it/insert a new version which completes the cycle
-        addCatalogItems(
-                "brooklyn.catalog:",
-                "  id: " + symbolicName + ".caller",
-                "  version: " + TEST_VERSION + "pre",
-                "",
-                "services:",
-                "- type: "+BasicEntity.class.getName());
-
-        addCatalogItems(
-                "brooklyn.catalog:",
-                "  id: " + symbolicName + ".callee",
-                "  version: " + TEST_VERSION,
-                "",
-                "services:",
-                "- type: " + symbolicName + ".caller");
-
-        try {
-            addCatalogItems(
-                    "brooklyn.catalog:",
-                    "  id: " + symbolicName + ".caller",
-                    "  version: " + TEST_VERSION,
-                    "",
-                    "services:",
-                    "- type: " + symbolicName + ".callee");
-            fail();
-        } catch (IllegalStateException e) {
-            assertTrue(e.toString().contains("recursive"), "Unexpected error message: "+e);
-        }
-    }
-
-    @Test
-    public void testChildItemsDoNotRecurse() throws Exception {
-        String symbolicName = "my.catalog.app.id.basic";
-        // Need to have a stand alone caller first so we can create an item to depend on it.
-        // After that replace it/insert a new version which completes the cycle
-        addCatalogItems(
-                "brooklyn.catalog:",
-                "  id: " + symbolicName + ".caller",
-                "  version: " + TEST_VERSION + "pre",
-                "",
-                "services:",
-                "- type: org.apache.brooklyn.entity.stock.BasicEntity");
-
-        addCatalogItems(
-                "brooklyn.catalog:",
-                "  id: " + symbolicName + ".callee",
-                "  version: " + TEST_VERSION,
-                "",
-                "services:",
-                "- type: " + symbolicName + ".caller");
-
-        try {
-            addCatalogItems(
-                    "brooklyn.catalog:",
-                    "  id: " + symbolicName + ".caller",
-                    "  version: " + TEST_VERSION,
-                    "",
-                    "services:",
-                    "- type: org.apache.brooklyn.entity.stock.BasicEntity",
-                    // Being a child is important, triggers the case where
-                    // we allow retrying with other transformers.
-                    "  brooklyn.children:",
-                    "  - type: " + symbolicName + ".callee");
-            fail();
-        } catch (IllegalStateException e) {
-            assertTrue(e.toString().contains("recursive"), "Unexpected error message: "+e);
-        }
-    }
-
-    @Test
-    public void testRecursiveCheckForDepenentsOnly() throws Exception {
-        String symbolicName = "my.catalog.app.id.basic";
-        addCatalogItems(
-                "brooklyn.catalog:",
-                "  id: " + symbolicName,
-                "  version: " + TEST_VERSION,
-                "",
-                "services:",
-                "- type: org.apache.brooklyn.entity.stock.BasicEntity");
-
-        createAndStartApplication(
-                "services:",
-                "- type: " + ver(symbolicName),
-                "  brooklyn.children:",
-                "  - type: " + ver(symbolicName),
-                "- type: " + ver(symbolicName),
-                "  brooklyn.children:",
-                "  - type: " + ver(symbolicName));
-    }
-
-    @Test
-    public void testOsgiNotLeakingToParent() {
-        addCatalogOSGiEntity(SIMPLE_ENTITY_TYPE);
-        try {
-            addCatalogItems(
-                    "brooklyn.catalog:",
-                    "  id: " + SIMPLE_ENTITY_TYPE,
-                    "  version: " + TEST_VERSION + "-update",
-                    "",
-                    "services:",
-                    "- type: " + SIMPLE_ENTITY_TYPE);
-            fail("Catalog addition expected to fail due to non-existent java type " + SIMPLE_ENTITY_TYPE);
-        } catch (IllegalStateException e) {
-            assertTrue(e.toString().contains("recursive"), "Unexpected error message: "+e);
-        }
-    }
-
-    @Test
-    public void testConfigAppliedToCatalogItem() throws Exception {
-        addCatalogOSGiEntity("test", TestEntity.class.getName());
-        String testName = "test-applies-config-on-catalog-item";
-        Entity app = createAndStartApplication(
-                "services:",
-                "- type: " + ver("test"),
-                "  brooklyn.config:",
-                "    test.confName: " + testName);
-        Entity testEntity = Iterables.getOnlyElement(app.getChildren());
-        assertEquals(testEntity.config().get(TestEntity.CONF_NAME), testName);
-    }
-
-    @Test
-    public void testFlagsAppliesToCatalogItem() throws Exception {
-        addCatalogOSGiEntity("test", TestEntity.class.getName());
-        String testName = "test-applies-config-on-catalog-item";
-        Entity app = createAndStartApplication(
-                "services:",
-                "- type: " + ver("test"),
-                "  confName: " + testName);
-        Entity testEntity = Iterables.getOnlyElement(app.getChildren());
-        assertEquals(testEntity.config().get(TestEntity.CONF_NAME), testName);
-    }
-
-    @Test
-    public void testExplicitFlagsAppliesToCatalogItem() throws Exception {
-        addCatalogOSGiEntity("test", TestEntity.class.getName());
-        String testName = "test-applies-config-on-catalog-item";
-        Entity app = createAndStartApplication(
-                "services:",
-                "- type: " + ver("test"),
-                "  brooklyn.flags:",
-                "    confName: " + testName);
-        Entity testEntity = Iterables.getOnlyElement(app.getChildren());
-        assertEquals(testEntity.config().get(TestEntity.CONF_NAME), testName);
-    }
-    
-
-    @Test
-    public void testConfigAppliedToCatalogItemImpl() throws Exception {
-        addCatalogOSGiEntity("test", TestEntityImpl.class.getName());
-        String testName = "test-applies-config-on-catalog-item";
-        Entity app = createAndStartApplication(
-                "services:",
-                "- type: " + ver("test"),
-                "  brooklyn.config:",
-                "    test.confName: " + testName);
-        Entity testEntity = Iterables.getOnlyElement(app.getChildren());
-        assertEquals(testEntity.config().get(TestEntity.CONF_NAME), testName);
-    }
-
-    @Test
-    public void testFlagsAppliesToCatalogItemImpl() throws Exception {
-        addCatalogOSGiEntity("test", TestEntityImpl.class.getName());
-        String testName = "test-applies-config-on-catalog-item";
-        Entity app = createAndStartApplication(
-                "services:",
-                "- type: " + ver("test"),
-                "  confName: " + testName);
-        Entity testEntity = Iterables.getOnlyElement(app.getChildren());
-        assertEquals(testEntity.config().get(TestEntity.CONF_NAME), testName);
-    }
-
-    @Test
-    public void testExplicitFlagsAppliesToCatalogItemImpl() throws Exception {
-        addCatalogOSGiEntity("test", TestEntityImpl.class.getName());
-        String testName = "test-applies-config-on-catalog-item";
-        Entity app = createAndStartApplication(
-                "services:",
-                "- type: " + ver("test"),
-                "  brooklyn.flags:",
-                "    confName: " + testName);
-        Entity testEntity = Iterables.getOnlyElement(app.getChildren());
-        assertEquals(testEntity.config().get(TestEntity.CONF_NAME), testName);
-    }
-
-    @Test
-    public void testHardcodedCatalog() throws Exception {
-        createAppEntitySpec(
-                "services:",
-                "- type: cluster",
-                "- type: vanilla");
-    }
-
-    private void registerAndLaunchAndAssertSimpleEntity(String symbolicName, String serviceType) throws Exception {
-        addCatalogOSGiEntity(symbolicName, serviceType);
-        String yaml = "name: simple-app-yaml\n" +
-                      "location: localhost\n" +
-                      "services: \n" +
-                      "  - serviceType: "+ver(symbolicName);
-        Entity app = createAndStartApplication(yaml);
-
-        Entity simpleEntity = Iterables.getOnlyElement(app.getChildren());
-        assertEquals(simpleEntity.getEntityType().getName(), SIMPLE_ENTITY_TYPE);
-
-        deleteCatalogEntity(symbolicName);
-    }
-
-    private void addCatalogOSGiEntity(String symbolicName) {
-        addCatalogOSGiEntity(symbolicName, SIMPLE_ENTITY_TYPE);
-    }
-
-    private void addCatalogOSGiEntity(String symbolicName, String serviceType) {
-        addCatalogOSGiEntity(symbolicName, serviceType, false);
-    }
-    
-    private void addCatalogOSGiEntity(String symbolicName, String serviceType, boolean extraLib) {
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  id: " + symbolicName,
-            "  name: My Catalog App",
-            "  description: My description",
-            "  icon_url: classpath://path/to/myicon.jpg",
-            "  version: " + TEST_VERSION,
-            "  libraries:",
-            "  - url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL +
-            (extraLib ? "\n"+"  - url: "+OsgiStandaloneTest.BROOKLYN_OSGI_TEST_A_0_1_0_URL : ""),
-            "  item:",
-            "    type: " + serviceType);
-    }
-
-    private void addCatalogOSGiEntities(String ...namesAndTypes) {
-        List<String> lines = MutableList.of(
-            "brooklyn.catalog:",
-            "  name: My Catalog App",
-            "  description: My description",
-            "  icon_url: classpath://path/to/myicon.jpg",
-            "  version: " + TEST_VERSION,
-            "  libraries:",
-            "  - url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL,
-            "  items:");
-        
-        for (int i=0; i<namesAndTypes.length; i+=2) {
-            lines.addAll(MutableList.of(
-            "  - id: " + namesAndTypes[i],
-            "    item:",
-            "      type: " + namesAndTypes[i+1]));
-        }
-            
-        addCatalogItems(lines);
-    }
-    private void addCatalogChildOSGiEntityWithServicesBlock(String symbolicName, String serviceType) {
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  id: " + symbolicName,
-            "  name: My Catalog App",
-            "  description: My description",
-            "  icon_url: classpath://path/to/myicon.jpg",
-            "  version: " + TEST_VERSION,
-            "  libraries:",
-            "  - url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL,
-            "  item:",
-            "    services:",
-            "    - type: " + BasicEntity.class.getName(),
-            "      brooklyn.children:",
-            "      - type: " + serviceType);
-    }
-    private void addCatalogChildOSGiEntity(String symbolicName, String serviceType) {
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  id: " + symbolicName,
-            "  name: My Catalog App",
-            "  description: My description",
-            "  icon_url: classpath://path/to/myicon.jpg",
-            "  version: " + TEST_VERSION,
-            "  libraries:",
-            "  - url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL,
-            "  item:",
-            "    type: " + BasicEntity.class.getName(),
-            "    brooklyn.children:",
-            "    - type: " + serviceType);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlLocationTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlLocationTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlLocationTest.java
deleted file mode 100644
index f792d65..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlLocationTest.java
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.brooklyn.camp.brooklyn.catalog;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNull;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.location.LocationDefinition;
-import org.apache.brooklyn.api.location.LocationSpec;
-import org.apache.brooklyn.api.typereg.OsgiBundleWithUrl;
-import org.apache.brooklyn.api.typereg.RegisteredType;
-import org.apache.brooklyn.camp.brooklyn.AbstractYamlTest;
-import org.apache.brooklyn.core.config.BasicConfigKey;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.mgmt.osgi.OsgiStandaloneTest;
-import org.apache.brooklyn.core.typereg.RegisteredTypePredicates;
-import org.apache.brooklyn.core.typereg.RegisteredTypes;
-import org.apache.brooklyn.location.localhost.LocalhostMachineProvisioningLocation;
-import org.apache.brooklyn.test.support.TestResourceUnavailableException;
-import org.apache.brooklyn.util.text.StringFunctions;
-import org.testng.Assert;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-
-public class CatalogYamlLocationTest extends AbstractYamlTest {
-    private static final String LOCALHOST_LOCATION_SPEC = "localhost";
-    private static final String LOCALHOST_LOCATION_TYPE = LocalhostMachineProvisioningLocation.class.getName();
-    private static final String SIMPLE_LOCATION_TYPE = "org.apache.brooklyn.test.osgi.entities.SimpleLocation";
-
-    @AfterMethod
-    public void tearDown() {
-        for (RegisteredType ci : mgmt().getTypeRegistry().getMatching(RegisteredTypePredicates.IS_LOCATION)) {
-            mgmt().getCatalog().deleteCatalogItem(ci.getSymbolicName(), ci.getVersion());
-        }
-    }
-    
-    @Test
-    public void testAddCatalogItem() throws Exception {
-        assertEquals(countCatalogLocations(), 0);
-
-        String symbolicName = "my.catalog.location.id.load";
-        addCatalogLocation(symbolicName, LOCALHOST_LOCATION_TYPE, null);
-        assertAdded(symbolicName, LOCALHOST_LOCATION_TYPE);
-        removeAndAssert(symbolicName);
-    }
-
-    @Test
-    public void testAddCatalogItemOsgi() throws Exception {
-        assertEquals(countCatalogLocations(), 0);
-
-        String symbolicName = "my.catalog.location.id.load";
-        addCatalogLocation(symbolicName, SIMPLE_LOCATION_TYPE, getOsgiLibraries());
-        assertAdded(symbolicName, SIMPLE_LOCATION_TYPE);
-        assertOsgi(symbolicName);
-        removeAndAssert(symbolicName);
-    }
-
-    @Test
-    public void testAddCatalogItemTopLevelItemSyntax() throws Exception {
-        assertEquals(countCatalogLocations(), 0);
-
-        String symbolicName = "my.catalog.location.id.load";
-        addCatalogLocationTopLevelItemSyntax(symbolicName, LOCALHOST_LOCATION_TYPE, null);
-        assertAdded(symbolicName, LOCALHOST_LOCATION_TYPE);
-        removeAndAssert(symbolicName);
-    }
-
-    @Test
-    public void testAddCatalogItemOsgiTopLevelItemSyntax() throws Exception {
-        assertEquals(countCatalogLocations(), 0);
-
-        String symbolicName = "my.catalog.location.id.load";
-        addCatalogLocationTopLevelItemSyntax(symbolicName, SIMPLE_LOCATION_TYPE, getOsgiLibraries());
-        assertAdded(symbolicName, SIMPLE_LOCATION_TYPE);
-        assertOsgi(symbolicName);
-        removeAndAssert(symbolicName);
-    }
-
-    private void assertOsgi(String symbolicName) {
-        RegisteredType item = mgmt().getTypeRegistry().get(symbolicName, TEST_VERSION);
-        Collection<OsgiBundleWithUrl> libs = item.getLibraries();
-        assertEquals(libs.size(), 1);
-        assertEquals(Iterables.getOnlyElement(libs).getUrl(), Iterables.getOnlyElement(getOsgiLibraries()));
-    }
-
-    @SuppressWarnings({ "rawtypes" })
-    private void assertAdded(String symbolicName, String expectedJavaType) {
-        RegisteredType item = mgmt().getTypeRegistry().get(symbolicName, TEST_VERSION);
-        assertEquals(item.getSymbolicName(), symbolicName);
-        Assert.assertTrue(RegisteredTypes.isSubtypeOf(item, Location.class), "Expected Location, not "+item.getSuperTypes());
-        assertEquals(countCatalogLocations(), 1);
-
-        // Item added to catalog should automatically be available in location registry
-        LocationDefinition def = mgmt().getLocationRegistry().getDefinedLocationByName(symbolicName);
-        assertEquals(def.getId(), symbolicName);
-        assertEquals(def.getName(), symbolicName);
-        
-        LocationSpec spec = (LocationSpec) mgmt().getTypeRegistry().createSpec(item, null, LocationSpec.class);
-        assertEquals(spec.getType().getName(), expectedJavaType);
-    }
-    
-    private void removeAndAssert(String symbolicName) {
-        // Deleting item: should be gone from catalog, and from location registry
-        deleteCatalogEntity(symbolicName);
-
-        assertEquals(countCatalogLocations(), 0);
-        assertNull(mgmt().getLocationRegistry().getDefinedLocationByName(symbolicName));
-    }
-
-    @Test
-    public void testLaunchApplicationReferencingLocationClass() throws Exception {
-        String symbolicName = "my.catalog.location.id.launch";
-        addCatalogLocation(symbolicName, LOCALHOST_LOCATION_TYPE, null);
-        runLaunchApplicationReferencingLocation(symbolicName, LOCALHOST_LOCATION_TYPE);
-
-        deleteCatalogEntity(symbolicName);
-    }
-
-    @Test
-    public void testLaunchApplicationReferencingLocationSpec() throws Exception {
-        String symbolicName = "my.catalog.location.id.launch";
-        addCatalogLocation(symbolicName, LOCALHOST_LOCATION_SPEC, null);
-        runLaunchApplicationReferencingLocation(symbolicName, LOCALHOST_LOCATION_TYPE);
-
-        deleteCatalogEntity(symbolicName);
-    }
-
-    @Test
-    public void testLaunchApplicationReferencingLocationClassTopLevelItemSyntax() throws Exception {
-        String symbolicName = "my.catalog.location.id.launch";
-        addCatalogLocationTopLevelItemSyntax(symbolicName, LOCALHOST_LOCATION_TYPE, null);
-        runLaunchApplicationReferencingLocation(symbolicName, LOCALHOST_LOCATION_TYPE);
-
-        deleteCatalogEntity(symbolicName);
-    }
-
-    @Test
-    public void testLaunchApplicationReferencingLocationSpecTopLevelSyntax() throws Exception {
-        String symbolicName = "my.catalog.location.id.launch";
-        addCatalogLocationTopLevelItemSyntax(symbolicName, LOCALHOST_LOCATION_SPEC, null);
-        runLaunchApplicationReferencingLocation(symbolicName, LOCALHOST_LOCATION_TYPE);
-
-        deleteCatalogEntity(symbolicName);
-    }
-
-    @Test
-    public void testLaunchApplicationReferencingOsgiLocation() throws Exception {
-        String symbolicName = "my.catalog.location.id.launch";
-        addCatalogLocation(symbolicName, SIMPLE_LOCATION_TYPE, getOsgiLibraries());
-        runLaunchApplicationReferencingLocation(symbolicName, SIMPLE_LOCATION_TYPE);
-        
-        deleteCatalogEntity(symbolicName);
-    }
-    
-    protected void runLaunchApplicationReferencingLocation(String locTypeInYaml, String locType) throws Exception {
-        Entity app = createAndStartApplication(
-            "name: simple-app-yaml",
-            "location: ",
-            "  "+locTypeInYaml+":",
-            "    config2: config2 override",
-            "    config3: config3",
-            "services: ",
-            "  - type: org.apache.brooklyn.entity.stock.BasicStartable");
-
-        Entity simpleEntity = Iterables.getOnlyElement(app.getChildren());
-        Location location = Iterables.getOnlyElement(Entities.getAllInheritedLocations(simpleEntity));
-        assertEquals(location.getClass().getName(), locType);
-        assertEquals(location.getConfig(new BasicConfigKey<String>(String.class, "config1")), "config1");
-        assertEquals(location.getConfig(new BasicConfigKey<String>(String.class, "config2")), "config2 override");
-        assertEquals(location.getConfig(new BasicConfigKey<String>(String.class, "config3")), "config3");
-    }
-
-    private List<String> getOsgiLibraries() {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-        return ImmutableList.of(OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL);
-    }
-    
-    private void addCatalogLocation(String symbolicName, String locationType, List<String> libraries) {
-        ImmutableList.Builder<String> yaml = ImmutableList.<String>builder().add(
-                "brooklyn.catalog:",
-                "  id: " + symbolicName,
-                "  name: My Catalog Location",
-                "  description: My description",
-                "  version: " + TEST_VERSION);
-        if (libraries!=null && libraries.size() > 0) {
-            yaml.add("  libraries:")
-                .addAll(Lists.transform(libraries, StringFunctions.prepend("  - url: ")));
-        }
-        yaml.add(
-                "  item.type: location",
-                "  item:",
-                "    type: " + locationType,
-                "    brooklyn.config:",
-                "      config1: config1",
-                "      config2: config2");
-        
-        
-        addCatalogItems(yaml.build());
-    }
-
-    private void addCatalogLocationTopLevelItemSyntax(String symbolicName, String locationType, List<String> libraries) {
-        ImmutableList.Builder<String> yaml = ImmutableList.<String>builder().add(
-                "brooklyn.catalog:",
-                "  id: " + symbolicName,
-                "  name: My Catalog Location",
-                "  description: My description",
-                "  version: " + TEST_VERSION);
-        if (libraries!=null && libraries.size() > 0) {
-            yaml.add("  libraries:")
-                .addAll(Lists.transform(libraries, StringFunctions.prepend("  - url: ")));
-        }
-        yaml.add(
-                "",
-                "brooklyn.locations:",
-                "- type: " + locationType,
-                "  brooklyn.config:",
-                "    config1: config1",
-                "    config2: config2");
-        
-        
-        addCatalogItems(yaml.build());
-    }
-
-    private int countCatalogLocations() {
-        return Iterables.size(mgmt().getTypeRegistry().getMatching(RegisteredTypePredicates.IS_LOCATION));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlPolicyTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlPolicyTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlPolicyTest.java
deleted file mode 100644
index fbfe630..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlPolicyTest.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.brooklyn.camp.brooklyn.catalog;
-
-import static org.testng.Assert.assertEquals;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.policy.Policy;
-import org.apache.brooklyn.api.typereg.RegisteredType;
-import org.apache.brooklyn.camp.brooklyn.AbstractYamlTest;
-import org.apache.brooklyn.core.catalog.CatalogPredicates;
-import org.apache.brooklyn.core.config.BasicConfigKey;
-import org.apache.brooklyn.core.mgmt.osgi.OsgiStandaloneTest;
-import org.apache.brooklyn.test.support.TestResourceUnavailableException;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.Iterables;
-
-public class CatalogYamlPolicyTest extends AbstractYamlTest {
-    private static final String SIMPLE_POLICY_TYPE = "org.apache.brooklyn.test.osgi.entities.SimplePolicy";
-    private static final String SIMPLE_ENTITY_TYPE = "org.apache.brooklyn.test.osgi.entities.SimpleEntity";
-
-    @Test
-    public void testAddCatalogItem() throws Exception {
-        assertEquals(countCatalogPolicies(), 0);
-
-        String symbolicName = "my.catalog.policy.id.load";
-        addCatalogOsgiPolicy(symbolicName, SIMPLE_POLICY_TYPE);
-
-        RegisteredType item = mgmt().getTypeRegistry().get(symbolicName, TEST_VERSION);
-        assertEquals(item.getSymbolicName(), symbolicName);
-        assertEquals(countCatalogPolicies(), 1);
-
-        deleteCatalogEntity(symbolicName);
-    }
-
-    @Test
-    public void testAddCatalogItemTopLevelSyntax() throws Exception {
-        assertEquals(countCatalogPolicies(), 0);
-
-        String symbolicName = "my.catalog.policy.id.load";
-        addCatalogOsgiPolicyTopLevelSyntax(symbolicName, SIMPLE_POLICY_TYPE);
-
-        RegisteredType item = mgmt().getTypeRegistry().get(symbolicName, TEST_VERSION);
-        assertEquals(item.getSymbolicName(), symbolicName);
-        assertEquals(countCatalogPolicies(), 1);
-
-        deleteCatalogEntity(symbolicName);
-    }
-
-    @Test
-    public void testLaunchApplicationReferencingPolicy() throws Exception {
-        String symbolicName = "my.catalog.policy.id.launch";
-        addCatalogOsgiPolicy(symbolicName, SIMPLE_POLICY_TYPE);
-        Entity app = createAndStartApplication(
-            "name: simple-app-yaml",
-            "location: localhost",
-            "services: ",
-            "  - type: org.apache.brooklyn.entity.stock.BasicEntity\n" +
-            "    brooklyn.policies:\n" +
-            "    - type: " + ver(symbolicName),
-            "      brooklyn.config:",
-            "        config2: config2 override",
-            "        config3: config3");
-
-        Entity simpleEntity = Iterables.getOnlyElement(app.getChildren());
-        Policy policy = Iterables.getOnlyElement(simpleEntity.policies());
-        assertEquals(policy.getPolicyType().getName(), SIMPLE_POLICY_TYPE);
-        assertEquals(policy.getConfig(new BasicConfigKey<String>(String.class, "config1")), "config1");
-        assertEquals(policy.getConfig(new BasicConfigKey<String>(String.class, "config2")), "config2 override");
-        assertEquals(policy.getConfig(new BasicConfigKey<String>(String.class, "config3")), "config3");
-
-        deleteCatalogEntity(symbolicName);
-    }
-
-    @Test
-    public void testLaunchApplicationReferencingPolicyTopLevelSyntax() throws Exception {
-        String symbolicName = "my.catalog.policy.id.launch";
-        addCatalogOsgiPolicyTopLevelSyntax(symbolicName, SIMPLE_POLICY_TYPE);
-        Entity app = createAndStartApplication(
-            "name: simple-app-yaml",
-            "location: localhost",
-            "services: ",
-            "  - type: org.apache.brooklyn.entity.stock.BasicEntity\n" +
-            "    brooklyn.policies:\n" +
-            "    - type: " + ver(symbolicName),
-            "      brooklyn.config:",
-            "        config2: config2 override",
-            "        config3: config3");
-
-        Entity simpleEntity = Iterables.getOnlyElement(app.getChildren());
-        Policy policy = Iterables.getOnlyElement(simpleEntity.policies());
-        assertEquals(policy.getPolicyType().getName(), SIMPLE_POLICY_TYPE);
-        assertEquals(policy.getConfig(new BasicConfigKey<String>(String.class, "config1")), "config1");
-        assertEquals(policy.getConfig(new BasicConfigKey<String>(String.class, "config2")), "config2 override");
-        assertEquals(policy.getConfig(new BasicConfigKey<String>(String.class, "config3")), "config3");
-
-        deleteCatalogEntity(symbolicName);
-    }
-    
-    @Test
-    public void testLaunchApplicationWithCatalogReferencingOtherCatalog() throws Exception {
-        String referencedSymbolicName = "my.catalog.policy.id.referenced";
-        String referrerSymbolicName = "my.catalog.policy.id.referring";
-        addCatalogOsgiPolicy(referencedSymbolicName, SIMPLE_POLICY_TYPE);
-
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  id: " + referrerSymbolicName,
-            "  name: My Catalog App",
-            "  description: My description",
-            "  icon_url: classpath://path/to/myicon.jpg",
-            "  version: " + TEST_VERSION,
-            "  libraries:",
-            "  - url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL,
-            "",
-            "services:",
-            "- type: " + SIMPLE_ENTITY_TYPE,
-            "  brooklyn.policies:",
-            "  - type: " + ver(referencedSymbolicName));
-
-        String yaml = "name: simple-app-yaml\n" +
-                      "location: localhost\n" +
-                      "services: \n" +
-                      "- type: "+ ver(referrerSymbolicName);
-
-        Entity app = createAndStartApplication(yaml);
-
-        Entity simpleEntity = Iterables.getOnlyElement(app.getChildren());
-        Policy policy = Iterables.getOnlyElement(simpleEntity.policies());
-        assertEquals(policy.getPolicyType().getName(), SIMPLE_POLICY_TYPE);
-
-        deleteCatalogEntity(referencedSymbolicName);
-    }
-
-    private void addCatalogOsgiPolicy(String symbolicName, String policyType) {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  id: " + symbolicName,
-            "  name: My Catalog Policy",
-            "  description: My description",
-            "  icon_url: classpath://path/to/myicon.jpg",
-            "  version: " + TEST_VERSION,
-            "  libraries:",
-            "  - url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL,
-            "  item:",
-            "    type: " + policyType,
-            "    brooklyn.config:",
-            "      config1: config1",
-            "      config2: config2");
-    }
-
-    private void addCatalogOsgiPolicyTopLevelSyntax(String symbolicName, String policyType) {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  id: " + symbolicName,
-            "  name: My Catalog Policy",
-            "  description: My description",
-            "  icon_url: classpath://path/to/myicon.jpg",
-            "  version: " + TEST_VERSION,
-            "  libraries:",
-            "  - url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL,
-            "",
-            "brooklyn.policies:",
-            "- type: " + policyType,
-            "  brooklyn.config:",
-            "    config1: config1",
-            "    config2: config2");
-    }
-
-    private int countCatalogPolicies() {
-        return Iterables.size(mgmt().getCatalog().getCatalogItems(CatalogPredicates.IS_POLICY));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlRebindTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlRebindTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlRebindTest.java
deleted file mode 100644
index 989bdb3..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlRebindTest.java
+++ /dev/null
@@ -1,343 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.brooklyn.camp.brooklyn.catalog;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.util.List;
-
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.apache.brooklyn.api.catalog.CatalogItem;
-import org.apache.brooklyn.api.mgmt.rebind.mementos.BrooklynMementoPersister;
-import org.apache.brooklyn.api.policy.Policy;
-import org.apache.brooklyn.api.sensor.Enricher;
-import org.apache.brooklyn.api.typereg.RegisteredType;
-import org.apache.brooklyn.camp.brooklyn.AbstractYamlRebindTest;
-import org.apache.brooklyn.core.BrooklynFeatureEnablement;
-import org.apache.brooklyn.core.catalog.internal.CatalogUtils;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.StartableApplication;
-import org.apache.brooklyn.core.mgmt.persist.BrooklynMementoPersisterToObjectStore;
-import org.apache.brooklyn.core.mgmt.persist.PersistenceObjectStore;
-import org.apache.brooklyn.core.mgmt.persist.PersistenceObjectStore.StoreObjectAccessor;
-import org.apache.brooklyn.core.mgmt.rebind.RebindOptions;
-import org.apache.brooklyn.core.test.policy.TestEnricher;
-import org.apache.brooklyn.core.test.policy.TestPolicy;
-import org.apache.brooklyn.entity.stock.BasicEntity;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.text.Strings;
-import org.testng.annotations.Test;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.InputSource;
-
-import com.google.common.base.Function;
-import com.google.common.base.Joiner;
-import com.google.common.base.Predicates;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-
-public class CatalogYamlRebindTest extends AbstractYamlRebindTest {
-
-    // TODO Other tests (relating to https://issues.apache.org/jira/browse/BROOKLYN-149) include:
-    //   - entities cannot be instantiated because class no longer on classpath (e.g. was OSGi)
-    //   - config/attribute cannot be instantiated (e.g. because class no longer on classpath)
-    //   - entity file corrupt
-    
-    enum RebindWithCatalogTestMode {
-        NO_OP,
-        STRIP_DEPRECATION_AND_ENABLEMENT_FROM_CATALOG_ITEM,
-        DEPRECATE_CATALOG,
-        DISABLE_CATALOG,
-        DELETE_CATALOG,
-        REPLACE_CATALOG_WITH_NEWER_VERSION;
-    }
-    
-    @Test
-    public void testRebindWithCatalogAndApp() throws Exception {
-        runRebindWithCatalogAndApp(RebindWithCatalogTestMode.NO_OP);
-    }
-    
-    @Test
-    public void testRebindWithCatalogDeprecatedAndAppExisting() throws Exception {
-        runRebindWithCatalogAndApp(RebindWithCatalogTestMode.DEPRECATE_CATALOG);
-    }
-    
-    @Test
-    public void testRebindWithCatalogDisabledAndAppExisting() throws Exception {
-        runRebindWithCatalogAndApp(RebindWithCatalogTestMode.DISABLE_CATALOG);
-    }
-    
-    // See https://issues.apache.org/jira/browse/BROOKLYN-149.
-    // Deletes the catalog item before rebind, but the referenced types are still on the 
-    // default classpath.
-    // Will fallback to loading from classpath.
-    @Test
-    public void testRebindWithCatalogDeletedAndAppExisting() throws Exception {
-        runRebindWithCatalogAndApp(RebindWithCatalogTestMode.DELETE_CATALOG);
-    }
-    
-    // Upgrades the catalog item before rebind, deleting the old version.
-    // Will automatically upgrade.
-    @Test
-    public void testRebindWithCatalogUpgradedWithOldDeletedAndAppExisting() throws Exception {
-        BrooklynFeatureEnablement.enable(BrooklynFeatureEnablement.FEATURE_AUTO_FIX_CATALOG_REF_ON_REBIND);
-        runRebindWithCatalogAndApp(RebindWithCatalogTestMode.REPLACE_CATALOG_WITH_NEWER_VERSION);
-    }
-    
-    /**
-     * Old persisted state for catalog items may not have a "deprecated" or "disabled"
-     * value. Need to check that their absence will default to false.
-     */
-    @Test
-    public void testRebindWithCatalogPropertiesForDeprecationAndEnablementAbsent() throws Exception {
-        runRebindWithCatalogAndApp(RebindWithCatalogTestMode.STRIP_DEPRECATION_AND_ENABLEMENT_FROM_CATALOG_ITEM);
-    }
-
-    @SuppressWarnings({ "unused", "deprecation" })
-    protected void runRebindWithCatalogAndApp(RebindWithCatalogTestMode mode) throws Exception {
-        String appSymbolicName = "my.catalog.app.id.load";
-        String appVersion = "0.1.0";
-        String appCatalogFormat = Joiner.on("\n").join(
-                "brooklyn.catalog:",
-                "  id: " + appSymbolicName,
-                "  version: %s",
-                "  item:",
-                "    type: "+ BasicEntity.class.getName(),
-                "    brooklyn.enrichers:",
-                "    - type: "+TestEnricher.class.getName(),
-                "    brooklyn.policies:",
-                "    - type: "+TestPolicy.class.getName());
-        
-        String locSymbolicName = "my.catalog.loc.id.load";
-        String locVersion = "1.0.0";
-        String locCatalogFormat = Joiner.on("\n").join(
-                "brooklyn.catalog:",
-                "  id: " + locSymbolicName,
-                "  version: %s",
-                "  item.type: location",
-                "  item:",
-                "    type: localhost");
-        
-        // Create the catalog items
-        CatalogItem<?, ?> appItem = Iterables.getOnlyElement(addCatalogItems(String.format(appCatalogFormat, appVersion)));
-        CatalogItem<?, ?> locItem = Iterables.getOnlyElement(addCatalogItems(String.format(locCatalogFormat, locVersion)));
-        final String appItemId = appItem.getId();
-        final String locItemId = locItem.getId();
-        
-        // Create an app, using that catalog item
-        String yaml = "name: simple-app-yaml\n" +
-                "location: \"brooklyn.catalog:"+CatalogUtils.getVersionedId(locSymbolicName, locVersion)+"\"\n" +
-                "services: \n" +
-                "- type: "+CatalogUtils.getVersionedId(appSymbolicName, appVersion);
-        origApp = (StartableApplication) createAndStartApplication(yaml);
-        BasicEntity origEntity = (BasicEntity) Iterables.getOnlyElement(origApp.getChildren());
-        TestPolicy origPolicy = (TestPolicy) Iterables.getOnlyElement(origEntity.policies());
-        TestEnricher origEnricher = (TestEnricher) Iterables.tryFind(origEntity.enrichers(), Predicates.instanceOf(TestEnricher.class)).get();
-        assertEquals(origEntity.getCatalogItemId(), appSymbolicName+":"+appVersion);
-
-        // Depending on test-mode, delete the catalog item, and then rebind
-        switch (mode) {
-            case DEPRECATE_CATALOG:
-                CatalogUtils.setDeprecated(mgmt(), appSymbolicName, appVersion, true);
-                CatalogUtils.setDeprecated(mgmt(), locSymbolicName, locVersion, true);
-                break;
-            case DISABLE_CATALOG:
-                CatalogUtils.setDisabled(mgmt(), appSymbolicName, appVersion, true);
-                CatalogUtils.setDisabled(mgmt(), locSymbolicName, locVersion, true);
-                break;
-            case DELETE_CATALOG:
-                mgmt().getCatalog().deleteCatalogItem(appSymbolicName, appVersion);
-                mgmt().getCatalog().deleteCatalogItem(locSymbolicName, locVersion);
-                break;
-            case REPLACE_CATALOG_WITH_NEWER_VERSION:
-                mgmt().getCatalog().deleteCatalogItem(appSymbolicName, appVersion);
-                mgmt().getCatalog().deleteCatalogItem(locSymbolicName, locVersion);
-                appVersion = "0.2.0";
-                locVersion = "1.1.0";
-                addCatalogItems(String.format(appCatalogFormat, appVersion));
-                addCatalogItems(String.format(locCatalogFormat, locVersion));
-                break;
-            case STRIP_DEPRECATION_AND_ENABLEMENT_FROM_CATALOG_ITEM:
-                // set everything false -- then below we rebind with these fields removed to ensure that we can rebind
-                CatalogUtils.setDeprecated(mgmt(), appSymbolicName, appVersion, false);
-                CatalogUtils.setDeprecated(mgmt(), locSymbolicName, locVersion, false);
-                CatalogUtils.setDisabled(mgmt(), appSymbolicName, appVersion, false);
-                CatalogUtils.setDisabled(mgmt(), locSymbolicName, locVersion, false);
-                break;
-            case NO_OP:
-                break; // no-op
-            default:
-                throw new IllegalStateException("Unknown mode: "+mode);
-        }
-
-        // Rebind
-        if (mode == RebindWithCatalogTestMode.STRIP_DEPRECATION_AND_ENABLEMENT_FROM_CATALOG_ITEM) {
-            // Edit the persisted state to remove the "deprecated" and "enablement" tags for our catalog items
-            rebind(RebindOptions.create()
-                    .stateTransformer(new Function<BrooklynMementoPersister, Void>() {
-                        @Override public Void apply(BrooklynMementoPersister input) {
-                            PersistenceObjectStore objectStore = ((BrooklynMementoPersisterToObjectStore)input).getObjectStore();
-                            StoreObjectAccessor appItemAccessor = objectStore.newAccessor("catalog/"+Strings.makeValidFilename(appItemId));
-                            StoreObjectAccessor locItemAccessor = objectStore.newAccessor("catalog/"+Strings.makeValidFilename(locItemId));
-                            String appItemMemento = checkNotNull(appItemAccessor.get(), "appItem in catalog");
-                            String locItemMemento = checkNotNull(locItemAccessor.get(), "locItem in catalog");
-                            String newAppItemMemento = removeFromXml(appItemMemento, ImmutableList.of("catalogItem/deprecated", "catalogItem/disabled"));
-                            String newLocItemMemento = removeFromXml(locItemMemento, ImmutableList.of("catalogItem/deprecated", "catalogItem/disabled"));
-                            appItemAccessor.put(newAppItemMemento);
-                            locItemAccessor.put(newLocItemMemento);
-                            return null;
-                        }}));
-        } else {
-            rebind();
-        }
-
-        // Ensure app is still there, and that it is usable - e.g. "stop" effector functions as expected
-        BasicEntity newEntity = (BasicEntity) Iterables.getOnlyElement(newApp.getChildren());
-        Policy newPolicy = Iterables.getOnlyElement(newEntity.policies());
-        Enricher newEnricher = Iterables.tryFind(newEntity.enrichers(), Predicates.instanceOf(TestEnricher.class)).get();
-        assertEquals(newEntity.getCatalogItemId(), appSymbolicName+":"+appVersion);
-
-        newApp.stop();
-        assertFalse(Entities.isManaged(newApp));
-        assertFalse(Entities.isManaged(newEntity));
-        
-        // Ensure catalog item is as expecpted
-        RegisteredType newAppItem = mgmt().getTypeRegistry().get(appSymbolicName, appVersion);
-        RegisteredType newLocItem = mgmt().getTypeRegistry().get(locSymbolicName, locVersion);
-
-        boolean itemDeployable;
-        switch (mode) {
-        case DISABLE_CATALOG:
-            assertTrue(newAppItem.isDisabled());
-            assertTrue(newLocItem.isDisabled());
-            itemDeployable = false;
-            break;
-        case DELETE_CATALOG:
-            assertNull(newAppItem);
-            assertNull(newLocItem);
-            itemDeployable = false;
-            break;
-        case DEPRECATE_CATALOG:
-            assertTrue(newAppItem.isDeprecated());
-            assertTrue(newLocItem.isDeprecated());
-            itemDeployable = true;
-            break;
-        case NO_OP:
-        case STRIP_DEPRECATION_AND_ENABLEMENT_FROM_CATALOG_ITEM:
-        case REPLACE_CATALOG_WITH_NEWER_VERSION:
-            assertNotNull(newAppItem);
-            assertNotNull(newLocItem);
-            assertFalse(newAppItem.isDeprecated());
-            assertFalse(newAppItem.isDisabled());
-            assertFalse(newLocItem.isDeprecated());
-            assertFalse(newLocItem.isDisabled());
-            itemDeployable = true;
-            break;
-        default:
-            throw new IllegalStateException("Unknown mode: "+mode);
-        }
-
-        // Try to deploy a new app
-        String yaml2 = "name: simple-app-yaml2\n" +
-                "location: \"brooklyn.catalog:"+CatalogUtils.getVersionedId(locSymbolicName, locVersion)+"\"\n" +
-                "services: \n" +
-                "- type: "+CatalogUtils.getVersionedId(appSymbolicName, appVersion);
-
-        if (itemDeployable) {
-            StartableApplication app2 = (StartableApplication) createAndStartApplication(yaml2);
-            BasicEntity entity2 = (BasicEntity) Iterables.getOnlyElement(app2.getChildren());
-            assertEquals(entity2.getCatalogItemId(), appSymbolicName+":"+appVersion);
-        } else {
-            try {
-                StartableApplication app2 = (StartableApplication) createAndStartApplication(yaml2);
-                fail();
-            } catch (Exception e) {
-                if (mode == RebindWithCatalogTestMode.DELETE_CATALOG) {
-                    if (!e.toString().contains("cannot be matched")) throw e;
-                } else {
-                    assertEquals(mode, RebindWithCatalogTestMode.DISABLE_CATALOG);
-                    if (!e.toString().contains("cannot be matched")) throw e;
-                }
-            }
-        }
-    }
-    
-    /**
-     * Given the "/"-separated path for the elements to be removed, it removes these from the xml
-     * and returns the transformed XML.
-     */
-    private String removeFromXml(String xml, List<String> elementsToRemove) {
-        try {
-            InputSource source = new InputSource(new StringReader(xml));
-            Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(source);
-
-            for (String elementToRemove : elementsToRemove) {
-                Node current = null;
-                boolean first = true;
-                for (String tag : elementToRemove.split("/")) {
-                    NodeList matches;
-                    if (first) {
-                        matches = doc.getElementsByTagName(tag);
-                        first = false;
-                    } else {
-                        matches = ((Element)current).getElementsByTagName(tag);
-                    }
-                    if (matches.getLength() > 0) {
-                        current = matches.item(0);
-                    } else {
-                        current = null;
-                        break;
-                    }
-                }
-                if (current != null) {
-                    current.getParentNode().removeChild(current);
-                }
-            }
-          
-            DOMSource domSource = new DOMSource(doc);
-            StringWriter writer = new StringWriter();
-            StreamResult result = new StreamResult(writer);
-            Transformer transformer = TransformerFactory.newInstance().newTransformer();
-            transformer.setOutputProperty(OutputKeys.INDENT, "yes");
-            transformer.transform(domSource, result);
-            
-            return writer.toString();
-          
-        } catch (Exception e) {
-            throw Exceptions.propagate(e);
-        }
-    }
-}


Mime
View raw message