use of com.alipay.sofa.ark.container.service.extension.spi.impl.ServiceBImpl3 in project sofa-ark by alipay.
the class ExtensionServiceTest method testExtensionServiceLoader.
@Test
public void testExtensionServiceLoader() {
PluginManagerService pluginManagerService = ArkServiceContainerHolder.getContainer().getService(PluginManagerService.class);
PluginModel pluginModel = new PluginModel().setPluginClassLoader(this.getClass().getClassLoader()).setPluginName("mock-plugin");
pluginManagerService.registerPlugin(pluginModel);
ServiceB impl1 = ArkServiceLoader.loadExtensionFromArkPlugin(ServiceB.class, "type1", "mock-plugin");
Assert.assertTrue(impl1 instanceof ServiceBImpl3);
ServiceB impl2 = ArkServiceLoader.loadExtensionFromArkPlugin(ServiceB.class, "type2", "mock-plugin");
Assert.assertTrue(impl2 instanceof ServiceBImpl4);
ServiceB impl3 = ArkServiceLoader.loadExtensionFromArkPlugin(ServiceB.class, "type1", "mock-plugin");
Assert.assertTrue(impl3 instanceof ServiceBImpl3);
ServiceB impl4 = ArkServiceLoader.loadExtensionFromArkPlugin(ServiceB.class, "type2", "mock-plugin");
Assert.assertTrue(impl4 instanceof ServiceBImpl4);
Assert.assertFalse(impl1 == impl3);
Assert.assertFalse(impl2 == impl4);
}
Aggregations