Package nexj.core.meta.integration

Examples of nexj.core.meta.integration.MessageTable


      if (m_interface == null)
      {
         return tobj;
      }

      MessageTable table = m_interface.getRequestTable();

      if (table.getMessageCount() == 0 && table.getFormat() == null)
      {
         return tobj;
      }

      Message message = table.findMessage(tobj.getClassName());

      if (message == null)
      {
         throw new IntegrationException("err.integration.service.invalidRequest",
            new Object[]{tobj.getClassName(), getName()});
View Full Code Here


      assertNull(root.getValue("middleName"));
   }

   public void testParseRootInheritanceWithMessageTable()
   {
      MessageTable table = new MessageTable();
      ObjectInput in;
      TransferObject root;

      table.addMessage(m_patientMsg);
      table.addMessage(m_surgeonMsg);
      m_parser.initializeMessageTable(table);


      // Parse Patient (uses Object_Inherit_Patient)
      in = new ObjectInput(m_patient);
      root = m_parser.parse(in, table);

      assertEquals("Object_Inherit_Patient", root.getClassName());
      assertEquals("Sarah", root.getValue("firstName"));
      assertEquals("Johnson", root.getValue("lastName"));
      assertTrue(root.hasValue("middleName"));
      assertNull(root.getValue("middleName"));


      // Parse Surgeon (uses Object_Inherit_Surgeon)
      in = new ObjectInput(m_surgeon);
      root = m_parser.parse(in, table);

      assertEquals("Object_Inherit_Surgeon", root.getClassName());
      assertEquals("Joshua", root.getValue("firstName"));
      assertEquals("Zig", root.getValue("lastName"));
      assertEquals("ECG", root.getValue("speciality"));
      assertFalse(root.hasValue("middleName"));


      // Parse Contact--error
      try
      {
         in = new ObjectInput(m_contact);
         m_parser.parse(in, table);
         fail("Expected IntegrationException");
      }
      catch (IntegrationException ex)
      {
         assertEquals("err.integration.object.unsupportedMessage", ex.getErrorCode());
      }


      // Parse Doctor--error
      try
      {
         in = new ObjectInput(m_doctor);
         m_parser.parse(in, table);
         fail("Expected IntegrationException");
      }
      catch (IntegrationException ex)
      {
         assertEquals("err.integration.object.unsupportedMessage", ex.getErrorCode());
      }


      // Change table
      table.addMessage(m_contactMsg);
      m_parser.initializeMessageTable(table);


      // Parse Contact (uses Object_Inherit_Contact)
      in = new ObjectInput(m_contact);
      root = m_parser.parse(in, table);

      assertEquals("Object_Inherit_Contact", root.getClassName());
      assertEquals("Joe", root.getValue("firstName"));
      assertFalse(root.hasValue("lastName"));


      // Parse Patient (uses Object_Inherit_Patient, polymorphic from Object_Inherit_Contact)
      in = new ObjectInput(m_patient);
      root = m_parser.parse(in, table);

      assertEquals("Object_Inherit_Patient", root.getClassName());
      assertEquals("Sarah", root.getValue("firstName"));
      assertEquals("Johnson", root.getValue("lastName"));
      assertTrue(root.hasValue("middleName"));
      assertNull(root.getValue("middleName"));


      // Parse Doctor (uses Object_Inherit_Contact)
      in = new ObjectInput(m_doctor);
      root = m_parser.parse(in, table);

      assertEquals("Object_Inherit_Contact", root.getClassName());
      assertEquals("Johan", root.getValue("firstName"));
      assertFalse(root.hasValue("lastName"));


      // Parse Surgeon (uses Object_Inherit_Surgeon, polymorphic from Object_Inherit_Contact)
      in = new ObjectInput(m_surgeon);
      root = m_parser.parse(in, table);

      assertEquals("Object_Inherit_Surgeon", root.getClassName());
      assertEquals("Joshua", root.getValue("firstName"));
      assertEquals("Zig", root.getValue("lastName"));
      assertEquals("ECG", root.getValue("speciality"));
      assertFalse(root.hasValue("middleName"));



      table = new MessageTable();
      table.addMessage(m_contactNonPolyMsg);
      table.addMessage(m_patientMsg);
      m_parser.initializeMessageTable(table);


      // Parse Patient (uses Object_Inherit_Patient from the table)
      in = new ObjectInput(m_patient);
      root = m_parser.parse(in, table);

      assertEquals("Object_Inherit_Patient", root.getClassName());
      assertEquals("Sarah", root.getValue("firstName"));
      assertEquals("Johnson", root.getValue("lastName"));
      assertTrue(root.hasValue("middleName"));
      assertNull(root.getValue("middleName"));


      // Parse Surgeon (uses Object_Inherit_Contact_NonPoly from the table)
      in = new ObjectInput(m_surgeon);
      root = m_parser.parse(in, table);

      assertEquals("Object_Inherit_Contact_NonPoly", root.getClassName());
      assertEquals("Joshua", root.getValue("firstName"));
      assertFalse(root.hasValue("lastName"));


      // Parse Contact (uses Object_Inherit_Contact_NonPoly from the table)
      in = new ObjectInput(m_contact);
      root = m_parser.parse(in, table);

      assertEquals("Object_Inherit_Contact_NonPoly", root.getClassName());
      assertEquals("Joe", root.getValue("firstName"));
      assertFalse(root.hasValue("lastName"));


      try
      {
         table = new MessageTable();
         table.addMessage(m_contactMsg);
         table.addMessage(m_contactNonPolyMsg);
         m_parser.initializeMessageTable(table);
         fail("Expected IntegrationException");
      }
      catch (IntegrationException ex)
      {
View Full Code Here

    * Tests that two Message objects, both with headers but different
    * delimiter/quote/escape, cannot be added to the message table.
    */
   public void testInvalidMessageTableWithHeaders() throws Exception
   {
      MessageTable table = new MessageTable();
     
      table.addMessage(m_simple_message);
      table.addMessage(m_tsv_message);
     
      try
      {
         m_parser.initializeMessageTable(table);
         fail();
View Full Code Here

    * Messages without can only be distinguished from eachother if they have
    * the same configuration (delimiter, quoting, etc.).
    */
   public void testInvalidMessageTableDifferentConfigurations() throws Exception
   {
      MessageTable table = new MessageTable();
     
      table.addMessage(m_noheader_message);
      table.addMessage(m_noquote_message);
     
      try
      {
         m_parser.initializeMessageTable(table);
         fail();
View Full Code Here

    * First data row must contain either 3 or 4 fields, and so
    * correct Message may be determined.
    */
   public void testGoodMessageTableNoHeadersLengthDifferent1() throws Exception
   {
      MessageTable table = new MessageTable();
     
      table.addMessage(Repository.getMetadata().getMessage("CSV_TableConflict_4Required"));
      table.addMessage(Repository.getMetadata().getMessage("CSV_TableConflict_3Required"));
     
      m_parser.initializeMessageTable(table);
     
      TransferObject root, record;
      List recordList;
View Full Code Here

    * First data row may have 4 fields, implying M1. If it has
    * 3, 2, 1, or 0 fields, then M2 is implied.
    */
   public void testGoodMessageTableNoHeadersLengthDifferent2() throws Exception
   {
      MessageTable table = new MessageTable();
     
      table.addMessage(Repository.getMetadata().getMessage("CSV_TableConflict_4Required"));
      table.addMessage(Repository.getMetadata().getMessage("CSV_TableConflict_3Optional"));
     
      m_parser.initializeMessageTable(table);
     
      TransferObject root, record;
      List recordList;
View Full Code Here

    * First data row may have 4 fields, implying M1. If it has
    * 3 or 2 fields, then M2 is implied.
    */
   public void testGoodMessageTableNoHeadersLengthDifferent3() throws Exception
   {
      MessageTable table = new MessageTable();
     
      table.addMessage(Repository.getMetadata().getMessage("CSV_TableConflict_4Required"));
      table.addMessage(Repository.getMetadata().getMessage("CSV_TableConflict_2Required1Optional"));
     
      m_parser.initializeMessageTable(table);
     
      TransferObject root, record;
      List recordList;
View Full Code Here

    * First data row may have 4 header fields, implying M1. If it has
    * 3, 2, 1, or 0 data fields, then M2 is implied.
    */
   public void testGoodMessageTableNoHeadersLengthDifferent4() throws Exception
   {
      MessageTable table = new MessageTable();
     
      table.addMessage(Repository.getMetadata().getMessage("CSV_TableConflict_4HeaderAllRequired"));
      table.addMessage(Repository.getMetadata().getMessage("CSV_TableConflict_3Optional"));
     
      m_parser.initializeMessageTable(table);
     
      TransferObject root, record;
      List recordList;
View Full Code Here

    *
    * Also tests that leading newlines are ignored.
    */
   public void testGoodMessageTableNoHeadersLengthDifferent5() throws Exception
   {
      MessageTable table = new MessageTable();
     
      table.addMessage(Repository.getMetadata().getMessage("CSV_TableConflict_4HeaderAllRequired"));
      table.addMessage(Repository.getMetadata().getMessage("CSV_TableConflict_2Required1Optional"));
      table.addMessage(Repository.getMetadata().getMessage("CSV_TableConflict_5Required"));
     
      m_parser.initializeMessageTable(table);
     
      TransferObject root, record;
      List recordList;
View Full Code Here

    *
    * Also tests that leading newlines are ignored.
    */
   public void testGoodMessageTableNoHeadersLengthDifferent6() throws Exception
   {
      MessageTable table = new MessageTable();
     
      table.addMessage(Repository.getMetadata().getMessage("CSV_TableConflict_4Header"));
      table.addMessage(Repository.getMetadata().getMessage("CSV_TableConflict_5Required"));
      table.addMessage(Repository.getMetadata().getMessage("CSV_TableConflict_1Required1Optional"));
     
      m_parser.initializeMessageTable(table);
     
      TransferObject root, record;
      List recordList;
View Full Code Here

TOP

Related Classes of nexj.core.meta.integration.MessageTable

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.