use of org.commonjava.indy.core.content.ContentGeneratorManager in project indy by Commonjava.
the class HttpProxyTest method setup.
@Before
public void setup() throws Exception {
contentMetadata.clear();
core.initGalley();
final TransportManager transports = new TransportManagerImpl(new HttpClientTransport(new HttpImpl(new MemoryPasswordManager())));
core.withTransportManager(transports);
core.initMissingComponents();
final HttproxConfig config = new HttproxConfig();
config.setEnabled(true);
proxyPort = config.getPort();
final BootOptions bootOpts = new BootOptions();
bootOpts.setBind(HOST);
storeManager = new MemoryStoreDataManager(true);
final IndyObjectMapper mapper = new IndyObjectMapper(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);
final DownloadManager downloadManager = new DefaultDownloadManager(storeManager, core.getTransferManager(), core.getLocationExpander(), 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));
final ContentManager contentManager = new DefaultContentManager(storeManager, downloadManager, mapper, new SpecialPathManagerImpl(), new MemoryNotFoundCache(), contentDigester, new ContentGeneratorManager());
DataFileManager dfm = new DataFileManager(temp.newFolder(), new DataFileEventManager());
final TemplatingEngine templates = new TemplatingEngine(new GStringTemplateEngine(), dfm);
final ContentController contentController = new ContentController(storeManager, contentManager, templates, mapper, new MimeTyper());
KeycloakConfig kcConfig = new KeycloakConfig();
kcConfig.setEnabled(false);
final KeycloakProxyAuthenticator auth = new KeycloakProxyAuthenticator(kcConfig, config);
ScriptEngine scriptEngine = new ScriptEngine(dfm);
WeftExecutorService transferService = new PoolWeftExecutorService("test-mitm-transfers", (ThreadPoolExecutor) Executors.newCachedThreadPool(), 2, 10f, false, null, null);
ProxyTransfersExecutor handler = new ProxyTransfersExecutor(transferService);
IndyTraceConfiguration itc = new IndyTraceConfiguration();
TraceManager tm = new TraceManager(new OtelTracePlugin(itc, itc), new SpanFieldsDecorator(Collections.emptyList()), itc);
proxy = new HttpProxy(config, bootOpts, new ProxyAcceptHandler(config, storeManager, contentController, auth, core.getCache(), scriptEngine, new MDCManager(), null, null, new CacheProducer(null, cacheManager, null), handler, tm));
proxy.start();
}
use of org.commonjava.indy.core.content.ContentGeneratorManager 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();
}
use of org.commonjava.indy.core.content.ContentGeneratorManager 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());
}
Aggregations