@Test public void testGetProperties() { Map<String,String> props = new java.util.HashMap<>(); AccumuloConfiguration parent = createMock(AccumuloConfiguration.class); Predicate<String> filter = createMock(Predicate.class); parent.getProperties(props, filter); replay(parent); String child1 = "child1"; String child2 = "child2"; List<String> children = new java.util.ArrayList<>(); children.add(child1); children.add(child2); expect(zc.getChildren(PATH)).andReturn(children); expect(zc.get(PATH + "/" + child1)).andReturn(VALUE_BYTES); expect(zc.get(PATH + "/" + child2)).andReturn(null); replay(zc); expect(filter.test(child1)).andReturn(true); expect(filter.test(child2)).andReturn(true); replay(filter); a.getProperties(props, PATH, filter, parent, null); assertEquals(1, props.size()); assertEquals(VALUE, props.get(child1)); verify(parent); }
void getProperties(Map<String,String> props, String path, Predicate<String> filter, AccumuloConfiguration parent, Predicate<String> parentFilter) { parent.getProperties(props, parentFilter != null ? parentFilter : filter); List<String> children = propCache.getChildren(path); if (children != null) { for (String child : children) { if (child != null && filter.test(child)) { String value = get(path + "/" + child); if (value != null) { props.put(child, value); } } } } }
ZooCachePropertyAccessor { void getProperties(Map<String,String> props, String path, Predicate<String> filter, AccumuloConfiguration parent, Predicate<String> parentFilter) { parent.getProperties(props, parentFilter != null ? parentFilter : filter); List<String> children = propCache.getChildren(path); if (children != null) { for (String child : children) { if (child != null && filter.test(child)) { String value = get(path + "/" + child); if (value != null) { props.put(child, value); } } } } } }
ZooCachePropertyAccessor { void getProperties(Map<String,String> props, String path, Predicate<String> filter, AccumuloConfiguration parent, Predicate<String> parentFilter) { parent.getProperties(props, parentFilter != null ? parentFilter : filter); List<String> children = propCache.getChildren(path); if (children != null) { for (String child : children) { if (child != null && filter.test(child)) { String value = get(path + "/" + child); if (value != null) { props.put(child, value); } } } } } ZooCachePropertyAccessor(ZooCache propCache); }
ZooCachePropertyAccessor { void getProperties(Map<String,String> props, String path, Predicate<String> filter, AccumuloConfiguration parent, Predicate<String> parentFilter) { parent.getProperties(props, parentFilter != null ? parentFilter : filter); List<String> children = propCache.getChildren(path); if (children != null) { for (String child : children) { if (child != null && filter.test(child)) { String value = get(path + "/" + child); if (value != null) { props.put(child, value); } } } } } ZooCachePropertyAccessor(ZooCache propCache);  }
ZooCachePropertyAccessor { void getProperties(Map<String,String> props, String path, Predicate<String> filter, AccumuloConfiguration parent, Predicate<String> parentFilter) { parent.getProperties(props, parentFilter != null ? parentFilter : filter); List<String> children = propCache.getChildren(path); if (children != null) { for (String child : children) { if (child != null && filter.test(child)) { String value = get(path + "/" + child); if (value != null) { props.put(child, value); } } } } } ZooCachePropertyAccessor(ZooCache propCache);   }