Package org.apache.etch.bindings.java.msg

Examples of org.apache.etch.bindings.java.msg.Message


   
    assertNull( transport.what );
    assertNull( transport.recipient );
    assertNull( transport.msg );
   
    Message msg = constructAddMessage();
    Mailbox mb = mmgr.transportCall( who, msg );
   
    assertSame( transport.what, What.TRANSPORT_MESSAGE );
    assertSame( transport.recipient, who );
    assertSame( transport.msg, msg );
    assertNotNull( mb );
   
    assertEquals( 1, mmgr.size() );
    assertNotNull( msg.getMessageId() );
    assertNull( msg.getInReplyTo() );
    assertSame( mb, mmgr.getMailbox( msg.getMessageId() ) );
   
    Message rmsg = msg.reply( MyValueFactory.mt_add_result );
    boolean msg_handled = mmgr.sessionMessage( who, rmsg );
    assertTrue( msg_handled );
   
    assertNull( session.what );
    assertNull( session.sender );
View Full Code Here


   
    assertNull( transport.what );
    assertNull( transport.recipient );
    assertNull( transport.msg );
   
    Message msg = constructAddMessage();
    Mailbox mb = mmgr.transportCall( who, msg );
   
    assertSame( transport.what, What.TRANSPORT_MESSAGE );
    assertSame( transport.recipient, who );
    assertSame( transport.msg, msg );
    assertNotNull( mb );
   
    assertEquals( 1, mmgr.size() );
    assertNotNull( msg.getMessageId() );
    assertNull( msg.getInReplyTo() );
    assertSame( mb, mmgr.getMailbox( msg.getMessageId() ) );
   
    mb.closeRead();
   
    assertEquals( 0, mmgr.size() );
    assertNull( mmgr.getMailbox( msg.getMessageId() ) );
   
    Message rmsg = msg.reply( MyValueFactory.mt_add_result );
    boolean msg_handled = mmgr.sessionMessage( who, rmsg );
    assertFalse( msg_handled );
   
    assertNull( session.what );
    assertNull( session.sender );
View Full Code Here

    pwAuth.sessionNotify( Session.UP );
   
    assertTrue( session.up );
   
    assertSame( What.TRANSPORT_MESSAGE, transport.what );
    Message msg = transport.msg;
    assertEquals( "_Etch_PwAuthReq", msg.type().getName() );
    assertEquals( "fred", msg.get( new Field( "user" ) ) );
    assertEquals( "1234", msg.get( new Field( "password" ) ) );
  }
View Full Code Here

    pwAuth.sessionNotify( Session.UP );
   
    assertTrue( session.up );
   
    assertSame( What.TRANSPORT_MESSAGE, transport.what );
    Message msg = transport.msg;
    assertEquals( "_Etch_PwAuthReq", msg.type().getName() );
    assertEquals( "fred", msg.get( new Field( "user" ) ) );
    assertEquals( "2345", msg.get( new Field( "password" ) ) );
  }
View Full Code Here

    pwAuth.sessionNotify( Session.UP );
   
    assertTrue( session.up );
   
    assertSame( What.TRANSPORT_MESSAGE, transport.what );
    Message msg = transport.msg;
    assertEquals( "_Etch_PwAuthReq", msg.type().getName() );
    assertEquals( "mary", msg.get( new Field( "user" ) ) );
    assertEquals( "3456", msg.get( new Field( "password" ) ) );
  }
View Full Code Here

