Package thrift.test

Examples of thrift.test.Reuse


  public void testReuseObject() throws Exception {
    TSerializer   binarySerializer   = new   TSerializer(new TBinaryProtocol.Factory());
    TDeserializer binaryDeserializer = new TDeserializer(new TBinaryProtocol.Factory());

    Reuse ru1 = new Reuse();
    HashSet<String> hs1 = new HashSet<String>();
    byte[] serBytes;   
    String st1 = new String("string1");
    String st2 = new String("string2");

    ru1.setVal1(11);
    ru1.setVal2(hs1);
    ru1.addToVal2(st1);
   
    serBytes = binarySerializer.serialize(ru1);

    // update hash set after serialization
    hs1.add(st2);

    binaryDeserializer.deserialize(ru1, serBytes);
  
    assertTrue( ru1.getVal2() == hs1 );
    assertTrue( hs1.size() == 2 );
  }
View Full Code Here

TOP

Related Classes of thrift.test.Reuse

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.