Search in sources :

Example 1 with Node

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

the class ColumnVisibilityTest method testEmptyParseTreesAreEqual.

@Test
public void testEmptyParseTreesAreEqual() {
    Comparator<Node> comparator = new NodeComparator(new byte[] {});
    Node empty = new ColumnVisibility().getParseTree();
    assertEquals(0, comparator.compare(empty, parse("")));
}
Also used : NodeComparator(org.apache.accumulo.core.security.ColumnVisibility.NodeComparator) Node(org.apache.accumulo.core.security.ColumnVisibility.Node) Test(org.junit.Test)

Example 2 with Node

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

the class ColumnVisibilityTest method testParseTreeWithTwoChildren.

@Test
public void testParseTreeWithTwoChildren() {
    Node node = parse("ABC|DEF");
    assertNode(node, NodeType.OR, 0, 7);
    assertNode(node.getChildren().get(0), NodeType.TERM, 0, 3);
    assertNode(node.getChildren().get(1), NodeType.TERM, 4, 7);
}
Also used : Node(org.apache.accumulo.core.security.ColumnVisibility.Node) Test(org.junit.Test)

Example 3 with Node

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

the class ColumnVisibilityTest method testParseTree.

@Test
public void testParseTree() {
    Node node = parse("(W)|(U&V)");
    assertNode(node, NodeType.OR, 0, 9);
    assertNode(node.getChildren().get(0), NodeType.TERM, 1, 2);
    assertNode(node.getChildren().get(1), NodeType.AND, 5, 8);
}
Also used : Node(org.apache.accumulo.core.security.ColumnVisibility.Node) Test(org.junit.Test)

Example 4 with Node

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

the class ColumnVisibilityTest method testParseTreeWithParenthesizedChildren.

@Test
public void testParseTreeWithParenthesizedChildren() {
    Node node = parse("ABC|(DEF&GHI)");
    assertNode(node, NodeType.OR, 0, 13);
    assertNode(node.getChildren().get(0), NodeType.TERM, 0, 3);
    assertNode(node.getChildren().get(1), NodeType.AND, 5, 12);
    assertNode(node.getChildren().get(1).children.get(0), NodeType.TERM, 5, 8);
    assertNode(node.getChildren().get(1).children.get(1), NodeType.TERM, 9, 12);
}
Also used : Node(org.apache.accumulo.core.security.ColumnVisibility.Node) Test(org.junit.Test)

Example 5 with Node

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

the class DisjunctiveNormalFormConverterTest method testTruthTableNullExpression.

/**
 * Test truth table with a {@code null} expression.
 */
@Test(expected = NullPointerException.class)
public void testTruthTableNullExpression() {
    final Node node = new DocumentVisibility("A").getParseTree();
    final byte[] expression = null;
    DisjunctiveNormalFormConverter.createTruthTableInputs(node, expression);
}
Also used : Node(org.apache.accumulo.core.security.ColumnVisibility.Node) DocumentVisibility(org.apache.rya.mongodb.document.visibility.DocumentVisibility) Test(org.junit.Test)

Aggregations

Node (org.apache.accumulo.core.security.ColumnVisibility.Node)12 Test (org.junit.Test)9 DocumentVisibility (org.apache.rya.mongodb.document.visibility.DocumentVisibility)2 ArrayList (java.util.ArrayList)1 LinkedHashSet (java.util.LinkedHashSet)1 NodeComparator (org.apache.accumulo.core.security.ColumnVisibility.NodeComparator)1