Package bagcheck

Examples of bagcheck.User


    System.out.println(failures + " out of " + total + " in " + (System.currentTimeMillis() - start) + "ms");

  }

  private User getUser() {
    User user = new User();
    user.email = $("spullara@yahoo.com");
    user.firstName = $("Sam");
    user.lastName = $("Pullara");
    user.image = $("");
    user.password = ByteBuffer.allocate(0);
View Full Code Here


  }

  @Test
  public void putGet() throws InterruptedException {
    AvroBase<User, byte[]> userRAB = getAB();
    User user = getUser();
    userRAB.put("test".getBytes(Charsets.UTF_8), user);
    Thread.sleep(1000);
    Row<User, byte[]> test = userRAB.get("test".getBytes(Charsets.UTF_8));
    assertEquals(user, test.value);
  }
View Full Code Here

  }

  @Test
  public void putGet2() {
    AvroBase<User, byte[]> userRAB = getAB();
    User user = getUser();
    row = "test".getBytes(Charsets.UTF_8);
    userRAB.put(row, user);
    userRAB.mutate(row, new Mutator<User>() {
      @Override
      public User mutate(User value) {
View Full Code Here

  }

  @Test
  public void testScan() {
    AvroBase<User, byte[]> userRAB = getAB();
    User user = getUser();
    long start;
    start = System.currentTimeMillis();
    for (int i = 0; i < 100000; i++) {
      userRAB.put(Ints.toByteArray(i), user);
    }
View Full Code Here

    }
    assertEquals(0, total);
  }

  private User getUser() {
    User user = new User();
    user.email = $("spullara@yahoo.com");
    user.firstName = $("Sam");
    user.lastName = $("Pullara");
    user.image = $("");
    user.password = ByteBuffer.allocate(0);
View Full Code Here

*/
public class UserTest extends TestCase {

  public void testSave() throws IOException {
    File file = File.createTempFile("hbase", "avro");
    User saved = new User();
    {
      saved.firstName = $("Sam");
      saved.lastName = $("Pullara");
      saved.birthday = $("1212");
      saved.gender = GenderType.MALE;
      saved.email = $("spullara@yahoo.com");
      saved.description = $("CTO of RightTime, Inc. and one of the founders of BagCheck");
      saved.title = $("Engineer");
      saved.image = $("http://farm1.static.flickr.com/1/buddyicons/32354567@N00.jpg");
      saved.location = $("Los Altos, CA");
      saved.password = ByteBuffer.wrap($("").getBytes());
      FileOutputStream fos = new FileOutputStream(file);

      BinaryEncoder be = new EncoderFactory().binaryEncoder(fos, null);
      SpecificDatumWriter<User> sdw = new SpecificDatumWriter<User>(User.class);
      sdw.write(saved, be);
      be.flush();
      fos.close();
    }
    {
      FileInputStream fis = new FileInputStream(file);
      DecoderFactory factory = new DecoderFactory();
      BinaryDecoder bd = factory.binaryDecoder(fis, null);
      SpecificDatumReader<User> sdr = new SpecificDatumReader<User>(User.class);
      User loaded = sdr.read(null, bd);
      fis.close();
      assertEquals(saved, loaded);
      assertEquals("Sam", loaded.firstName.toString());
    }
  }
View Full Code Here

    }
  }

  public void testOptional() throws IOException {
    File file = File.createTempFile("hbase", "avro");
    User saved = new User();
    {
      saved.firstName = $("Sam");
      saved.lastName = $("Pullara");
//      saved.birthday = $("1212");
//      saved.gender = GenderType.MALE;
      saved.email = $("spullara@yahoo.com");
//      saved.description = $("CTO of RightTime, Inc. and one of the founders of BagCheck");
//      saved.title = $("Engineer");
      saved.image = $("http://farm1.static.flickr.com/1/buddyicons/32354567@N00.jpg");
//      saved.location = $("Los Altos, CA");
      saved.password = ByteBuffer.wrap($("").getBytes());
      FileOutputStream fos = new FileOutputStream(file);
      BinaryEncoder be = new EncoderFactory().binaryEncoder(fos, null);
      SpecificDatumWriter<User> sdw = new SpecificDatumWriter<User>(User.class);
      sdw.write(saved, be);
      be.flush();
      fos.close();
    }
    {
      FileInputStream fis = new FileInputStream(file);
      DecoderFactory factory = new DecoderFactory();
      BinaryDecoder bd = factory.binaryDecoder(fis, null);
      SpecificDatumReader<User> sdr = new SpecificDatumReader<User>(User.class);
      User loaded = sdr.read(null, bd);
      fis.close();
      assertEquals(saved, loaded);
      assertEquals(null, loaded.location);
      assertEquals("Sam", loaded.firstName.toString());
    }
View Full Code Here

  }

  @Test
  public void putGet() throws InterruptedException {
    MongoAB<User, byte[]> userRAB = getAB();
    User user = getUser();
    userRAB.put("test".getBytes(Charsets.UTF_8), user);
    Thread.sleep(1000);
    Row<User, byte[]> test = userRAB.get("test".getBytes(Charsets.UTF_8));
    assertEquals(user, test.value);
  }
View Full Code Here

  }

  @Test
  public void putGet2() {
    MongoAB<User, byte[]> userRAB = getAB();
    User user = getUser();
    row = "test".getBytes(Charsets.UTF_8);
    userRAB.put(row, user);
    userRAB.mutate(row, new Mutator<User>() {
      @Override
      public User mutate(User value) {
View Full Code Here

  }

  @Test
  public void testScan() {
    MongoAB<User, byte[]> userRAB = getAB();
    User user = getUser();
    long start;
    start = System.currentTimeMillis();
    for (int i = 0; i < 100000; i++) {
      userRAB.put(Ints.toByteArray(i), user);
    }
View Full Code Here

TOP

Related Classes of bagcheck.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.