.get());
*/
final Component car_engine = yan.getComponentOfType(CarEngine.class);
assertNull(car_engine.getType());
final StatefulResource resource = (StatefulResource)yan.getInstanceOfType(StatefulResource.class);
final CarEngine engine = (CarEngine)yan.getInstanceOfType(CarEngine.class);
assertEquals(0, engine.getStarted());
assertEquals(0, engine.getStopped());
assertEquals(0, engine.getInit());
assertEquals(0, engine.getDisposed());
assertEquals(0, resource.getInitCount());
assertEquals(0, resource.getDestroyedCount());
//new DefaultLifecycle(yan).init();
lm.init();
assertEquals(0, engine.getStarted());
assertEquals(0, engine.getStopped());
assertEquals(1, engine.getInit());
assertEquals(0, engine.getDisposed());
assertEquals(1, resource.getInitCount());
assertEquals(0, resource.getDestroyedCount());
try{
//new DefaultLifecycle(yan).start();
lm.start();
fail("should have failed with unsupported");
}
catch(UnsupportedOperationException e){
assertEquals("start", e.getMessage());
}
assertEquals(1, engine.getStarted());
assertEquals(0, engine.getStopped());
assertEquals(1, engine.getInit());
assertEquals(0, engine.getDisposed());
assertEquals(1, resource.getInitCount());
assertEquals(0, resource.getDestroyedCount());
//new DefaultLifecycle(yan).init();
lm.init();
assertEquals(1, engine.getStarted());
assertEquals(0, engine.getStopped());
assertEquals(1, engine.getInit());
assertEquals(0, engine.getDisposed());
assertEquals(1, resource.getInitCount());
assertEquals(0, resource.getDestroyedCount());
//new DefaultLifecycle(yan).stop();
lm.stop();
assertEquals(1, engine.getStarted());
assertEquals(1, engine.getStopped());
assertEquals(1, engine.getInit());
assertEquals(0, engine.getDisposed());
assertEquals(1, resource.getInitCount());
assertEquals(0, resource.getDestroyedCount());
//final DefaultLifecycle lc = new DefaultLifecycle(yan);
//lc.dispose();
lm.dispose();
assertEquals(1, engine.getStarted());
assertEquals(1, engine.getStopped());
assertEquals(1, engine.getInit());
assertEquals(1, engine.getDisposed());
assertEquals(1, resource.getInitCount());
assertEquals(1, resource.getDestroyedCount());
try{
//lc.start();
lm.start();
fail("should have failed with unsupported");
}
catch(UnsupportedOperationException e){
assertEquals("start", e.getMessage());
}
assertEquals(2, engine.getStarted());
assertEquals(1, engine.getStopped());
assertEquals(1, engine.getInit());
assertEquals(1, engine.getDisposed());
assertEquals(1, resource.getInitCount());
assertEquals(1, resource.getDestroyedCount());
//lc.stop();
lm.stop();
assertEquals(2, engine.getStarted());
assertEquals(2, engine.getStopped());
assertEquals(1, engine.getInit());
assertEquals(1, engine.getDisposed());
assertEquals(1, resource.getInitCount());
assertEquals(1, resource.getDestroyedCount());
/*
lc.dispose();
assertEquals(1, engine.getStarted());
assertEquals(1, engine.getStopped());