Exemple #1
0
        public void ParserCanJoinMessages()
        {
            var messageParser = new MessageParser();

            #region message
            string messagePart1 = @"<?xml version=""1.0"" encoding=""utf-8""?>
<SolvePartialProblems xmlns=""http://www.mini.pw.edu.pl/ucc/"">
  <ProblemType>DVRP</ProblemType>
  <Id>1</Id>
  <CommonData />
  <SolvingTimeout>100000000</SolvingTimeout>
  <PartialProblems>
    <PartialProblem>
      <TaskId>2</TaskId>
      <Data>AAEAAAD/////AQA";

            string messagePart2 = @"AAAAAAAAMAgAAAD1Db21tb24sIFZlcnNpb249MC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1udWxsBQEAAAAfQ29tbW9uLlByb2JsZW1zLkR2cnBQcm9ibGVtRGF0YQUAAAAHQ2xpZW50cwZEZXBvdHMFRmxlZXQGQ3V0T2ZmA1RhZwQEBAAAJUNvbW1vbi5Qcm9ibGVtcy5EVlJQUmVxdWlyZWQuQ2xpZW50W10CAAAAJENvbW1vbi5Qcm9ibGVtcy5EVlJQUmVxdWlyZWQuRGVwb3RbXQIAAAAlQ29tbW9uLlByb2JsZW1zLkRWUlBSZXF1aXJlZC5WZWhpY2xlcwIAAAAGCAIAAAAJAwAAAAkEAAAACQUAAAAAAAAAAADgP/0DAAAHAwAAAAABAAAACQAAAAQjQ29tbW9uLlByb2JsZW1zLkRWUlBSZXF1aXJlZC5DbGllbnQCAAAACQYAAAAJBwAAAAkIAAAACQkAAAAJCgAAAAkLAAAACQwAAAAJDQAAAAkOAAAABwQAAAAAAQAAAAEAAAAEIkNvbW1vbi5Qcm9ibGVtcy5EVlJQUmVxdWlyZWQuRGVwb3QCAAAACQ8AAAAFBQAAACVDb21tb24uUHJvYmxlbXMuRFZSUFJlcXVpcmVkLlZlaGljbGVzAwAAAAVzcGVlZAhjYXBhY2l0eQVjb3VudAAAAAYGCAIAAAAAAAAAAADwPwAAAAAAAFlADAAAAAUGAAAAI0NvbW1vbi5Qcm9ibGVtcy5EVlJQUm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AAAhsb2NhdGlvbglzdGFydFRpbWUHZW5kVGltZQQAACJDb21tb24uUHJvYmxlbXMuRFZSUFJlcXVpcmVkLlBvaW50AgAAAAYGAgAAAAHV////8P///wAAAAAAAAAAAAAAAAAAAAAJEQAAAAAAAAAAAAAAAAAAAAAAhEAL</Data>
    </PartialProblem>
  </PartialProblems>
</SolvePartialProblems>";
            #endregion

            messageParser.ParseMessage(messagePart1);
            Assert.AreEqual(0, messageParser.GetMessagesToProcess().Count);
            messageParser.ParseMessage(messagePart2);

            Assert.AreEqual(1, messageParser.GetMessagesToProcess().Count);
        }
