public void TestMethodMultiHibernation() { var proces = new HibernateWorkflowSimple() { InputParametr = 10 }; var vm = new VirtualMachine.VirtualMachine(); vm.Start(proces); var serializedVMXml = vm.Serialize(); object retFromSerializedVM = ""; while (vm.Status == VirtualMachineState.Hibernated) { vm = VirtualMachine.VirtualMachine.Deserialize(serializedVMXml); retFromSerializedVM = vm.Resume(); serializedVMXml = vm.Serialize(); } var inProcProces = new HibernateWorkflowSimple() { InputParametr = 10 }; var retInProcProces = inProcProces.Start(); Assert.AreEqual(retInProcProces, retFromSerializedVM); }
public void TestMethod1() { var proces = new HibernateWorkflowSimple() { InputParametr = 10 }; var vm = new VirtualMachine.VirtualMachine(); vm.Start(proces); var serializedVMXml = vm.Serialize(); var vmNew = VirtualMachine.VirtualMachine.Deserialize(serializedVMXml); var retFromSerializedVM = vmNew.Resume(); var inProcProces = new HibernateWorkflowSimple() { InputParametr = 10 }; var retInProcProces = inProcProces.Start(); Assert.AreEqual(retInProcProces, retFromSerializedVM); }
public ProcessContainer AddProcess(ProcessBase process) { if (process.Debug == true) { //uruchamiamy proces w trybie debug var kontenerProcesu = new DebugProcesContainer() { Id = process.Id }; kontenerProcesu.Process = process; kontenerProcesu.Thread = new Thread(debugThread); kontenerProcesu.Thread.Name = "proces " + process.Id; process.Status = EnumProcessStatus.WaitingForExecution; debugProcesess.Add(kontenerProcesu); kontenerProcesu.Thread.Start(kontenerProcesu); return(kontenerProcesu); } else { process.Status = EnumProcessStatus.WaitingForExecution; var wm = new VirtualMachine.VirtualMachine(); //dodaje tylko do kolejki uruchomienia - nie uruchamiam w tym wątku wm.Start(process, doExecuting: false); var xml = wm.Serialize(); var serializedProcess = new ProcessContainer(); serializedProcess.Id = process.Id; serializedProcess.Status = process.Status; serializedProcess.ExecutionDate = process.ExecutionDate; serializedProcess.VirtualMachineXml = xml; dal.AddProcess(serializedProcess); return(serializedProcess); } }
public void SetVirtualMachine(VirtualMachine.VirtualMachine vm) { VirtualMachineXml = vm.Serialize(); }