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

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


    private CommonAuxiliaryFieldsCellExtractor auxExtractor = new CommonAuxiliaryFieldsCellExtractor();

    @BeforeClass
    public void setupParamsAndInstance()
            throws AccumuloException, AccumuloSecurityException, TableExistsException, TableNotFoundException {
        mockInstance = new MockInstance("testInstance");
        Connector conn = mockInstance.getConnector("user1", "password".getBytes());
        if(conn.tableOperations().exists(PEOPLE_TABLE))
            conn.tableOperations().delete(PEOPLE_TABLE);
        conn.tableOperations().create(PEOPLE_TABLE);
    }
View Full Code Here


    private static final Text EVENT2 = new Text("2343");

    @BeforeClass
    public void setupParamsAndInstance()
            throws AccumuloException, AccumuloSecurityException, TableExistsException, TableNotFoundException {
        mockInstance = new MockInstance("testInstance");
        Connector conn = mockInstance.getConnector("user1", "password".getBytes());
        if(conn.tableOperations().exists(PEOPLE_TABLE))
            conn.tableOperations().delete(PEOPLE_TABLE);
        conn.tableOperations().create(PEOPLE_TABLE);
    }
View Full Code Here

 
  public ProxyServer(Properties props) {
   
    String useMock = props.getProperty("useMockInstance");
    if (useMock != null && Boolean.parseBoolean(useMock))
      instance = new MockInstance();
    else
      instance = new ZooKeeperInstance(props.getProperty("instance"), props.getProperty("zookeepers"));
   
    scannerCache = CacheBuilder.newBuilder().expireAfterAccess(10, TimeUnit.MINUTES).maximumSize(1000).removalListener(new CloseScanner()).build();
   
View Full Code Here

          String instance = DataStoreFactory.findProperty(properties, this, INSTANCE_NAME_PROPERTY, null);
          String zookeepers = DataStoreFactory.findProperty(properties, this, ZOOKEEPERS_NAME_PROPERTY, null);
          conn = new ZooKeeperInstance(instance, zookeepers).getConnector(user, password);
          authInfo = new AuthInfo(user, ByteBuffer.wrap(password.getBytes()), conn.getInstance().getInstanceID());
        } else {
          conn = new MockInstance().getConnector(user, password);
        }
 
        if (autoCreateSchema)
          createSchema();
      } catch (AccumuloException e) {
View Full Code Here

    bw.close();
  }
 
  @Test
  public void test() throws Exception {
    Instance instance = new MockInstance();
    Connector connector = instance.getConnector("root", new PasswordToken(""));
    BatchWriter bw = connector.createBatchWriter("!METADATA", new BatchWriterConfig());
   
    // Create a fake METADATA table with these splits
    String splits[] = {"a", "e", "j", "o", "t", "z"};
    // create metadata for a table "t" with the splits above
View Full Code Here

    ball = new byte[b1.length + b2.length + 1];
    System.arraycopy(b1, 0, ball, 0, b1.length);
    ball[b1.length] = (byte) 0;
    System.arraycopy(b2, 0, ball, b1.length + 1, b2.length);

    Instance instance = new MockInstance();
    Connector conn = instance.getConnector("root", new PasswordToken(new byte[0]));

    conn.tableOperations().create(table);
    BatchWriter bw = conn.createBatchWriter(table, new BatchWriterConfig());
    Mutation m = new Mutation(ball);
    m.put(new byte[0], new byte[0], new byte[0]);
View Full Code Here

    return keyValues;
  }

  @Test
  public void test1() throws Exception {
    MockInstance instance = new MockInstance("rft1");
    Connector conn = instance.getConnector("", new PasswordToken(""));

    conn.tableOperations().create("table1");
    BatchWriter bw = conn.createBatchWriter("table1", new BatchWriterConfig());

    for (Mutation m : createMutations()) {
View Full Code Here

  }

  @Test
  public void testChainedRowFilters() throws Exception {
    MockInstance instance = new MockInstance("rft1");
    Connector conn = instance.getConnector("", new PasswordToken(""));

    conn.tableOperations().create("chained_row_filters");
    BatchWriter bw = conn.createBatchWriter("chained_row_filters", new BatchWriterConfig());
    for (Mutation m : createMutations()) {
      bw.addMutation(m);
View Full Code Here

    assertEquals(new HashSet<String>(Arrays.asList("0", "1", "2", "3", "4")), getRows(scanner));
  }

  @Test
  public void testFilterConjunction() throws Exception {
    MockInstance instance = new MockInstance("rft1");
    Connector conn = instance.getConnector("", new PasswordToken(""));

    conn.tableOperations().create("filter_conjunction");
    BatchWriter bw = conn.createBatchWriter("filter_conjunction", new BatchWriterConfig());
    for (Mutation m : createMutations()) {
      bw.addMutation(m);
View Full Code Here

    }
  }
 
  @Test
  public void testMap() throws Exception {
    MockInstance mockInstance = new MockInstance(INSTANCE_NAME);
    Connector c = mockInstance.getConnector("root", new PasswordToken(""));
    c.tableOperations().create(TEST_TABLE_1);
    BatchWriter bw = c.createBatchWriter(TEST_TABLE_1, new BatchWriterConfig());
    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

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.