Search in sources :

Example 6 with MemoryNotFoundCache

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

the class TestProvider method init.

@PostConstruct
public void init() {
    try {
        this.storageProviderConfig = new DefaultStorageProviderConfiguration(TEMP.newFolder("storage"));
        this.dataConfig = new DataFileConfiguration(TEMP.newFolder("data"), TEMP.newFolder("work"));
    } catch (final IOException e) {
        e.printStackTrace();
        Assert.fail("Failed to setup temporary directory structures: " + e.getMessage());
    }
    this.nfc = new MemoryNotFoundCache();
    this.xmlInfra = new XMLInfrastructure();
    this.typeMapper = new StandardTypeMapper();
    this.indyConfig = new DefaultIndyConfiguration();
    this.objectMapper = new IndyObjectMapper(true);
}
Also used : DefaultStorageProviderConfiguration(org.commonjava.indy.filer.def.conf.DefaultStorageProviderConfiguration) IndyObjectMapper(org.commonjava.indy.model.core.io.IndyObjectMapper) DataFileConfiguration(org.commonjava.indy.subsys.datafile.conf.DataFileConfiguration) XMLInfrastructure(org.commonjava.maven.galley.maven.parse.XMLInfrastructure) MemoryNotFoundCache(org.commonjava.maven.galley.nfc.MemoryNotFoundCache) IOException(java.io.IOException) StandardTypeMapper(org.commonjava.maven.galley.maven.internal.type.StandardTypeMapper) DefaultIndyConfiguration(org.commonjava.indy.conf.DefaultIndyConfiguration) PostConstruct(javax.annotation.PostConstruct)

Example 7 with MemoryNotFoundCache

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

the class TestProvider method setup.

@PostConstruct
public void setup() {
    storeDataManager = new MemoryStoreDataManager(true);
    nfc = new MemoryNotFoundCache();
    objectMapper = new IndyObjectMapper(false);
    fileEventManager = new NoOpFileEventManager();
    transferDecorator = new NoOpTransferDecorator();
    transportManagerConfig = new TransportManagerConfig();
    weftConfig = new DefaultWeftConfig();
    globalHttpConfiguration = new GlobalHttpConfiguration();
    userLifecycleManager = new AlternativeUserLifecycleManager();
    temp = new TemporaryFolder();
    try {
        temp.create();
        cacheProvider = new FileCacheProvider(temp.newFolder("storage"), indyPathGenerator, fileEventManager, new TransferDecoratorManager(transferDecorator));
    } catch (IOException e) {
        fail("Cannot initialize temporary directory structure");
        temp.delete();
    }
}
Also used : FileCacheProvider(org.commonjava.maven.galley.cache.FileCacheProvider) NoOpTransferDecorator(org.commonjava.maven.galley.io.NoOpTransferDecorator) DefaultWeftConfig(org.commonjava.cdi.util.weft.config.DefaultWeftConfig) TransportManagerConfig(org.commonjava.maven.galley.config.TransportManagerConfig) MemoryNotFoundCache(org.commonjava.maven.galley.nfc.MemoryNotFoundCache) IOException(java.io.IOException) NoOpFileEventManager(org.commonjava.maven.galley.event.NoOpFileEventManager) AlternativeUserLifecycleManager(org.commonjava.indy.action.fixture.AlternativeUserLifecycleManager) IndyObjectMapper(org.commonjava.indy.model.core.io.IndyObjectMapper) MemoryStoreDataManager(org.commonjava.indy.mem.data.MemoryStoreDataManager) TransferDecoratorManager(org.commonjava.maven.galley.io.TransferDecoratorManager) GlobalHttpConfiguration(org.commonjava.maven.galley.transport.htcli.conf.GlobalHttpConfiguration) TemporaryFolder(org.junit.rules.TemporaryFolder) PostConstruct(javax.annotation.PostConstruct)

Example 8 with MemoryNotFoundCache

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

the class CoreServerProvider method init.

