Fix the test run.
Some checks failed
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is failing

This commit is contained in:
Manuel Friedli 2022-02-02 02:09:25 +01:00
parent 4d0c5f5c18
commit 251baca8e2
Signed by: manuel
GPG key ID: 41D08ABA75634DA1
3 changed files with 14 additions and 6 deletions

View file

@ -15,6 +15,7 @@
<version>0.0.1-SNAPSHOT</version>
<properties>
<logback.version>1.2.10</logback.version>
<slf4j.version>1.7.35</slf4j.version>
</properties>
@ -22,7 +23,7 @@
<dependency>
<groupId>ch.fritteli.labyrinth</groupId>
<artifactId>labyrinth-generator</artifactId>
<version>0.0.2-SNAPSHOT</version>
<version>0.0.2</version>
</dependency>
<dependency>
<groupId>io.vavr</groupId>
@ -44,7 +45,7 @@
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.10</version>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>

View file

@ -27,7 +27,8 @@ import java.net.InetSocketAddress;
import java.net.URISyntaxException;
import java.nio.charset.StandardCharsets;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Function;
@ -37,7 +38,13 @@ public class LabyrinthServer {
@NonNull
private final HttpServer httpServer;
@NonNull
private final ExecutorService executorService = Executors.newCachedThreadPool();
private final ExecutorService executorService = new ThreadPoolExecutor(
0,
1_000,
5,
TimeUnit.SECONDS,
new SynchronousQueue<>()
);
public LabyrinthServer(@NonNull final ServerConfig config) throws IOException, URISyntaxException {
this.httpServer = HttpServer.create(new InetSocketAddress(config.getAddress(), config.getPort()), 5);

View file

@ -4,7 +4,6 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.net.UnknownHostException;
import java.util.Properties;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
@ -12,7 +11,8 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
class ServerConfigTest {
@BeforeEach
void clearSysProperties() {
System.setProperties(new Properties());
System.clearProperty(ServerConfig.SYSPROP_HOST);
System.clearProperty(ServerConfig.SYSPROP_PORT);
}
@Test