use of com.tvd12.ezyfoxserver.config.EzyConfig in project ezyfox-server by youngmonkeys.
the class EzyStarterTest method notPrintSettings.
@Test
public void notPrintSettings() {
// given
EzyStarter starter = new ExEzyStarter.Builder().build();
EzyConfig config = mock(EzyConfig.class);
when(config.isPrintSettings()).thenReturn(false);
EzySimpleServer server = new EzySimpleServer();
server.setConfig(config);
EzySimpleSettings settings = new EzySimpleSettings();
server.setSettings(settings);
// when
MethodInvoker.create().object(starter).method("startEzyFox").param(EzyServer.class, server).call();
// then
verify(config, times(1)).isPrintSettings();
}
use of com.tvd12.ezyfoxserver.config.EzyConfig in project ezyfox-server by youngmonkeys.
the class EzyStarter method startEzyFox.
protected void startEzyFox(EzyServer server) throws Exception {
EzyConfig config = server.getConfig();
if (config.isPrintSettings()) {
getLogger().info("settings: \n{}", server);
}
EzyServerBootstrap serverBoostrap = newServerBoostrap(server);
serverBoostrap.start();
serverContext = serverBoostrap.getContext();
serverContext.setProperty(EzyServerBootstrap.class, serverBoostrap);
}
use of com.tvd12.ezyfoxserver.config.EzyConfig in project ezyfox-server by youngmonkeys.
the class EzyLoaderTest method newAppClassLoaderNotEnableClassLoader.
@Test
public void newAppClassLoaderNotEnableClassLoader() {
// given
InternalLoader sut = new InternalLoader();
FieldUtil.setFieldValue(sut, "classLoader", Thread.currentThread().getContextClassLoader());
EzyConfig config = mock(EzyConfig.class);
when(config.isEnableAppClassLoader()).thenReturn(false);
FieldUtil.setFieldValue(sut, "config", config);
// when
ClassLoader classLoader = MethodUtil.invokeMethod("newAppClassLoader", sut, new File(""));
// then
Asserts.assertEquals(Thread.currentThread().getContextClassLoader(), classLoader);
}
use of com.tvd12.ezyfoxserver.config.EzyConfig in project ezyfox-server by youngmonkeys.
the class EzyLoaderTest method getEntryFoldersEmptyTest.
@Test
public void getEntryFoldersEmptyTest() {
// given
InternalLoader sut = new InternalLoader();
EzyConfig config = mock(EzyConfig.class);
when(config.isEnableAppClassLoader()).thenReturn(false);
FieldUtil.setFieldValue(sut, "config", config);
// when
File[] folders = MethodUtil.invokeMethod("getEntryFolders", sut);
// then
Asserts.assertEquals(new File[0], folders);
}
use of com.tvd12.ezyfoxserver.config.EzyConfig in project ezyfox-server by youngmonkeys.
the class EzyStarter method startSystem.
protected void startSystem() throws Exception {
EzyConfig config = readConfig(configFile);
startSystem(config);
}
Aggregations