use of com.ctrip.xpipe.lifecycle.DefaultRegistry in project x-pipe by ctripcorp.
the class AbstractTest method beforeAbstractTest.
@Before
public void beforeAbstractTest() throws Exception {
ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.PARANOID);
// clear interrupt
Thread.interrupted();
executors = Executors.newCachedThreadPool(XpipeThreadFactory.create(getTestName()));
scheduled = Executors.newScheduledThreadPool(OsUtils.getCpuCount(), XpipeThreadFactory.create(getTestName()));
orginProperties = (Properties) System.getProperties().clone();
doBeforeAbstractTest();
logger.info(remarkableMessage("[begin test][{}]"), name.getMethodName());
componentRegistry = new DefaultRegistry(new CreatedComponentRedistry(), getSpringRegistry());
startedComponentRegistry = new CreatedComponentRedistry();
startedComponentRegistry.initialize();
startedComponentRegistry.start();
Thread.setDefaultUncaughtExceptionHandler(new DefaultExceptionHandler());
InputStream fins = getClass().getClassLoader().getResourceAsStream("xpipe-test.properties");
try {
properties.load(fins);
} finally {
if (fins != null) {
fins.close();
}
}
File file = new File(getTestFileDir());
if (file.exists() && deleteTestDirBeforeTest()) {
deleteTestDir();
}
if (!file.exists()) {
boolean testSucceed = file.mkdirs();
if (!testSucceed) {
throw new IllegalStateException("test dir make failed!" + file);
}
}
}
use of com.ctrip.xpipe.lifecycle.DefaultRegistry 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.DefaultRegistry 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;
}
Aggregations