use of com.ctrip.xpipe.lifecycle.SpringComponentRegistry in project x-pipe by ctripcorp.
the class AppTest method initComponentRegistry.
private void initComponentRegistry(ConfigurableApplicationContext context) throws Exception {
ComponentRegistry registry = new DefaultRegistry(new CreatedComponentRedistry(), new SpringComponentRegistry(context));
registry.initialize();
registry.start();
ComponentRegistryHolder.initializeRegistry(registry);
}
use of com.ctrip.xpipe.lifecycle.SpringComponentRegistry in project x-pipe by ctripcorp.
the class KeeperContainerApplication method initComponentRegistry.
private static ComponentRegistry initComponentRegistry(ConfigurableApplicationContext context) throws Exception {
final ComponentRegistry registry = new DefaultRegistry(new CreatedComponentRedistry(), new SpringComponentRegistry(context));
registry.initialize();
registry.start();
ComponentRegistryHolder.initializeRegistry(registry);
return registry;
}
use of com.ctrip.xpipe.lifecycle.SpringComponentRegistry in project x-pipe by ctripcorp.
the class SpringComponentRegistryTest method test.
@Test
public void test() throws Exception {
ConfigurableApplicationContext applicationContext = new AnnotationConfigApplicationContext(TestFactory.class);
ComponentRegistry componentRegistry = new SpringComponentRegistry(applicationContext);
componentRegistry.initialize();
componentRegistry.start();
Map<String, Lifecycle> objects = componentRegistry.getComponents(Lifecycle.class);
for (Lifecycle lifecycle : objects.values()) {
if (lifecycle instanceof TopElement) {
Assert.assertTrue(lifecycle.getLifecycleState().isStarted());
} else {
Assert.assertTrue(lifecycle.getLifecycleState().isEmpty());
}
}
}
Aggregations