@PostConstruct
public void init() {
    try {
        folder.create();
        this.nfc = new MemoryNotFoundCache();
        this.dataFileManager = new DataFileManager(new DataFileConfiguration(folder.newFolder("indy-data")), dataFileEvents);
        this.storeManager = new DataFileStoreDataManager(dataFileManager, objectMapper, storeDispatch);
        storageConfig.setStorageRootDirectory(folder.newFolder("indy-storage"));
        this.xml = new XMLInfrastructure();
        this.typeMapper = new StandardTypeMapper();
    } catch (IOException e) {
        throw new IllegalStateException("Failed to start core server provider: " + e.getMessage(), e);
    }
}
Also used : DataFileStoreDataManager(org.commonjava.indy.flat.data.DataFileStoreDataManager) DataFileManager(org.commonjava.indy.subsys.datafile.DataFileManager) DataFileConfiguration(org.commonjava.indy.subsys.datafile.conf.DataFileConfiguration) XMLInfrastructure(org.commonjava.maven.galley.maven.parse.XMLInfrastructure) MemoryNotFoundCache(org.commonjava.maven.galley.nfc.MemoryNotFoundCache) IOException(java.io.IOException) StandardTypeMapper(org.commonjava.maven.galley.maven.internal.type.StandardTypeMapper) PostConstruct(javax.annotation.PostConstruct)

Example 9 with MemoryNotFoundCache

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

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

the class PackageMetadataGeneratorTest method setup.

@Before
public void setup() throws Exception {
    stores = new MemoryStoreDataManager(true);
    core = new GalleyCoreBuilder(new FileCacheProviderFactory(temp.newFolder("cache"))).build();
    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);
    final LocationExpander locations = new IndyLocationExpander(stores);
    final PackageMetadataMerger merger = new PackageMetadataMerger();
    final TypeMapper types = new StandardTypeMapper();
    final DownloadManager downloads = new DefaultDownloadManager(stores, core.getTransferManager(), locations, null, nfc, rescanService);
    WeftExecutorService contentAccessService = new PoolWeftExecutorService("test-content-access-executor", (ThreadPoolExecutor) Executors.newCachedThreadPool(), 2, 10f, false, null, null);
    DefaultDirectContentAccess contentAccess = new DefaultDirectContentAccess(downloads, contentAccessService);
    final GroupMergeHelper helper = new GroupMergeHelper(downloads);
    specialPathManager = new SpecialPathManagerImpl();
    fileManager = new DefaultDownloadManager(stores, core.getTransferManager(), core.getLocationExpander(), rescanService);
    generator = new PackageMetadataGenerator(contentAccess, stores, downloads, types, merger, helper, new MemoryNotFoundCache(), new IndyPathGenerator(Collections.singleton(new NPMStoragePathCalculator(specialPathManager))), new NPMStoragePathCalculator(specialPathManager));
}
Also used : StandardTypeMapper(org.commonjava.maven.galley.maven.internal.type.StandardTypeMapper) TypeMapper(org.commonjava.maven.galley.maven.spi.type.TypeMapper) 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) DownloadManager(org.commonjava.indy.content.DownloadManager) DefaultDownloadManager(org.commonjava.indy.core.content.DefaultDownloadManager) 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) MemoryStoreDataManager(org.commonjava.indy.mem.data.MemoryStoreDataManager) IndyPathGenerator(org.commonjava.indy.content.IndyPathGenerator) IndyLocationExpander(org.commonjava.indy.content.IndyLocationExpander) PackageMetadataMerger(org.commonjava.indy.pkg.npm.content.group.PackageMetadataMerger) DefaultDownloadManager(org.commonjava.indy.core.content.DefaultDownloadManager) DefaultDirectContentAccess(org.commonjava.indy.core.content.DefaultDirectContentAccess) DefaultIndyConfiguration(org.commonjava.indy.conf.DefaultIndyConfiguration) StandardTypeMapper(org.commonjava.maven.galley.maven.internal.type.StandardTypeMapper) GroupMergeHelper(org.commonjava.indy.core.content.group.GroupMergeHelper) 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