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

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


  /** Tests add performance.
   * @throws Exception */
  @Test public void test_add_perf() throws Exception
  {
    Type add = vf.getType( "add" );
   
    Field x = new Field( "x" );
    add.putValidator( x, Validator_int.get( 0 ) );
   
    Field y = new Field( "y" );
    add.putValidator( y, Validator_int.get( 0 ) );
   
    Field _mf__messageId = DefaultValueFactory._mf__messageId;
    add.putValidator( _mf__messageId, Validator_long.get( 0 ) );
   
    long msgid = 0x0123456789abcdefL;
   
//    System.out.printf( "add.id() = %04x\n", add.getId() );
//    System.out.printf( "x.id() = %04x\n", x.getId() );
View Full Code Here


    testbadvalue( 0, 5.5f );
    testbadvalue( 0, 6.6 );
    testbadvalue( 0, "" );
    testbadvalue( 0, "abc" );
    testbadvalue( 0, new Object() );
    testbadvalue( 0, new StructValue( new Type( "abc" ), vf ) );
    testbadvalue( 0, new Date() );

    testbadvalue( 1, null );
    testbadvalue( 1, false );
    testbadvalue( 1, true );
    testbadvalue( 1, (byte) 1 );
    testbadvalue( 1, (short) 2222 );
    testbadvalue( 1, 333333 );
    testbadvalue( 1, 4444444444444444L );
    testbadvalue( 1, 5.5f );
    testbadvalue( 1, 6.6 );
    testbadvalue( 1, "" );
    testbadvalue( 1, "abc" );
    testbadvalue( 1, new Object() );
    testbadvalue( 1, new StructValue( new Type( "abc" ), vf ) );
    testbadvalue( 1, new Date() );
  }
View Full Code Here

 
  /** Tests sum performance.
   * @throws Exception */
  @Test public void test_sum_perf() throws Exception
  {
    Type sum = vf.getType( "sum" );
   
    Field values = new Field( "values" );
    sum.putValidator( values, Validator_int.get( 1 ) );
   
    Field _mf__messageId = DefaultValueFactory._mf__messageId;
    sum.putValidator( _mf__messageId, Validator_long.get( 0 ) );
   
    long msgid = 0x0123456789abcdefL;
   
//    System.out.printf( "add.id() = %04x\n", add.getId() );
//    System.out.printf( "x.id() = %04x\n", x.getId() );
View Full Code Here

//    System.out.println( "msg = "+msg );
  }
 
  private void assertValueToBytes( Object value, byte[] expectedBytes ) throws Exception
  {
    Type t = new Type( 1, "a" );
    Field f = new Field( 2, "b" );
    t.putValidator( f, Validator_object.get( 0 ) );
   
    Message msg = new Message( t, vf );
    msg.put( f, value );
//    System.out.println( "msg = "+msg );
   
View Full Code Here

    testgoodvalue( 0, 5.5f );
    testgoodvalue( 0, 6.6 );
    testgoodvalue( 0, "" );
    testgoodvalue( 0, "abc" );
    testgoodvalue( 0, new Object() );
    testgoodvalue( 0, new StructValue( new Type( "abc" ), vf ) );
    testgoodvalue( 0, new Date() );
  }
View Full Code Here

    testbadvalue( 1, 5.5f );
    testbadvalue( 1, 6.6 );
    testbadvalue( 1, "" );
    testbadvalue( 1, "abc" );
    testbadvalue( 1, new Object() );
    testbadvalue( 1, new StructValue( new Type( "abc" ), vf ) );
    testbadvalue( 1, new Date() );
  }
View Full Code Here

  private void testMap( StrIntHashMap map )
  {
//    System.out.println( "---------------------------------------------" );
//    System.out.println( "map = "+map );
   
    Type type = new Type( "map" );
    Class2TypeMap class2type = new Class2TypeMap();
    StrIntHashMapSerializer.init( type, class2type );
    ImportExportHelper helper = type.getImportExportHelper();
   
    StructValue sv = helper.exportValue( vf, map );
//    System.out.println( "sv = "+sv );
   
    assertEquals( sv.type(), type );
View Full Code Here

  {
//    System.out.println( "---------------------------------------------" );
//    System.out.println( "date = "+date );
   
    ValueFactory vf = new DummyValueFactory();
    Type type = new Type( "date" );
    Class2TypeMap class2type = new Class2TypeMap();
    DateSerializer.init( type, class2type );
    ImportExportHelper helper = type.getImportExportHelper();
   
    StructValue sv = helper.exportValue( vf, date );
//    System.out.println( "sv = "+sv );
   
    assertEquals( sv.type(), type );
View Full Code Here

    testbadvalue( 0, 5.5f );
    testbadvalue( 0, 6.6 );
    testbadvalue( 0, "" );
    testbadvalue( 0, "abc" );
    testbadvalue( 0, new Object() );
    testbadvalue( 0, new StructValue( new Type( "abc" ), vf ) );
    testbadvalue( 0, new Date() );

    testbadvalue( 1, null );
    testbadvalue( 1, false );
    testbadvalue( 1, true );
    testbadvalue( 1, (byte) 1 );
    testbadvalue( 1, (short) 2222 );
    testbadvalue( 1, 33333333 );
    testbadvalue( 1, 4444444444444444L );
    testbadvalue( 1, 5.5f );
    testbadvalue( 1, 6.6 );
    testbadvalue( 1, "" );
    testbadvalue( 1, "abc" );
    testbadvalue( 1, new Object() );
    testbadvalue( 1, new StructValue( new Type( "abc" ), vf ) );
    testbadvalue( 1, new Date() );
  }
View Full Code Here

  {
//    System.out.println( "---------------------------------------------" );
//    System.out.println( "map = "+map );
   
    ValueFactory vf = new DummyValueFactory();
    Type type = new Type( "map" );
    Class2TypeMap class2type = new Class2TypeMap();
    StrStrHashMapSerializer.init( type, class2type );
    ImportExportHelper helper = type.getImportExportHelper();
   
    StructValue sv = helper.exportValue( vf, map );
//    System.out.println( "sv = "+sv );
   
    assertEquals( sv.type(), type );
View Full Code Here

TOP

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

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.