Search in sources :

Example 1 with FileCacheProvider

use of org.commonjava.maven.galley.cache.FileCacheProvider in project galley by Commonjava.

the class GalleyMavenFixture method before.

@Override
public void before() throws Throwable {
    if (autoInit) {
        if (maven == null) {
            initMissingComponents();
            if (mavenBuilder.getCacheProviderFactory() == null && mavenBuilder.getCache() == null && temp != null && cacheDir == null) {
                cacheDir = temp.newFolder("cache");
            }
            mavenBuilder.withCache(new FileCacheProvider(cacheDir, mavenBuilder.getPathGenerator(), mavenBuilder.getFileEvents(), mavenBuilder.getTransferDecorator()));
            maven = mavenBuilder.build();
        }
    }
    super.before();
}
Also used : FileCacheProvider(org.commonjava.maven.galley.cache.FileCacheProvider)

Example 2 with FileCacheProvider

use of org.commonjava.maven.galley.cache.FileCacheProvider in project indy by Commonjava.

the class TestProvider method setup.

//    private Http http;
//
//    private IndyLocationExpander locationExpander;
//
//    private IndyLocationResolver locationResolver;
@PostConstruct
public void setup() {
    storeDataManager = new MemoryStoreDataManager(true);
    nfc = new MemoryNotFoundCache();
    objectMapper = new IndyObjectMapper(false);
    fileEventManager = new NoOpFileEventManager();
    transferDecorator = new NoOpTransferDecorator();
    transportManagerConfig = new TransportManagerConfig();
    temp = new TemporaryFolder();
    try {
        temp.create();
        cacheProvider = new FileCacheProvider(temp.newFolder("storage"), indyPathGenerator, fileEventManager, transferDecorator);
    } catch (IOException e) {
        fail("Cannot initialize temporary directory structure");
        temp.delete();
    }
}
Also used : FileCacheProvider(org.commonjava.maven.galley.cache.FileCacheProvider) NoOpFileEventManager(org.commonjava.maven.galley.event.NoOpFileEventManager) NoOpTransferDecorator(org.commonjava.maven.galley.io.NoOpTransferDecorator) IndyObjectMapper(org.commonjava.indy.model.core.io.IndyObjectMapper) MemoryStoreDataManager(org.commonjava.indy.mem.data.MemoryStoreDataManager) TemporaryFolder(org.junit.rules.TemporaryFolder) TransportManagerConfig(org.commonjava.maven.galley.config.TransportManagerConfig) MemoryNotFoundCache(org.commonjava.maven.galley.nfc.MemoryNotFoundCache) IOException(java.io.IOException) PostConstruct(javax.annotation.PostConstruct)

Example 3 with FileCacheProvider

use of org.commonjava.maven.galley.cache.FileCacheProvider in project galley by Commonjava.

the class TransferManagerImplTest method setup.

@Before
public void setup() {
    transport = new TestTransport();
    transportMgr = new TransportManagerImpl(transport);
    cacheProvider = new FileCacheProvider(temp.newFolder("cache"), new HashedLocationPathGenerator(), new NoOpFileEventManager(), new NoOpTransferDecorator(), true);
    nfc = new MemoryNotFoundCache();
    fileEvents = new NoOpFileEventManager();
    executor = Executors.newSingleThreadExecutor();
    TransportManagerConfig transportManagerConfig = new TransportManagerConfig();
    final DownloadHandler dh = new DownloadHandler(nfc, transportManagerConfig, executor);
    final UploadHandler uh = new UploadHandler(nfc, transportManagerConfig, executor);
    final ListingHandler lh = new ListingHandler(nfc);
    final ExistenceHandler eh = new ExistenceHandler(nfc);
    mgr = new TransferManagerImpl(transportMgr, cacheProvider, nfc, fileEvents, dh, uh, lh, eh, new SpecialPathManagerImpl(), Executors.newFixedThreadPool(2));
}
Also used : FileCacheProvider(org.commonjava.maven.galley.cache.FileCacheProvider) ListingHandler(org.commonjava.maven.galley.internal.xfer.ListingHandler) NoOpTransferDecorator(org.commonjava.maven.galley.io.NoOpTransferDecorator) TransferManagerImpl(org.commonjava.maven.galley.internal.TransferManagerImpl) TransportManagerImpl(org.commonjava.maven.galley.transport.TransportManagerImpl) HashedLocationPathGenerator(org.commonjava.maven.galley.io.HashedLocationPathGenerator) DownloadHandler(org.commonjava.maven.galley.internal.xfer.DownloadHandler) TransportManagerConfig(org.commonjava.maven.galley.config.TransportManagerConfig) MemoryNotFoundCache(org.commonjava.maven.galley.nfc.MemoryNotFoundCache) SpecialPathManagerImpl(org.commonjava.maven.galley.io.SpecialPathManagerImpl) NoOpFileEventManager(org.commonjava.maven.galley.event.NoOpFileEventManager) TestTransport(org.commonjava.maven.galley.testing.core.transport.TestTransport) UploadHandler(org.commonjava.maven.galley.internal.xfer.UploadHandler) ExistenceHandler(org.commonjava.maven.galley.internal.xfer.ExistenceHandler) Before(org.junit.Before)

Example 4 with FileCacheProvider

use of org.commonjava.maven.galley.cache.FileCacheProvider in project galley by Commonjava.

the class CoreFixture method initMissingComponents.

