@Test public void testRebindAfterItemDeprecated() { String symbolicName = "rebind-yaml-catalog-item-test"; String yaml = Joiner.on("\n") .join( "brooklyn.catalog:", " items:", " - id: " + symbolicName, " version: " + TEST_VERSION, " itemType: entity", " item:", " type: io.camp.mock:AppServer"); CatalogEntityItemDto item = CatalogItemBuilder.newEntity(symbolicName, TEST_VERSION) .displayName(symbolicName) .plan(yaml) .build(); origManagementContext.getCatalog().addItem(item); assertNotNull(item, "catalogItem"); BasicBrooklynCatalog catalog = (BasicBrooklynCatalog) origManagementContext.getCatalog(); item.setDeprecated(true); catalog.persist(item); rebindAndAssertCatalogsAreEqual(); RegisteredType catalogItemAfterRebind = newManagementContext.getTypeRegistry().get("rebind-yaml-catalog-item-test", TEST_VERSION); assertTrue(catalogItemAfterRebind.isDeprecated(), "Expected item to be deprecated"); }
@Test public void testAddAndRebindEntityLegacyFormat() throws Exception { String symbolicName = "rebind-yaml-catalog-item-test"; String yaml = "name: " + symbolicName + "\n" + "brooklyn.catalog:\n" + " version: " + TEST_VERSION + "\n" + "services:\n" + "- type: io.camp.mock:AppServer"; CatalogEntityItemDto item = CatalogItemBuilder.newEntity(symbolicName, TEST_VERSION) .displayName(symbolicName) .plan(yaml) .build(); origManagementContext.getCatalog().addItem(item); LOG.info("Added item to catalog: {}, id={}", item, item.getId()); rebindAndAssertCatalogsAreEqual(); }
@Test public void testAddAndRebindEntity() throws Exception { String symbolicName = "rebind-yaml-catalog-item-test"; String yaml = Joiner.on("\n") .join( "brooklyn.catalog:", " items:", " - id: " + symbolicName, " version: " + TEST_VERSION, " itemType: entity", " item:", " type: io.camp.mock:AppServer"); CatalogEntityItemDto item = CatalogItemBuilder.newEntity(symbolicName, TEST_VERSION) .displayName(symbolicName) .plan(yaml) .build(); origManagementContext.getCatalog().addItem(item); LOG.info("Added item to catalog: {}, id={}", item, item.getId()); rebindAndAssertCatalogsAreEqual(); }