blob: ec4712df519e88a63bd349eb18c0c114201bd9b8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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();
}
}
}
|