Package org.apache.accumulo.core.security

Examples of org.apache.accumulo.core.security.VisibilityEvaluator.evaluate()


  @Test
  public void testVisibilityEvaluator() throws VisibilityParseException {
    VisibilityEvaluator ct = new VisibilityEvaluator(ByteArraySet.fromStrings("one", "two", "three", "four"));
   
    // test for and
    assertTrue("'and' test", ct.evaluate(new ColumnVisibility("one&two")));
   
    // test for or
    assertTrue("'or' test", ct.evaluate(new ColumnVisibility("foor|four")));
   
    // test for and and or
View Full Code Here


   
    // test for and
    assertTrue("'and' test", ct.evaluate(new ColumnVisibility("one&two")));
   
    // test for or
    assertTrue("'or' test", ct.evaluate(new ColumnVisibility("foor|four")));
   
    // test for and and or
    assertTrue("'and' and 'or' test", ct.evaluate(new ColumnVisibility("(one&two)|(foo&bar)")));
   
    // test for false negatives
View Full Code Here

   
    // test for or
    assertTrue("'or' test", ct.evaluate(new ColumnVisibility("foor|four")));
   
    // test for and and or
    assertTrue("'and' and 'or' test", ct.evaluate(new ColumnVisibility("(one&two)|(foo&bar)")));
   
    // test for false negatives
    for (String marking : new String[] {"one", "one|five", "five|one", "(one)", "(one&two)|(foo&bar)", "(one|foo)&three", "one|foo|bar", "(one|foo)|bar",
        "((one|foo)|bar)&two"}) {
      assertTrue(marking, ct.evaluate(new ColumnVisibility(marking)));
View Full Code Here

    assertTrue("'and' and 'or' test", ct.evaluate(new ColumnVisibility("(one&two)|(foo&bar)")));
   
    // test for false negatives
    for (String marking : new String[] {"one", "one|five", "five|one", "(one)", "(one&two)|(foo&bar)", "(one|foo)&three", "one|foo|bar", "(one|foo)|bar",
        "((one|foo)|bar)&two"}) {
      assertTrue(marking, ct.evaluate(new ColumnVisibility(marking)));
    }
   
    // test for false positives
    for (String marking : new String[] {"five", "one&five", "five&one", "((one|foo)|bar)&goober"}) {
      assertFalse(marking, ct.evaluate(new ColumnVisibility(marking)));
View Full Code Here

      assertTrue(marking, ct.evaluate(new ColumnVisibility(marking)));
    }
   
    // test for false positives
    for (String marking : new String[] {"five", "one&five", "five&one", "((one|foo)|bar)&goober"}) {
      assertFalse(marking, ct.evaluate(new ColumnVisibility(marking)));
    }
   
    // test missing separators; these should throw an exception
    for (String marking : new String[] {"one(five)", "(five)one", "(one)(two)", "a|(b(c))"}) {
      try {
View Full Code Here

    }
   
    // test missing separators; these should throw an exception
    for (String marking : new String[] {"one(five)", "(five)one", "(one)(two)", "a|(b(c))"}) {
      try {
        ct.evaluate(new ColumnVisibility(marking));
        fail(marking + " failed to throw");
      } catch (Throwable e) {
        // all is good
      }
    }
View Full Code Here

    }
   
    // test unexpected separator
    for (String marking : new String[] {"&(five)", "|(five)", "(five)&", "five|", "a|(b)&", "(&five)", "(five|)"}) {
      try {
        ct.evaluate(new ColumnVisibility(marking));
        fail(marking + " failed to throw");
      } catch (Throwable e) {
        // all is good
      }
    }
View Full Code Here

    }
   
    // test mismatched parentheses
    for (String marking : new String[] {"(", ")", "(a&b", "b|a)"}) {
      try {
        ct.evaluate(new ColumnVisibility(marking));
        fail(marking + " failed to throw");
      } catch (Throwable e) {
        // all is good
      }
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.