use of org.commonjava.maven.galley.transport.htcli.HttpImpl in project galley by Commonjava.
the class DownloadHandlerConcurrencyTest method before.
@Before
public void before() throws IOException {
executor = Executors.newCachedThreadPool();
cacheProvider = new FileCacheProvider(temp.newFolder(), new HashedLocationPathGenerator(), new NoOpFileEventManager(), new NoOpTransferDecorator(), false);
transport = new HttpClientTransport(new HttpImpl(new MemoryPasswordManager()), new ObjectMapper(), new GlobalHttpConfiguration());
}
use of org.commonjava.maven.galley.transport.htcli.HttpImpl in project pom-manipulation-ext by release-engineering.
the class GalleyInfrastructure method init.
private void init(final File targetDirectory, final List<ArtifactRepository> remoteRepositories, final ArtifactRepository localRepository, final Settings settings, final List<String> activeProfiles, final Location customLocation, final Transport customTransport, File cacheDir_) throws ManipulationException {
LocationExpander locationExpander;
try {
final List<Location> custom = customLocation == null ? Collections.<Location>emptyList() : Collections.singletonList(customLocation);
locationExpander = new MavenLocationExpander(custom, remoteRepositories, localRepository, mirrorSelector, settings, activeProfiles);
} catch (final MalformedURLException e) {
throw new ManipulationException("Failed to setup Maven-specific LocationExpander: %s", e, e.getMessage());
}
xml = new XMLInfrastructure();
xpaths = new XPathManager();
final TransportManager transports;
if (customTransport != null) {
transports = new TransportManagerImpl(customTransport);
} else {
transports = new TransportManagerImpl(new HttpClientTransport(new HttpImpl(new MemoryPasswordManager())), new FileTransport(), new ZipJarTransport());
}
cacheDir = cacheDir_;
if (cacheDir == null) {
cacheDir = new File(targetDirectory, "manipulator-cache");
}
final FileEventManager fileEvents = new NoOpFileEventManager();
final CacheProvider cache = new FileCacheProvider(cacheDir, new HashedLocationPathGenerator(), fileEvents, new NoOpTransferDecorator());
final NotFoundCache nfc = new MemoryNotFoundCache();
executor = Executors.newCachedThreadPool();
final TransportManagerConfig config = new TransportManagerConfig();
final TransferManager transfers = new TransferManagerImpl(transports, cache, nfc, fileEvents, new DownloadHandler(nfc, config, executor), new UploadHandler(nfc, config, executor), new ListingHandler(nfc), new ExistenceHandler(nfc), new SpecialPathManagerImpl(), executor);
final TypeMapper types = new StandardTypeMapper();
final ArtifactMetadataManager metadataManager = new ArtifactMetadataManagerImpl(transfers, locationExpander);
final VersionResolver versionResolver = new VersionResolverImpl(new MavenMetadataReader(xml, locationExpander, metadataManager, xpaths));
artifactManager = new ArtifactManagerImpl(transfers, locationExpander, types, versionResolver);
// TODO: auto-adjust this to the current Maven runtime!
final MavenPluginDefaults pluginDefaults = new StandardMaven304PluginDefaults();
final MavenPluginImplications pluginImplications = new StandardMavenPluginImplications(xml);
pomReader = new MavenPomReader(xml, locationExpander, artifactManager, xpaths, pluginDefaults, pluginImplications);
metadataReader = new MavenMetadataReader(xml, locationExpander, metadataManager, xpaths);
}
use of org.commonjava.maven.galley.transport.htcli.HttpImpl 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.maven.galley.transport.htcli.HttpImpl 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());
}
use of org.commonjava.maven.galley.transport.htcli.HttpImpl in project galley by Commonjava.
the class EmbeddableCDIProducer method postConstruct.
@PostConstruct
public void postConstruct() {
fileEventManager = new NoOpFileEventManager();
transferDecorator = new NoOpTransferDecorator();
pathGenerator = new HashedLocationPathGenerator();
nfc = new MemoryNotFoundCache();
// locationExpander = new NoOpLocationExpander();
// locationResolver = new SimpleUrlLocationResolver( locationExpander, transportManager );
transportManagerConfig = new TransportManagerConfig();
passwordManager = new MemoryPasswordManager();
http = new HttpImpl(passwordManager);
objectMapper = new ObjectMapper();
objectMapper.registerModules(new ProjectVersionRefSerializerModule());
pluginDefaults = new StandardMaven350PluginDefaults();
pluginImplications = new StandardMavenPluginImplications(xml);
}
Aggregations