ddanielr commented on code in PR #3927:
URL: https://github.com/apache/accumulo/pull/3927#discussion_r1382149618


##########
core/src/test/java/org/apache/accumulo/core/conf/PropertyTest.java:
##########
@@ -105,6 +106,20 @@ public void testPorts() {
     }
   }
 
+  @Test
+  public void testJson() {
+    // JsonParser.parseString("not json");
+
+    var p1 = TSERV_COMPACTION_SERVICE_META_EXECUTORS;
+    
assertFalse(TSERV_COMPACTION_SERVICE_META_EXECUTORS.getType().isValidFormat("notJson"));
+
+    String json =
+        
"[{'name':'small','type':'internal','maxSize':'32M','numThreads':2},{'name':'huge','type':'internal','numThreads':2}]"
+            .replaceAll("'", "\"");
+    assertTrue(Property.isValidProperty(p1.getKey(), json));
+
+  }
+

Review Comment:
   This test should probably follow the other property test patterns and test 
all properties with the JSON property type. 
   Something like:
   ```suggestion
      for (Property prop : Property.values()) {
         if (prop.getType().equals(PropertyType.JSON)) {
           assertFalse(prop.getType().isValidFormat("notJson"));
           String json =
               
"[{'foo':'bar','type':'test','fooBar':'32'},{'foo':'bar','type':'test','fooBar':32}]".replaceAll(
                   "'", "\"");
           assertTrue(Property.isValidProperty(prop.getKey(), json));
         }
       }
   ```
   
   



##########
core/src/test/java/org/apache/accumulo/core/conf/PropertyTest.java:
##########
@@ -105,6 +106,20 @@ public void testPorts() {
     }
   }
 
+  @Test
+  public void testJson() {
+    // JsonParser.parseString("not json");

Review Comment:
   This comment can be removed
   ```suggestion
   ```
   
   



##########
test/src/main/java/org/apache/accumulo/test/shell/ConfigSetIT.java:
##########
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.accumulo.test.shell;
+
+import static 
org.apache.accumulo.core.conf.Property.MONITOR_RESOURCES_EXTERNAL;
+import static 
org.apache.accumulo.core.conf.Property.TSERV_COMPACTION_SERVICE_ROOT_EXECUTORS;
+import static org.apache.accumulo.harness.AccumuloITBase.MINI_CLUSTER_ONLY;
+import static org.apache.accumulo.harness.AccumuloITBase.SUNNY_DAY;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+import org.apache.accumulo.core.client.AccumuloClient;
+import org.apache.accumulo.core.client.AccumuloException;
+import org.apache.accumulo.core.client.security.tokens.PasswordToken;
+import org.apache.accumulo.harness.SharedMiniClusterBase;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@Tag(MINI_CLUSTER_ONLY)
+@Tag(SUNNY_DAY)
+public class ConfigSetIT extends SharedMiniClusterBase {
+  @BeforeAll
+  public static void setup() throws Exception {
+    SharedMiniClusterBase.startMiniCluster();
+  }
+
+  @AfterAll
+  public static void teardown() {
+    SharedMiniClusterBase.stopMiniCluster();
+  }
+
+  private static final Logger log = LoggerFactory.getLogger(ConfigSetIT.class);
+
+  @Test
+  public void setInvalidJson() throws Exception {

Review Comment:
   This question is probably out of scope of the "simple validation" of this PR.
    
   Is there a way to test setting a custom, user-defined property (created 
under the `general.custom` prefix that's of type JSON with the shell?



-- 
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