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

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


   
  }
 
  // simulate a merge happening while iterating over tablets
  public void testMerge() throws Exception {
    MockInstance mi = new MockInstance();
    Connector conn = mi.getConnector("", new PasswordToken(""));
   
    KeyExtent ke1 = new KeyExtent(new Text("0"), new Text("m"), null);
    Mutation mut1 = ke1.getPrevRowUpdateMutation();
    Constants.METADATA_DIRECTORY_COLUMN.put(mut1, new Value("/d1".getBytes()));
   
View Full Code Here


import org.apache.hadoop.io.Text;

public class CloneTest extends TestCase {
 
  public void testNoFiles() throws Exception {
    MockInstance mi = new MockInstance();
    Connector conn = mi.getConnector("", new PasswordToken(""));
   
    KeyExtent ke = new KeyExtent(new Text("0"), null, null);
    Mutation mut = ke.getPrevRowUpdateMutation();
   
    Constants.METADATA_TIME_COLUMN.put(mut, new Value("M0".getBytes()));
View Full Code Here

    // scan tables metadata entries and confirm the same
   
  }
 
  public void testFilesChange() throws Exception {
    MockInstance mi = new MockInstance();
    Connector conn = mi.getConnector("", new PasswordToken(""));
   
    KeyExtent ke = new KeyExtent(new Text("0"), null, null);
    Mutation mut = ke.getPrevRowUpdateMutation();
   
    Constants.METADATA_TIME_COLUMN.put(mut, new Value("M0".getBytes()));
View Full Code Here

   
  }
 
  // test split where files of children are the same
  public void testSplit1() throws Exception {
    MockInstance mi = new MockInstance();
    Connector conn = mi.getConnector("", new PasswordToken(""));
   
    BatchWriter bw1 = conn.createBatchWriter(Constants.METADATA_TABLE_NAME, new BatchWriterConfig());
   
    bw1.addMutation(createTablet("0", null, null, "/default_tablet", "/default_tablet/0_0.rf"));
   
View Full Code Here

    assertTrue(files.contains("../0/default_tablet/0_0.rf"));
  }
 
  // test split where files of children differ... like majc and split occurred
  public void testSplit2() throws Exception {
    MockInstance mi = new MockInstance();
    Connector conn = mi.getConnector("", new PasswordToken(""));
   
    BatchWriter bw1 = conn.createBatchWriter(Constants.METADATA_TABLE_NAME, new BatchWriterConfig());
   
    bw1.addMutation(createTablet("0", null, null, "/default_tablet", "/default_tablet/0_0.rf"));
   
View Full Code Here

    return mut;
  }
 
  // test two tablets splitting into four
  public void testSplit3() throws Exception {
    MockInstance mi = new MockInstance();
    Connector conn = mi.getConnector("", new PasswordToken(""));
   
    BatchWriter bw1 = conn.createBatchWriter(Constants.METADATA_TABLE_NAME, new BatchWriterConfig());
   
    bw1.addMutation(createTablet("0", "m", null, "/d1", "/d1/file1"));
    bw1.addMutation(createTablet("0", null, "m", "/d2", "/d2/file2"));
View Full Code Here

  }
 
  // test cloned marker
  public void testClonedMarker() throws Exception {
   
    MockInstance mi = new MockInstance();
    Connector conn = mi.getConnector("", new PasswordToken(""));
   
    BatchWriter bw1 = conn.createBatchWriter(Constants.METADATA_TABLE_NAME, new BatchWriterConfig());
   
    bw1.addMutation(createTablet("0", "m", null, "/d1", "/d1/file1"));
    bw1.addMutation(createTablet("0", null, "m", "/d2", "/d2/file2"));
View Full Code Here

    assertTrue(files.contains("../0/d4/file3"));
  }
 
  // test two tablets splitting into four
  public void testMerge() throws Exception {
    MockInstance mi = new MockInstance();
    Connector conn = mi.getConnector("", new PasswordToken(""));
   
    BatchWriter bw1 = conn.createBatchWriter(Constants.METADATA_TABLE_NAME, new BatchWriterConfig());
   
    bw1.addMutation(createTablet("0", "m", null, "/d1", "/d1/file1"));
    bw1.addMutation(createTablet("0", null, "m", "/d2", "/d2/file2"));
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

    }
  }

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