Exemple #2
0
        public void ParserCanSplitMessages()
        {
            var messageParser = new MessageParser();

            #region message
            string concatenatedMessage = @"<?xml version=""1.0"" encoding=""utf-8""?>
<SolvePartialProblems xmlns=""http://www.mini.pw.edu.pl/ucc/"">
  <ProblemType>DVRP</ProblemType>
  <Id>1</Id>
  <CommonData />
  <SolvingTimeout>100000000</SolvingTimeout>
  <PartialProblems>
    <PartialProblem>
      <TaskId>2</TaskId>
      <Data>AAEAAAD/////AQAAAAAAAAAMAgAAAD1Db21tb24sIFZlcnNpb249MC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1udWxsBQEAAAAfQ29tbW9uLlByb2JsZW1zLkR2cnBQcm9ibGVtRGF0YQUAAAAHQ2xpZW50cwZEZXBvdHMFRmxlZXQGQ3V0T2ZmA1RhZwQEBAAAJUNvbW1vbi5Qcm9ibGVtcy5EVlJQUmVxdWlyZWQuQ2xpZW50W10CAAAAJENvbW1vbi5Qcm9ibGVtcy5EVlJQUmVxdWlyZWQuRGVwb3RbXQIAAAAlQ29tbW9uLlByb2JsZW1zLkRWUlBSZXF1aXJlZC5WZWhpY2xlcwIAAAAGCAIAAAAJAwAAAAkEAAAACQUAAAAAAAAAAADgP/0DAAAHAwAAAAABAAAACQAAAAQjQ29tbW9uLlByb2JsZW1zLkRWUlBSZXF1aXJlZC5DbGllbnQCAAAACQY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AAB3v////D///8AAAAAAMBXQAAAAAAAACpACREAAAAAAAAAAAAAAAAAAAAAADRAAAAAAACAQcAGJAAAAAE3AQ0AAAAGAAAAAdv////w////AAAAAADAUUAAAAAAAIBWwAkRAAAAAAAAAAAAAAAAAAAAAAA0QAAAAAAAAD7ABicAAAABOAEOAAAABgAAAAHY////8P///wAAAAAAAENAAAAAAAAAQEAJEQAAAAAAAAAAAEZAAAAAAAAANEAAAAAAAAA6wAYqAAAAATkFDwAAACJDb21tb24uUHJvYmxlbXMuRFZSUFJlcXVpcmVkLkRlcG90AwAAAAhsb2NhdGlvbglzdGFydFRpbWUHZW5kVGltZQQAACJDb21tb24uUHJvYmxlbXMuRFZSUFJlcXVpcmVkLlBvaW50AgAAAAYGAgAAAAHV////8P///wAAAAAAAAAAAAAAAAAAAAAJEQAAAAAAAAAAAAAAAAAAAAAAhEAL</Data>
    </PartialProblem>
  </PartialProblems>
</SolvePartialProblems><?xml version=""1.0"" encoding=""utf-8""?>
<SolvePartialProblems xmlns=""http://www.mini.pw.edu.pl/ucc/"">
  <ProblemType>DVRP</ProblemType>
  <Id>1</Id>
  <CommonData />
  <SolvingTimeout>100000000</SolvingTimeout>
  <PartialProblems>
    <PartialProblem>
      <TaskId>3</TaskId>
      <Data>AAEAAAD/////AQAAAAAAAAAMAgAAAD1Db21tb24sIFZlcnNpb249MC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1udWxsBQEAAAAfQ29tbW9uLlByb2JsZW1zLkR2cnBQcm9ibGVtRGF0YQUAAAAHQ2xpZW50cwZEZXBvdHMFRmxlZXQGQ3V0T2ZmA1RhZwQEBAAAJUNvbW1vbi5Qcm9ibGVtcy5EVlJQUmVxdWlyZWQuQ2xpZW50W10CAAAAJENvbW1vbi5Qcm9ibGVtcy5EVlJQUmVxdWlyZWQuRGVwb3RbXQIAAAAlQ29tbW9uLlByb2JsZW1zLkRWUlBSZXF1aXJlZC5WZWhpY2xlcwIA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AAA0QAAAAAAAAEXABh4AAAABNQELAAAABgAAAAHh////8P///wAAAAAAAEXAAAAAAAAACEAJEQAAAAAAAAAAAAAAAAAAAAAANEAAAAAAAAAzwAYhAAAAATYBDAAAAAYAAAAB3v////D///8AAAAAAMBXQAAAAAAAACpACREAAAAAAAAAAAAAAAAAAAAAADRAAAAAAACAQcAGJAAAAAE3AQ0AAAAGAAAAAdv////w////AAAAAADAUUAAAAAAAIBWwAkRAAAAAAAAAAAAAAAAAAAAAAA0QAAAAAAAAD7ABicAAAABOAEOAAAABgAAAAHY////8P///wAAAAAAAENAAAAAAAAAQEAJEQAAAAAAAAAAAEZAAAAAAAAANEAAAAAAAAA6wAYqAAAAATkFDwAAACJDb21tb24uUHJvYmxlbXMuRFZSUFJlcXVpcmVkLkRlcG90AwAAAAhsb2NhdGlvbglzdGFydFRpbWUHZW5kVGltZQQAACJDb21tb24uUHJvYmxlbXMuRFZSUFJlcXVpcmVkLlBvaW50AgAAAAYGAgAAAAHV////8P///wAAAAAAAAAAAAAAAAAAAAAJEQAAAAAAAAAAAAAAAAAAAAAAhEAL</Data>
    </PartialProblem>
  </PartialProblems>
</SolvePartialProblems><?xml version=""1.0"" encoding=""utf-8""?>
<SolvePartialProblems xmlns=""http://www.mini.pw.edu.pl/ucc/"">
  <ProblemType>DVRP</ProblemType>
  <Id>1</Id>
  <CommonData />
  <SolvingTimeout>100000000</SolvingTimeout>
  <PartialProblems>
    <PartialProblem>
      <TaskId>4</TaskId>
      <Data>AAEAAAD/////AQAAAAAAAAAMAgAAAD1Db21tb24sIFZlcnNpb249MC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1udWxsBQEAAAAfQ29tbW9uLlByb2JsZW1zLkR2cnBQcm9ibGVtRGF0YQUAAAAHQ2xpZW50cwZEZXBvdHMFRmxlZXQGQ3V0T2ZmA1RhZwQEBAAAJUNvbW1vbi5Qcm9ibGVtcy5EVlJQUmVxdWlyZWQuQ2xp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QAAAAAAAAAAAAAAAAAAAAAAA0QAAAAAAAAEXABhoAAAABNQEKAAAABgAAAAHl////8f///wAAAAAAAEXAAAAAAAAACEAJEAAAAAAAAAAAAAAAAAAAAAAANEAAAAAAAAAzwAYdAAAAATYBCwAAAAYAAAAB4v////H///8AAAAAAMBXQAAAAAAAACpACRAAAAAAAAAAAAAAAAAAAAAAADRAAAAAAACAQcAGIAAAAAE3AQwAAAAGAAAAAd/////x////AAAAAADAUUAAAAAAAIBWwAkQAAAAAAAAAAAAAAAAAAAAAAA0QAAAAAAAAD7ABiMAAAABOAENAAAABgAAAAHc////8f///wAAAAAAAENAAAAAAAAAQEAJEAAAAAAAAAAAAEZAAAAAAAAANEAAAAAAAAA6wAYmAAAAATkFDgAAACJDb21tb24uUHJvYmxlbXMuRFZSUFJlcXVpcmVkLkRlcG90AwAAAAhsb2NhdGlvbglzdGFydFRpbWUHZW5kVGltZQQAACJDb21tb24uUHJvYmxlbXMuRFZSUFJlcXVpcmVkLlBvaW50AgAAAAYGAgAAAAHZ////8f///wAAAAAAAAAAAAAAAAAAAAAJEAAAAAAAAAAAAAAAAAAAAAAAhEAL</Data>
    </PartialProblem>
  </PartialProblems>
</SolvePartialProblems><?xml version=""1.0"" encoding=""utf-8""?>
<SolvePartialProblems xmlns=""http://www.mini.pw.edu.pl/ucc/"">
  <ProblemType>DVRP</ProblemType>
  <Id>1</Id>
  <CommonData />
  <SolvingTimeout>100000000</SolvingTimeout>
  <PartialProblems>
    <PartialProblem>
      <TaskId>5</TaskId>
      <Data>AAEAAAD/////AQAAAAAAAAAMAgAAAD1Db21tb24sIFZlcnNpb249MC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1udWxsBQEAAAAfQ29tbW9uLlByb2JsZW1zLkR2cnBQcm9ibGVtRGF0YQUAAAAHQ2xpZW50cwZEZXBvdHMFRmxlZXQGQ3V0T2ZmA1RhZwQEBAAAJUNvbW1vbi5Qcm9ibGVtcy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AAAAB5/////D///8AAAAAAIBNQAAAAAAAgFBACREAAAAAAAAAAAAAAAAAAAAAADRAAAAAAAAAQMAGGwAAAAE0AQoAAAAGAAAAAeT////w////AAAAAACAS0AAAAAAAIBBwAkRAAAAAAAAAAAAAAAAAAAAAAA0QAAAAAAAAEXABh4AAAABNQELAAAABgAAAAHh////8P///wAAAAAAAEXAAAAAAAAACEAJEQAAAAAAAAAAAAAAAAAAAAAANEAAAAAAAAAzwAYhAAAAATYBDAAAAAYAAAAB3v////D///8AAAAAAMBXQAAAAAAAACpACREAAAAAAAAAAAAAAAAAAAAAADRAAAAAAACAQcAGJAAAAAE3AQ0AAAAGAAAAAdv////w////AAAAAADAUUAAAAAAAIBWwAkRAAAAAAAAAAAAAAAAAAAAAAA0QAAAAAAAAD7ABicAAAABOAEOAAAABgAAAAHY////8P///wAAAAAAAENAAAAAAAAAQEAJEQAAAAAAAAAAAEZAAAAAAAAANEAAAAAAAAA6wAYqAAAAATkFDwAAACJDb21tb24uUHJvYmxlbXMuRFZSUFJlcXVpcmVkLkRlcG90AwAAAAhsb2NhdGlvbglzdGFydFRpbWUHZW5kVGltZQQAACJDb21tb24uUHJvYmxlbXMuRFZSUFJlcXVpcmVkLlBvaW50AgAAAAYGAgAAAAHV////8P///wAAAAAAAAAAAAAAAAAAAAAJEQAAAAAAAAAAAAAAAAAAAAAAhEAL</Data>
    </PartialProblem>
  </PartialProblems>
</SolvePartialProblems>";
            #endregion

            messageParser.ParseMessage(concatenatedMessage);

            var messages = messageParser.GetMessagesToProcess();

            Assert.AreEqual(4, messages.Count);
        }
