public void DeserializeSolveRequest()
 {
     SolveRequest d = new SolveRequest();
     string xml = d.SerializeToXML();
     d = (SolveRequest)xml.DeserializeXML();
     Assert.IsNotNull(d);
 }
Ejemplo n.º 2
0
 protected abstract string ReceivedSolveRequest(SolveRequest solveRequest);
 public void SerializeSolveRequest()
 {
     SolveRequest d = new SolveRequest();
     string xml = d.SerializeToXML();
     Assert.IsNotNull(xml);
 }
Ejemplo n.º 4
0
 protected override string ReceivedSolveRequest(SolveRequest solveRequest)
 {
     Debug.Assert(false, "Should not be here");
     return null;
 }
Ejemplo n.º 5
0
        protected override string ReceivedSolveRequest(SolveRequest solveRequest)
        {
            this.serverQueues.SolveRequests.Enqueue(solveRequest);
            SolveRequestResponse response = new SolveRequestResponse();

            if(solveRequest.IdSpecified)
                response.Id = solveRequest.Id; //TaskIDCounter++;
            else
                response.Id = TaskIDCounter++;
            response.IdSpecified = true;

            if (!this.BackupMode)
            Console.WriteLine("Sending SolveRequestResponse");
            return response.SerializeToXML();
        }
Ejemplo n.º 6
0
        private void SendSolveRequest(SolveRequest solveRequest)
        {
            String message = solveRequest.SerializeToXML();
            CMSocket.Instance.SendMessage(this.Port, this.IP, message, this);

            //nowy comment
            //Object obj = response.DeserializeXML();
            //Debug.Assert(obj is SolveRequestResponse, "Wrong response object");
            //SolveRequestResponse requestResopnse = (SolveRequestResponse)obj;
            //Debug.Assert(requestResopnse.IdSpecified, "No ID in solve request response");
            //if (!requestResopnse.IdSpecified)
            //    return;
            //Console.WriteLine("ID of the problem" + requestResopnse.Id);

            //stary comment
            //string message = solveRequest.SerializeToXML();
            //string res = CMSocket.Instance.SendMessage(this.Port, this.IP, message, this);
            //Object obj = res.DeserializeXML();
            //if (!(obj is SolveRequestResponse))
            //    throw new Exception("Wrong type");

            //SolveRequestResponse response = (SolveRequestResponse)obj;
            //if (response.IdSpecified) {
            //    ulong id = response.Id;
            //}
        }
Ejemplo n.º 7
0
 void ProblemsTimerCallback(object sender, System.Timers.ElapsedEventArgs e)
 {
     if (this.problems.Count <= 0)
         return;
     String singleProblem = this.problems.Dequeue();
     if (singleProblem == null)
         return;
     var base64 = singleProblem.Base64Encode();
     SolveRequest solveRequest = new SolveRequest();
     solveRequest.Data = base64;
     solveRequest.ProblemType = Utilities.ProblemNameForType(ProblemType.DVRP);
     this.SendSolveRequest(solveRequest);
 }