[FIX] StartLaunchServerTest теперь нормально работает.

This commit is contained in:
Zaxar163 2020-04-05 11:30:32 +03:00
parent 34e941ddfd
commit 68c06de23e
2 changed files with 12 additions and 3 deletions

View file

@ -23,6 +23,7 @@ public NettyServerSocketHandler(LaunchServer server) {
@Override
public void close() {
if (nettyServer == null) return;
nettyServer.close();
nettyServer.service.channels.close();
}

View file

@ -1,5 +1,6 @@
package pro.gravit.launchserver;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
@ -28,7 +29,7 @@ public class StartLaunchServerTest {
public static LaunchServer launchServer;
@BeforeAll
public static void prepare() throws Exception {
public static void prepare() throws Throwable {
LaunchServerModulesManager modulesManager = new LaunchServerModulesManager(modulesDir, configDir, null);
LaunchServerConfig config = LaunchServerConfig.getDefault(LaunchServer.LaunchServerEnv.TEST);
Launcher.gsonManager = new LaunchServerGsonManager(modulesManager);
@ -48,12 +49,14 @@ public static void prepare() throws Exception {
.setLaunchServerConfigManager(new LaunchServer.LaunchServerConfigManager() {
@Override
public LaunchServerConfig readConfig() {
return null;
return LaunchServerConfig.getDefault(LaunchServer.LaunchServerEnv.TEST);
}
@Override
public LaunchServerRuntimeConfig readRuntimeConfig() {
return null;
LaunchServerRuntimeConfig r = new LaunchServerRuntimeConfig();
r.reset();
return r;
}
@Override
@ -71,6 +74,11 @@ public void writeRuntimeConfig(LaunchServerRuntimeConfig config) {
launchServer = builder.build();
}
@AfterAll
public static void complete() throws Throwable {
launchServer.close();
}
@Test
public void start() {
launchServer.run();