Search in sources :

Example 46 with PluginModel

use of com.alipay.sofa.ark.container.model.PluginModel in project sofa-ark by alipay.

the class HandleArchiveTest method testExcludePlugin.

@Test
public void testExcludePlugin() {
    try {
        HandleArchiveStage handleArchiveStage = new HandleArchiveStage();
        System.setProperty(PLUGIN_ACTIVE_EXCLUDE, "pluginA,pluginB");
        PluginModel pluginModel = new PluginModel();
        pluginModel.setPluginName("pluginA");
        Assert.assertTrue(handleArchiveStage.isPluginExcluded(pluginModel));
        pluginModel.setPluginName("pluginB");
        Assert.assertTrue(handleArchiveStage.isPluginExcluded(pluginModel));
        pluginModel.setPluginName("pluginC");
        Assert.assertFalse(handleArchiveStage.isPluginExcluded(pluginModel));
    } finally {
        System.clearProperty(PLUGIN_ACTIVE_EXCLUDE);
    }
}
Also used : PluginModel(com.alipay.sofa.ark.container.model.PluginModel) HandleArchiveStage(com.alipay.sofa.ark.container.pipeline.HandleArchiveStage) Test(org.junit.Test)

Example 47 with PluginModel

use of com.alipay.sofa.ark.container.model.PluginModel in project sofa-ark by alipay.

the class PluginManagerServiceTest method testGetAllPluginNames.

@Test
public void testGetAllPluginNames() {
    PluginModel pluginA = new PluginModel();
    pluginA.setPluginName("plugin A");
    pluginManagerService.registerPlugin(pluginA);
    PluginModel pluginB = new PluginModel();
    pluginB.setPluginName("plugin B");
    pluginManagerService.registerPlugin(pluginB);
    Assert.assertTrue(pluginManagerService.getAllPluginNames().contains(pluginA.getPluginName()));
    Assert.assertTrue(pluginManagerService.getAllPluginNames().contains(pluginB.getPluginName()));
    Assert.assertEquals(2, pluginManagerService.getAllPluginNames().size());
}
Also used : PluginModel(com.alipay.sofa.ark.container.model.PluginModel) Test(org.junit.Test)

Aggregations

PluginModel (com.alipay.sofa.ark.container.model.PluginModel)47 Test (org.junit.Test)42 BaseTest (com.alipay.sofa.ark.container.BaseTest)34 ITest (com.alipay.sofa.ark.container.testdata.ITest)25 URL (java.net.URL)16 PluginContextImpl (com.alipay.sofa.ark.container.model.PluginContextImpl)9 HashSet (java.util.HashSet)9 BizModel (com.alipay.sofa.ark.container.model.BizModel)8 PluginClassLoader (com.alipay.sofa.ark.container.service.classloader.PluginClassLoader)7 Plugin (com.alipay.sofa.ark.spi.model.Plugin)7 TestObjectA (com.alipay.sofa.ark.container.testdata.impl.TestObjectA)5 PluginManagerService (com.alipay.sofa.ark.spi.service.plugin.PluginManagerService)5 ArkContainerTest (com.alipay.sofa.ark.container.ArkContainerTest)4 HandleArchiveStage (com.alipay.sofa.ark.container.pipeline.HandleArchiveStage)4 URLClassLoader (java.net.URLClassLoader)4 Attributes (java.util.jar.Attributes)4 DefaultServiceFilter (com.alipay.sofa.ark.container.registry.DefaultServiceFilter)3 PluginServiceProvider (com.alipay.sofa.ark.container.registry.PluginServiceProvider)3 ArkRuntimeException (com.alipay.sofa.ark.exception.ArkRuntimeException)3 ContainerServiceProvider (com.alipay.sofa.ark.container.registry.ContainerServiceProvider)2