//    System.out.printf( "x.id() = %04x\n", x.getId() );
//    System.out.printf( "y.id() = %04x\n", y.getId() );
//    System.out.printf( "_mf__messageId.id() = %04x\n", _mf__messageId.getId() );
//    System.out.printf( "msgid = %08x\n", msgid );
   
    Message msg = new Message( add, vf );
    msg.put( x, 1 );
    msg.put( y, 2 );
    msg.put( _mf__messageId, msgid );
    testmsg2bytes( msg, null,  new byte[] { 3, -122, 39, -23, -73, -100, 3, -122, 21, 10, 44, -77, 1, -122, 99, 6, -76, 104, -121, 1, 2, 3, 4, 5, 6, 7, 8, -122, 21, 10, 44, -76, 2, -127 } );
    testmsg2bytes( msg, false, new byte[] { 3, -122, 39, -23, -73, -100, 3, -122, 21, 10, 44, -77, 1, -122, 99, 6, -76, 104, -121, 1, 2, 3, 4, 5, 6, 7, 8, -122, 21, 10, 44, -76, 2, -127 } );
    testmsg2bytes( msg, true,  new byte[] { 3, -109, 3, 97, 100, 100, 3, -109, 1, 120, 1, -109, 10, 95, 109, 101, 115, 115, 97, 103, 101, 73, 100, -121, 1, 2, 3, 4, 5, 6, 7, 8, -109, 1, 121, 2, -127 } );
   
    msg = new Message( add, vf );
    msg.put( x, 1000000000 );
    msg.put( y, 2000000000 );
    msg.put( _mf__messageId, msgid );
    testmsg2bytes( msg, null,  new byte[] { 3, -122, 39, -23, -73, -100, 3, -122, 21, 10, 44, -77, -122, 59, -102, -54, 0, -122, 99, 6, -76, 104, -121, 1, 2, 3, 4, 5, 6, 7, 8, -122, 21, 10, 44, -76, -122, 119, 53, -108, 0, -127 } );
    testmsg2bytes( msg, false, new byte[] { 3, -122, 39, -23, -73, -100, 3, -122, 21, 10, 44, -77, -122, 59, -102, -54, 0, -122, 99, 6, -76, 104, -121, 1, 2, 3, 4, 5, 6, 7, 8, -122, 21, 10, 44, -76, -122, 119, 53, -108, 0, -127 } );
    testmsg2bytes( msg, true,  new byte[] { 3, -109, 3, 97, 100, 100, 3, -109, 1, 120, -122, 59, -102, -54, 0, -109, 10, 95, 109, 101, 115, 115, 97, 103, 101, 73, 100, -121, 1, 2, 3, 4, 5, 6, 7, 8, -109, 1, 121, -122, 119, 53, -108, 0, -127 } );
  }
View Full Code Here

  /** @throws Exception */
  @Test
  public void newMessage() throws Exception
  {
    Message msg = remote._newMessage( mt );
    msg.checkType( mt );
    assertSame( vf, msg.vf() );
  }
View Full Code Here

  /** @throws Exception */
  @Test
  public void send() throws Exception
  {
    Message msg = remote._newMessage( mt );
   
    remote._send( msg );
   
    assertSame( What.TRANSPORT_MESSAGE, transport.what );
    assertNull( transport.recipient );
View Full Code Here

  /** @throws Exception */
  @Test
  public void begincall() throws Exception
  {
    Message msg = remote._newMessage( mt );
   
    transport.mb = mb;
   
    Mailbox rmb = remote._begincall( msg );
   
View Full Code Here

      -122, // INT (key)
      21, 10, 44, -77, // x
      1, // tiny int = 1 (value)
      -127 // NONE
    };
    Message msg = bytes2msg( buf );
    msg.checkType( add );
    Assert.assertEquals( 3, msg.size() );
    Assert.assertEquals( 1, msg.get( x ) );
    Assert.assertEquals( 2, msg.get( y ) );
    Assert.assertEquals( msgid, msg.get( _mf__messageId ) );
   
    buf = new byte[]
    {
      3, // version
      -122, // INT (type)
      39, -23, -73, -100, // add
      3, // length
      -122, // INT (key)
      99, 6, -76, 104,
      -121, // LONG (value)
      1, 35, 69, 103, -119, -85, -51, -17,
      -122, // INT (key)
      21, 10, 44, -76, // y
      -122, // INT (value)
      119, 53, -108, 0,
      -122, // INT (key)
      21, 10, 44, -77, // x
      -122, // INT (value)
      59, -102, -54, 0,
      -127 // NONE
    };
    msg = bytes2msg( buf );
    msg.checkType( add );
    Assert.assertEquals( 3, msg.size() );
    Assert.assertEquals( 1000000000, msg.get( x ) );
    Assert.assertEquals( 2000000000, msg.get( y ) );
    Assert.assertEquals( msgid, msg.get( _mf__messageId ) );
  }
View Full Code Here

TOP

Related Classes of org.apache.etch.bindings.java.msg.Message

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.