use of org.commonjava.indy.mem.data.MemoryStoreDataManager 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));
}
use of org.commonjava.indy.mem.data.MemoryStoreDataManager in project indy by Commonjava.
the class MavenMetadataGeneratorTest method setup.
@Before
public void setup() throws Exception {
stores = new MemoryStoreDataManager(true);
final LocationExpander locations = new IndyLocationExpander(stores);
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 DownloadManager downloads = new DefaultDownloadManager(stores, fixture.getTransferManager(), locations, null, nfc, rescanService);
final XMLInfrastructure xml = new XMLInfrastructure();
final TypeMapper types = new StandardTypeMapper();
final MavenMetadataMerger merger = new MavenMetadataMerger();
final GroupMergeHelper helper = new GroupMergeHelper(downloads);
WeftExecutorService contentAccessService = new PoolWeftExecutorService("test-content-access-executor", (ThreadPoolExecutor) Executors.newCachedThreadPool(), 2, 10f, false, null, null);
DefaultDirectContentAccess contentAccess = new DefaultDirectContentAccess(downloads, contentAccessService);
WeftExecutorService mdService = new PoolWeftExecutorService("test-md-executor", (ThreadPoolExecutor) Executors.newCachedThreadPool(), 2, 10f, false, null, null);
generator = new MavenMetadataGenerator(contentAccess, stores, xml, types, merger, helper, new MemoryNotFoundCache(), mdService);
metadataReader = new MavenMetadataReader(xml, locations, fixture.getArtifactMetadataManager(), fixture.getXPathManager());
}
use of org.commonjava.indy.mem.data.MemoryStoreDataManager 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();
}
}
use of org.commonjava.indy.mem.data.MemoryStoreDataManager 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.mem.data.MemoryStoreDataManager 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));
}
Aggregations