Search in sources :

Example 1 with TemplatingEngine

use of org.commonjava.indy.subsys.template.TemplatingEngine in project indy by Commonjava.

the class SetBackSettingsManagerTest method setup.

@Before
public void setup() throws Exception {
    storeManager = new MemoryStoreDataManager(true);
    final File dataSrc = new File("./src/main/data");
    final File data = temp.newFolder("data");
    FileUtils.copyDirectory(dataSrc, data);
    final DataFileConfiguration config = new DataFileConfiguration(data, temp.newFolder("work"));
    final DataFileManager fileManager = new DataFileManager(config, new DataFileEventManager());
    final TemplatingEngine templates = new TemplatingEngine(new GStringTemplateEngine(), fileManager);
    manager = new SetBackSettingsManager(storeManager, templates, fileManager, new SetbackConfig(true));
}
Also used : MemoryStoreDataManager(org.commonjava.indy.mem.data.MemoryStoreDataManager) DataFileEventManager(org.commonjava.indy.subsys.datafile.change.DataFileEventManager) DataFileManager(org.commonjava.indy.subsys.datafile.DataFileManager) TemplatingEngine(org.commonjava.indy.subsys.template.TemplatingEngine) DataFileConfiguration(org.commonjava.indy.subsys.datafile.conf.DataFileConfiguration) GStringTemplateEngine(groovy.text.GStringTemplateEngine) SetbackConfig(org.commonjava.indy.setback.conf.SetbackConfig) DataFile(org.commonjava.indy.subsys.datafile.DataFile) File(java.io.File) Before(org.junit.Before)

Example 2 with TemplatingEngine

use of org.commonjava.indy.subsys.template.TemplatingEngine 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();
}
Also used : PoolWeftExecutorService(org.commonjava.cdi.util.weft.PoolWeftExecutorService) DefaultContentManager(org.commonjava.indy.core.content.DefaultContentManager) SpanFieldsDecorator(org.commonjava.o11yphant.trace.SpanFieldsDecorator) DownloadManager(org.commonjava.indy.content.DownloadManager) DefaultDownloadManager(org.commonjava.indy.core.content.DefaultDownloadManager) TraceManager(org.commonjava.o11yphant.trace.TraceManager) HttpImpl(org.commonjava.maven.galley.transport.htcli.HttpImpl) SpecialPathManagerImpl(org.commonjava.maven.galley.io.SpecialPathManagerImpl) HttproxConfig(org.commonjava.indy.httprox.conf.HttproxConfig) DirectContentAccess(org.commonjava.indy.content.DirectContentAccess) DefaultDirectContentAccess(org.commonjava.indy.core.content.DefaultDirectContentAccess) IndyObjectMapper(org.commonjava.indy.model.core.io.IndyObjectMapper) MemoryStoreDataManager(org.commonjava.indy.mem.data.MemoryStoreDataManager) KeycloakProxyAuthenticator(org.commonjava.indy.httprox.keycloak.KeycloakProxyAuthenticator) OtelTracePlugin(org.commonjava.o11yphant.otel.OtelTracePlugin) ProxyTransfersExecutor(org.commonjava.indy.httprox.handler.ProxyTransfersExecutor) DefaultDownloadManager(org.commonjava.indy.core.content.DefaultDownloadManager) DefaultIndyConfiguration(org.commonjava.indy.conf.DefaultIndyConfiguration) ContentDigester(org.commonjava.indy.content.ContentDigester) DefaultContentDigester(org.commonjava.indy.core.content.DefaultContentDigester) TransportManagerImpl(org.commonjava.maven.galley.transport.TransportManagerImpl) DefaultContentDigester(org.commonjava.indy.core.content.DefaultContentDigester) ContentController(org.commonjava.indy.core.ctl.ContentController) DataFileEventManager(org.commonjava.indy.subsys.datafile.change.DataFileEventManager) DefaultContentManager(org.commonjava.indy.core.content.DefaultContentManager) ContentManager(org.commonjava.indy.content.ContentManager) ExpiringMemoryNotFoundCache(org.commonjava.indy.core.inject.ExpiringMemoryNotFoundCache) MemoryNotFoundCache(org.commonjava.maven.galley.nfc.MemoryNotFoundCache) ExpiringMemoryNotFoundCache(org.commonjava.indy.core.inject.ExpiringMemoryNotFoundCache) GStringTemplateEngine(groovy.text.GStringTemplateEngine) MemoryPasswordManager(org.commonjava.maven.galley.auth.MemoryPasswordManager) BootOptions(org.commonjava.propulsor.boot.BootOptions) MimeTyper(org.commonjava.indy.util.MimeTyper) ScriptEngine(org.commonjava.indy.subsys.template.ScriptEngine) WeftExecutorService(org.commonjava.cdi.util.weft.WeftExecutorService) PoolWeftExecutorService(org.commonjava.cdi.util.weft.PoolWeftExecutorService) CacheProducer(org.commonjava.indy.subsys.infinispan.CacheProducer) HttpClientTransport(org.commonjava.maven.galley.transport.htcli.HttpClientTransport) MDCManager(org.commonjava.indy.bind.jaxrs.MDCManager) DataFileManager(org.commonjava.indy.subsys.datafile.DataFileManager) TemplatingEngine(org.commonjava.indy.subsys.template.TemplatingEngine) MockContentAdvisor(org.commonjava.indy.test.fixture.core.MockContentAdvisor) IndyTraceConfiguration(org.commonjava.indy.subsys.honeycomb.config.IndyTraceConfiguration) TransportManager(org.commonjava.maven.galley.spi.transport.TransportManager) ContentGeneratorManager(org.commonjava.indy.core.content.ContentGeneratorManager) ProxyAcceptHandler(org.commonjava.indy.httprox.handler.ProxyAcceptHandler) DefaultDirectContentAccess(org.commonjava.indy.core.content.DefaultDirectContentAccess) KeycloakConfig(org.commonjava.indy.subsys.keycloak.conf.KeycloakConfig) Before(org.junit.Before)

