Package org.apache.accumulo.core.client.admin

Examples of org.apache.accumulo.core.client.admin.TableOperations.create()


  public void testImport() throws Throwable {
    ImportTestFilesAndData dataAndFiles = prepareTestFiles();
    Instance instance = new MockInstance("foo");
    Connector connector = instance.getConnector("user", new PasswordToken(new byte[0]));
    TableOperations tableOperations = connector.tableOperations();
    tableOperations.create("a_table");
    tableOperations.importDirectory("a_table", dataAndFiles.importPath.toString(), dataAndFiles.failurePath.toString(), false);
    Scanner scanner = connector.createScanner("a_table", new Authorizations());
    Iterator<Entry<Key,Value>> iterator = scanner.iterator();
    for (int i = 0; i < 5; i++) {
      Assert.assertTrue(iterator.hasNext());
View Full Code Here


  @Test
  public void testDeleteRows() throws Exception {
    Instance instance = new MockInstance("rows");
    Connector connector = instance.getConnector("user", new PasswordToken("foo".getBytes()));
    TableOperations to = connector.tableOperations();
    to.create("test");
    BatchWriter bw = connector.createBatchWriter("test", new BatchWriterConfig());
    for (int r = 0; r < 20; r++) {
      Mutation m = new Mutation("" + r);
      for (int c = 0; c < 5; c++) {
        m.put(new Text("cf"), new Text("" + c), new Value(("" + c).getBytes()));
View Full Code Here

  @Test
  public void testDeleteRowsWithNullKeys() throws Exception {
    Instance instance = new MockInstance("rows");
    Connector connector = instance.getConnector("user", new PasswordToken("foo"));
    TableOperations to = connector.tableOperations();
    to.create("test2");
    BatchWriter bw = connector.createBatchWriter("test2", new BatchWriterConfig());
    for (int r = 0; r < 30; r++) {
      Mutation m = new Mutation(Integer.toString(r));
      for (int c = 0; c < 5; c++) {
        m.put(new Text("cf"), new Text(Integer.toString(c)), new Value(Integer.toString(c).getBytes()));
View Full Code Here

  @Test
  public void testTableIdMap() throws Exception {
    Instance inst = new MockInstance("testTableIdMap");
    Connector conn = inst.getConnector("root", new PasswordToken(""));
    TableOperations tops = conn.tableOperations();
    tops.create("foo");

    // Should get a table ID, not the table name
    Assert.assertNotEquals("foo", tops.tableIdMap().get("foo"));
  }
}
View Full Code Here

  public void testMetaSplit() throws Exception {
    Instance instance = new ZooKeeperInstance(cluster.getInstanceName(), cluster.getZooKeepers());
    Connector connector = instance.getConnector("root", new PasswordToken(secret));
    TableOperations opts = connector.tableOperations();
    for (int i = 1; i <= 10; i++) {
      opts.create("" + i);
    }
    opts.merge(Constants.METADATA_TABLE_NAME, new Text("01"), new Text("02"));
    assertEquals(2, opts.listSplits(Constants.METADATA_TABLE_NAME).size());
    addSplits(opts, "4 5 6 7 8".split(" "));
    assertEquals(7, opts.listSplits(Constants.METADATA_TABLE_NAME).size());
View Full Code Here

 
  @Test
  public void test() throws Exception {
    Connector c = instance.getConnector("user", new PasswordToken("pass"));
    TableOperations tops = c.tableOperations();
    tops.create("t1");
    tops.create("t2");
    tops.create("t3");
    String t1Id = tops.tableIdMap().get("t1"), t2Id = tops.tableIdMap().get("t2"), t3Id = tops.tableIdMap().get("t3");
    state = new TreeMap<TServerInstance,TabletServerStatus>();
    TServerInstance svr = mkts("10.0.0.1:1234", "0x01020304");
View Full Code Here

  @Test
  public void test() throws Exception {
    Connector c = instance.getConnector("user", new PasswordToken("pass"));
    TableOperations tops = c.tableOperations();
    tops.create("t1");
    tops.create("t2");
    tops.create("t3");
    String t1Id = tops.tableIdMap().get("t1"), t2Id = tops.tableIdMap().get("t2"), t3Id = tops.tableIdMap().get("t3");
    state = new TreeMap<TServerInstance,TabletServerStatus>();
    TServerInstance svr = mkts("10.0.0.1:1234", "0x01020304");
    state.put(svr, status(t1Id, 10, t2Id, 10, t3Id, 10));
View Full Code Here

  public void test() throws Exception {
    Connector c = instance.getConnector("user", new PasswordToken("pass"));
    TableOperations tops = c.tableOperations();
    tops.create("t1");
    tops.create("t2");
    tops.create("t3");
    String t1Id = tops.tableIdMap().get("t1"), t2Id = tops.tableIdMap().get("t2"), t3Id = tops.tableIdMap().get("t3");
    state = new TreeMap<TServerInstance,TabletServerStatus>();
    TServerInstance svr = mkts("10.0.0.1:1234", "0x01020304");
    state.put(svr, status(t1Id, 10, t2Id, 10, t3Id, 10));
   
View Full Code Here

    try {
      final String table1 = "testTableRenameDataValidation_table1", table2 = "testTableRenameDataValidation_table2";

      TableOperations tops = connector.tableOperations();
      tops.create(table1);

      BatchWriter bw1 = mtbw.getBatchWriter(table1);

      Mutation m1 = new Mutation("foo");
      m1.put("col1", "", "val1");
View Full Code Here

      m1.put("col1", "", "val1");

      bw1.addMutation(m1);

      tops.rename(table1, table2);
      tops.create(table1);

      BatchWriter bw2 = mtbw.getBatchWriter(table1);
     
      Mutation m2 = new Mutation("bar");
      m2.put("col1", "", "val1");
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.