Github user aledsage commented on a diff in the pull request:
https://github.com/apache/incubator-brooklyn/pull/540#discussion_r25814985
--- Diff:
core/src/test/java/brooklyn/entity/rebind/RebindCatalogItemTest.java ---
@@ -192,6 +194,23 @@ public void
testSameCatalogItemIdRemovalAndAdditionRebinds() throws Exception {
rebindAndAssertCatalogsAreEqual();
}
+ @Test
+ public void testRebindAfterItemDeprecated() {
+ String yaml =
+ "name: rebind-yaml-catalog-item-test\n" +
+ "brooklyn.catalog:\n" +
+ " version: " + TEST_VERSION + "\n" +
+ "services:\n" +
+ "- type: io.camp.mock:AppServer";
+ BasicBrooklynCatalog catalog = (BasicBrooklynCatalog)
origManagementContext.getCatalog();
+ CatalogItem<?, ?> catalogItem = catalog.addItem(yaml);
+ assertNotNull(catalogItem, "catalogItem");
+ catalogItem.setDeprecated(true);
--- End diff --
Does this need to also call `catalog.persist(catalogItem)`, after calling
`setDeprecated`? Presumably it works just now because the add + setDeprecated
happen in rapid succession, so the persister writes both changes in one go. If
you put a sleep for 2 seconds in between then I'm betting it would fail.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---