Package org.apache.niolex.commons.test.Benchmark

Examples of org.apache.niolex.commons.test.Benchmark.Bean


      protected void run() {
          byte[] bs = ProtoStuffUtil.seriMulti(new Object[] {bench, q});
          Type[] types = new Type[] {Benchmark.class, Bean.class};
          Object[] back = ProtoStuffUtil.parseMulti(bs, types);
          Benchmark cp = (Benchmark) back[0];
          Bean t = (Bean) back[1];
          assertTrue(t.getId() == 452723);
          assertTrue(t.getBirth().getTime() == 5354482831545L);
          assertTrue(bench.equals(cp));
      }
View Full Code Here


  /**
   * Test method for {@link org.apache.niolex.commons.seri.ProtoStuffUtil#parseOne(byte[], java.lang.reflect.Type)}.
   */
  @Test
  public void testParseOne() {
    Bean t = new Bean(3, "Qute", 12212, new Date(1338008328709L));
    byte[] tar = seriOne(t);
    Bean p2 = (Bean)parseOne(tar, Bean.class);
    assertEquals(p2.getBirth(), new Date(1338008328709L));
    assertEquals(p2.getId(), 12212);
    System.out.println("Tar.size " + tar.length);
  }
View Full Code Here

  /**
   * Test method for {@link org.apache.niolex.commons.seri.ProtoStuffUtil#parseMulti(byte[], java.lang.reflect.Type[])}.
   */
  @Test
  public void testParseMulti() {
    Bean t = new Bean(3, "Qute", 12212, new Date(1338008328709L));
    Bean q = new Bean(5, "Another", 523212, new Date(1338008328334L));
    Benchmark ben = Benchmark.makeBenchmark();
    byte[] tar = seriMulti(new Object[] {t, ben, q});
    System.out.println("Tar.size " + tar.length);
    Object[] r = parseMulti(tar, new Type[] {Bean.class, Benchmark.class, Bean.class});
    assertEquals(r[0], t);
View Full Code Here

public class SmileUtilTest extends SmileUtil {

  @Test
  public final void testObj2Bin() throws Exception {
    Bean t = new Bean(3, "Qute", 12212, new Date(1338008328709L));
    byte[] bin = obj2bin(t);
    Bean st = bin2Obj(bin, Bean.class);
    assertEquals(st, t);
  }
View Full Code Here

    assertEquals(st, t);
  }

  @Test
  public void testBin2ObjType() throws Exception {
    Bean t = new Bean(233, "Quty", 548166, new Date(1338008328709L));
    byte[] bin = obj2bin(t);
    Bean st = bin2Obj(bin, SmileUtil.getTypeFactory().constructType(Bean.class));
    assertEquals(st, t);
  }
View Full Code Here

    assertEquals(st, t);
  }

  @Test
  public void testBin2ObjRef() throws Exception {
    Bean t = new Bean(3, "Qute", 12212, new Date(1338008328709L));
    byte[] bin = obj2bin(t);
    Bean st = bin2Obj(bin, new TypeReference<Bean>(){});
    assertEquals(st, t);
  }
View Full Code Here

  }

  @Test
  public final void testWriteObj() throws Exception {
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    Bean t = new Bean(67563, "Lex", 122435612, new Date(1338008328709L));
    List<Bean> m = new ArrayList<Bean>();
    m.add(t);
    m.add(t);
    writeObj(out, m);
    out.close();
View Full Code Here

  }

  @Test
  public final void testReadObjInputStreamClassOfT() throws Exception {
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    Bean t = new Bean(6563, "Qute", 12546212, new Date(1338008328709L));
    List<Bean> m = new ArrayList<Bean>();
    m.add(t);
    m.add(t);
    writeObj(out, m);
    out.close();
View Full Code Here

  }

  @Test
  public void testReadObjRef() throws Exception {
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    Bean t = new Bean(3565, "Qute", 123212139, new Date(1338008328709L));
    List<Bean> m = new ArrayList<Bean>();
    m.add(t);
    m.add(t);
    writeObj(out, m);
    out.close();
View Full Code Here

TOP

Related Classes of org.apache.niolex.commons.test.Benchmark.Bean

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.