Search in sources :

Example 1 with RegistryService

use of com.alipay.sofa.ark.spi.service.registry.RegistryService in project sofa-ark by alipay.

the class InjectionServiceTest method test.

@Test
public void test() {
    RegistryService registryService = ArkServiceContainerHolder.getContainer().getService(RegistryService.class);
    PluginMockService pluginMockService = new PluginMockService();
    registryService.publishService(PluginMockService.class, pluginMockService, new ContainerServiceProvider());
    Assert.assertNotNull(pluginMockService.getBizFactoryService());
    Assert.assertNotNull(pluginMockService.getBizManagerService());
    Assert.assertNull(pluginMockService.getClassLoaderService());
}
Also used : ContainerServiceProvider(com.alipay.sofa.ark.container.registry.ContainerServiceProvider) RegistryService(com.alipay.sofa.ark.spi.service.registry.RegistryService) BaseTest(com.alipay.sofa.ark.container.BaseTest) Test(org.junit.Test)

Example 2 with RegistryService

use of com.alipay.sofa.ark.spi.service.registry.RegistryService in project sofa-ark by alipay.

the class CommandHandlerTest method test.

@Test
public void test() {
    ArkCommandHandler arkCommandHandler = new ArkCommandHandler();
    RegistryService registryService = ArkServiceContainerHolder.getContainer().getService(RegistryService.class);
    registryService.publishService(CommandProvider.class, new MockCommandProvider(), new ContainerServiceProvider());
    Assert.assertTrue(arkCommandHandler.handleCommand("any").contains("mock help"));
    Assert.assertTrue("mock command provider".equals(arkCommandHandler.handleCommand("mock")));
}
Also used : ArkCommandHandler(com.alipay.sofa.ark.container.session.handler.ArkCommandHandler) ContainerServiceProvider(com.alipay.sofa.ark.container.registry.ContainerServiceProvider) RegistryService(com.alipay.sofa.ark.spi.service.registry.RegistryService) BaseTest(com.alipay.sofa.ark.container.BaseTest) Test(org.junit.Test)

Example 3 with RegistryService

use of com.alipay.sofa.ark.spi.service.registry.RegistryService in project sofa-ark by alipay.

the class RegistryServiceTest method before.

@Before
public void before() {
    ArkServiceContainer arkServiceContainer = new ArkServiceContainer();
    arkServiceContainer.start();
    registryService = ArkServiceContainerHolder.getContainer().getService(RegistryService.class);
    pluginManagerService = ArkServiceContainerHolder.getContainer().getService(PluginManagerService.class);
    pluginDeployService = ArkServiceContainerHolder.getContainer().getService(PluginDeployService.class);
    classloaderService = ArkServiceContainerHolder.getContainer().getService(ClassloaderService.class);
}
Also used : PluginManagerService(com.alipay.sofa.ark.spi.service.plugin.PluginManagerService) PluginDeployService(com.alipay.sofa.ark.spi.service.plugin.PluginDeployService) RegistryService(com.alipay.sofa.ark.spi.service.registry.RegistryService) ClassloaderService(com.alipay.sofa.ark.spi.service.classloader.ClassloaderService) ArkServiceContainer(com.alipay.sofa.ark.container.service.ArkServiceContainer) Before(org.junit.Before)

Aggregations

RegistryService (com.alipay.sofa.ark.spi.service.registry.RegistryService)3 BaseTest (com.alipay.sofa.ark.container.BaseTest)2 ContainerServiceProvider (com.alipay.sofa.ark.container.registry.ContainerServiceProvider)2 Test (org.junit.Test)2 ArkServiceContainer (com.alipay.sofa.ark.container.service.ArkServiceContainer)1 ArkCommandHandler (com.alipay.sofa.ark.container.session.handler.ArkCommandHandler)1 ClassloaderService (com.alipay.sofa.ark.spi.service.classloader.ClassloaderService)1 PluginDeployService (com.alipay.sofa.ark.spi.service.plugin.PluginDeployService)1 PluginManagerService (com.alipay.sofa.ark.spi.service.plugin.PluginManagerService)1 Before (org.junit.Before)1