accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From afu...@apache.org
Subject svn commit: r1354475 [2/2] - in /accumulo/branches/ACCUMULO-652: core/src/main/java/org/apache/accumulo/core/file/rfile/ core/src/main/java/org/apache/accumulo/core/iterators/ core/src/main/java/org/apache/accumulo/core/iterators/predicates/ core/src/m...
Date Wed, 27 Jun 2012 12:48:18 GMT
Modified: accumulo/branches/ACCUMULO-652/core/src/test/java/org/apache/accumulo/core/security/VisibilityEvaluatorTest.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-652/core/src/test/java/org/apache/accumulo/core/security/VisibilityEvaluatorTest.java?rev=1354475&r1=1354474&r2=1354475&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-652/core/src/test/java/org/apache/accumulo/core/security/VisibilityEvaluatorTest.java
(original)
+++ accumulo/branches/ACCUMULO-652/core/src/test/java/org/apache/accumulo/core/security/VisibilityEvaluatorTest.java
Wed Jun 27 12:48:16 2012
@@ -26,33 +26,33 @@ import org.junit.Test;
 public class VisibilityEvaluatorTest {
   
   @Test
-  public void testVisibilityEvaluator() throws VisibilityParseException {
-    VisibilityEvaluator ct = new VisibilityEvaluator(ByteArraySet.fromStrings("one", "two",
"three", "four"));
+  public void testVisibilityEvaluator() {
+    Authorizations auths = new Authorizations(ByteArraySet.fromStrings("one", "two", "three",
"four"));
     
     // test for and
-    assertTrue("'and' test", ct.evaluate(new ColumnVisibility("one&two")));
+    assertTrue("'and' test", new ColumnVisibility("one&two").evaluate(auths));
     
     // test for or
-    assertTrue("'or' test", ct.evaluate(new ColumnVisibility("foor|four")));
+    assertTrue("'or' test", new ColumnVisibility("foor|four").evaluate(auths));
     
     // test for and and or
-    assertTrue("'and' and 'or' test", ct.evaluate(new ColumnVisibility("(one&two)|(foo&bar)")));
+    assertTrue("'and' and 'or' test", new ColumnVisibility("(one&two)|(foo&bar)").evaluate(auths));
     
     // 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)));
+      assertTrue(marking, new ColumnVisibility(marking).evaluate(auths));
     }
     
     // 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)));
+      assertFalse(marking, new ColumnVisibility(marking).evaluate(auths));
     }
     
     // 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));
+        new ColumnVisibility(marking).evaluate(auths);
         fail(marking + " failed to throw");
       } catch (Throwable e) {
         // all is good
@@ -62,7 +62,7 @@ public class VisibilityEvaluatorTest {
     // test unexpected separator
     for (String marking : new String[] {"&(five)", "|(five)", "(five)&", "five|",
"a|(b)&", "(&five)", "(five|)"}) {
       try {
-        ct.evaluate(new ColumnVisibility(marking));
+        new ColumnVisibility(marking).evaluate(auths);
         fail(marking + " failed to throw");
       } catch (Throwable e) {
         // all is good
@@ -72,7 +72,7 @@ public class VisibilityEvaluatorTest {
     // test mismatched parentheses
     for (String marking : new String[] {"(", ")", "(a&b", "b|a)"}) {
       try {
-        ct.evaluate(new ColumnVisibility(marking));
+        new ColumnVisibility(marking).evaluate(auths);
         fail(marking + " failed to throw");
       } catch (Throwable e) {
         // all is good

Modified: accumulo/branches/ACCUMULO-652/examples/wikisearch/query/src/main/java/org/apache/accumulo/examples/wikisearch/parser/EventFields.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-652/examples/wikisearch/query/src/main/java/org/apache/accumulo/examples/wikisearch/parser/EventFields.java?rev=1354475&r1=1354474&r2=1354475&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-652/examples/wikisearch/query/src/main/java/org/apache/accumulo/examples/wikisearch/parser/EventFields.java
(original)
+++ accumulo/branches/ACCUMULO-652/examples/wikisearch/query/src/main/java/org/apache/accumulo/examples/wikisearch/parser/EventFields.java
Wed Jun 27 12:48:16 2012
@@ -72,14 +72,14 @@ public class EventFields implements SetM
     }
     
     public int size() {
-      return visibility.flatten().length + value.length;
+      return visibility.getExpression().length + value.length;
     }
     
     @Override
     public String toString() {
       StringBuilder buf = new StringBuilder();
       if (null != visibility)
-        buf.append(" visibility: ").append(new String(visibility.flatten()));
+        buf.append(" visibility: ").append(new String(visibility.getExpression()));
       if (null != value)
         buf.append(" value size: ").append(value.length);
       if (null != value)
@@ -219,7 +219,7 @@ public class EventFields implements SetM
       // Write the key
       StringSerializer.put(buf, entry.getKey());
       // Write the fields in the value
-      valueSerializer.writeObjectData(buf, entry.getValue().getVisibility().flatten());
+      valueSerializer.writeObjectData(buf, entry.getValue().getVisibility().getExpression());
       valueSerializer.writeObjectData(buf, entry.getValue().getValue());
     }
   }



Mime
View raw message