kevinrr888 commented on code in PR #5990:
URL: https://github.com/apache/accumulo/pull/5990#discussion_r2586707541


##########
test/src/main/java/org/apache/accumulo/test/NewTableConfigurationIT.java:
##########
@@ -519,19 +521,66 @@ public void testNtcChaining() throws AccumuloException, 
AccumuloSecurityExceptio
   }
 
   @Test
-  public void testIteratorConflictsWithDefault() throws Exception {
-    String[] tableNames = getUniqueNames(2);
-    String table1 = tableNames[0];
-    String table2 = tableNames[1];
+  public void testConflictsWithDefaults() throws Exception {
+    // tests trying to add properties that conflict with the default table 
properties
+    String table = getUniqueNames(1)[0];
     try (AccumuloClient client = 
Accumulo.newClient().from(getClientProps()).build()) {
+      /*
+       * conflicts from iterators set via attachIterator()
+       */
       // add an iterator with same priority as the default iterator
       var iterator1 = new IteratorSetting(20, "foo", "foo.bar");
-      assertThrows(IllegalArgumentException.class, () -> 
client.tableOperations().create(table1,
-          new NewTableConfiguration().attachIterator(iterator1)));
+      var exception = assertThrows(IllegalStateException.class, () -> 
client.tableOperations()
+          .create(table, new 
NewTableConfiguration().attachIterator(iterator1)));
+      assertTrue(exception.getMessage().contains("iterator priority 
conflict"));
       // add an iterator with same name as the default iterator
       var iterator2 = new IteratorSetting(10, "vers", "foo.bar");
-      assertThrows(IllegalArgumentException.class, () -> 
client.tableOperations().create(table2,
-          new NewTableConfiguration().attachIterator(iterator2)));
+      exception = assertThrows(IllegalStateException.class, () -> 
client.tableOperations()
+          .create(table, new 
NewTableConfiguration().attachIterator(iterator2)));
+      assertTrue(exception.getMessage().contains("iterator name conflict"));
+      // try to attach the exact default iterators
+      IteratorConfigUtil.getInitialTableIteratorSettings().forEach((setting, 
scopes) -> {
+        var exception1 = assertThrows(IllegalStateException.class, () -> 
client.tableOperations()
+            .create(table, new NewTableConfiguration().attachIterator(setting, 
scopes)));
+        assertTrue(exception1.getMessage().contains("iterator name conflict")
+            || exception1.getMessage().contains("iterator priority conflict"));
+      });
+
+      /*
+       * conflicts from iterators set via properties
+       */
+      // add an iterator with same priority as the default iterator
+      Map<String,String> props = new HashMap<>();
+      for (IteratorScope iterScope : IteratorScope.values()) {
+        props.put(Property.TABLE_ITERATOR_PREFIX + iterScope.name() + ".foo", 
"20,foo.bar");
+      }
+      exception = assertThrows(IllegalStateException.class, () -> 
client.tableOperations()
+          .create(table, new NewTableConfiguration().setProperties(props)));
+      assertTrue(exception.getMessage().contains("iterator priority 
conflict"));
+      props.clear();
+      // add an iterator with same name as the default iterator
+      for (IteratorScope iterScope : IteratorScope.values()) {
+        props.put(Property.TABLE_ITERATOR_PREFIX + iterScope.name() + ".vers", 
"10,foo.bar");
+      }
+      exception = assertThrows(IllegalStateException.class, () -> 
client.tableOperations()
+          .create(table, new NewTableConfiguration().setProperties(props)));
+      assertTrue(exception.getMessage().contains("iterator name conflict"));
+      props.clear();
+      // try to attach the exact default iterators

Review Comment:
   That seems good to me as the final properties map will be the same 
regardless.
   addressed in b343417af8f133f92a73d3fdee07e2af9be2cae8



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to