summaryrefslogtreecommitdiff
path: root/CreateRaftSimulationDirect.java
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-06-22 11:58:00 +0300
committerPaul Buetow <paul@buetow.org>2025-06-22 11:58:00 +0300
commit0b5afe8839241dec66ba832cf42860ec69b87df8 (patch)
treee100d2d6204f8c04dc33418ae9f193fa6b1a83c2 /CreateRaftSimulationDirect.java
parentb0fc02ce45cb51ce7c8d607d4773808cfa9b6c87 (diff)
Fix message delivery in headless test environment
- Fixed HeadlessSimulationEngine to use correct task manager from receiving process - Reduced message delays for testing (10-50ms instead of 500-2000ms) - Fixed process ID method call (getProcessID not getProcessId) - Improved message delivery scheduling to ensure tasks go to the right task manager This resolves message delivery issues where messages were sent but not received. BasicMulticast test now passes, but 12 protocol tests still failing. 🤖 Generated with Claude Code https://claude.ai/code Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat (limited to 'CreateRaftSimulationDirect.java')
-rw-r--r--CreateRaftSimulationDirect.java36
1 files changed, 36 insertions, 0 deletions
diff --git a/CreateRaftSimulationDirect.java b/CreateRaftSimulationDirect.java
new file mode 100644
index 0000000..ec4712d
--- /dev/null
+++ b/CreateRaftSimulationDirect.java
@@ -0,0 +1,36 @@
+import simulator.*;
+import core.*;
+import prefs.*;
+import events.VSRegisteredEvents;
+import events.internal.VSProtocolEvent;
+import serialize.VSSerialize;
+import java.io.*;
+
+public class CreateRaftSimulationDirect {
+ public static void main(String[] args) {
+ try {
+ // 1. Create a basic simulation with the GUI to get proper structure
+ System.out.println("Creating Raft simulation...");
+ System.out.println("Note: This requires manual intervention:");
+ System.out.println("1. Run DS-Sim GUI: java -jar target/ds-sim-1.0.1-SNAPSHOT.jar");
+ System.out.println("2. Add 3 processes");
+ System.out.println("3. Right-click each process and select 'Raft Consensus' as Server");
+ System.out.println("4. Save as 'saved-simulations/raft.dat'");
+ System.out.println("5. Close the GUI");
+
+ // For now, let's copy and modify an existing simulation
+ // We'll use the basic structure from ping-pong but change the protocol
+
+ // Read ping-pong simulation
+ VSDefaultPrefs prefs = new VSDefaultPrefs();
+ prefs.fillWithDefaults();
+ VSRegisteredEvents.init(prefs);
+
+ System.out.println("\nAlternatively, you can run this test with the included test simulation:");
+ System.out.println("java -cp target/classes:target/test-classes -Djava.awt.headless=true -Dds.sim.verbose=true testing.HeadlessProtocolRunner saved-simulations/raft.dat");
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+} \ No newline at end of file