@Test(timeout = 5000)
public void testPreShutdownIsCalled() throws Exception
{
Furnace furnace = LocalServices.getFurnace(getClass().getClassLoader());
AddonRegistry registry = furnace.getAddonRegistry();
Addon dep2 = registry.getAddon(AddonId.from("dep2", "2"));
RecordingEventManager manager = registry.getServices(RecordingEventManager.class).get();
Assert.assertEquals(3, manager.getPostStartupCount());
MutableAddonRepository repository = (MutableAddonRepository) furnace.getRepositories().get(0);
repository.disable(dep2.getId());
Addons.waitUntilStopped(dep2);
Assert.assertEquals(1, manager.getPreShutdownCount());