This is an automated email from the ASF dual-hosted git repository.
kturner pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo-access.git
The following commit(s) were added to refs/heads/main by this push:
new 9c3fa54 Copies some test cases from accumulo code base (#82)
9c3fa54 is described below
commit 9c3fa5469ac5eac1097b9af3d0bdb8a7463d8a70
Author: Keith Turner <[email protected]>
AuthorDate: Tue Jan 7 15:40:22 2025 -0500
Copies some test cases from accumulo code base (#82)
---
src/test/java/org/apache/accumulo/access/AccessExpressionTest.java | 7 +++++++
src/test/resources/testdata.json | 4 +++-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/test/java/org/apache/accumulo/access/AccessExpressionTest.java
b/src/test/java/org/apache/accumulo/access/AccessExpressionTest.java
index 76b3782..17cebc9 100644
--- a/src/test/java/org/apache/accumulo/access/AccessExpressionTest.java
+++ b/src/test/java/org/apache/accumulo/access/AccessExpressionTest.java
@@ -86,6 +86,11 @@ public class AccessExpressionTest {
testData.add(List.of("(b)|((a))", "a|b"));
testData.add(List.of("(b|(a|c))&x", "x&(a|b|c)"));
testData.add(List.of("(((a)))", "a"));
+ testData.add(List.of("b&c&a", "a&b&c"));
+ testData.add(List.of("c&b&a", "a&b&c"));
+ testData.add(List.of("a&(b&c)", "a&b&c"));
+ testData.add(List.of("(a&c)&b", "a&b&c"));
+ testData.add(List.of("(d&c&b&a)|(b&c&a&d)", "a&b&c&d"));
testData.add(List.of("Z|M|A", "A|M|Z"));
testData.add(List.of("Z&M&A", "A&M&Z"));
testData.add(List.of("(Y&B)|(Z&A)", "(A&Z)|(B&Y)"));
@@ -123,6 +128,8 @@ public class AccessExpressionTest {
var expected = testCase.get(1);
assertEquals(expected, AccessExpression.of(expression,
true).getExpression());
assertEquals(expected, AccessExpression.of(expression.getBytes(UTF_8),
true).getExpression());
+ assertEquals(expected, AccessExpression
+ .of(AccessExpression.of(expression, true).getExpression(),
true).getExpression());
// when not normalizing should see the original expression
assertEquals(expression,
AccessExpression.of(expression).getExpression());
diff --git a/src/test/resources/testdata.json b/src/test/resources/testdata.json
index 3654e49..3d94876 100644
--- a/src/test/resources/testdata.json
+++ b/src/test/resources/testdata.json
@@ -440,7 +440,9 @@
"expressions": [
"\"A#C\"|\"A?C\"",
"\"A\\\"C\"&\"A\\\\C\"",
- "(\"A\\\"C\"|B)&(\"A#C\"|D)"
+ "(\"A\\\"C\"|B)&(\"A#C\"|D)",
+ "\"A#C\"",
+ "(\"A#C\")"
]
},
{