Beispiel #1
0
 public virtual void SetUp()
 {
     MockMessageBeanRegistry.Initialize();
     CodeResolverRegistry.Register(new TrivialCodeResolver());
     this.document      = GetSourceDocument();
     this.service       = new MockTestCaseMessageDefinitionService();
     this.messageSource = new Hl7MessageSource(MockVersionNumber.MOCK_NEWFOUNDLAND, this.document, null, null, service);
 }
Beispiel #2
0
 public Hl7PartSource(Hl7MessageSource hl7InteractionSource, string hl7Type, XmlElement currentElement, string originalHl7Type
                      )
 {
     this.hl7InteractionSource = hl7InteractionSource;
     this.hl7Type             = hl7Type;
     this.currentElement      = currentElement;
     this.messagePart         = InitMessagePart(hl7Type);
     this.originalMessagePart = originalHl7Type == null ? this.messagePart : InitMessagePart(originalHl7Type);
 }
Beispiel #3
0
        //	@Test
        //	public void shouldMapMultipleCardinalityAssociationWithNullFlavor() throws Exception {
        //		Document document1 = new DocumentFactory().createFromResource(
        //				new ClasspathResource(this.getClass(), "findCandidatesQuery_withNullFlavor.xml"));
        //
        //		Hl7MessageSource rootPartSource1 = new Hl7MessageSource(SpecificationVersion.V02R02.getVersionLiteral(),
        //				document1,
        //				this.service);
        //
        //		FindCandidatesQueryMessageBean bean = (FindCandidatesQueryMessageBean)new Hl7SourceMapper().mapToTeal(rootPartSource1).getMessageObject();
        //
        //		assertNotNull("teal bean", bean);
        //		assertFalse("first reason has no null flavor", bean.getReasons().get(0).hasNullFlavor());
        //		assertTrue("second reason has null flavor", bean.getReasons().get(1).hasNullFlavor());
        //		assertEquals("second reason null flavor", NullFlavor.OTHER, bean.getReasons().get(1).getNullFlavor());
        //	}
        /// <exception cref="System.IO.IOException"></exception>
        /// <exception cref="Platform.Xml.Sax.SAXException"></exception>
        /// <exception cref="System.Xml.XPath.XPathException"></exception>
        private object MapPartSourceToTeal(VersionNumber version, string xml, string relationshipType)
        {
            XmlDocument      document1       = new DocumentFactory().CreateFromString(xml);
            Hl7MessageSource rootPartSource1 = new Hl7MessageSource(version, new DocumentFactory().CreateFromString("<PRPA_IN101103CA xmlns=\"urn:hl7-org:v3\" />"
                                                                                                                    ), null, null, this.service);
            Hl7PartSource partSource1 = rootPartSource1.CreatePartSource(CreateRelationship(relationshipType), document1.DocumentElement
                                                                         );

            return(new Hl7SourceMapper().MapPartSourceToTeal(partSource1, null));
        }
Beispiel #4
0
        public virtual void SetUp()
        {
            MockMessageBeanRegistry.Initialize();
            CodeResolverRegistry.Register(new TrivialCodeResolver());
            this.service  = new MockTestCaseMessageDefinitionService();
            this.document = GetSourceDocument();
            Hl7MessageSource rootSource = new Hl7MessageSource(MockVersionNumber.MOCK_NEWFOUNDLAND, document, null, null, this.service
                                                               );

            this.element    = document.DocumentElement;
            this.partSource = rootSource.CreatePartSource(CreateRelationship("MFMI_MT700711CA.Author"), element);
        }
Beispiel #5
0
 public virtual XmlToModelResult MapToTeal(Hl7MessageSource hl7MessageSource)
 {
     if (hl7MessageSource.GetInteraction() != null)
     {
         Type        messageBeanType = MessageBeanRegistry.GetInstance().GetInteractionBeanType(hl7MessageSource.GetMessageTypeKey());
         object      messageBean     = BeanUtil.Instantiate <object>(messageBeanType);
         BeanWrapper wrapper         = new BeanWrapper(messageBean);
         MapToTeal(hl7MessageSource, wrapper, null);
         hl7MessageSource.GetResult().SetMessageObject(messageBean);
         CreateBeanPathOnErrorMessages(hl7MessageSource.GetResult(), messageBean);
     }
     return(hl7MessageSource.GetResult());
 }