Exemple #3
0
        protected void ProcessMessage(byte[] msg)
        {
            var    encoder        = new UTF8Encoding();
            string messagesString = encoder.GetString(msg);

            _messageParser.ParseMessage(messagesString);
            var messagesToProcess = _messageParser.GetMessagesToProcess();

            foreach (var xmlMessage in messagesToProcess)
            {
                Type type = Message.GetMessageType(xmlMessage);

                switch (type.Name)
                {
                case ("RegisterResponseMessage"):
                {
                    var regMsg = Message.Deserialize <RegisterResponseMessage>(xmlMessage);

                    ProcessRegisterResponseMessage(regMsg);
                    break;
                }

                case ("SolveRequestMessage"):
                {
                    throw new NotImplementedException();
                    break;
                }

                case ("DivideProblemMessage"):
                {
                    DivideProblemMessage divMsg = Message.Deserialize <DivideProblemMessage>(xmlMessage);
                    ProcessDivideProblemMessage(divMsg);
                    break;
                }

                case ("SolveRequestResponseMessage"):
                {
                    var solveRequestResponseMsg = Message.Deserialize <SolveRequestResponseMessage>(xmlMessage);
                    ProcessSolveRequestResponseMessage(solveRequestResponseMsg);
                    break;
                }

                case ("SolutionRequestMessage"):
                {
                    throw new NotImplementedException();
                    break;
                }

                case ("SolutionsMessage"):
                {
                    var solutionsMsg = Message.Deserialize <SolutionsMessage>(xmlMessage);
                    ProcessSolutionsMessage(solutionsMsg);
                    break;
                }

                case ("SolvePartialProblemsMessage"):
                {
                    SolvePartialProblemsMessage _msg = Message.Deserialize <SolvePartialProblemsMessage>(xmlMessage);
                    ProcessSolvePartialProblemsMessage(_msg);
                    break;
                }
                }
            }
        }