diff options
| author | BMatajsz <90217645+BMatajsz@users.noreply.github.com> | 2024-12-03 10:27:54 -0500 |
|---|---|---|
| committer | BMatajsz <90217645+BMatajsz@users.noreply.github.com> | 2024-12-03 10:27:54 -0500 |
| commit | 298eb839a8ccdd625978cf51476a6c412d11902b (patch) | |
| tree | 99571b2234f546b6a5b536d27dac086d1ec99433 /src/test/java/derms | |
| parent | d0b0b50f18c4713814c565af2f3146ec82aa6b0f (diff) | |
| parent | 1a2c519e5e70cc1e31eaef5cd770da75d75d6654 (diff) | |
| download | soen423-298eb839a8ccdd625978cf51476a6c412d11902b.zip | |
Merge branch 'test' of https://github.com/sam-rba/soen423 into test
Diffstat (limited to 'src/test/java/derms')
| -rw-r--r-- | src/test/java/derms/test/SystemTest.java | 24 |
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); } } }); |