test_class.declarator: cache
test_class.modifier: @Mock
test_class.original_string: @Mock
    Cache<Object, Object> cache;
test_class.type: Cache<Object, Object>
test_class.var_name: cache
test_class.declarator: entry
test_class.modifier: @Mock
test_class.original_string: @Mock
    CacheEntry<Object, Object> entry;
test_class.type: CacheEntry<Object, Object>
test_class.var_name: entry
test_class.declarator: populator
test_class.original_string: ConcurrentCachePopulator<Object, Object> populator;
test_class.type: ConcurrentCachePopulator<Object, Object>
test_class.var_name: populator
test_class.file: imcache-core/src/test/java/com/cetsoft/imcache/cache/populator/ConcurrentCachePopulatorTest.java
test_class.identifier: ConcurrentCachePopulatorTest
test_case.body: @Test
    public void populate() {
      Object object = new Object();
      List<CacheEntry<Object, Object>> entries = new ArrayList<CacheEntry<Object, Object>>();
      entries.add(entry);
      doReturn(object).when(entry).getKey();
      doReturn(object).when(entry).getValue();
      doReturn(entries).when(populator).loadEntries();
      doNothing().when(cache).put(object, object);
      populator.pupulate();
      try {
        Thread.sleep(100);
      } catch (InterruptedException e) {
      }
      verify(cache, atLeast(1)).put(object, object);
      verify(populator).loadEntries();
    }
test_case.class_method_signature: ConcurrentCachePopulatorTest.populate()
test_case.full_signature: @Test public void populate()
test_case.identifier: populate
test_case.invocations: add getKey when doReturn getValue when doReturn loadEntries when doReturn put when doNothing pupulate sleep put verify atLeast loadEntries verify
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void populate()
focal_class.declarator: DEFAULT_CONCURRENCY_LEVEL = 11
focal_class.modifier: private final static
focal_class.original_string: private final static int DEFAULT_CONCURRENCY_LEVEL = 11;
focal_class.type: int
focal_class.var_name: DEFAULT_CONCURRENCY_LEVEL
focal_class.declarator: populatorExecutor
focal_class.modifier: private final
focal_class.original_string: private final ExecutorService populatorExecutor;
focal_class.type: ExecutorService
focal_class.var_name: populatorExecutor
focal_class.declarator: concurrencyLevel
focal_class.modifier: private
focal_class.original_string: private int concurrencyLevel;
focal_class.type: int
focal_class.var_name: concurrencyLevel
focal_class.file: imcache-core/src/main/java/com/cetsoft/imcache/cache/populator/ConcurrentCachePopulator.java
focal_class.identifier: ConcurrentCachePopulator
focal_class.class_method_signature: ConcurrentCachePopulator.ConcurrentCachePopulator(final Cache<K, V> cache, final int concurrencyLevel)
focal_class.full_signature: public  ConcurrentCachePopulator(final Cache<K, V> cache, final int concurrencyLevel)
focal_class.identifier: ConcurrentCachePopulator
focal_class.modifiers: public
focal_class.parameters: (final Cache<K, V> cache, final int concurrencyLevel)
focal_class.signature:  ConcurrentCachePopulator(final Cache<K, V> cache, final int concurrencyLevel)
focal_class.class_method_signature: ConcurrentCachePopulator.ConcurrentCachePopulator(Cache<K, V> cache)
focal_class.full_signature: public  ConcurrentCachePopulator(Cache<K, V> cache)
focal_class.identifier: ConcurrentCachePopulator
focal_class.modifiers: public
focal_class.parameters: (Cache<K, V> cache)
focal_class.signature:  ConcurrentCachePopulator(Cache<K, V> cache)
focal_class.class_method_signature: ConcurrentCachePopulator.pupulate()
focal_class.full_signature: public void pupulate()
focal_class.identifier: pupulate
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void pupulate()
focal_class.superclass: extends AbstractCachePopulator<K, V>
focal_method.body: public void pupulate() {
      final List<CacheEntry<K, V>> entries = loadEntries();
      if (entries.size() < concurrencyLevel) {
        concurrencyLevel = entries.size();
      }
      final int partition = entries.size() / concurrencyLevel;
      for (int i = 0; i < concurrencyLevel; i++) {
        final int start = i * partition;
        final int stop = i != concurrencyLevel - 1 ? (i + 1) * partition : entries.size();
        populatorExecutor.execute(() -> {
          for (int j = start; j < stop; j++) {
            cache.put(entries.get(j).getKey(), entries.get(j).getValue());
          }
        });
      }
      populatorExecutor.shutdown();
    }
focal_method.class_method_signature: ConcurrentCachePopulator.pupulate()
focal_method.full_signature: public void pupulate()
focal_method.identifier: pupulate
focal_method.invocations: loadEntries size size size size execute put getKey get getValue get shutdown
focal_method.modifiers: public
focal_method.parameters: ()
focal_method.return: void
focal_method.signature: void pupulate()