String localHost = new DefaultSystemNameProvider().getSystemName();
TokenContextService tokenContextService = getProcessServer().getTokenContextService();
// Create all kinds of contexts and simulate several states
TokenContext tc1 = startSimpleSignalSetProcess("TestSignal1", "Done", 0);
tc1.setLifecycleState(LifecycleState.SELECTED);
tc1.setLifecycleRequest(LifecycleRequest.NONE);
tc1.setNodeId(localHost);
tokenContextService.saveContext(tc1);
TokenContext tc2 = startSimpleSignalSetProcess("TestSignal2", "Done", 0);
tc2.setLifecycleState(LifecycleState.SELECTED);
tc2.setLifecycleRequest(LifecycleRequest.NONE);
tc2.setNodeId("DifferentHost");
tokenContextService.saveContext(tc2);
TokenContext tc3 = startSimpleSignalSetProcess("TestSignal3", "Done", 0);
tc3.setLifecycleState(LifecycleState.RUNNING);
tc3.setLifecycleRequest(LifecycleRequest.NONE);
tc3.setNodeId(localHost);
tokenContextService.saveContext(tc3);
TokenContext tc4 = startSimpleSignalSetProcess("TestSignal4", "Done", 0);
tc4.setLifecycleState(LifecycleState.ERROR);
tc4.setLifecycleRequest(LifecycleRequest.NONE);
tc4.setNodeId(localHost);
tokenContextService.saveContext(tc4);
TokenContext tc5 = startSimpleSignalSetProcess("TestSignal5", "Done", 0);
tokenContextService.saveContext(tc5);
getProcessServer().getEngine().commit();
// Execute those that can be executed