Search in sources :

Example 11 with MemoryNotFoundCache

use of org.commonjava.maven.galley.nfc.MemoryNotFoundCache in project galley by Commonjava.

the class EmbeddableCDIProducer method postConstruct.

@PostConstruct
public void postConstruct() {
    fileEventManager = new NoOpFileEventManager();
    transferDecorator = new NoOpTransferDecorator();
    pathGenerator = new HashedLocationPathGenerator();
    nfc = new MemoryNotFoundCache();
    // locationExpander = new NoOpLocationExpander();
    // locationResolver = new SimpleUrlLocationResolver( locationExpander, transportManager );
    transportManagerConfig = new TransportManagerConfig();
    passwordManager = new MemoryPasswordManager();
    http = new HttpImpl(passwordManager);
    objectMapper = new ObjectMapper();
    objectMapper.registerModules(new ProjectVersionRefSerializerModule());
    pluginDefaults = new StandardMaven350PluginDefaults();
    pluginImplications = new StandardMavenPluginImplications(xml);
}
Also used : NoOpFileEventManager(org.commonjava.maven.galley.event.NoOpFileEventManager) NoOpTransferDecorator(org.commonjava.maven.galley.io.NoOpTransferDecorator) HashedLocationPathGenerator(org.commonjava.maven.galley.io.HashedLocationPathGenerator) TransportManagerConfig(org.commonjava.maven.galley.config.TransportManagerConfig) MemoryNotFoundCache(org.commonjava.maven.galley.nfc.MemoryNotFoundCache) MemoryPasswordManager(org.commonjava.maven.galley.auth.MemoryPasswordManager) StandardMavenPluginImplications(org.commonjava.maven.galley.maven.internal.defaults.StandardMavenPluginImplications) HttpImpl(org.commonjava.maven.galley.transport.htcli.HttpImpl) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) ProjectVersionRefSerializerModule(org.commonjava.maven.atlas.ident.jackson.ProjectVersionRefSerializerModule) StandardMaven350PluginDefaults(org.commonjava.maven.galley.maven.internal.defaults.StandardMaven350PluginDefaults) PostConstruct(javax.annotation.PostConstruct)

Example 12 with MemoryNotFoundCache

use of org.commonjava.maven.galley.nfc.MemoryNotFoundCache in project indy by Commonjava.

the class PromotionManagerTest method setup.