Beispiel #6
0
        public virtual void SetUp()
        {
            MockMessageBeanRegistry.Initialize();
            CodeResolverRegistry.Register(new EnumBasedCodeResolver(typeof(Ca.Infoway.Messagebuilder.Domainvalue.Controlact.ActStatus
                                                                           )));
            CodeResolverRegistry.Register(new TrivialCodeResolver());
            this.service  = new MockTestCaseMessageDefinitionService();
            this.document = GetSourceDocument(XML);
            this.element  = this.document.DocumentElement;
            Hl7MessageSource rootSource = new Hl7MessageSource(MockVersionNumber.MOCK_NEWFOUNDLAND, this.document, null, null, this.service
                                                               );

            this.partSource = rootSource.CreatePartSource(CreateRelationship("MCCI_MT002100CA.Sender"), element);
        }
Beispiel #7
0
        public virtual void ShouldHandleIndicatorAttributesWhenNullFlavor()
        {
            this.document = GetSourceDocument(XML_NULL);
            this.element  = this.document.DocumentElement;
            Hl7MessageSource rootSource = new Hl7MessageSource(MockVersionNumber.MOCK_MR2009, this.document, null, null, this.service
                                                               );

            this.partSource = rootSource.CreatePartSource(CreateRelationship("POIZ_MT030050CA.InFulfillmentOf"), element);
            InFulfillmentOfBean teal = (InFulfillmentOfBean) new Hl7SourceMapper().MapPartSourceToTeal(this.partSource, null);

            Assert.IsNotNull(teal, "teal");
            Assert.IsTrue(((BL)teal.GetField("immunizationPlan")).Null, "null flavor");
            Assert.AreEqual(2, teal.DoseNumber.Value, "dose number");
            Assert.IsNull(teal.ImmunizationPlan, "indicator");
        }
Beispiel #8
0
        public virtual void ShouldMapRealmCode()
        {
            Sender senderBean = (Sender) new Hl7SourceMapper().MapPartSourceToTeal(this.partSource, null);

            Assert.IsNotNull(senderBean, "sender");
            Assert.IsNull(senderBean.GetRealmCode(), "realm code not expected");
            XmlDocument      document2   = GetSourceDocument(XML3);
            XmlElement       element2    = document2.DocumentElement;
            Hl7MessageSource rootSource2 = new Hl7MessageSource(MockVersionNumber.MOCK_NEWFOUNDLAND, document2, null, null, this.service
                                                                );
            Hl7PartSource partSource2         = rootSource2.CreatePartSource(CreateRelationship("MCCI_MT002100CA.Sender"), element2);
            Sender        senderBeanWithRealm = (Sender) new Hl7SourceMapper().MapPartSourceToTeal(partSource2, null);

            Assert.IsNotNull(senderBeanWithRealm, "observation");
            Assert.IsNotNull(senderBeanWithRealm.GetRealmCode(), "observation has realms");
            Assert.AreEqual(2, senderBeanWithRealm.GetRealmCode().Count, "observation has two realms");
            Assert.AreEqual(Realm.CANADA, senderBeanWithRealm.GetRealmCode()[0], "realm");
            Assert.AreEqual(Realm.ALBERTA, senderBeanWithRealm.GetRealmCode()[1], "realm");
        }
Beispiel #9
0
        public virtual void ShouldMapObservationAttributes()
        {
            XmlDocument      document2   = GetSourceDocument(XML2);
            XmlElement       element2    = document2.DocumentElement;
            Hl7MessageSource rootSource2 = new Hl7MessageSource(MockVersionNumber.MOCK_NEWFOUNDLAND, document2, null, null, this.service
                                                                );
            Hl7PartSource partSource2 = rootSource2.CreatePartSource(CreateRelationship("PORX_MT010120CA.QuantityObservationEvent"),
                                                                     element2);
            QuantityObservationEventBean teal = (QuantityObservationEventBean) new Hl7SourceMapper().MapPartSourceToTeal(partSource2,
                                                                                                                         null);

            Assert.IsNotNull(teal, "teal");
            Assert.IsNotNull(teal.PatientMeasurementType, "code1");
            Assert.IsNotNull(teal.PatientMeasuredValue, "code2");
            XmlToModelResult result = partSource2.GetResult();

            Assert.IsNotNull(result, "result");
            Assert.AreEqual(3, result.GetHl7Errors().Count);
            Assert.AreEqual(Hl7ErrorCode.UNSUPPORTED_INTERACTION, result.GetHl7Errors()[0].GetHl7ErrorCode());
            Assert.AreEqual(Hl7ErrorCode.MANDATORY_FIELD_NOT_PROVIDED, result.GetHl7Errors()[1].GetHl7ErrorCode());
            Assert.AreEqual(Hl7ErrorCode.MANDATORY_FIELD_NOT_PROVIDED, result.GetHl7Errors()[2].GetHl7ErrorCode());
        }