Example 3 with TemplatingEngine

use of org.commonjava.indy.subsys.template.TemplatingEngine 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

GStringTemplateEngine (groovy.text.GStringTemplateEngine)3 MemoryStoreDataManager (org.commonjava.indy.mem.data.MemoryStoreDataManager)3 DataFileManager (org.commonjava.indy.subsys.datafile.DataFileManager)3 DataFileEventManager (org.commonjava.indy.subsys.datafile.change.DataFileEventManager)3 TemplatingEngine (org.commonjava.indy.subsys.template.TemplatingEngine)3 Before (org.junit.Before)3 PoolWeftExecutorService (org.commonjava.cdi.util.weft.PoolWeftExecutorService)2 WeftExecutorService (org.commonjava.cdi.util.weft.WeftExecutorService)2 ContentManager (org.commonjava.indy.content.ContentManager)2 DirectContentAccess (org.commonjava.indy.content.DirectContentAccess)2 DownloadManager (org.commonjava.indy.content.DownloadManager)2 ContentGeneratorManager (org.commonjava.indy.core.content.ContentGeneratorManager)2 DefaultContentDigester (org.commonjava.indy.core.content.DefaultContentDigester)2 DefaultContentManager (org.commonjava.indy.core.content.DefaultContentManager)2 DefaultDirectContentAccess (org.commonjava.indy.core.content.DefaultDirectContentAccess)2 DefaultDownloadManager (org.commonjava.indy.core.content.DefaultDownloadManager)2 IndyObjectMapper (org.commonjava.indy.model.core.io.IndyObjectMapper)2 MimeTyper (org.commonjava.indy.util.MimeTyper)2 SpecialPathManagerImpl (org.commonjava.maven.galley.io.SpecialPathManagerImpl)2 MemoryNotFoundCache (org.commonjava.maven.galley.nfc.MemoryNotFoundCache)2