protected override Message[] RespondSolutionRequestMessage(SolutionRequest message, IDictionary <int, ProblemDataSet> dataSets, IDictionary <int, ActiveComponent> activeComponents, List <BackupServerInfo> backups) { //sent by client node. send NoOperation + CaseExtractor.GetSolutionState var solutionState = DataSetOps.GetSolutionState(message, dataSets); if (solutionState == null) { return(new Message[] { new NoOperation() { BackupServersInfo = backups.ToArray() } }); } return(new Message[] { solutionState, new NoOperation() { BackupServersInfo = backups.ToArray() } }); }
public void DataSetFinalSolutionState() { var dict = new Dictionary <int, ProblemDataSet>(); var bytes = new byte[1] { 1 }; dict.Add(1, new ProblemDataSet() { CommonData = bytes, TaskManagerId = 1, ProblemType = "abc", PartialSets = new[] { new PartialSet() { PartialProblem = new SolvePartialProblemsPartialProblem(), PartialSolution = new SolutionsSolution() { Type = SolutionsSolutionType.Final }, Status = PartialSetStatus.Sent } } }); var ret = DataSetOps.GetSolutionState(new SolutionRequest() { Id = 1 }, dict); Assert.AreEqual(typeof(Solutions), ret.GetType()); var msg = ret.Cast <Solutions>(); Assert.AreEqual(1, msg.SolutionsList.Length); Assert.AreEqual(SolutionsSolutionType.Final, msg.SolutionsList[0].Type); }