Search in sources :

Example 6 with WeftExecutorService

use of org.commonjava.cdi.util.weft.WeftExecutorService in project indy by Commonjava.

the class DefaultDownloadManagerTest method setup.

@Before
public void setup() throws IOException, GalleyInitException {
    contentMetadata.clear();
    core = new GalleyCoreBuilder(new FileCacheProviderFactory(temp.newFolder("cache"))).build();
    storeManager = new MemoryStoreDataManager(true);
    LocationExpander locationExpander = new IndyLocationExpander(storeManager);
    final DefaultIndyConfiguration config = new DefaultIndyConfiguration();
    config.setNotFoundCacheTimeoutSeconds(1);
    final ExpiringMemoryNotFoundCache nfc = new ExpiringMemoryNotFoundCache(config);
    WeftExecutorService rescanService = new PoolWeftExecutorService("test-rescan-executor", (ThreadPoolExecutor) Executors.newCachedThreadPool(), 2, 10f, false, null, null);
    downloadManager = new DefaultDownloadManager(storeManager, core.getTransferManager(), locationExpander, null, nfc, rescanService);
    WeftExecutorService contentAccessService = new PoolWeftExecutorService("test-content-access-executor", (ThreadPoolExecutor) Executors.newCachedThreadPool(), 2, 10f, false, null, null);
    DirectContentAccess dca = new DefaultDirectContentAccess(downloadManager, contentAccessService);
    ContentDigester contentDigester = new DefaultContentDigester(dca, new CacheHandle<String, TransferMetadata>("content-metadata", contentMetadata));
    contentManager = new DefaultContentManager(storeManager, downloadManager, new IndyObjectMapper(true), new SpecialPathManagerImpl(), new MemoryNotFoundCache(), contentDigester, new ContentGeneratorManager());
}
Also used : PoolWeftExecutorService(org.commonjava.cdi.util.weft.PoolWeftExecutorService) GalleyCoreBuilder(org.commonjava.maven.galley.GalleyCoreBuilder) FileCacheProviderFactory(org.commonjava.maven.galley.cache.FileCacheProviderFactory) ExpiringMemoryNotFoundCache(org.commonjava.indy.core.inject.ExpiringMemoryNotFoundCache) MemoryNotFoundCache(org.commonjava.maven.galley.nfc.MemoryNotFoundCache) ExpiringMemoryNotFoundCache(org.commonjava.indy.core.inject.ExpiringMemoryNotFoundCache) SpecialPathManagerImpl(org.commonjava.maven.galley.io.SpecialPathManagerImpl) PoolWeftExecutorService(org.commonjava.cdi.util.weft.PoolWeftExecutorService) WeftExecutorService(org.commonjava.cdi.util.weft.WeftExecutorService) LocationExpander(org.commonjava.maven.galley.spi.transport.LocationExpander) IndyLocationExpander(org.commonjava.indy.content.IndyLocationExpander) DirectContentAccess(org.commonjava.indy.content.DirectContentAccess) TransferMetadata(org.commonjava.maven.galley.io.checksum.TransferMetadata) IndyObjectMapper(org.commonjava.indy.model.core.io.IndyObjectMapper) MemoryStoreDataManager(org.commonjava.indy.mem.data.MemoryStoreDataManager) IndyLocationExpander(org.commonjava.indy.content.IndyLocationExpander) DefaultIndyConfiguration(org.commonjava.indy.conf.DefaultIndyConfiguration) ContentDigester(org.commonjava.indy.content.ContentDigester) Before(org.junit.Before)

Example 7 with WeftExecutorService

use of org.commonjava.cdi.util.weft.WeftExecutorService in project indy by Commonjava.

the class DownloadManagerTest method setupTest.

@Before
public void setupTest() throws Exception {
    data = new MemoryStoreDataManager(true);
    WeftExecutorService rescanService = new PoolWeftExecutorService("test-rescan-executor", (ThreadPoolExecutor) Executors.newCachedThreadPool(), 2, 10f, false, null, null);
    downloader = new DefaultDownloadManager(data, fixture.getTransferManager(), new IndyLocationExpander(data), null, new NoOpNotFoundCache(), rescanService);
}
Also used : PoolWeftExecutorService(org.commonjava.cdi.util.weft.PoolWeftExecutorService) WeftExecutorService(org.commonjava.cdi.util.weft.WeftExecutorService) PoolWeftExecutorService(org.commonjava.cdi.util.weft.PoolWeftExecutorService) MemoryStoreDataManager(org.commonjava.indy.mem.data.MemoryStoreDataManager) IndyLocationExpander(org.commonjava.indy.content.IndyLocationExpander) DefaultDownloadManager(org.commonjava.indy.core.content.DefaultDownloadManager) NoOpNotFoundCache(org.commonjava.maven.galley.nfc.NoOpNotFoundCache) Before(org.junit.Before)

Example 8 with WeftExecutorService

use of org.commonjava.cdi.util.weft.WeftExecutorService in project indy by Commonjava.

the class ContentControllerTest method setup.

