Search in sources :

Example 1 with EzyPluginsStarter

use of com.tvd12.ezyfoxserver.EzyPluginsStarter in project ezyfox-server by youngmonkeys.

the class EzyPluginsStarterTest method test1.

@Test
public void test1() {
    EzyPluginsStarter starter = new EzyPluginsStarter.Builder() {

        @Override
        public EzyPluginsStarter build() {
            return new EzyPluginsStarter(this) {

                public java.util.Set<String> getPluginNames() {
                    return Sets.newHashSet("test");
                }

                public EzyPluginEntryLoader newPluginEntryLoader(String pluginName) throws Exception {
                    throw new Exception();
                }
            };
        }
    }.zoneContext(EzyZoneContextsTest.newDefaultZoneContext()).build();
    starter.start();
}
Also used : EzyPluginsStarter(com.tvd12.ezyfoxserver.EzyPluginsStarter) Test(org.testng.annotations.Test) BaseTest(com.tvd12.test.base.BaseTest)

Example 2 with EzyPluginsStarter

use of com.tvd12.ezyfoxserver.EzyPluginsStarter in project ezyfox-server by youngmonkeys.

the class EzyPluginsStarterTest method newAppEntryLoaderArgsNotNullTest.

@Test
public void newAppEntryLoaderArgsNotNullTest() {
    // given
    EzySimpleZoneContext zoneContext = EzyZoneContextsTest.newDefaultZoneContext();
    EzySimplePlugin plugin = new EzySimplePlugin();
    EzySimplePluginSetting pluginSetting = new EzySimplePluginSetting();
    pluginSetting.setName("abc");
    pluginSetting.setEntryLoader(InternalPluginEntryLoader.class);
    pluginSetting.setEntryLoaderArgs(new String[] { "Hello" });
    plugin.setSetting(pluginSetting);
    EzySimplePluginContext pluginContext = new EzySimplePluginContext();
    pluginContext.setPlugin(plugin);
    EzySimpleZoneSetting zoneSetting = new EzySimpleZoneSetting();
    EzySimplePluginsSetting pluginsSetting = new EzySimplePluginsSetting();
    pluginsSetting.setItem(pluginSetting);
    zoneSetting.setPlugins(pluginsSetting);
    zoneContext.addPluginContext(pluginSetting, pluginContext);
    EzySimpleZone zone = new EzySimpleZone();
    zone.setSetting(zoneSetting);
    zoneContext.setZone(zone);
    EzyPluginsStarter starter = new EzyPluginsStarter.Builder().zoneContext(zoneContext).build();
    // when
    starter.start();
    // then
    Asserts.assertNotNull(plugin.getEntry());
}
Also used : EzySimpleZone(com.tvd12.ezyfoxserver.EzySimpleZone) EzySimplePluginContext(com.tvd12.ezyfoxserver.context.EzySimplePluginContext) EzySimpleZoneContext(com.tvd12.ezyfoxserver.context.EzySimpleZoneContext) EzySimplePlugin(com.tvd12.ezyfoxserver.EzySimplePlugin) EzySimpleZoneSetting(com.tvd12.ezyfoxserver.setting.EzySimpleZoneSetting) EzyPluginsStarter(com.tvd12.ezyfoxserver.EzyPluginsStarter) EzySimplePluginsSetting(com.tvd12.ezyfoxserver.setting.EzySimplePluginsSetting) EzySimplePluginSetting(com.tvd12.ezyfoxserver.setting.EzySimplePluginSetting) Test(org.testng.annotations.Test) BaseTest(com.tvd12.test.base.BaseTest)

Aggregations

EzyPluginsStarter (com.tvd12.ezyfoxserver.EzyPluginsStarter)2 BaseTest (com.tvd12.test.base.BaseTest)2 Test (org.testng.annotations.Test)2 EzySimplePlugin (com.tvd12.ezyfoxserver.EzySimplePlugin)1 EzySimpleZone (com.tvd12.ezyfoxserver.EzySimpleZone)1 EzySimplePluginContext (com.tvd12.ezyfoxserver.context.EzySimplePluginContext)1 EzySimpleZoneContext (com.tvd12.ezyfoxserver.context.EzySimpleZoneContext)1 EzySimplePluginSetting (com.tvd12.ezyfoxserver.setting.EzySimplePluginSetting)1 EzySimplePluginsSetting (com.tvd12.ezyfoxserver.setting.EzySimplePluginsSetting)1 EzySimpleZoneSetting (com.tvd12.ezyfoxserver.setting.EzySimpleZoneSetting)1