}
public void testSystemRestart() throws NoSuchMethodException {
List<Class<?>> interfaces = new ArrayList<Class<?>>();
interfaces.add(Source.class);
Source originalSource = new SourceImpl();
SystemAtomicComponent component = EasyMock.createMock(SystemAtomicComponent.class);
component.start();
component.stop();
EasyMock.expectLastCall().times(2);
EasyMock.expect(component.getName()).andReturn("source").atLeastOnce();
EasyMock.expect(component.isSystem()).andReturn(true).atLeastOnce();
EasyMock.expect(component.getServiceInstance()).andReturn(originalSource).atLeastOnce();
EasyMock.expect(component.getServiceInterfaces()).andReturn(interfaces);
EasyMock.replay(component);
CompositeComponent composite = new CompositeComponentImpl("foo", null, null, null);
composite.start();
composite.register(component);
AtomicComponent atomicComponent = (AtomicComponent) composite.getSystemChild("source");
Source source = (Source) atomicComponent.getServiceInstance();
assertNotNull(source);
composite.stop();
composite.start();
atomicComponent = (AtomicComponent) composite.getSystemChild("source");
Source source2 = (Source) atomicComponent.getServiceInstance();
assertNotNull(source2);
composite.stop();
EasyMock.verify(component);
}