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);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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);
            }
        }