Search in sources :

Example 1 with PromotionValidationTools

use of org.commonjava.indy.promote.validate.PromotionValidationTools 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)

Aggregations

File (java.io.File)1 Locker (org.commonjava.cdi.util.weft.Locker)1 PoolWeftExecutorService (org.commonjava.cdi.util.weft.PoolWeftExecutorService)1 WeftExecutorService (org.commonjava.cdi.util.weft.WeftExecutorService)1 DefaultIndyConfiguration (org.commonjava.indy.conf.DefaultIndyConfiguration)1 ContentDigester (org.commonjava.indy.content.ContentDigester)1 DirectContentAccess (org.commonjava.indy.content.DirectContentAccess)1 IndyLocationExpander (org.commonjava.indy.content.IndyLocationExpander)1 ContentGeneratorManager (org.commonjava.indy.core.content.ContentGeneratorManager)1 DefaultContentDigester (org.commonjava.indy.core.content.DefaultContentDigester)1 DefaultContentManager (org.commonjava.indy.core.content.DefaultContentManager)1 DefaultDirectContentAccess (org.commonjava.indy.core.content.DefaultDirectContentAccess)1 DefaultDownloadManager (org.commonjava.indy.core.content.DefaultDownloadManager)1 ExpiringMemoryNotFoundCache (org.commonjava.indy.core.inject.ExpiringMemoryNotFoundCache)1 MemoryStoreDataManager (org.commonjava.indy.mem.data.MemoryStoreDataManager)1 IndyObjectMapper (org.commonjava.indy.model.core.io.IndyObjectMapper)1 PromoteConfig (org.commonjava.indy.promote.conf.PromoteConfig)1 PromoteDataFileManager (org.commonjava.indy.promote.conf.PromoteDataFileManager)1 PromoteValidationsManager (org.commonjava.indy.promote.validate.PromoteValidationsManager)1 PromotionValidationTools (org.commonjava.indy.promote.validate.PromotionValidationTools)1