@Before
public void setup() throws Exception {
    contentMetadata.clear();
    galleyParts = new GalleyMavenFixture(true, temp);
    galleyParts.initMissingComponents();
    storeManager = new MemoryStoreDataManager(true);
    final DefaultIndyConfiguration indyConfig = new DefaultIndyConfiguration();
    indyConfig.setNotFoundCacheTimeoutSeconds(1);
    final ExpiringMemoryNotFoundCache nfc = new ExpiringMemoryNotFoundCache(indyConfig);
    WeftExecutorService rescanService = new PoolWeftExecutorService("test-rescan-executor", (ThreadPoolExecutor) Executors.newCachedThreadPool(), 2, 10f, false, null, null);
    downloadManager = new DefaultDownloadManager(storeManager, galleyParts.getTransferManager(), new IndyLocationExpander(storeManager), new MockInstance<>(new MockContentAdvisor()), 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<>("content-metadata", contentMetadata));
    specialPathManager = new SpecialPathManagerImpl();
    contentManager = new DefaultContentManager(storeManager, downloadManager, new IndyObjectMapper(true), specialPathManager, new MemoryNotFoundCache(), contentDigester, new ContentGeneratorManager());
    File tempData = temp.newFolder("data");
    promoteDataManager = new PromoteDataFileManager(temp.newFolder("data", "promote"), new DataFileEventManager());
    validationsManager = new PromoteValidationsManager(promoteDataManager, new PromoteConfig(), new ValidationRuleParser(new ScriptEngine(new DataFileManager(tempData, new DataFileEventManager())), new IndyObjectMapper(true)));
    WeftExecutorService validateService = new PoolWeftExecutorService("test-validate-executor", (ThreadPoolExecutor) Executors.newCachedThreadPool(), 2, 10f, false, null, null);
    MavenModelProcessor modelProcessor = new MavenModelProcessor();
    PromoteConfig config = new PromoteConfig();
    validator = new PromotionValidator(validationsManager, new PromotionValidationTools(contentManager, storeManager, galleyParts.getPomReader(), galleyParts.getMavenMetadataReader(), modelProcessor, galleyParts.getTypeMapper(), galleyParts.getTransferManager(), contentDigester, null, config), storeManager, downloadManager, validateService, null);
    WeftExecutorService svc = new PoolWeftExecutorService("test-executor", (ThreadPoolExecutor) Executors.newCachedThreadPool(), 2, 10f, false, null, null);
    manager = new PromotionManager(validator, contentManager, downloadManager, storeManager, new Locker<>(), config, nfc, svc, svc, specialPathManager);
    executor = Executors.newCachedThreadPool();
}
Also used : PoolWeftExecutorService(org.commonjava.cdi.util.weft.PoolWeftExecutorService) PromoteDataFileManager(org.commonjava.indy.promote.conf.PromoteDataFileManager) Locker(org.commonjava.cdi.util.weft.Locker) ValidationRuleParser(org.commonjava.indy.promote.validate.ValidationRuleParser) GalleyMavenFixture(org.commonjava.maven.galley.testing.maven.GalleyMavenFixture) DefaultContentManager(org.commonjava.indy.core.content.DefaultContentManager) MavenModelProcessor(org.commonjava.maven.galley.maven.rel.MavenModelProcessor) SpecialPathManagerImpl(org.commonjava.maven.galley.io.SpecialPathManagerImpl) DirectContentAccess(org.commonjava.indy.content.DirectContentAccess) DefaultDirectContentAccess(org.commonjava.indy.core.content.DefaultDirectContentAccess) MockInstance(org.commonjava.indy.test.fixture.core.MockInstance) IndyObjectMapper(org.commonjava.indy.model.core.io.IndyObjectMapper) MemoryStoreDataManager(org.commonjava.indy.mem.data.MemoryStoreDataManager) IndyLocationExpander(org.commonjava.indy.content.IndyLocationExpander) DefaultDownloadManager(org.commonjava.indy.core.content.DefaultDownloadManager) DefaultIndyConfiguration(org.commonjava.indy.conf.DefaultIndyConfiguration) PromotionValidator(org.commonjava.indy.promote.validate.PromotionValidator) ContentDigester(org.commonjava.indy.content.ContentDigester) DefaultContentDigester(org.commonjava.indy.core.content.DefaultContentDigester) PromotionValidationTools(org.commonjava.indy.promote.validate.PromotionValidationTools) DefaultContentDigester(org.commonjava.indy.core.content.DefaultContentDigester) DataFileEventManager(org.commonjava.indy.subsys.datafile.change.DataFileEventManager) PromoteConfig(org.commonjava.indy.promote.conf.PromoteConfig) ExpiringMemoryNotFoundCache(org.commonjava.indy.core.inject.ExpiringMemoryNotFoundCache) MemoryNotFoundCache(org.commonjava.maven.galley.nfc.MemoryNotFoundCache) ExpiringMemoryNotFoundCache(org.commonjava.indy.core.inject.ExpiringMemoryNotFoundCache) ScriptEngine(org.commonjava.indy.subsys.template.ScriptEngine) WeftExecutorService(org.commonjava.cdi.util.weft.WeftExecutorService) PoolWeftExecutorService(org.commonjava.cdi.util.weft.PoolWeftExecutorService) PromoteValidationsManager(org.commonjava.indy.promote.validate.PromoteValidationsManager) PromoteDataFileManager(org.commonjava.indy.promote.conf.PromoteDataFileManager) DataFileManager(org.commonjava.indy.subsys.datafile.DataFileManager) MockContentAdvisor(org.commonjava.indy.test.fixture.core.MockContentAdvisor) ContentGeneratorManager(org.commonjava.indy.core.content.ContentGeneratorManager) DefaultDirectContentAccess(org.commonjava.indy.core.content.DefaultDirectContentAccess) File(java.io.File) Before(org.junit.Before)

Example 13 with MemoryNotFoundCache

use of org.commonjava.maven.galley.nfc.MemoryNotFoundCache 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 14 with MemoryNotFoundCache

use of org.commonjava.maven.galley.nfc.MemoryNotFoundCache 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

MemoryNotFoundCache (org.commonjava.maven.galley.nfc.MemoryNotFoundCache)14 SpecialPathManagerImpl (org.commonjava.maven.galley.io.SpecialPathManagerImpl)8 MemoryStoreDataManager (org.commonjava.indy.mem.data.MemoryStoreDataManager)7 Before (org.junit.Before)7 PoolWeftExecutorService (org.commonjava.cdi.util.weft.PoolWeftExecutorService)6 WeftExecutorService (org.commonjava.cdi.util.weft.WeftExecutorService)6 DefaultIndyConfiguration (org.commonjava.indy.conf.DefaultIndyConfiguration)6 IndyObjectMapper (org.commonjava.indy.model.core.io.IndyObjectMapper)6 DefaultDirectContentAccess (org.commonjava.indy.core.content.DefaultDirectContentAccess)5 DefaultDownloadManager (org.commonjava.indy.core.content.DefaultDownloadManager)5 ExpiringMemoryNotFoundCache (org.commonjava.indy.core.inject.ExpiringMemoryNotFoundCache)5 TransportManagerConfig (org.commonjava.maven.galley.config.TransportManagerConfig)5 StandardTypeMapper (org.commonjava.maven.galley.maven.internal.type.StandardTypeMapper)5 IOException (java.io.IOException)4 PostConstruct (javax.annotation.PostConstruct)4 DownloadManager (org.commonjava.indy.content.DownloadManager)4 IndyLocationExpander (org.commonjava.indy.content.IndyLocationExpander)4 DataFileManager (org.commonjava.indy.subsys.datafile.DataFileManager)4 NoOpFileEventManager (org.commonjava.maven.galley.event.NoOpFileEventManager)4 NoOpTransferDecorator (org.commonjava.maven.galley.io.NoOpTransferDecorator)4