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();
}
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();
}
}
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));
}
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()));
}
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());
}
Aggregations