@Test public void testAddUsageListenerViaProperties() throws Exception { BrooklynProperties brooklynProperties = BrooklynProperties.Factory.newEmpty(); brooklynProperties.put( UsageManager.USAGE_LISTENERS, RecordingStaticUsageListener.class.getName()); mgmt = LocalManagementContextForTests.newInstance(brooklynProperties); assertUsageListenerCalledWhenApplicationStarted(); }
@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 protected LocalManagementContext newTestManagementContext() { // Don't need OSGi return LocalManagementContextForTests.newInstance(); }