Search in sources :

Example 1 with HandleArchiveStage

use of com.alipay.sofa.ark.container.pipeline.HandleArchiveStage in project sofa-ark by alipay.

the class HandleArchiveTest method testIncludePlugin.

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

Example 2 with HandleArchiveStage

use of com.alipay.sofa.ark.container.pipeline.HandleArchiveStage in project sofa-ark by alipay.

the class HandleArchiveTest method testIncludeExcludeBiz.

@Test
public void testIncludeExcludeBiz() {
    try {
        HandleArchiveStage handleArchiveStage = new HandleArchiveStage();
        System.setProperty(BIZ_ACTIVE_INCLUDE, "bizA:1.0.0");
        System.setProperty(BIZ_ACTIVE_EXCLUDE, "bizA:1.0.0,BizB:1.0.0");
        BizModel bizModel = new BizModel();
        bizModel.setBizName("bizA").setBizVersion("1.0.0");
        Assert.assertFalse(handleArchiveStage.isBizExcluded(bizModel));
        bizModel.setBizName("bizB");
        Assert.assertTrue(handleArchiveStage.isBizExcluded(bizModel));
        bizModel.setBizName("bizC");
        Assert.assertTrue(handleArchiveStage.isBizExcluded(bizModel));
    } finally {
        System.clearProperty(BIZ_ACTIVE_INCLUDE);
        System.clearProperty(BIZ_ACTIVE_EXCLUDE);
    }
}
Also used : HandleArchiveStage(com.alipay.sofa.ark.container.pipeline.HandleArchiveStage) BizModel(com.alipay.sofa.ark.container.model.BizModel) Test(org.junit.Test)

Example 3 with HandleArchiveStage

use of com.alipay.sofa.ark.container.pipeline.HandleArchiveStage in project sofa-ark by alipay.

the class HandleArchiveTest method testIncludeExcludePlugin.

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

Example 4 with HandleArchiveStage

use of com.alipay.sofa.ark.container.pipeline.HandleArchiveStage in project sofa-ark by alipay.

the class HandleArchiveTest method testNoIncludeExcludeBiz.

@Test
public void testNoIncludeExcludeBiz() {
    HandleArchiveStage handleArchiveStage = new HandleArchiveStage();
    PluginModel pluginModel = new PluginModel();
    pluginModel.setPluginName("pluginA");
    Assert.assertFalse(handleArchiveStage.isPluginExcluded(pluginModel));
    pluginModel.setPluginName("pluginB");
    Assert.assertFalse(handleArchiveStage.isPluginExcluded(pluginModel));
}
Also used : PluginModel(com.alipay.sofa.ark.container.model.PluginModel) HandleArchiveStage(com.alipay.sofa.ark.container.pipeline.HandleArchiveStage) Test(org.junit.Test)

Example 5 with HandleArchiveStage

use of com.alipay.sofa.ark.container.pipeline.HandleArchiveStage in project sofa-ark by alipay.

the class HandleArchiveTest method testIncludeBiz.

@Test
public void testIncludeBiz() {
    try {
        HandleArchiveStage handleArchiveStage = new HandleArchiveStage();
        System.setProperty(BIZ_ACTIVE_INCLUDE, "bizA:1.0.0");
        BizModel bizModel = new BizModel();
        bizModel.setBizName("bizA").setBizVersion("1.0.0");
        Assert.assertFalse(handleArchiveStage.isBizExcluded(bizModel));
        bizModel.setBizName("pluginB");
        Assert.assertTrue(handleArchiveStage.isBizExcluded(bizModel));
        bizModel.setBizName("pluginC");
        Assert.assertTrue(handleArchiveStage.isBizExcluded(bizModel));
    } finally {
        System.clearProperty(BIZ_ACTIVE_INCLUDE);
    }
}
Also used : HandleArchiveStage(com.alipay.sofa.ark.container.pipeline.HandleArchiveStage) BizModel(com.alipay.sofa.ark.container.model.BizModel) Test(org.junit.Test)

Aggregations

HandleArchiveStage (com.alipay.sofa.ark.container.pipeline.HandleArchiveStage)8 Test (org.junit.Test)8 BizModel (com.alipay.sofa.ark.container.model.BizModel)4 PluginModel (com.alipay.sofa.ark.container.model.PluginModel)4