summaryrefslogtreecommitdiffstats
path: root/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/derms/test/SystemTest.java24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/test/java/derms/test/SystemTest.java b/src/test/java/derms/test/SystemTest.java
index 2112ce9..59b08fa 100644
--- a/src/test/java/derms/test/SystemTest.java
+++ b/src/test/java/derms/test/SystemTest.java
@@ -9,6 +9,8 @@ import derms.replica1.DERMSServerPublisher;
import org.junit.jupiter.api.*;
import java.io.*;
import java.net.MalformedURLException;
+import java.net.InetAddress;
+import java.net.NetworkInterface;
import java.nio.file.*;
import java.util.*;
import derms.util.*;
@@ -27,7 +29,6 @@ class SystemTest {
// [TODO]
// input IP and NET config
private static String IP = "127.0.0.1";
- private static String NET = "en0";
@BeforeEach
void clearLogFile() throws IOException {
@@ -37,7 +38,6 @@ class SystemTest {
@BeforeAll
static void runMains() throws IOException {
String[] argsFE = {IP, IP};
- String[] argsSQ = {IP, NET};
Thread feThread = new Thread(() -> {
try {
@@ -50,7 +50,10 @@ class SystemTest {
Thread sequencerThread = new Thread(() -> {
try {
- Sequencer.main(argsSQ);
+ InetAddress ip = InetAddress.getByName(IP);
+ NetworkInterface netIfc = NetworkInterface.getByInetAddress(ip);
+ Sequencer sequencer = new Sequencer(ip, netIfc);
+ sequencer.run();
} catch (Exception e) {
e.printStackTrace();
}
@@ -75,8 +78,7 @@ class SystemTest {
ReplicaManager.main(argsRM);
ResponderClient responderClient = new ResponderClient(IP);
- ResponderClient.Add addCommand = responderClient.new Add();
- addCommand.add("MTL1001", "ambulance", "10");
+ responderClient.addResource("MTL1001", "ambulance", 10);
// Compare the number of lines in the log files, to determine if they match or not
assertTrue(LogComparator.compareFiles(TEST_LOG_PATH, EXPECTED_LOG_PATH_NORM));
@@ -93,8 +95,7 @@ class SystemTest {
ReplicaManager.main(argsRM);
ResponderClient responderClient = new ResponderClient(IP);
- ResponderClient.Add addCommand = responderClient.new Add();
- addCommand.add("MTL1001", "ambulance", "10");
+ responderClient.addResource("MTL1001", "ambulance", 10);
// Compare the number of lines in the log files, to determine if they match or not
assertTrue(LogComparator.compareFiles(TEST_LOG_PATH, EXPECTED_LOG_PATH_BYZ));
@@ -111,8 +112,7 @@ class SystemTest {
ReplicaManager.main(argsRM);
ResponderClient responderClient = new ResponderClient(IP);
- ResponderClient.Add addCommand = responderClient.new Add();
- addCommand.add("MTL1001", "ambulance", "10");
+ responderClient.addResource("MTL1001", "ambulance", 10);
// Compare the number of lines in the log files, to determine if they match or not
assertTrue(LogComparator.compareFiles(TEST_LOG_PATH, EXPECTED_LOG_PATH_CRASH));
@@ -143,8 +143,7 @@ class SystemTest {
e.printStackTrace();
} finally {
if (responderClient != null) {
- ResponderClient.Add addCommand = responderClient.new Add();
- addCommand.add("MTL1001", "ambulance", "10");
+ responderClient.addResource("MTL1001", "ambulance", 10);
}
}
});
@@ -157,8 +156,7 @@ class SystemTest {
e.printStackTrace();
} finally {
if (responderClient2 != null) {
- ResponderClient.Add addCommand2 = responderClient2.new Add();
- addCommand2.add("MTL1002", "ambulance", "11");
+ responderClient2.addResource("MTL1002", "ambulance", 11);
}
}
});