Rework and refactoring

This commit is contained in:
Christopher Schnick
2022-09-02 01:41:51 +02:00
parent 6efad1fe42
commit c7606f9f8e
82 changed files with 1618 additions and 396 deletions
@@ -1,42 +0,0 @@
package io.xpipe.api.test;
import io.xpipe.api.connector.XPipeConnection;
import io.xpipe.beacon.BeaconClient;
import io.xpipe.beacon.BeaconServer;
public class ConnectionFactory {
private static boolean alreadyStarted;
public static void start() throws Exception {
if (BeaconServer.isRunning()) {
alreadyStarted = true;
return;
}
if (!BeaconServer.tryStart()) {
throw new AssertionError();
}
XPipeConnection.waitForStartup().orElseThrow();
if (!BeaconServer.isRunning()) {
throw new AssertionError();
}
}
public static void stop() throws Exception {
if (alreadyStarted) {
return;
}
if (!BeaconServer.isRunning()) {
return;
}
var client = new BeaconClient();
if (!BeaconServer.tryStop(client)) {
throw new AssertionError();
}
XPipeConnection.waitForShutdown();
}
}
@@ -1,17 +0,0 @@
package io.xpipe.api.test;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
public class DaemonControl {
@BeforeAll
public static void setup() throws Exception {
ConnectionFactory.start();
}
@AfterAll
public static void teardown() throws Exception {
ConnectionFactory.stop();
}
}