コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="message"></param>
        public void InsertPCM(UploadedMessage message)
        {
            var msg       = Serialization.ByteArrayToString(message.Message);
            var validator = new StmSchemaValidator();

            validator.ValidatePCMMessageXML(msg);

            base.Insert(message);
        }
コード例 #2
0
        private void Validate(PublishedPcmMessage entity)
        {
            var msg = Serialization.ByteArrayToString(entity.Message);

            var validator = new StmSchemaValidator();

            //validate the XML against its XSD
            validator.ValidatePCMMessageXML(msg);
        }
コード例 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="entity"></param>
        public void InsertArea(UploadedMessage entity)
        {
            var msg       = Serialization.ByteArrayToString(entity.Message);
            var validator = new StmSchemaValidator();

            validator.ValidateAreaMessageXML(msg);

            base.Insert(entity);
        }
コード例 #4
0
        public void S124Parser()
        {
            byte[] msg       = GetMessageRaw(@"STMMessageSamples\S124_01.gml");
            var    msgString = Serialization.ByteArrayToString(msg);

            var validator = new StmSchemaValidator();

            validator.ValidateAreaMessageXML(msgString);

            var parser = new S124Parser(msgString);
            var id     = parser.AreaMessageId;
        }
コード例 #5
0
        public void TxtParser()
        {
            byte[] msg       = GetMessageRaw(@"STMMessageSamples\textMessage with area-1.xml");
            var    msgString = Serialization.ByteArrayToString(msg);

            var validator = new StmSchemaValidator();

            validator.ValidateTextMessageXML(msgString);

            var parser = new TxtParser(msgString);
            var id     = parser.TextMessageId;
        }
コード例 #6
0
        public void Rtz11Parser()
        {
            byte[] msg       = GetMessageRaw(@"STMMessageSamples\rtz_route_stm_1_1_28032017.rtz");
            var    msgString = Serialization.ByteArrayToString(msg);

            var validator = new StmSchemaValidator();

            validator.ValidateRTZMessageXML(msgString);

            var parser = new Rtz11Parser(msgString);
            var status = parser.RouteStatus;
        }
コード例 #7
0
        public void Rtz10Parser()
        {
            byte[] msg       = GetMessageRaw(@"STMMessageSamples\RTZ v1.0 STM several extensions-1.rtz");
            var    msgString = Serialization.ByteArrayToString(msg);

            var validator = new StmSchemaValidator();

            validator.ValidateRTZMessageXML(msgString);

            var parser = RtzParserFactory.Create(msgString);
            var status = parser.RouteStatus;
        }
コード例 #8
0
        private void Validate(PublishedRtzMessage entity)
        {
            var msg = Serialization.ByteArrayToString(entity.Message);

            var validator = new StmSchemaValidator();

            //validate the XML against its XSD
            validator.ValidateRTZMessageXML(msg);

            //validate the message content according to our business rules
            validator.ValidateRTZMessage(msg);

            //Validate UVID between header and RTZ
            validator.ValidateUVID(entity.MessageID, msg);
        }
コード例 #9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="entity"></param>
        public void InsertRTZ(UploadedMessage entity)
        {
            var msg       = Serialization.ByteArrayToString(entity.Message);
            var validator = new StmSchemaValidator();

            //validate the XML against its XSD
            validator.ValidateRTZMessageXML(msg);

            //validate the message content according to our business rules
            validator.ValidateRTZMessage(msg);

            //Validate UVID between header and RTZ
            validator.ValidateUVID(entity.MessageID, msg);

            base.Insert(entity);
        }
コード例 #10
0
        public void TestRTZMessageInincosistentUVID()
        {
            byte[] msg       = GetMessageRaw(@"STMMessageSamples\msg1_invalidUVID.rtz");
            var    msgString = Serialization.ByteArrayToString(msg);
            var    parser    = RtzParserFactory.Create(msgString);
            string uvid      = parser.VesselVoyage;
            var    validator = new StmSchemaValidator();

            try
            {
                validator.ValidateUVID("urn:mrn:stm:voyage:id:vis1:0001", msgString);
            }
            catch (StmSchemaValidationException ex)
            {
                Assert.IsNotNull(ex);
            }
        }