You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2019/04/04 16:19:23 UTC

[GitHub] [accumulo] milleruntime commented on a change in pull request #1073: Move similar tests into PermissionsIT

milleruntime commented on a change in pull request #1073: Move similar tests into PermissionsIT
URL: https://github.com/apache/accumulo/pull/1073#discussion_r272259713
 
 

 ##########
 File path: test/src/main/java/org/apache/accumulo/test/functional/PermissionsIT.java
 ##########
 @@ -780,4 +784,54 @@ private void verifyHasNoTablePermissions(AccumuloClient root_client, String user
         throw new IllegalStateException(
             user + " SHOULD NOT have table permission " + p + " for table " + table);
   }
+
+  private void testArbitraryProperty(AccumuloClient c, String tableName, boolean havePerm)
+      throws AccumuloException, TableNotFoundException {
+    // Set variables for the property name to use and the initial value
+    String propertyName = "table.custom.description";
+    String description1 = "Description";
+
+    // Make sure the property name is valid
+    assertTrue(Property.isValidPropertyKey(propertyName));
+    // Set the property to the desired value
+    try {
+      c.tableOperations().setProperty(tableName, propertyName, description1);
+
+      // Loop through properties to make sure the new property is added to the list
+      int count = 0;
+      for (Entry<String,String> property : c.tableOperations().getProperties(tableName)) {
+        if (property.getKey().equals(propertyName) && property.getValue().equals(description1))
+          count++;
+      }
+      assertEquals(count, 1);
+
+      // Set the property as something different
+      String description2 = "set second";
+      c.tableOperations().setProperty(tableName, propertyName, description2);
+
+      // Loop through properties to make sure the new property is added to the list
+      count = 0;
+      for (Entry<String,String> property : c.tableOperations().getProperties(tableName)) {
+        if (property.getKey().equals(propertyName) && property.getValue().equals(description2))
+          count++;
+      }
+      assertEquals(count, 1);
+
+      // Remove the property and make sure there is no longer a value associated with it
+      c.tableOperations().removeProperty(tableName, propertyName);
 
 Review comment:
   Yeah I see what you are saying.  The testMissingSystemPermission() method in this class does test that removeProperty throws a AccumuloSecurityException.  [Here](https://github.com/milleruntime/accumulo/blob/9292f715adaa69748696e115aa2b6246c32218aa/test/src/main/java/org/apache/accumulo/test/functional/PermissionsIT.java#L204)

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services