use of com.tvd12.ezyfoxserver.context.EzySimpleAppContext in project ezyfox-server by youngmonkeys.
the class EzyAppsStarterTest method newAppEntryLoaderClassLoaderIsNull.
@Test
public void newAppEntryLoaderClassLoaderIsNull() {
// given
Map<String, ClassLoader> loaders = new ConcurrentHashMap<>();
EzySimpleZoneContext zoneContext = EzyZoneContextsTest.newDefaultZoneContext();
EzySimpleApplication app = new EzySimpleApplication();
EzySimpleAppSetting appSetting = new EzySimpleAppSetting();
appSetting.setName("abc");
app.setSetting(appSetting);
EzySimpleAppContext appContext = new EzySimpleAppContext();
appContext.setApp(app);
EzySimpleZoneSetting zoneSetting = new EzySimpleZoneSetting();
EzySimpleAppsSetting appsSetting = new EzySimpleAppsSetting();
appsSetting.setItem(appSetting);
zoneSetting.setApplications(appsSetting);
zoneContext.addAppContext(appSetting, appContext);
EzySimpleZone zone = new EzySimpleZone();
zone.setSetting(zoneSetting);
zoneContext.setZone(zone);
EzyAppsStarter starter = new EzyAppsStarter.Builder().zoneContext(zoneContext).appClassLoaders(loaders).enableAppClassLoader(true).build();
// when
starter.start();
// then
Asserts.assertNull(app.getEntry());
}
use of com.tvd12.ezyfoxserver.context.EzySimpleAppContext in project ezyfox-server by youngmonkeys.
the class EzyAppsStarterTest method newAppEntryLoaderArgsNotNullTest.
@Test
public void newAppEntryLoaderArgsNotNullTest() {
// given
Map<String, ClassLoader> loaders = new ConcurrentHashMap<>();
EzySimpleZoneContext zoneContext = EzyZoneContextsTest.newDefaultZoneContext();
EzySimpleApplication app = new EzySimpleApplication();
EzySimpleAppSetting appSetting = new EzySimpleAppSetting();
appSetting.setName("abc");
appSetting.setEntryLoader(InternalAppEntryLoader.class);
appSetting.setEntryLoaderArgs(new String[] { "Hello" });
app.setSetting(appSetting);
EzySimpleAppContext appContext = new EzySimpleAppContext();
appContext.setApp(app);
EzySimpleZoneSetting zoneSetting = new EzySimpleZoneSetting();
EzySimpleAppsSetting appsSetting = new EzySimpleAppsSetting();
appsSetting.setItem(appSetting);
zoneSetting.setApplications(appsSetting);
zoneContext.addAppContext(appSetting, appContext);
EzySimpleZone zone = new EzySimpleZone();
zone.setSetting(zoneSetting);
zoneContext.setZone(zone);
EzyAppsStarter starter = new EzyAppsStarter.Builder().zoneContext(zoneContext).appClassLoaders(loaders).enableAppClassLoader(false).classLoader(Thread.currentThread().getContextClassLoader()).build();
// when
starter.start();
// then
Asserts.assertNotNull(app.getEntry());
}
use of com.tvd12.ezyfoxserver.context.EzySimpleAppContext in project ezyfox-server by youngmonkeys.
the class EzyAppsStarterTest method test2.
@Test
public void test2() {
Map<String, ClassLoader> loaders = new ConcurrentHashMap<>();
EzySimpleZoneContext zoneContext = EzyZoneContextsTest.newDefaultZoneContext();
EzySimpleApplication app = new EzySimpleApplication();
EzySimpleAppSetting appSetting = new EzySimpleAppSetting();
appSetting.setName("abc");
app.setSetting(appSetting);
EzySimpleAppContext appContext = new EzySimpleAppContext();
appContext.setApp(app);
EzySimpleZoneSetting zoneSetting = new EzySimpleZoneSetting();
EzySimpleAppsSetting appsSetting = new EzySimpleAppsSetting();
appsSetting.setItem(appSetting);
zoneSetting.setApplications(appsSetting);
zoneContext.addAppContext(appSetting, appContext);
EzyAppsStarter starter = new EzyAppsStarter.Builder().zoneContext(zoneContext).appClassLoaders(loaders).build();
starter.start();
}
Aggregations