Examples of MockInstance


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

   * @see #setMockInstance(Class, Configuration, String)
   */
  public static Instance getInstance(Class<?> implementingClass, Configuration conf) {
    String instanceType = conf.get(enumToConfKey(implementingClass, InstanceOpts.TYPE), "");
    if ("MockInstance".equals(instanceType))
      return new MockInstance(conf.get(enumToConfKey(implementingClass, InstanceOpts.NAME)));
    else if ("ZooKeeperInstance".equals(instanceType)) {
      return new ZooKeeperInstance(conf.get(enumToConfKey(implementingClass, InstanceOpts.NAME)), conf.get(enumToConfKey(implementingClass,
          InstanceOpts.ZOO_KEEPERS)));
    } else if (instanceType.isEmpty())
      throw new IllegalStateException("Instance has not been configured for " + implementingClass.getSimpleName());
View Full Code Here

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

    if (null == instanceName) {
      return null;
    }
   
    if (isMockInstance()) { 
      return new MockInstance(getInstanceName());
    }
   
    if (null == zooKeepers) {
      return null;
    }
View Full Code Here

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

    }
  }
 
  @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

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

    }
  }

  @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

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

    return getInstance(InputFormatBase.getConfiguration(job));
  }
 
  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

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

    cleanup();
  }
 
  public void testWithBatchScanner() throws Exception {
    Value empty = new Value(new byte[] {});
    MockInstance inst = new MockInstance("mockabye");
    Connector connector = inst.getConnector("user", "pass");
    connector.tableOperations().create("index");
    BatchWriter bw = connector.createBatchWriter("index", 1000, 1000, 1);
    Mutation m = new Mutation("000012");
    m.put("rvy", "5000000000000000", empty);
    m.put("15qh", "5000000000000000", empty);
View Full Code Here

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

    }
  }

  @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

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

    }
  }

  @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

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

  }

  @SuppressWarnings("deprecation")
  @Test
  public void testRegex() throws Exception {
    MockInstance mockInstance = new MockInstance("testmapinstance");
    Connector c = mockInstance.getConnector("root", new byte[] {});
    c.tableOperations().create("testtable3");
    BatchWriter bw = c.createBatchWriter("testtable3", 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

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

    Collection<Pair<Text,Text>> fetchColumns = Collections.singleton(new Pair<Text,Text>(new Text("foo"), new Text("bar")));
    boolean isolated = true, localIters = true;
    int maxVersions = 5;
    Level level = Level.WARN;

    Instance inst = new MockInstance(instance);
    Connector connector = inst.getConnector(username, password);
    connector.tableOperations().create(table);

    AccumuloInputFormat.setInputInfo(job, username, password, table, auths);
    AccumuloInputFormat.setMockInstance(job, instance);
    AccumuloInputFormat.setRegex(job, org.apache.accumulo.core.client.mapreduce.InputFormatBase.RegexType.ROW, rowRegex);
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.