Package org.apache.accumulo.core.client.mock

Examples of org.apache.accumulo.core.client.mock.MockInstance


    tabCompletion = !cl.hasOption(tabCompleteOption.getLongOpt());
   
    // should only be one instance option set
    instance = null;
    if (cl.hasOption(fakeOption.getLongOpt())) {
      instance = new MockInstance();
    } else if (cl.hasOption(hdfsZooInstance.getOpt())) {
      instance = HdfsZooInstance.getInstance();
    } else if (cl.hasOption(zooKeeperInstance.getOpt())) {
      String[] zkOpts = cl.getOptionValues(zooKeeperInstance.getOpt());
      instance = new ZooKeeperInstance(zkOpts[0], zkOpts[1]);
View Full Code Here


    }
  }
 
  @Test
  public void test() throws Exception {
    MockInstance instance = new MockInstance("instance1");
    Connector conn = instance.getConnector("root", "".getBytes());
    conn.tableOperations().create("test");
    BatchWriter bw = conn.createBatchWriter("test", 100000l, 100l, 5);
   
    insertList(bw, row1);
    insertList(bw, row2);
View Full Code Here

    }
  }
 
  @Test
  public void testMR() throws Exception {
    MockInstance mockInstance = new MockInstance("testmrinstance");
    Connector c = mockInstance.getConnector("root", new byte[] {});
    c.tableOperations().create("testtable1");
    c.tableOperations().create("testtable2");
    BatchWriter bw = c.createBatchWriter("testtable1", 10000L, 1000L, 4);
    for (int i = 0; i < 100; i++) {
      Mutation m = new Mutation(new Text(String.format("%09x", i + 1)));
View Full Code Here

    assertEquals(i, results.size());
  }
 
  @Test
  public void testIntersect() throws Exception {
    Instance instance = new MockInstance("local");
    Connector conn = instance.getConnector("root", "".getBytes());
    conn.tableOperations().create("intersect");
    BatchWriter bw = conn.createBatchWriter("intersect", 1000, 10l, 1);
    Mutation m = new Mutation("part1");
    m.put("bar", "doc1", "value");
    m.put("bar", "doc2", "value");
View Full Code Here

    checkResults(csis, resultSet3, PartialKey.ROW_COLFAM_COLQUAL);
  }
 
  @Test
  public void testVersioning() throws Exception {
    Instance instance = new MockInstance("local");
    Connector conn = instance.getConnector("root", "".getBytes());
    conn.tableOperations().create("table");
    conn.tableOperations().removeProperty("table", "table.iterator.scan.vers");
    conn.tableOperations().removeProperty("table", "table.iterator.majc.vers");
    conn.tableOperations().removeProperty("table", "table.iterator.minc.vers");
    BatchWriter bw = conn.createBatchWriter("table", 1000, 10l, 1);
View Full Code Here

    m.put("cf", "cq", "v");
    return m;
  }
 
  public void test1() throws Exception {
    MockInstance mi = new MockInstance();
   
    Connector conn = mi.getConnector("root", "foo");
    conn.tableOperations().create("foo");
   
    BatchWriter bw = conn.createBatchWriter("foo", 1000000, 60000l, 2);
   
    bw.addMutation(nm(new byte[] {0}));
View Full Code Here

    }
  }
 
  @Test
  public void testMap() throws Exception {
    MockInstance mockInstance = new MockInstance("testmapinstance");
    Connector c = mockInstance.getConnector("root", new byte[] {});
    c.tableOperations().create("testtable");
    BatchWriter bw = c.createBatchWriter("testtable", 10000L, 1000L, 4);
    for (int i = 0; i < 100; i++) {
      Mutation m = new Mutation(new Text(String.format("%09x", i + 1)));
      m.put(new Text(), new Text(), new Value(String.format("%09x", i).getBytes()));
View Full Code Here

    }
  }
 
  @Test
  public void testSimple() throws Exception {
    MockInstance mockInstance = new MockInstance("testmapinstance");
    Connector c = mockInstance.getConnector("root", new byte[] {});
    c.tableOperations().create("testtable2");
    BatchWriter bw = c.createBatchWriter("testtable2", 10000L, 1000L, 4);
    for (int i = 0; i < 100; i++) {
      Mutation m = new Mutation(new Text(String.format("%09x", i + 1)));
      m.put(new Text(), new Text(), new Value(String.format("%09x", i).getBytes()));
View Full Code Here

   * @see #setZooKeeperInstance(Configuration, String, String)
   * @see #setMockInstance(Configuration, String)
   */
  protected static Instance getInstance(Configuration conf) {
    if (conf.getBoolean(MOCK, false))
      return new MockInstance(conf.get(INSTANCE_NAME));
    return new ZooKeeperInstance(conf.get(INSTANCE_NAME), conf.get(ZOOKEEPERS));
  }
View Full Code Here

    tabCompletion = !cl.hasOption(tabCompleteOption.getLongOpt());
   
    // should only be one instance option set
    instance = null;
    if (cl.hasOption(fakeOption.getLongOpt())) {
      instance = new MockInstance();
    } else if (cl.hasOption(hdfsZooInstance.getOpt())) {
      instance = getDefaultInstance(AccumuloConfiguration.getSiteConfiguration());
    } else if (cl.hasOption(zooKeeperInstance.getOpt())) {
      String[] zkOpts = cl.getOptionValues(zooKeeperInstance.getOpt());
      instance = new ZooKeeperInstance(zkOpts[0], zkOpts[1]);
View Full Code Here

TOP

Related Classes of org.apache.accumulo.core.client.mock.MockInstance

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.