Package org.infinispan.protostream.domain

Examples of org.infinispan.protostream.domain.User


   @Test
   public void test() throws Exception {
      final SerializationContext ctx = createContext();

      User user = new User();
      user.setId(1);
      user.setName("John");
      user.setSurname("Batman");
      user.setGender(User.Gender.MALE);
      user.setAccountIds(Arrays.asList(1, 3));
      user.setAddresses(Collections.singletonList(new Address("Old Street", "XYZ42")));

      byte[] bytes = ProtobufUtil.toWrappedByteArray(ctx, user);

      TagHandler tagHandler = new TagHandler() {
         private Descriptor nextDescriptor = null;
View Full Code Here


   public static final int NUM_OUTER_LOOPS = 1000;
   public static final int NUM_INNER_LOOPS = 100000;

   @Test
   public void testProtoStreamWrite() throws Exception {
      User user = createTestObject();

      long[] results = new long[1];
      for (int i = 0; i < NUM_OUTER_LOOPS; i++) {
         log.infof("----------------------- # %d ------------------------", i);
View Full Code Here

      }
   }

   @Test
   public void testProtoStreamRead() throws Exception {
      User user = createTestObject();

      long[] results = new long[1];
      byte[] bytes = writeWithProtoStream(user, results);

      for (int i = 0; i < NUM_OUTER_LOOPS; i++) {
View Full Code Here

    * marshallers, allowing 5 cases out of 1000 to have bad performance due to unfavorable thread scheduling, time
    * measurement inaccuracies, garbage collection pauses or whatever bad karma.
    */
   @Test
   public void testComparativeReadWrite() throws Exception {
      User user = createTestObject();

      int jinx = 0;
      byte[][] bytes = new byte[3][];
      long[][] results = new long[3][1];
      for (int i = 0; i < NUM_OUTER_LOOPS; i++) {
View Full Code Here

      // allow 5 cases where performance is worse than others
      assertTrue(jinx <= 5);
   }

   private User createTestObject() {
      User user = new User();
      user.setId(1);
      user.setName("John");
      user.setSurname("Batman");
      user.setGender(User.Gender.MALE);
      user.setAccountIds(Arrays.asList(1, 3));
      List<Address> addresses = new ArrayList<Address>();
      addresses.add(new Address("Old Street", "XYZ42"));
      addresses.add(new Address("Bond Street", "QQ42"));
      user.setAddresses(addresses);
      return user;
   }
View Full Code Here

TOP

Related Classes of org.infinispan.protostream.domain.User

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.