public void initMissingComponents() throws Exception {
    if (coreBuilder == null) {
        initGalley();
    }
    final List<Transport> transports = coreBuilder.getEnabledTransports();
    if (transports == null || transports.isEmpty()) {
        System.out.println("Initializing test transport implicitly");
        initTestTransport();
    }
    coreBuilder.initMissingComponents();
    if (temp != null && cacheDir == null) {
        cacheDir = temp.newFolder("cache");
    }
    Logger logger = LoggerFactory.getLogger(getClass());
    logger.debug("Initializing FileCacheProvider with:\n  Cache directory: {}\n  PathGenerator: {}\n  FileEventManager: {}\n  TransferDecorator: {}", cacheDir, coreBuilder.getPathGenerator(), coreBuilder.getFileEvents(), coreBuilder.getTransferDecorator());
    coreBuilder.withCache(new FileCacheProvider(cacheDir, coreBuilder.getPathGenerator(), coreBuilder.getFileEvents(), coreBuilder.getTransferDecorator()));
}
Also used : FileCacheProvider(org.commonjava.maven.galley.cache.FileCacheProvider) Transport(org.commonjava.maven.galley.spi.transport.Transport) TestTransport(org.commonjava.maven.galley.testing.core.transport.TestTransport) Logger(org.slf4j.Logger)

Example 5 with FileCacheProvider

use of org.commonjava.maven.galley.cache.FileCacheProvider in project indy by Commonjava.

the class AutoProxDataManagerDecoratorTest method setup.

@Before
public final void setup() throws Exception {
    rootDir = temp.newFolder("indy.root");
    autoproxDataDir = new File(rootDir, "data/autoprox");
    autoproxDataDir.mkdirs();
    File cacheDir = temp.newFolder();
    FileCacheProvider cache = new FileCacheProvider(cacheDir, new HashedLocationPathGenerator(), new NoOpFileEventManager(), new NoOpTransferDecorator());
    galley = new GalleyMavenBuilder(cache).withEnabledTransports(new HttpClientTransport(new HttpImpl(new MemoryPasswordManager()))).build();
    final DataFileManager dataFiles = new DataFileManager(rootDir, new DataFileEventManager());
    ruleParser = new ScriptRuleParser(new ScriptEngine(dataFiles));
    final AutoProxConfig indyConfig = new AutoProxConfig(autoproxDataDir.getName(), true);
    catalog = new AutoProxCatalogManager(dataFiles, indyConfig, ruleParser);
    storeDataManager = new TestAutoProxyDataManager(catalog, galley.getTransferManager());
    storeDataManager.install();
    storeDataManager.clear(summary);
    storeQuery = storeDataManager.query().packageType(MAVEN_PKG_KEY);
    System.setProperty("baseUrl", http.getBaseUri());
}
Also used : FileCacheProvider(org.commonjava.maven.galley.cache.FileCacheProvider) NoOpTransferDecorator(org.commonjava.maven.galley.io.NoOpTransferDecorator) HashedLocationPathGenerator(org.commonjava.maven.galley.io.HashedLocationPathGenerator) AutoProxConfig(org.commonjava.indy.autoprox.conf.AutoProxConfig) DataFileEventManager(org.commonjava.indy.subsys.datafile.change.DataFileEventManager) MemoryPasswordManager(org.commonjava.maven.galley.auth.MemoryPasswordManager) HttpImpl(org.commonjava.maven.galley.transport.htcli.HttpImpl) ScriptEngine(org.commonjava.indy.subsys.template.ScriptEngine) NoOpFileEventManager(org.commonjava.maven.galley.event.NoOpFileEventManager) GalleyMavenBuilder(org.commonjava.maven.galley.maven.GalleyMavenBuilder) HttpClientTransport(org.commonjava.maven.galley.transport.htcli.HttpClientTransport) ScriptRuleParser(org.commonjava.indy.autoprox.util.ScriptRuleParser) DataFileManager(org.commonjava.indy.subsys.datafile.DataFileManager) TestAutoProxyDataManager(org.commonjava.indy.autoprox.fixture.TestAutoProxyDataManager) File(java.io.File) Before(org.junit.Before)

Aggregations

FileCacheProvider (org.commonjava.maven.galley.cache.FileCacheProvider)5 NoOpFileEventManager (org.commonjava.maven.galley.event.NoOpFileEventManager)3 NoOpTransferDecorator (org.commonjava.maven.galley.io.NoOpTransferDecorator)3 TransportManagerConfig (org.commonjava.maven.galley.config.TransportManagerConfig)2 HashedLocationPathGenerator (org.commonjava.maven.galley.io.HashedLocationPathGenerator)2 MemoryNotFoundCache (org.commonjava.maven.galley.nfc.MemoryNotFoundCache)2 TestTransport (org.commonjava.maven.galley.testing.core.transport.TestTransport)2 Before (org.junit.Before)2 File (java.io.File)1 IOException (java.io.IOException)1 PostConstruct (javax.annotation.PostConstruct)1 AutoProxConfig (org.commonjava.indy.autoprox.conf.AutoProxConfig)1 TestAutoProxyDataManager (org.commonjava.indy.autoprox.fixture.TestAutoProxyDataManager)1 ScriptRuleParser (org.commonjava.indy.autoprox.util.ScriptRuleParser)1 MemoryStoreDataManager (org.commonjava.indy.mem.data.MemoryStoreDataManager)1 IndyObjectMapper (org.commonjava.indy.model.core.io.IndyObjectMapper)1 DataFileManager (org.commonjava.indy.subsys.datafile.DataFileManager)1 DataFileEventManager (org.commonjava.indy.subsys.datafile.change.DataFileEventManager)1 ScriptEngine (org.commonjava.indy.subsys.template.ScriptEngine)1 MemoryPasswordManager (org.commonjava.maven.galley.auth.MemoryPasswordManager)1