Package nexj.core.integration.io

Examples of nexj.core.integration.io.ObjectInput


      Iterator itr = null;

      if (table != null && table.getFormat() != null)
      {
         tobj = ((MessageParser)table.getFormat().getParser().getInstance(context))
            .parse((body instanceof Input) ? (Input)body : new ObjectInput(body), table);
         itr = channel.getBindingIterator(table.getMessage(tobj.getClassName()));
      }
      else
      {
         if (body instanceof Input)
View Full Code Here


                   "20000000a80000007365696e66656c64" +
                   "2f636861726163746572732f6a657272" +
                   "792e747874504b050600000000040004" +
                   "0010010000f500000000000a");

      TransferObject root = m_parser.parse(new ObjectInput(zipBin), m_message);
      List filesList = (List)root.getValue("files");

      assertEquals("Zip_AllMapped", root.getClassName());
      assertNotNull(filesList);
      assertEquals(4, filesList.size());
View Full Code Here

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

         {
            throw new IntegrationException("err.rpc.file.missingBody",
               new Object[] {m_channel.getName()});
         }

         ObjectInput conv = new ObjectInput(body);

         if (m_channel.getEncoding() != null)
         {
            conv.setEncoding(m_channel.getEncoding());
         }

         data = conv.getBinary();
         conn = m_connectionFactory.getConnection();

         if (s_logger.isDebugEnabled())
         {
            s_logger.debug("Using file connection: " + conn);
View Full Code Here

               }
            }
         }
         else
         {
            ObjectInput input = new ObjectInput(body);

            if (!input.isEmpty())
            {
               input.setEncoding(sEncoding);

               InputStream istream = input.getInputStream();

               try
               {
                  IOUtil.copy(ostream, istream);
               }
View Full Code Here

               if (m_response.getContentType() == null && channel.getContentType() != null)
               {
                  m_response.setContentType(channel.getContentType());
               }

               ObjectInput input = new ObjectInput(body);

               if (body instanceof String)
               {
                  if (m_response.getContentType() == null)
                  {
                     m_response.setContentType("text/plain");
                  }
                 
                  input.setEncoding(m_response.getCharacterEncoding());

                  Writer writer = m_response.getWriter();
                 
                  IOUtil.copy(writer, input.getReader());
                  writer.close();
               }
               else
               {
                  OutputStream ostream = m_response.getOutputStream();
                 
                  IOUtil.copy(ostream, input.getInputStream());
                  ostream.close();
               }
            }
         }
      }
View Full Code Here

      {
         input = (Input)body;
      }
      else
      {
         input = new ObjectInput(body);
      }

      return ((MessageParser)format.getParser().getInstance(context)).parse(input, table);
   }
View Full Code Here

                     tobj = null;
                  }
                  else
                  {
                     tobj = ((MessageParser)format.getParser().getInstance(context))
                        .parse(new ObjectInput(obj), response);
                  }
               }

               machine.returnValue(tobj, nArgCount);
View Full Code Here

         if (message != null && message.getFormat() != null)
         {
            if (bParse)
            {
               Input in = new ObjectInput(value);
               MessageParser parser;

               if (m_parserMap == null)
               {
                  m_parserMap = new HashTab(m_context.getMetadata().getFormatCount());
View Full Code Here

      rollback();
   }

   public void testParseRootInheritance()
   {
      ObjectInput in;
      TransferObject root;

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

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


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

      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 Patient as Object_Inherit_Contact (polymorphically becomes Object_Inherit_Patient)
      in = new ObjectInput(m_patient);
      root = m_parser.parse(in, m_contactMsg);

      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 as Object_Inherit_Contact (polymorphically becomes Object_Inherit_Surgeon)
      in = new ObjectInput(m_surgeon);
      root = m_parser.parse(in, m_contactMsg);

      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 Doctor as Object_Inherit_Contact (stays as Object_Inherit_Contact)
      in = new ObjectInput(m_doctor);
      root = m_parser.parse(in, m_contactMsg);

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


      // Parse Doctor as Object_Inherit_Patient (fails)
      in = new ObjectInput(m_doctor);

      try
      {
         root = m_parser.parse(in, m_patientMsg);
         fail("Expected IntegrationException");
      }
      catch (IntegrationException ex)
      {
         ex = (IntegrationException)ex.getCause();
         assertEquals("err.integration.object.missingMapping", ex.getErrorCode());
      }

      // Parse Surgeon as Object_Inherit_Patient (fails)
      in = new ObjectInput(m_surgeon);

      try
      {
         root = m_parser.parse(in, m_patientMsg);
         fail("Expected IntegrationException");
      }
      catch (IntegrationException ex)
      {
         ex = (IntegrationException)ex.getCause();
         assertEquals("err.integration.object.missingMapping", ex.getErrorCode());
      }


      // Parse Patient as Object_Inherit_Contact_NonPoly (not polymorphic, so does not become Patient2)
      in = new ObjectInput(m_patient);
      root = m_parser.parse(in, m_contactNonPolyMsg);

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


      // Parse Patient as Object_Inherit_Patient2
      in = new ObjectInput(m_patient);
      root = m_parser.parse(in, m_patient2Msg);

      assertEquals("Object_Inherit_Patient2", root.getClassName());
      assertEquals("Sarah", root.getValue("firstName"));
      assertEquals("Johnson", root.getValue("lastName"));
View Full Code Here

TOP

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

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.