This is an automated email from the ASF dual-hosted git repository. mmiller pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/main by this push: new 61b107d876 Add Verify & fix test in NamespaceConfigurationTest (#2756) 61b107d876 is described below commit 61b107d876e2427b5fd7c1536036e1a050732ac5 Author: Mike Miller <mmil...@apache.org> AuthorDate: Tue Jun 7 10:58:26 2022 +0000 Add Verify & fix test in NamespaceConfigurationTest (#2756) * Add Verify calls to NamespaceConfigurationTest * Fix the testGet_InParent test in NamespaceConfigurationTest Co-authored-by: Christopher Tubbs <ctubb...@apache.org> --- .../server/conf/NamespaceConfigurationTest.java | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/server/base/src/test/java/org/apache/accumulo/server/conf/NamespaceConfigurationTest.java b/server/base/src/test/java/org/apache/accumulo/server/conf/NamespaceConfigurationTest.java index 621e10f42f..47d2f769b0 100644 --- a/server/base/src/test/java/org/apache/accumulo/server/conf/NamespaceConfigurationTest.java +++ b/server/base/src/test/java/org/apache/accumulo/server/conf/NamespaceConfigurationTest.java @@ -37,6 +37,7 @@ import java.util.function.Predicate; import org.apache.accumulo.core.clientImpl.Namespace; import org.apache.accumulo.core.conf.AccumuloConfiguration; +import org.apache.accumulo.core.conf.ConfigurationCopy; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.data.InstanceId; import org.apache.accumulo.core.data.NamespaceId; @@ -91,6 +92,7 @@ public class NamespaceConfigurationTest { NamespaceConfiguration nsConfig = new NamespaceConfiguration(context, NSID, parent); assertEquals(NSID, nsConfig.getNamespaceId()); assertEquals(parent, nsConfig.getParent()); + verify(propStore, context); } @Test @@ -99,21 +101,21 @@ public class NamespaceConfigurationTest { assertEquals("sekrit", nsConfig.get(Property.INSTANCE_SECRET)); - verify(propStore); + verify(propStore, context); } @Test public void testGet_InParent() { - Property p = Property.INSTANCE_SECRET; - - expect(parent.get(p.getKey())).andReturn("sekrit"); - replay(parent); + String randomKey = UUID.randomUUID().toString(); + String customTablePropKey = Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + randomKey; + String expectedValue = "thisIsTheExpectedValue"; + ConfigurationCopy parent = new ConfigurationCopy(Map.of(customTablePropKey, expectedValue)); nsConfig = new NamespaceConfiguration(context, NSID, parent); - assertEquals("sekrit", nsConfig.get(Property.INSTANCE_SECRET)); + assertEquals(expectedValue, nsConfig.get(customTablePropKey)); - // TODO Need to check parent and accessor usage + verify(propStore, context); } @Test @@ -129,6 +131,7 @@ public class NamespaceConfigurationTest { NamespaceConfiguration accumuloNsConfig = new NamespaceConfiguration(context, Namespace.ACCUMULO.id(), parent); assertNull(accumuloNsConfig.get(Property.INSTANCE_SECRET)); + verify(propStore, context); } @Test @@ -160,6 +163,7 @@ public class NamespaceConfigurationTest { assertEquals("tock", props.get("tick")); assertEquals("bark", props.get("dog")); assertEquals("meow", props.get("cat")); + verify(propStore, parent, context); } @Test @@ -170,6 +174,6 @@ public class NamespaceConfigurationTest { assertEquals("sekrit", value); nsConfig.invalidateCache(); - verify(propStore); + verify(propStore, context); } }