Search in sources :

Example 31 with ComponentManager

use of com.alipay.sofa.runtime.spi.component.ComponentManager in project sofa-boot by sofastack.

the class IsleSpringComponentTest method test.

@Test
public void test() {
    ComponentManager componentManager = sofaRuntimeContext.getComponentManager();
    ComponentName componentName1 = ComponentNameFactory.createComponentName(SpringContextComponent.SPRING_COMPONENT_TYPE, "com.alipay.sofa.isle.module1");
    ComponentName componentName2 = ComponentNameFactory.createComponentName(SpringContextComponent.SPRING_COMPONENT_TYPE, "com.alipay.sofa.isle.module2");
    Assert.assertNotNull(componentManager.getComponentInfo(componentName1));
    Assert.assertNotNull(componentManager.getComponentInfo(componentName2));
    Assert.assertEquals("com.alipay.sofa.isle.module1", componentManager.getComponentInfo(componentName1).getApplicationContext().getId());
    Assert.assertEquals("com.alipay.sofa.isle.module2", componentManager.getComponentInfo(componentName2).getApplicationContext().getId());
}
Also used : ComponentManager(com.alipay.sofa.runtime.spi.component.ComponentManager) ComponentName(com.alipay.sofa.runtime.api.component.ComponentName) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

ComponentManager (com.alipay.sofa.runtime.spi.component.ComponentManager)31 ComponentInfo (com.alipay.sofa.runtime.spi.component.ComponentInfo)26 Test (org.junit.Test)14 ComponentName (com.alipay.sofa.runtime.api.component.ComponentName)10 GenericApplicationContext (org.springframework.context.support.GenericApplicationContext)10 JvmBinding (com.alipay.sofa.runtime.service.binding.JvmBinding)8 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)8 ReferenceComponent (com.alipay.sofa.runtime.service.component.ReferenceComponent)6 Binding (com.alipay.sofa.runtime.spi.binding.Binding)4 DefaultImplementation (com.alipay.sofa.runtime.spi.component.DefaultImplementation)4 SofaRuntimeContext (com.alipay.sofa.runtime.spi.component.SofaRuntimeContext)4 ServiceRuntimeException (com.alipay.sofa.runtime.api.ServiceRuntimeException)3 ComponentLifeCycle (com.alipay.sofa.runtime.api.component.ComponentLifeCycle)2 ComponentType (com.alipay.sofa.runtime.model.ComponentType)2 ServiceComponent (com.alipay.sofa.runtime.service.component.ServiceComponent)2 SpringImplementationImpl (com.alipay.sofa.runtime.spi.spring.SpringImplementationImpl)2 SpringContextComponent (com.alipay.sofa.runtime.spring.SpringContextComponent)2 SpringContextImplementation (com.alipay.sofa.runtime.spring.SpringContextImplementation)2 SampleService (com.alipay.sofa.runtime.test.beans.facade.SampleService)2 DefaultSampleService (com.alipay.sofa.runtime.test.beans.service.DefaultSampleService)2