Package nexj.core.integration.io

Examples of nexj.core.integration.io.StringInput


   public void testHL7Adapter()
   {
      Format format = m_metadata.getFormat("HL7");
      Message msg = m_metadata.getMessage("HL7_25_ADT_A04");
      TransferObject to = ((MessageParser)format.getParser().getInstance(m_context))
         .parse(new StringInput("MSH|^~\\&|||||20050326012305.528+0100||ADT^A04|1|P|2.5||||||\rEVN|A04||||||\rPID|||1234567890^^^&OHIP||Test^Joe||19800102|M||U|123 45th St^^Toronto^ON^A1B2C3^Canada^H^||(416) 123-4567|(416) 456-7890|||||||||||||||||||||||||\r"), msg);
      TransferObject patientID = (TransferObject)to.getValue("patientIdentification");

      Timestamp birthDate = (Timestamp)((TransferObject)patientID.getValue("dateTimeOfBirth")).getValue("time");
      Calendar calendar = Calendar.getInstance();
      calendar.setTime(birthDate);
View Full Code Here


      Writer writer = new StringWriter();

      ((MessageFormatter)format.getFormatter().getInstance(m_context)).format(pat, msg, new WriterOutput(writer));
     
      TransferObject patCompare = ((MessageParser)format.getParser().getInstance(m_context))
         .parse(new StringInput(writer.toString()), msg);
      TransferObject plCompare = (TransferObject)patCompare.getValue("player");
      List idsCompare = (List)plCompare.getValue("id");
      TransferObject idCompare = (TransferObject)idsCompare.get(0);
      assertEquals(idCompare.getValue("id"), "111222333");
      assertEquals(idCompare.getValue("type"), "OHIP");
View Full Code Here

   public void testXMLAdapter2()
   {
      Format format = m_metadata.getFormat("XML");
      Message msg = m_metadata.getMessage("XML_PatientDemographics");
      TransferObject to = ((MessageParser)format.getParser().getInstance(m_context))
         .parse(new StringInput("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<a:Patient xmlns:a=\"http://nexj.com/nexj\" xmlns:b=\"http://nexj.com/nexj/b\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://nexj.com/nexj/integration.xsd\"><player><firstName>My1</firstName><lastName>Test</lastName><id type=\"OHIP\" b:id=\"111222333\"/></player></a:Patient>"), msg);
      TransferObject player = (TransferObject)to.getValue("player");
      List ids = (List)player.getValue("id");
      TransferObject id = (TransferObject)ids.get(0);
      assertEquals(id.getValue("id"), "111222333");
      assertEquals(id.getValue("type"), "OHIP");
View Full Code Here

      Format format = m_metadata.getFormat("XML");
      Writer writer = new StringWriter();
      ((MessageFormatter)format.getFormatter().getInstance(m_context)).format(table, tableMessage, new WriterOutput(writer));

      table = ((MessageParser)format.getParser().getInstance(m_context)).parse(new StringInput(writer.toString()), tableMessage);
      rows = (List)table.getValue("Row");
      row = (TransferObject)rows.get(0);
      assertEquals(row.getValue("value"), "abcdef");
     
      Message recursiveMessage = (Message)messageRegistry.get("recursiveElement");
View Full Code Here

     
      writer = new StringWriter();
      ((MessageFormatter)format.getFormatter().getInstance(m_context)).format(table, tableMessage, new WriterOutput(writer));
     
      table = ((MessageParser)format.getParser().getInstance(m_context))
         .parse(new StringInput(writer.toString()), tableMessage);
      row = (TransferObject)table.getValue("a_b");
      assertEquals(row.getValue("isConfirmedBySourceOwner"), Boolean.FALSE);
   }
View Full Code Here

    */
   public void testTransformParsePrimitive()
   {
      Message csvMessage = m_metadata.getMessage("CSVTestSuiteResult");
      MessageParser csvParser = (MessageParser)csvMessage.getFormat().getParser().getInstance(m_context);
      StringInput in;
      TransferObject root, result, sub;
      List list;

      in = new StringInput("date,status,result\n" +
         "2009-09-23T17:34:00,PASS,\"<XMLTestResult seed=\\\"5\\\"><a>aValue</a></XMLTestResult>\"\n" +
         "2009-09-23T17:36:00,FAIL,\"<XMLTestResult><a>aValue2</a><b>bValue</b></XMLTestResult>\"\n"
         );

      root = csvParser.parse(in, csvMessage);
View Full Code Here

   /**
    * Parses a reference with the parent message.
    */
   public void testParseParent()
   {
      StringInput in = new StringInput(XML_HEADER +
         "<referrer xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">" +
         "<name>123</name>" +
         "<reference>" +
            "<a>Avalue</a>" +
            "<b>17</b>" +
View Full Code Here

   /**
    * Parses a reference with a child message.
    */
   public void testParseChild1()
   {
      StringInput in = new StringInput(XML_HEADER +
         "<referrer xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">" +
         "<name>123</name>" +
         "<reference xsi:type=\"Child1Type\">" +
            "<b>23</b>" +
            "<c1>31</c1>" +
View Full Code Here

   /**
    * Parses a reference with a child's child message.
    */
   public void testParseChild1Child()
   {
      StringInput in = new StringInput(XML_HEADER +
         "<referrer xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">" +
         "<name>123</name>" +
         "<reference xsi:type=\"Child1ChildType\">" +
            "<b>23</b>" +
            "<c1>31</c1>" +
View Full Code Here

    * Parses a reference to the child message.
    */
   public void testParseChild1_Child1Referrer()
   {
      Message msg = m_context.getMetadata().getMessage("XML_Inherit_Child1_Referrer");
      StringInput in = new StringInput(XML_HEADER +
         "<childReferrer>" +
         "<name>123</name>" +
         "<child1>" +
            "<b>23</b>" +
            "<c1>31</c1>" +
View Full Code Here

TOP

Related Classes of nexj.core.integration.io.StringInput

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.