Package org.apache.accumulo.core.client

Examples of org.apache.accumulo.core.client.Connector.tableOperations()


    } catch (TableExistsException tee) {
      Logger.getLogger(IndexMeta.class).warn("Table createEvents exists");
    }
   
    try {
      conn.tableOperations().create("tabletEvents");
    } catch (TableExistsException tee) {
      Logger.getLogger(IndexMeta.class).warn("Table tabletEvents exists");
    }
   
    job.waitForCompletion(true);
View Full Code Here


  }
 
  @Test
  public void testSunnyDay() throws Exception {
    Connector c = new MockConnector("root", new MockInstance());
    c.tableOperations().create("test");
    BatchWriter bw = c.createBatchWriter("test", new BatchWriterConfig());
    for (int i = 0; i < 100; i++) {
      int r = random.nextInt();
      Mutation m = new Mutation(asText(r));
      m.put(asText(random.nextInt()), asText(random.nextInt()), new Value(Integer.toHexString(r).getBytes()));
View Full Code Here

  }
 
  @Test
  public void testBadMutations() throws Exception {
    Connector c = new MockConnector("root", new MockInstance());
    c.tableOperations().create("test");
    BatchWriter bw = c.createBatchWriter("test", new BatchWriterConfig().setMaxMemory(10000L).setMaxLatency(1000L, TimeUnit.MILLISECONDS).setMaxWriteThreads(4));

    try {
      bw.addMutation(null);
      Assert.fail("addMutation should throw IAE for null mutation");
View Full Code Here

  @Test
  public void testAggregation() throws Exception {
    MockInstance mockInstance = new MockInstance();
    Connector c = mockInstance.getConnector("root", new PasswordToken(""));
    String table = "perDayCounts";
    c.tableOperations().create(table);
    IteratorSetting is = new IteratorSetting(10, "String Summation", SummingCombiner.class);
    Combiner.setColumns(is, Collections.singletonList(new IteratorSetting.Column("day")));
    SummingCombiner.setEncodingType(is, SummingCombiner.Type.STRING);
    c.tableOperations().attachIterator(table, is);
    String keys[][] = { {"foo", "day", "20080101"}, {"foo", "day", "20080101"}, {"foo", "day", "20080103"}, {"bar", "day", "20080101"},
View Full Code Here

    String table = "perDayCounts";
    c.tableOperations().create(table);
    IteratorSetting is = new IteratorSetting(10, "String Summation", SummingCombiner.class);
    Combiner.setColumns(is, Collections.singletonList(new IteratorSetting.Column("day")));
    SummingCombiner.setEncodingType(is, SummingCombiner.Type.STRING);
    c.tableOperations().attachIterator(table, is);
    String keys[][] = { {"foo", "day", "20080101"}, {"foo", "day", "20080101"}, {"foo", "day", "20080103"}, {"bar", "day", "20080101"},
        {"bar", "day", "20080101"},};
    BatchWriter bw = c.createBatchWriter("perDayCounts", new BatchWriterConfig());
    for (String elt[] : keys) {
      Mutation m = new Mutation(new Text(elt[0]));
View Full Code Here

  }
 
  @Test
  public void testDelete() throws Exception {
    Connector c = new MockConnector("root", new MockInstance());
    c.tableOperations().create("test");
    BatchWriter bw = c.createBatchWriter("test", new BatchWriterConfig());
   
    Mutation m1 = new Mutation("r1");
   
    m1.put("cf1", "cq1", 1, "v1");
View Full Code Here

    }
   
    assertEquals(0, count);
   
    try {
      c.tableOperations().create("test_this_$tableName");
      assertTrue(false);
     
    } catch (IllegalArgumentException iae) {
     
    }
View Full Code Here

  @Test
  public void testDeletewithBatchDeleter() throws Exception {
    Connector c = new MockConnector("root", new MockInstance());
   
    // make sure we are using a clean table
    if (c.tableOperations().exists("test"))
      c.tableOperations().delete("test");
    c.tableOperations().create("test");
   
    BatchDeleter deleter = c.createBatchDeleter("test", Constants.NO_AUTHS, 2, new BatchWriterConfig());
    // first make sure it deletes fine when its empty
View Full Code Here

  public void testDeletewithBatchDeleter() throws Exception {
    Connector c = new MockConnector("root", new MockInstance());
   
    // make sure we are using a clean table
    if (c.tableOperations().exists("test"))
      c.tableOperations().delete("test");
    c.tableOperations().create("test");
   
    BatchDeleter deleter = c.createBatchDeleter("test", Constants.NO_AUTHS, 2, new BatchWriterConfig());
    // first make sure it deletes fine when its empty
    deleter.setRanges(Collections.singletonList(new Range(("r1"))));
View Full Code Here

    Connector c = new MockConnector("root", new MockInstance());
   
    // make sure we are using a clean table
    if (c.tableOperations().exists("test"))
      c.tableOperations().delete("test");
    c.tableOperations().create("test");
   
    BatchDeleter deleter = c.createBatchDeleter("test", Constants.NO_AUTHS, 2, new BatchWriterConfig());
    // first make sure it deletes fine when its empty
    deleter.setRanges(Collections.singletonList(new Range(("r1"))));
    deleter.delete();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.