summaryrefslogtreecommitdiff
path: root/src/test/java/simulator/builder/SimulationBuilderTest.java
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-06-22 16:45:17 +0300
committerPaul Buetow <paul@buetow.org>2025-06-22 16:45:17 +0300
commit4c16cc3c4da7bbf8375d7951185db1761eb396bf (patch)
tree19199b664ce802ed3e967e318e6d4ffeb8c9bf39 /src/test/java/simulator/builder/SimulationBuilderTest.java
parent464df52901e2dcb84eb81a22f2db19cbf17e5a9f (diff)
Remove all Raft protocol code
Removed all Raft-related code as it was not working properly: - Removed VSRaftProtocol.java implementation - Removed all Raft test files - Removed Raft example/demo files - Removed Raft documentation - Removed Raft simulation files (.dat) - Removed Raft scripts - Updated VSRegisteredEvents to remove Raft registration - Updated SimulationBuilder to remove RAFT constant - Updated SimulationFactory to remove Raft methods - Updated SimulationBuilderTest to remove Raft tests - Updated pom.xml to remove Raft test configurations The protocol had issues with leader election not completing in GUI mode. 🤖 Generated with Claude Code https://claude.ai/code Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat (limited to 'src/test/java/simulator/builder/SimulationBuilderTest.java')
-rw-r--r--src/test/java/simulator/builder/SimulationBuilderTest.java44
1 files changed, 1 insertions, 43 deletions
diff --git a/src/test/java/simulator/builder/SimulationBuilderTest.java b/src/test/java/simulator/builder/SimulationBuilderTest.java
index 82860f0..5061477 100644
--- a/src/test/java/simulator/builder/SimulationBuilderTest.java
+++ b/src/test/java/simulator/builder/SimulationBuilderTest.java
@@ -29,43 +29,6 @@ class SimulationBuilderTest {
}
}
- @Test
- void testCreateBasicRaftSimulation() throws Exception {
- String filename = TEST_DIR + "test-raft.dat";
-
- // Create a basic Raft simulation
- new SimulationBuilder()
- .withProcesses(3)
- .withProtocol(SimulationBuilder.Protocols.RAFT)
- .activateServers(0, 1, 2)
- .save(filename);
-
- // Verify file was created
- File file = new File(filename);
- assertTrue(file.exists(), "Simulation file should be created");
- assertTrue(file.length() > 1000, "File should have content");
-
- // Verify it contains Raft protocol
- String content = Files.readString(file.toPath());
- assertTrue(content.contains("VSRaftProtocol"), "Should contain Raft protocol classname");
- }
-
- @Test
- void testCreateRaftWithClients() throws Exception {
- String filename = TEST_DIR + "test-raft-clients.dat";
-
- // Use factory method
- SimulationFactory.createRaftSimulation(3, 2)
- .save(filename);
-
- // Verify file was created
- File file = new File(filename);
- assertTrue(file.exists(), "Simulation file should be created");
-
- // Should have 5 processes (3 servers + 2 clients)
- String content = Files.readString(file.toPath());
- assertTrue(content.contains("VSRaftProtocol"), "Should contain Raft protocol");
- }
@Test
void testCreatePingPongSimulation() throws Exception {
@@ -88,7 +51,7 @@ class SimulationBuilderTest {
// Create a complex simulation with events
new SimulationBuilder()
.withProcesses(5)
- .withProtocol(SimulationBuilder.Protocols.RAFT)
+ .withProtocol(SimulationBuilder.Protocols.TWO_PHASE_COMMIT)
.withDuration(30000)
.activateServers(0, 1, 2)
.activateClients(1000, 3, 4)
@@ -109,7 +72,6 @@ class SimulationBuilderTest {
void testAllProtocolTypes() throws Exception {
// Test that all protocol constants work
String[] protocols = {
- SimulationBuilder.Protocols.RAFT,
SimulationBuilder.Protocols.PING_PONG,
SimulationBuilder.Protocols.BERKLEY_TIME,
SimulationBuilder.Protocols.BROADCAST,
@@ -137,10 +99,6 @@ class SimulationBuilderTest {
void testInvalidConfiguration() {
// Test that invalid configurations throw exceptions
assertThrows(IllegalArgumentException.class, () -> {
- SimulationFactory.createRaftSimulation(2, 0); // Too few servers
- });
-
- assertThrows(IllegalArgumentException.class, () -> {
SimulationFactory.createBerkeleyTimeSimulation(1); // Too few processes
});
}