@Before
public void setup() throws Exception {
    contentMetadata.clear();
    fixture.initMissingComponents();
    final StoreDataManager storeManager = new MemoryStoreDataManager(true);
    WeftExecutorService rescanService = new PoolWeftExecutorService("test-rescan-executor", (ThreadPoolExecutor) Executors.newCachedThreadPool(), 2, 10f, false, null, null);
    final DownloadManager fileManager = new DefaultDownloadManager(storeManager, fixture.getTransferManager(), fixture.getLocationExpander(), rescanService);
    WeftExecutorService contentAccessService = new PoolWeftExecutorService("test-content-access-executor", (ThreadPoolExecutor) Executors.newCachedThreadPool(), 2, 10f, false, null, null);
    final DirectContentAccess dca = new DefaultDirectContentAccess(fileManager, contentAccessService);
    final ContentManager contentManager = new DefaultContentManager(storeManager, fileManager, new IndyObjectMapper(true), new SpecialPathManagerImpl(), new MemoryNotFoundCache(), new DefaultContentDigester(dca, new CacheHandle<String, TransferMetadata>("content-metadata", contentMetadata)), new ContentGeneratorManager());
    final TemplatingEngine templates = new TemplatingEngine(new GStringTemplateEngine(), new DataFileManager(fixture.getTemp().newFolder("indy-home"), new DataFileEventManager()));
    content = new ContentController(storeManager, contentManager, templates, new IndyObjectMapper(true), new MimeTyper());
}
Also used : PoolWeftExecutorService(org.commonjava.cdi.util.weft.PoolWeftExecutorService) DefaultContentDigester(org.commonjava.indy.core.content.DefaultContentDigester) DataFileEventManager(org.commonjava.indy.subsys.datafile.change.DataFileEventManager) DefaultContentManager(org.commonjava.indy.core.content.DefaultContentManager) ContentManager(org.commonjava.indy.content.ContentManager) MemoryNotFoundCache(org.commonjava.maven.galley.nfc.MemoryNotFoundCache) GStringTemplateEngine(groovy.text.GStringTemplateEngine) DefaultContentManager(org.commonjava.indy.core.content.DefaultContentManager) DownloadManager(org.commonjava.indy.content.DownloadManager) DefaultDownloadManager(org.commonjava.indy.core.content.DefaultDownloadManager) MimeTyper(org.commonjava.indy.util.MimeTyper) SpecialPathManagerImpl(org.commonjava.maven.galley.io.SpecialPathManagerImpl) PoolWeftExecutorService(org.commonjava.cdi.util.weft.PoolWeftExecutorService) WeftExecutorService(org.commonjava.cdi.util.weft.WeftExecutorService) DefaultDirectContentAccess(org.commonjava.indy.core.content.DefaultDirectContentAccess) DirectContentAccess(org.commonjava.indy.content.DirectContentAccess) IndyObjectMapper(org.commonjava.indy.model.core.io.IndyObjectMapper) MemoryStoreDataManager(org.commonjava.indy.mem.data.MemoryStoreDataManager) CacheHandle(org.commonjava.indy.subsys.infinispan.CacheHandle) TemplatingEngine(org.commonjava.indy.subsys.template.TemplatingEngine) DataFileManager(org.commonjava.indy.subsys.datafile.DataFileManager) MemoryStoreDataManager(org.commonjava.indy.mem.data.MemoryStoreDataManager) StoreDataManager(org.commonjava.indy.data.StoreDataManager) DefaultDownloadManager(org.commonjava.indy.core.content.DefaultDownloadManager) ContentGeneratorManager(org.commonjava.indy.core.content.ContentGeneratorManager) DefaultDirectContentAccess(org.commonjava.indy.core.content.DefaultDirectContentAccess) Before(org.junit.Before)

Aggregations

PoolWeftExecutorService (org.commonjava.cdi.util.weft.PoolWeftExecutorService)8 WeftExecutorService (org.commonjava.cdi.util.weft.WeftExecutorService)8 MemoryStoreDataManager (org.commonjava.indy.mem.data.MemoryStoreDataManager)8 DefaultDownloadManager (org.commonjava.indy.core.content.DefaultDownloadManager)7 Before (org.junit.Before)7 IndyLocationExpander (org.commonjava.indy.content.IndyLocationExpander)6 DefaultDirectContentAccess (org.commonjava.indy.core.content.DefaultDirectContentAccess)6 MemoryNotFoundCache (org.commonjava.maven.galley.nfc.MemoryNotFoundCache)6 DefaultIndyConfiguration (org.commonjava.indy.conf.DefaultIndyConfiguration)5 DirectContentAccess (org.commonjava.indy.content.DirectContentAccess)5 DownloadManager (org.commonjava.indy.content.DownloadManager)5 ExpiringMemoryNotFoundCache (org.commonjava.indy.core.inject.ExpiringMemoryNotFoundCache)5 IndyObjectMapper (org.commonjava.indy.model.core.io.IndyObjectMapper)5 SpecialPathManagerImpl (org.commonjava.maven.galley.io.SpecialPathManagerImpl)5 ContentDigester (org.commonjava.indy.content.ContentDigester)4 DefaultContentDigester (org.commonjava.indy.core.content.DefaultContentDigester)4 ContentGeneratorManager (org.commonjava.indy.core.content.ContentGeneratorManager)3 DefaultContentManager (org.commonjava.indy.core.content.DefaultContentManager)3 DataFileManager (org.commonjava.indy.subsys.datafile.DataFileManager)3 DataFileEventManager (org.commonjava.indy.subsys.datafile.change.DataFileEventManager)3