Search in sources :

Example 76 with ColumnVisibility

use of org.apache.accumulo.core.security.ColumnVisibility in project incubator-rya by apache.

the class RyaTableMutationsFactory method deleteMutation.

protected Mutation deleteMutation(TripleRow tripleRow) {
    Mutation m = new Mutation(new Text(tripleRow.getRow()));
    byte[] columnFamily = tripleRow.getColumnFamily();
    Text cfText = columnFamily == null ? EMPTY_TEXT : new Text(columnFamily);
    byte[] columnQualifier = tripleRow.getColumnQualifier();
    Text cqText = columnQualifier == null ? EMPTY_TEXT : new Text(columnQualifier);
    m.putDelete(cfText, cqText, new ColumnVisibility(tripleRow.getColumnVisibility()), tripleRow.getTimestamp());
    return m;
}
Also used : Text(org.apache.hadoop.io.Text) Mutation(org.apache.accumulo.core.data.Mutation) ColumnVisibility(org.apache.accumulo.core.security.ColumnVisibility)

Example 77 with ColumnVisibility

use of org.apache.accumulo.core.security.ColumnVisibility in project accumulo by apache.

the class ConditionTest method testHashCode.

@Test
public void testHashCode() {
    ColumnVisibility cvis = new ColumnVisibility(VISIBILITY);
    c.setVisibility(cvis);
    c.setValue(VALUE);
    c.setTimestamp(1234L);
    c.setIterators(ITERATORS);
    int hc1 = c.hashCode();
    Condition c2 = new Condition(FAMILY, QUALIFIER);
    c2.setVisibility(cvis);
    c2.setValue(VALUE);
    c2.setTimestamp(1234L);
    c2.setIterators(ITERATORS);
    assertTrue(c.equals(c2));
    assertEquals(hc1, c2.hashCode());
}
Also used : ColumnVisibility(org.apache.accumulo.core.security.ColumnVisibility) Test(org.junit.Test)

Example 78 with ColumnVisibility

use of org.apache.accumulo.core.security.ColumnVisibility in project accumulo by apache.

the class ConditionTest method testGetSetVisibility.

@Test
public void testGetSetVisibility() {
    ColumnVisibility vis = new ColumnVisibility(VISIBILITY);
    c.setVisibility(vis);
    assertEquals(VISIBILITY, toString(c.getVisibility()));
}
Also used : ColumnVisibility(org.apache.accumulo.core.security.ColumnVisibility) Test(org.junit.Test)

Example 79 with ColumnVisibility

use of org.apache.accumulo.core.security.ColumnVisibility in project accumulo by apache.

the class KeyTest method testVisibilityGetters.

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()));
}
Also used : Text(org.apache.hadoop.io.Text) ColumnVisibility(org.apache.accumulo.core.security.ColumnVisibility) TKey(org.apache.accumulo.core.data.thrift.TKey)

Example 80 with ColumnVisibility

use of org.apache.accumulo.core.security.ColumnVisibility in project accumulo by apache.

the class MutationTest method testPutsStringString.

@Test
public void testPutsStringString() {
    Mutation m = new Mutation("r1");
    m.put("cf1", "cq1", "v1");
    m.put("cf2", "cq2", new ColumnVisibility("cv2"), "v2");
    m.put("cf3", "cq3", 3l, "v3");
    m.put("cf4", "cq4", new ColumnVisibility("cv4"), 4l, "v4");
    m.putDelete("cf5", "cq5");
    m.putDelete("cf6", "cq6", new ColumnVisibility("cv6"));
    m.putDelete("cf7", "cq7", 7l);
    m.putDelete("cf8", "cq8", new ColumnVisibility("cv8"), 8l);
    assertEquals(8, m.size());
    assertEquals("r1", new String(m.getRow()));
    List<ColumnUpdate> updates = m.getUpdates();
    assertEquals(8, m.size());
    assertEquals(8, updates.size());
    verifyColumnUpdate(updates.get(0), "cf1", "cq1", "", 0l, false, false, "v1");
    verifyColumnUpdate(updates.get(1), "cf2", "cq2", "cv2", 0l, false, false, "v2");
    verifyColumnUpdate(updates.get(2), "cf3", "cq3", "", 3l, true, false, "v3");
    verifyColumnUpdate(updates.get(3), "cf4", "cq4", "cv4", 4l, true, false, "v4");
    verifyColumnUpdate(updates.get(4), "cf5", "cq5", "", 0l, false, true, "");
    verifyColumnUpdate(updates.get(5), "cf6", "cq6", "cv6", 0l, false, true, "");
    verifyColumnUpdate(updates.get(6), "cf7", "cq7", "", 7l, true, true, "");
    verifyColumnUpdate(updates.get(7), "cf8", "cq8", "cv8", 8l, true, true, "");
}
Also used : TMutation(org.apache.accumulo.core.data.thrift.TMutation) ColumnVisibility(org.apache.accumulo.core.security.ColumnVisibility) Test(org.junit.Test)

Aggregations

ColumnVisibility (org.apache.accumulo.core.security.ColumnVisibility)131 Mutation (org.apache.accumulo.core.data.Mutation)57 Text (org.apache.hadoop.io.Text)57 Value (org.apache.accumulo.core.data.Value)52 Key (org.apache.accumulo.core.data.Key)39 Test (org.junit.Test)37 BatchWriter (org.apache.accumulo.core.client.BatchWriter)28 BatchWriterConfig (org.apache.accumulo.core.client.BatchWriterConfig)20 Authorizations (org.apache.accumulo.core.security.Authorizations)17 ArrayList (java.util.ArrayList)16 Entry (java.util.Map.Entry)16 TableNotFoundException (org.apache.accumulo.core.client.TableNotFoundException)16 Scanner (org.apache.accumulo.core.client.Scanner)14 AccumuloException (org.apache.accumulo.core.client.AccumuloException)12 MutationsRejectedException (org.apache.accumulo.core.client.MutationsRejectedException)12 Configuration (org.apache.hadoop.conf.Configuration)12 Connector (org.apache.accumulo.core.client.Connector)10 IteratorSetting (org.apache.accumulo.core.client.IteratorSetting)10 TMutation (org.apache.accumulo.core.data.thrift.TMutation)10 Element (uk.gov.gchq.gaffer.data.element.Element)9