use of com.alipay.sofa.isle.ApplicationRuntimeModel in project sofa-boot by alipay.
the class ModelCreatingStageTest method test.
@Test
public void test() throws Exception {
applicationContext.getBean("modelCreatingStage", ModelCreatingStage.class).process();
ApplicationRuntimeModel application = applicationContext.getBean(SofaBootConstants.APPLICATION, ApplicationRuntimeModel.class);
Assert.assertNotNull(application.getSofaRuntimeContext());
}
use of com.alipay.sofa.isle.ApplicationRuntimeModel in project sofa-boot by alipay.
the class IsleBeanEndpointTest method testBeans.
@Test
public void testBeans() {
ConfigurableApplicationContext context = new ClassPathXmlApplicationContext();
context.setId("bootstrap");
context.refresh();
ApplicationRuntimeModel model = new ApplicationRuntimeModel();
model.addInstalled(new MockDeploymentDescriptor("A"));
model.addInstalled(new MockDeploymentDescriptor("B"));
context.getBeanFactory().registerSingleton(SofaBootConstants.APPLICATION, model);
IsleBeansEndpoint isleBeansEndpoint = new IsleBeansEndpoint(context);
BeansEndpoint.ApplicationBeans applicationBeans = isleBeansEndpoint.beans();
Assert.assertNotNull(applicationBeans);
Map<String, BeansEndpoint.ContextBeans> beansMap = applicationBeans.getContexts();
Assert.assertNotNull(beansMap);
Assert.assertEquals(3, beansMap.size());
Assert.assertNotNull(beansMap.get("bootstrap"));
BeansEndpoint.ContextBeans contextBeansA = beansMap.get("isle-module-A");
Assert.assertNotNull(contextBeansA);
Assert.assertEquals("isle-module-parentA", contextBeansA.getParentId());
Assert.assertTrue(contextBeansA.getBeans().toString().contains("com.alipay.sofa.boot.actuator.beans.IsleBeanEndpointTest$TestBean"));
BeansEndpoint.ContextBeans contextBeansB = beansMap.get("isle-module-B");
Assert.assertNotNull(contextBeansB);
Assert.assertEquals("isle-module-parentB", contextBeansB.getParentId());
Assert.assertTrue(contextBeansB.getBeans().toString().contains("com.alipay.sofa.boot.actuator.beans.IsleBeanEndpointTest$TestBean"));
}
use of com.alipay.sofa.isle.ApplicationRuntimeModel in project sofa-boot by sofastack.
the class IsleBeansEndpoint method beans.
@ReadOperation
@Override
public ApplicationBeans beans() {
ApplicationBeans applicationBeans = super.beans();
ApplicationRuntimeModel applicationRuntimeModel = context.getBean(SofaBootConstants.APPLICATION, ApplicationRuntimeModel.class);
Map<String, ContextBeans> moduleApplicationContexts = getModuleApplicationContexts(applicationRuntimeModel);
applicationBeans.getContexts().putAll(moduleApplicationContexts);
return applicationBeans;
}
use of com.alipay.sofa.isle.ApplicationRuntimeModel in project sofa-boot by sofastack.
the class ModelCreatingStage method doProcess.
@Override
protected void doProcess() throws Exception {
ApplicationRuntimeModel application = new ApplicationRuntimeModel();
application.setAppName(appName);
SofaRuntimeManager sofaRuntimeManager = applicationContext.getBean(SofaRuntimeManager.class);
application.setSofaRuntimeContext(sofaRuntimeManager.getSofaRuntimeContext());
application.setModuleDeploymentValidator(new DefaultModuleDeploymentValidator());
getAllDeployments(application);
applicationContext.getBeanFactory().registerSingleton(SofaBootConstants.APPLICATION, application);
}
use of com.alipay.sofa.isle.ApplicationRuntimeModel in project sofa-boot by sofastack.
the class ModuleLogOutputStage method doProcess.
@Override
protected void doProcess() throws Exception {
ApplicationRuntimeModel application = applicationContext.getBean(SofaBootConstants.APPLICATION, ApplicationRuntimeModel.class);
StringBuilder stringBuilder = new StringBuilder();
logInstalledModules(stringBuilder, application.getInstalled());
logFailedModules(stringBuilder, application.getFailed());
logInfoBeanCost(stringBuilder, application.getInstalled());
SofaLogger.info(stringBuilder.toString());
}
Aggregations