test_class.declarator: store = new MemoryNodeStore()
test_class.modifier: private final
test_class.original_string: private final NodeStore store = new MemoryNodeStore();
test_class.type: NodeStore
test_class.var_name: store
test_class.declarator: counter = mock(NodeCounter.class)
test_class.modifier: private
test_class.original_string: private NodeCounter counter = mock(NodeCounter.class);
test_class.type: NodeCounter
test_class.var_name: counter
test_class.file: oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/progress/NodeCounterMBeanEstimatorTest.java
test_class.identifier: NodeCounterMBeanEstimatorTest
test_case.body: @Test
      public void estimateCount() throws Exception {
          NodeBuilder builder = store.getRoot().builder();
  
          builder.child("idx-a");
  
          builder.child("idx-b").setProperty(PROP_INCLUDED_PATHS, asList("/content"), Type.STRINGS);
          builder.child("idx-b").setProperty(PROP_EXCLUDED_PATHS, asList("/content/old"), Type.STRINGS);
  
          builder.child("idx-c").setProperty(PROP_INCLUDED_PATHS, asList("/libs"), Type.STRINGS);
  
          builder.child("idx-d").setProperty(PROP_EXCLUDED_PATHS, asList("/libs"), Type.STRINGS);
  
  
          builder.child("content").child("idx-e").setProperty(PROP_EXCLUDED_PATHS, asList("/content/old"), Type.STRINGS);
          builder.child("content").child("idx-f");
  
          store.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
  
          Map<String, Integer> counts = ImmutableMap.of(
                  "/", 100,
                  "/content", 50,
                  "/content/old", 10,
                  "/libs", 30
          );
  
          when(counter.getEstimatedNodeCount(anyString())).then((invocation -> {
              String path = (String) invocation.getArguments()[0];
              if (counts.containsKey(path)) {
                  return (long)counts.get(path);
              }
              return -1;
          }));
  
          NodeCountEstimator estimator = new NodeCounterMBeanEstimator(store, counter);
  
          assertEquals(100, estimator.getEstimatedNodeCount("/", of("/idx-a")));
          assertEquals(100, estimator.getEstimatedNodeCount("/", of("/idx-a", "/idx-b")));
          assertEquals(40, estimator.getEstimatedNodeCount("/", of("/idx-b")));
          assertEquals(70, estimator.getEstimatedNodeCount("/", of("/idx-b", "/idx-c")));
  
          assertEquals(50, estimator.getEstimatedNodeCount("/content", of("/content/idx-f")));
          assertEquals(40, estimator.getEstimatedNodeCount("/content", of("/content/idx-e")));
      }
test_case.class_method_signature: NodeCounterMBeanEstimatorTest.estimateCount()
test_case.full_signature: @Test public void estimateCount()
test_case.identifier: estimateCount
test_case.invocations: builder getRoot child setProperty child asList setProperty child asList setProperty child asList setProperty child asList setProperty child child asList child child merge of then when getEstimatedNodeCount anyString getArguments containsKey get assertEquals getEstimatedNodeCount of assertEquals getEstimatedNodeCount of assertEquals getEstimatedNodeCount of assertEquals getEstimatedNodeCount of assertEquals getEstimatedNodeCount of assertEquals getEstimatedNodeCount of
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void estimateCount()
focal_class.declarator: log = LoggerFactory.getLogger(getClass())
focal_class.modifier: private final
focal_class.original_string: private final Logger log = LoggerFactory.getLogger(getClass());
focal_class.type: Logger
focal_class.var_name: log
focal_class.declarator: counter
focal_class.modifier: private final
focal_class.original_string: private final NodeCounter counter;
focal_class.type: NodeCounter
focal_class.var_name: counter
focal_class.declarator: nodeStore
focal_class.modifier: private final
focal_class.original_string: private final NodeStore nodeStore;
focal_class.type: NodeStore
focal_class.var_name: nodeStore
focal_class.file: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/progress/NodeCounterMBeanEstimator.java
focal_class.identifier: NodeCounterMBeanEstimator
focal_class.interfaces: implements NodeCountEstimator
focal_class.class_method_signature: NodeCounterMBeanEstimator.NodeCounterMBeanEstimator(NodeStore nodeStore)
focal_class.full_signature: public  NodeCounterMBeanEstimator(NodeStore nodeStore)
focal_class.identifier: NodeCounterMBeanEstimator
focal_class.modifiers: public
focal_class.parameters: (NodeStore nodeStore)
focal_class.signature:  NodeCounterMBeanEstimator(NodeStore nodeStore)
focal_class.class_method_signature: NodeCounterMBeanEstimator.NodeCounterMBeanEstimator(NodeStore nodeStore, NodeCounter nodeCounter)
focal_class.full_signature:   NodeCounterMBeanEstimator(NodeStore nodeStore, NodeCounter nodeCounter)
focal_class.identifier: NodeCounterMBeanEstimator
focal_class.parameters: (NodeStore nodeStore, NodeCounter nodeCounter)
focal_class.signature:  NodeCounterMBeanEstimator(NodeStore nodeStore, NodeCounter nodeCounter)
focal_class.class_method_signature: NodeCounterMBeanEstimator.getEstimatedNodeCount(String basePath, Set<String> indexPaths)
focal_class.full_signature: @Override public long getEstimatedNodeCount(String basePath, Set<String> indexPaths)
focal_class.identifier: getEstimatedNodeCount
focal_class.modifiers: @Override public
focal_class.parameters: (String basePath, Set<String> indexPaths)
focal_class.return: long
focal_class.signature: long getEstimatedNodeCount(String basePath, Set<String> indexPaths)
focal_method.body: @Override
      public long getEstimatedNodeCount(String basePath, Set<String> indexPaths) {
          PathPerimeter pp = new PathPerimeter();
          pp.compute(basePath, indexPaths);
  
          if (pp.includeAll) {
              return counter.getEstimatedNodeCount(basePath);
          } else {
              long totalCount = 0;
              for (String path : pp.includes) {
                  long estimate = counter.getEstimatedNodeCount(path);
                  if (estimate > 0) {
                      totalCount += estimate;
                  }
              }
              for (String path : pp.excludes) {
                  long estimate = counter.getEstimatedNodeCount(path);
                  if (estimate > 0) {
                      totalCount -= estimate;
                  }
              }
  
              log.info("Paths to be traversed {}", pp);
              return totalCount;
          }
      }
focal_method.class_method_signature: NodeCounterMBeanEstimator.getEstimatedNodeCount(String basePath, Set<String> indexPaths)
focal_method.full_signature: @Override public long getEstimatedNodeCount(String basePath, Set<String> indexPaths)
focal_method.identifier: getEstimatedNodeCount
focal_method.invocations: compute getEstimatedNodeCount getEstimatedNodeCount getEstimatedNodeCount info
focal_method.modifiers: @Override public
focal_method.parameters: (String basePath, Set<String> indexPaths)
focal_method.return: long
focal_method.signature: long getEstimatedNodeCount(String basePath, Set<String> indexPaths)