@Override protected LocalManagementContext createOrigManagementContext() { BrooklynProperties properties = BrooklynProperties.Factory.newDefault(); properties.put( BrooklynServerConfig.BROOKLYN_CATALOG_URL, "classpath://brooklyn/entity/rebind/rebind-catalog-item-test-catalog.xml"); properties.put( BrooklynServerConfig.CATALOG_LOAD_MODE, org.apache.brooklyn.core.catalog.CatalogLoadMode.LOAD_BROOKLYN_CATALOG_URL); return RebindTestUtils.managementContextBuilder(mementoDir, classLoader) .properties(properties) .persistPeriodMillis(getPersistPeriodMillis()) .forLive(useLiveManagementContext()) .buildStarted(); }
@Test public void testAddUsageListenerViaProperties() throws Exception { BrooklynProperties brooklynProperties = BrooklynProperties.Factory.newEmpty(); brooklynProperties.put( UsageManager.USAGE_LISTENERS, RecordingStaticUsageListener.class.getName()); mgmt = LocalManagementContextForTests.newInstance(brooklynProperties); assertUsageListenerCalledWhenApplicationStarted(); }
@Override protected LocalManagementContext newTestManagementContext() { ResourceUtils ru = new ResourceUtils(this); File jar = createJar(ru); File catalog = createCatalog(ru, jar); BrooklynProperties properties = BrooklynProperties.Factory.newEmpty(); properties.put(BrooklynServerConfig.BROOKLYN_CATALOG_URL, catalog.toURI().toString()); return LocalManagementContextForTests.builder(true) .useProperties(properties) .disableOsgi(false) .build(); }
@Override protected LocalManagementContext createNewManagementContext( File mementoDir, HighAvailabilityMode haMode) { BrooklynProperties properties = BrooklynProperties.Factory.newDefault(); properties.put( BrooklynServerConfig.BROOKLYN_CATALOG_URL, "classpath://brooklyn/entity/rebind/rebind-catalog-item-test-catalog.xml"); return RebindTestUtils.managementContextBuilder(mementoDir, classLoader) .properties(properties) .forLive(useLiveManagementContext()) .haMode(haMode) .emptyCatalog(useEmptyCatalog()) .buildUnstarted(); }
@Test(expectedExceptions = ClassCastException.class) public void testErrorWhenConfiguredClassIsNotAUsageListener() { BrooklynProperties brooklynProperties = BrooklynProperties.Factory.newEmpty(); brooklynProperties.put(UsageManager.USAGE_LISTENERS, Integer.class.getName()); mgmt = LocalManagementContextForTests.newInstance(brooklynProperties); }
@Override public <T> Object put(ConfigKey<T> key, T value) { return delegate.put(key, value); }
@Override public Object put(Object key, Object value) { return delegate.put(key, value); }