### Question:
CatalogResource extends AbstractBrooklynRestResource implements CatalogApi { @SuppressWarnings("deprecation") @Override public void setDisabled(String itemId, boolean disabled) { if (!Entitlements.isEntitled(mgmt().getEntitlementManager(), Entitlements.MODIFY_CATALOG_ITEM, StringAndArgument.of(itemId, "disabled"))) { throw WebResourceUtils.unauthorized("User '%s' is not authorized to modify catalog", Entitlements.getEntitlementContext().user()); } CatalogUtils.setDisabled(mgmt(), itemId, disabled); }  @Override @Consumes(MediaType.MULTIPART_FORM_DATA) Response createFromMultipart(InputStream uploadedInputStream, FormDataContentDisposition fileDetail); @Override Response create(String yaml); @SuppressWarnings("deprecation") @Override Response resetXml(String xml, boolean ignoreErrors); @Override @Deprecated void deleteEntity(String entityId); @Override void deleteApplication(String symbolicName, String version); @Override void deleteEntity(String symbolicName, String version); @Override void deletePolicy(String policyId, String version); @Override void deleteLocation(String locationId, String version); @Override List<CatalogEntitySummary> listEntities(String regex, String fragment, boolean allVersions); @Override List<CatalogItemSummary> listApplications(String regex, String fragment, boolean allVersions); @Override @Deprecated CatalogEntitySummary getEntity(String entityId); @Override CatalogEntitySummary getEntity(String symbolicName, String version); @Override @Deprecated CatalogEntitySummary getApplication(String applicationId); @Override CatalogEntitySummary getApplication(String symbolicName, String version); @Override List<CatalogPolicySummary> listPolicies(String regex, String fragment, boolean allVersions); @Override @Deprecated CatalogPolicySummary getPolicy(String policyId); @Override CatalogPolicySummary getPolicy(String policyId, String version); @Override List<CatalogLocationSummary> listLocations(String regex, String fragment, boolean allVersions); @Override @Deprecated CatalogLocationSummary getLocation(String locationId); @Override CatalogLocationSummary getLocation(String locationId, String version); @Override @Deprecated Response getIcon(String itemId); @Override Response getIcon(String itemId, String version); @Override void setDeprecatedLegacy(String itemId, boolean deprecated); @SuppressWarnings("deprecation") @Override void setDeprecated(String itemId, boolean deprecated); @SuppressWarnings("deprecation") @Override void setDisabled(String itemId, boolean disabled);  }### Answer:
@Test public void testSetDisabled() { String symbolicName = "my.catalog.item.id.for.disabling"; String serviceType = "org.apache.brooklyn.entity.stock.BasicApplication"; addTestCatalogItem(symbolicName, "template", TEST_VERSION, serviceType); addTestCatalogItem(symbolicName, "template", "2.0", serviceType); try { List<CatalogEntitySummary> applications = client().resource("/v1/catalog/applications") .queryParam("fragment", symbolicName).queryParam("allVersions", "true").get(new GenericType<List<CatalogEntitySummary>>() {}); assertEquals(applications.size(), 2); CatalogItemSummary summary0 = applications.get(0); CatalogItemSummary summary1 = applications.get(1); disableCatalogItem(summary0.getSymbolicName(), summary0.getVersion(), true); List<CatalogEntitySummary> applicationsAfterDisabled = client().resource("/v1/catalog/applications") .queryParam("fragment", "basicapp").queryParam("allVersions", "true").get(new GenericType<List<CatalogEntitySummary>>() {}); assertEquals(applicationsAfterDisabled.size(), 1); assertTrue(applicationsAfterDisabled.contains(summary1)); disableCatalogItem(summary0.getSymbolicName(), summary0.getVersion(), false); List<CatalogEntitySummary> applicationsAfterUnDisabled = client().resource("/v1/catalog/applications") .queryParam("fragment", "basicapp").queryParam("allVersions", "true").get(new GenericType<List<CatalogEntitySummary>>() {}); assertEquals(applications, applicationsAfterUnDisabled); } finally { client().resource("/v1/catalog/entities/"+symbolicName+"/"+TEST_VERSION) .delete(ClientResponse.class); client().resource("/v1/catalog/entities/"+symbolicName+"/"+"2.0") .delete(ClientResponse.class); } }