Package org.apache.accumulo.core.security

Examples of org.apache.accumulo.core.security.ColumnVisibility$Node


 
  public void testByteArrays() {
    Mutation m = new Mutation("r1".getBytes());
   
    m.put("cf1".getBytes(), "cq1".getBytes(), "v1".getBytes());
    m.put("cf2".getBytes(), "cq2".getBytes(), new ColumnVisibility("cv2"), "v2".getBytes());
    m.put("cf3".getBytes(), "cq3".getBytes(), 3l, "v3".getBytes());
    m.put("cf4".getBytes(), "cq4".getBytes(), new ColumnVisibility("cv4"), 4l, "v4".getBytes());
   
    m.putDelete("cf5".getBytes(), "cq5".getBytes());
    m.putDelete("cf6".getBytes(), "cq6".getBytes(), new ColumnVisibility("cv6"));
    m.putDelete("cf7".getBytes(), "cq7".getBytes(), 7l);
    m.putDelete("cf8".getBytes(), "cq8".getBytes(), new ColumnVisibility("cv8"), 8l);
   
    assertEquals(8, m.size());
   
    List<ColumnUpdate> updates = m.getUpdates();
   
View Full Code Here


   */
  @Test
  public void testMultipleReadFieldsCalls() throws IOException {
    // Create test mutations and write them to a byte output stream
    Mutation m1 = new Mutation("row1");
    m1.put("cf1.1", "cq1.1", new ColumnVisibility("A|B"), "val1.1");
    m1.put("cf1.2", "cq1.2", new ColumnVisibility("C|D"), "val1.2");
    byte[] val1_3 = new byte[Mutation.VALUE_SIZE_COPY_CUTOFF + 3];
    Arrays.fill(val1_3, (byte) 3);
    m1.put("cf1.3", "cq1.3", new ColumnVisibility("E|F"), new String(val1_3));
    int size1 = m1.size();
    long nb1 = m1.numBytes();
   
    Mutation m2 = new Mutation("row2");
    byte[] val2 = new byte[Mutation.VALUE_SIZE_COPY_CUTOFF + 2];
    Arrays.fill(val2, (byte) 2);
    m2.put("cf2", "cq2", new ColumnVisibility("G|H"), 1234, new String(val2));
    int size2 = m2.size();
    long nb2 = m2.numBytes();
   
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    DataOutputStream dos = new DataOutputStream(bos);
View Full Code Here

  @Test
  public void test4() throws Exception {
    Mutation m1 = new Mutation(new Text("r1"));
   
    m1.put(nt("cf1"), nt("cq1"), nv("v1"));
    m1.put(nt("cf2"), nt("cq2"), new ColumnVisibility("cv2"), nv("v2"));
   
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    DataOutputStream dos = new DataOutputStream(bos);
    m1.write(dos);
    dos.close();
   
    Mutation m2 = new Mutation(new Text("r2"));
   
    m2.put(nt("cf3"), nt("cq3"), nv("v3"));
    m2.put(nt("cf4"), nt("cq4"), new ColumnVisibility("cv2"), nv("v4"));
   
    ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
    DataInputStream dis = new DataInputStream(bis);
   
    // used to be a bug where puts done before readFields would be seen
View Full Code Here

  @Test
  public void testNewSerialization() throws Exception {
    // write an old mutation
    OldMutation m2 = new OldMutation("r1");
    m2.put("cf1", "cq1", "v1");
    m2.put("cf2", "cq2", new ColumnVisibility("cv2"), "v2");
    m2.putDelete("cf3", "cq3");
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    DataOutputStream dos = new DataOutputStream(bos);
    m2.write(dos);
    dos.close();
View Full Code Here

  @Test
  public void testReserialize() throws Exception {
    // test reading in a new mutation from an old mutation and reserializing the new mutation... this was failing
    OldMutation om = new OldMutation("r1");
    om.put("cf1", "cq1", "v1");
    om.put("cf2", "cq2", new ColumnVisibility("cv2"), "v2");
    om.putDelete("cf3", "cq3");
    StringBuilder bigVal = new StringBuilder();
    for (int i = 0; i < 100000; i++) {
      bigVal.append('a');
    }
View Full Code Here

  @Test
  public void testEquals() {
    Mutation m1 = new Mutation("r1");
   
    m1.put("cf1", "cq1", "v1");
    m1.put("cf1", "cq1", new ColumnVisibility("A&B"), "v2");
    m1.put("cf1", "cq1", 3, "v3");
    m1.put("cf1", "cq1", new ColumnVisibility("A&B&C"), 4, "v4");
    m1.putDelete("cf2", "cf3");
    m1.putDelete("cf2", "cf4", 3);
    m1.putDelete("cf2", "cf4", new ColumnVisibility("A&B&C"), 3);
   
    // m2 has same data as m1
    Mutation m2 = new Mutation("r1");
   
    m2.put("cf1", "cq1", "v1");
    m2.put("cf1", "cq1", new ColumnVisibility("A&B"), "v2");
    m2.put("cf1", "cq1", 3, "v3");
    m2.put("cf1", "cq1", new ColumnVisibility("A&B&C"), 4, "v4");
    m2.putDelete("cf2", "cf3");
    m2.putDelete("cf2", "cf4", 3);
    m2.putDelete("cf2", "cf4", new ColumnVisibility("A&B&C"), 3);
   
    // m3 has different row than m1
    Mutation m3 = new Mutation("r2");
   
    m3.put("cf1", "cq1", "v1");
    m3.put("cf1", "cq1", new ColumnVisibility("A&B"), "v2");
    m3.put("cf1", "cq1", 3, "v3");
    m3.put("cf1", "cq1", new ColumnVisibility("A&B&C"), 4, "v4");
    m3.putDelete("cf2", "cf3");
    m3.putDelete("cf2", "cf4", 3);
    m3.putDelete("cf2", "cf4", new ColumnVisibility("A&B&C"), 3);

    // m4 has a different column than m1
    Mutation m4 = new Mutation("r1");
   
    m4.put("cf2", "cq1", "v1");
    m4.put("cf1", "cq1", new ColumnVisibility("A&B"), "v2");
    m4.put("cf1", "cq1", 3, "v3");
    m4.put("cf1", "cq1", new ColumnVisibility("A&B&C"), 4, "v4");
    m4.putDelete("cf2", "cf3");
    m4.putDelete("cf2", "cf4", 3);
    m4.putDelete("cf2", "cf4", new ColumnVisibility("A&B&C"), 3);
   
    // m5 has a different value than m1
    Mutation m5 = new Mutation("r1");
   
    m5.put("cf1", "cq1", "v1");
    m5.put("cf1", "cq1", new ColumnVisibility("A&B"), "v2");
    m5.put("cf1", "cq1", 3, "v4");
    m5.put("cf1", "cq1", new ColumnVisibility("A&B&C"), 4, "v4");
    m5.putDelete("cf2", "cf3");
    m5.putDelete("cf2", "cf4", 3);
    m5.putDelete("cf2", "cf4", new ColumnVisibility("A&B&C"), 3);

    assertEquals(m1, m1);
    assertEquals(m1, m2);
    assertEquals(m2, m1);
    assertFalse(m1.equals(m3));
View Full Code Here

    }
    Connector connector = opts.getConnector();
    BatchWriter bw = connector.createBatchWriter(opts.tableName, bwOpts.getBatchWriterConfig());
   
    // reuse the ColumnVisibility object to improve performance
    ColumnVisibility cv = opts.visiblity;
  
    // Generate num unique row ids in the given range
    HashSet<Long> rowids = new HashSet<Long>(opts.num);
    while (rowids.size() < opts.num) {
      rowids.add((Math.abs(r.nextLong()) % (opts.max - opts.min)) + opts.min);
View Full Code Here

        boolean ambiguousZone = WalkingSecurity.get(state).inAmbiguousZone(conn.whoami(), tp);
       
        String key = WalkingSecurity.get(state).getLastKey() + "1";
        Mutation m = new Mutation(new Text(key));
        for (String s : WalkingSecurity.get(state).getAuthsArray()) {
          m.put(new Text(), new Text(), new ColumnVisibility(s), new Value("value".getBytes(Constants.UTF8)));
        }
        BatchWriter writer = null;
        try {
          try {
            writer = conn.createBatchWriter(tableName, new BatchWriterConfig().setMaxMemory(9000l).setMaxWriteThreads(1));
View Full Code Here

 
  public void testVisibilityGetters() {
    Key k = new Key("r", "f", "q", "v1|(v2&v3)");
   
    Text expression = k.getColumnVisibility();
    ColumnVisibility parsed = k.getColumnVisibilityParsed();
   
    assertEquals(expression, new Text(parsed.getExpression()));
  }
View Full Code Here

    fs.mkdirs(tempFile.getParent());
    FileSKVWriter writer = FileOperations.getInstance().openWriter(tempFile.toString(), fs, defaultConf, AccumuloConfiguration.getDefaultConfiguration());
    writer.startDefaultLocalityGroup();
    List<Pair<Key,Value>> keyVals = new ArrayList<Pair<Key,Value>>();
    for (int i = 0; i < 5; i++) {
      keyVals.add(new Pair<Key,Value>(new Key("a" + i, "b" + i, "c" + i, new ColumnVisibility(""), 1000l + i), new Value(Integer.toString(i).getBytes())));
    }
    for (Pair<Key,Value> keyVal : keyVals) {
      writer.append(keyVal.getFirst(), keyVal.getSecond());
    }
    writer.close();
View Full Code Here

TOP

Related Classes of org.apache.accumulo.core.security.ColumnVisibility$Node

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.