Search in sources :

Example 1 with DownloadManager

use of org.commonjava.indy.content.DownloadManager 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 DownloadManager downloads = new DefaultDownloadManager(stores, fixture.getTransferManager(), locations);
    final XMLInfrastructure xml = new XMLInfrastructure();
    final TypeMapper types = new StandardTypeMapper();
    final MavenMetadataMerger merger = new MavenMetadataMerger(Collections.emptyList());
    final GroupMergeHelper helper = new GroupMergeHelper(downloads);
    DefaultDirectContentAccess contentAccess = new DefaultDirectContentAccess(downloads, Executors.newCachedThreadPool());
    generator = new MavenMetadataGenerator(contentAccess, stores, xml, types, merger, helper, new MemoryNotFoundCache());
    metadataReader = new MavenMetadataReader(xml, locations, fixture.getArtifactMetadataManager(), fixture.getXPathManager());
}
Also used : StandardTypeMapper(org.commonjava.maven.galley.maven.internal.type.StandardTypeMapper) TypeMapper(org.commonjava.maven.galley.maven.spi.type.TypeMapper) MemoryNotFoundCache(org.commonjava.maven.galley.nfc.MemoryNotFoundCache) DownloadManager(org.commonjava.indy.content.DownloadManager) DefaultDownloadManager(org.commonjava.indy.core.content.DefaultDownloadManager) LocationExpander(org.commonjava.maven.galley.spi.transport.LocationExpander) IndyLocationExpander(org.commonjava.indy.content.IndyLocationExpander) MavenMetadataMerger(org.commonjava.indy.pkg.maven.content.group.MavenMetadataMerger) MemoryStoreDataManager(org.commonjava.indy.mem.data.MemoryStoreDataManager) IndyLocationExpander(org.commonjava.indy.content.IndyLocationExpander) XMLInfrastructure(org.commonjava.maven.galley.maven.parse.XMLInfrastructure) DefaultDownloadManager(org.commonjava.indy.core.content.DefaultDownloadManager) MavenMetadataReader(org.commonjava.maven.galley.maven.parse.MavenMetadataReader) DefaultDirectContentAccess(org.commonjava.indy.core.content.DefaultDirectContentAccess) StandardTypeMapper(org.commonjava.maven.galley.maven.internal.type.StandardTypeMapper) GroupMergeHelper(org.commonjava.indy.core.content.group.GroupMergeHelper) Before(org.junit.Before)

Example 2 with DownloadManager

use of org.commonjava.indy.content.DownloadManager 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 DownloadManager downloadManager = new DefaultDownloadManager(storeManager, core.getTransferManager(), core.getLocationExpander(), new MockInstance<>(new MockContentAdvisor()));
    DirectContentAccess dca = new DefaultDirectContentAccess(downloadManager, Executors.newSingleThreadExecutor());
    ContentDigester contentDigester = new DefaultContentDigester(dca, new CacheHandle<String, TransferMetadata>("content-metadata", contentMetadata));
    final ContentManager contentManager = new DefaultContentManager(storeManager, downloadManager, mapper, new SpecialPathManagerImpl(), new MemoryNotFoundCache(), contentDigester, Collections.<ContentGenerator>emptySet());
    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);
    proxy = new HttpProxy(config, bootOpts, new ProxyAcceptHandler(config, storeManager, contentController, auth, core.getCache(), scriptEngine));
    proxy.start();
}
Also used : DefaultContentManager(org.commonjava.indy.core.content.DefaultContentManager) DownloadManager(org.commonjava.indy.content.DownloadManager) DefaultDownloadManager(org.commonjava.indy.core.content.DefaultDownloadManager) 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) TransferMetadata(org.commonjava.maven.galley.io.checksum.TransferMetadata) MemoryStoreDataManager(org.commonjava.indy.mem.data.MemoryStoreDataManager) KeycloakProxyAuthenticator(org.commonjava.indy.httprox.keycloak.KeycloakProxyAuthenticator) DefaultDownloadManager(org.commonjava.indy.core.content.DefaultDownloadManager) 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) MemoryNotFoundCache(org.commonjava.maven.galley.nfc.MemoryNotFoundCache) GStringTemplateEngine(groovy.text.GStringTemplateEngine) MemoryPasswordManager(org.commonjava.maven.galley.auth.MemoryPasswordManager) BootOptions(org.commonjava.indy.boot.BootOptions) MimeTyper(org.commonjava.indy.util.MimeTyper) ScriptEngine(org.commonjava.indy.subsys.template.ScriptEngine) HttpClientTransport(org.commonjava.maven.galley.transport.htcli.HttpClientTransport) DataFileManager(org.commonjava.indy.subsys.datafile.DataFileManager) TemplatingEngine(org.commonjava.indy.subsys.template.TemplatingEngine) MockContentAdvisor(org.commonjava.indy.test.fixture.core.MockContentAdvisor) TransportManager(org.commonjava.maven.galley.spi.transport.TransportManager) 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 3 with DownloadManager

use of org.commonjava.indy.content.DownloadManager in project indy by Commonjava.

the class KojiMavenMetadataProviderTest method initKojiClient.

private void initKojiClient(String exchangeName, boolean verifyArtifacts) throws BindException, IOException, GalleyInitException, IndyDataException {
    StoreDataManager storeDataManager = new MemoryStoreDataManager(true);
    if (verifyArtifacts) {
        RemoteRepository verifyRepo = new RemoteRepository(MAVEN_PKG_KEY, VERIFY_REPO, server.formatUrl(VERIFY_BASEPATH));
        storeDataManager.storeArtifactStore(verifyRepo, new ChangeSummary(ChangeSummary.SYSTEM_USER, "Adding verification repo"), false, true, new EventMetadata());
        kojiConfig.setArtifactAuthorityStore(new StoreKey(MAVEN_PKG_KEY, remote, VERIFY_REPO).toString());
    }
    String resourceBase = "koji-metadata/" + exchangeName;
    configureKojiServer(server, KOJI_BASEPATH, counter, resourceBase, verifyArtifacts, VERIFY_BASEPATH);
    kojiClient = new KojiClient(kojiConfig, new MemoryPasswordManager(), Executors.newCachedThreadPool());
    GalleyCore galley = new GalleyCoreBuilder(new FileCacheProviderFactory(temp.newFolder("cache"))).withEnabledTransports(new HttpClientTransport(new HttpImpl(new org.commonjava.maven.galley.auth.MemoryPasswordManager()), new IndyObjectMapper(true), new GlobalHttpConfiguration())).build();
    DownloadManager downloadManager = new DefaultDownloadManager(storeDataManager, galley.getTransferManager(), new IndyLocationExpander(storeDataManager));
    DirectContentAccess directContentAccess = new DefaultDirectContentAccess(downloadManager, Executors.newCachedThreadPool());
    DirectContentAccess dca = new DefaultDirectContentAccess(downloadManager, Executors.newSingleThreadExecutor());
    ContentDigester contentDigester = new DefaultContentDigester(dca, new CacheHandle<String, TransferMetadata>("content-metadata", contentMetadata));
    KojiBuildAuthority buildAuthority = new KojiBuildAuthority(kojiConfig, new StandardTypeMapper(), kojiClient, storeDataManager, contentDigester, directContentAccess);
    provider = new KojiMavenMetadataProvider(this.cache, kojiClient, buildAuthority, kojiConfig);
}
Also used : GalleyCoreBuilder(org.commonjava.maven.galley.GalleyCoreBuilder) RemoteRepository(org.commonjava.indy.model.core.RemoteRepository) DownloadManager(org.commonjava.indy.content.DownloadManager) DefaultDownloadManager(org.commonjava.indy.core.content.DefaultDownloadManager) HttpImpl(org.commonjava.maven.galley.transport.htcli.HttpImpl) EventMetadata(org.commonjava.maven.galley.event.EventMetadata) DirectContentAccess(org.commonjava.indy.content.DirectContentAccess) DefaultDirectContentAccess(org.commonjava.indy.core.content.DefaultDirectContentAccess) IndyObjectMapper(org.commonjava.indy.model.core.io.IndyObjectMapper) TransferMetadata(org.commonjava.maven.galley.io.checksum.TransferMetadata) MemoryStoreDataManager(org.commonjava.indy.mem.data.MemoryStoreDataManager) IndyLocationExpander(org.commonjava.indy.content.IndyLocationExpander) MemoryStoreDataManager(org.commonjava.indy.mem.data.MemoryStoreDataManager) StoreDataManager(org.commonjava.indy.data.StoreDataManager) DefaultDownloadManager(org.commonjava.indy.core.content.DefaultDownloadManager) StandardTypeMapper(org.commonjava.maven.galley.maven.internal.type.StandardTypeMapper) ContentDigester(org.commonjava.indy.content.ContentDigester) DefaultContentDigester(org.commonjava.indy.core.content.DefaultContentDigester) GalleyCore(org.commonjava.maven.galley.GalleyCore) DefaultContentDigester(org.commonjava.indy.core.content.DefaultContentDigester) FileCacheProviderFactory(org.commonjava.maven.galley.cache.FileCacheProviderFactory) MemoryPasswordManager(org.commonjava.util.jhttpc.auth.MemoryPasswordManager) StoreKey(org.commonjava.indy.model.core.StoreKey) HttpClientTransport(org.commonjava.maven.galley.transport.htcli.HttpClientTransport) GlobalHttpConfiguration(org.commonjava.maven.galley.transport.htcli.conf.GlobalHttpConfiguration) ChangeSummary(org.commonjava.indy.audit.ChangeSummary) KojiClient(com.redhat.red.build.koji.KojiClient) DefaultDirectContentAccess(org.commonjava.indy.core.content.DefaultDirectContentAccess)

Example 4 with DownloadManager

use of org.commonjava.indy.content.DownloadManager in project indy by Commonjava.

the class ContentControllerTest method setup.

@Before
public void setup() throws Exception {
    contentMetadata.clear();
    fixture.initMissingComponents();
    final StoreDataManager storeManager = new MemoryStoreDataManager(true);
    final DownloadManager fileManager = new DefaultDownloadManager(storeManager, fixture.getTransferManager(), fixture.getLocationExpander());
    final DirectContentAccess dca = new DefaultDirectContentAccess(fileManager, Executors.newSingleThreadExecutor());
    final ContentManager contentManager = new DefaultContentManager(storeManager, fileManager, new IndyObjectMapper(true), new SpecialPathManagerImpl(), new MemoryNotFoundCache(), new DefaultContentDigester(dca, new CacheHandle<String, TransferMetadata>("content-metadata", contentMetadata)), Collections.<ContentGenerator>emptySet());
    final TemplatingEngine templates = new TemplatingEngine(new GStringTemplateEngine(), new DataFileManager(fixture.getTemp().newFolder("indy-home"), new DataFileEventManager()));
    content = new ContentController(storeManager, contentManager, templates, new IndyObjectMapper(true), new MimeTyper());
}
Also used : DefaultContentDigester(org.commonjava.indy.core.content.DefaultContentDigester) DataFileEventManager(org.commonjava.indy.subsys.datafile.change.DataFileEventManager) DefaultContentManager(org.commonjava.indy.core.content.DefaultContentManager) ContentManager(org.commonjava.indy.content.ContentManager) MemoryNotFoundCache(org.commonjava.maven.galley.nfc.MemoryNotFoundCache) GStringTemplateEngine(groovy.text.GStringTemplateEngine) DefaultContentManager(org.commonjava.indy.core.content.DefaultContentManager) DownloadManager(org.commonjava.indy.content.DownloadManager) DefaultDownloadManager(org.commonjava.indy.core.content.DefaultDownloadManager) MimeTyper(org.commonjava.indy.util.MimeTyper) SpecialPathManagerImpl(org.commonjava.maven.galley.io.SpecialPathManagerImpl) DefaultDirectContentAccess(org.commonjava.indy.core.content.DefaultDirectContentAccess) DirectContentAccess(org.commonjava.indy.content.DirectContentAccess) IndyObjectMapper(org.commonjava.indy.model.core.io.IndyObjectMapper) MemoryStoreDataManager(org.commonjava.indy.mem.data.MemoryStoreDataManager) CacheHandle(org.commonjava.indy.subsys.infinispan.CacheHandle) TemplatingEngine(org.commonjava.indy.subsys.template.TemplatingEngine) DataFileManager(org.commonjava.indy.subsys.datafile.DataFileManager) MemoryStoreDataManager(org.commonjava.indy.mem.data.MemoryStoreDataManager) StoreDataManager(org.commonjava.indy.data.StoreDataManager) DefaultDownloadManager(org.commonjava.indy.core.content.DefaultDownloadManager) DefaultDirectContentAccess(org.commonjava.indy.core.content.DefaultDirectContentAccess) Before(org.junit.Before)

Aggregations

DownloadManager (org.commonjava.indy.content.DownloadManager)4 DefaultDirectContentAccess (org.commonjava.indy.core.content.DefaultDirectContentAccess)4 DefaultDownloadManager (org.commonjava.indy.core.content.DefaultDownloadManager)4 MemoryStoreDataManager (org.commonjava.indy.mem.data.MemoryStoreDataManager)4 DirectContentAccess (org.commonjava.indy.content.DirectContentAccess)3 DefaultContentDigester (org.commonjava.indy.core.content.DefaultContentDigester)3 IndyObjectMapper (org.commonjava.indy.model.core.io.IndyObjectMapper)3 MemoryNotFoundCache (org.commonjava.maven.galley.nfc.MemoryNotFoundCache)3 Before (org.junit.Before)3 GStringTemplateEngine (groovy.text.GStringTemplateEngine)2 ContentDigester (org.commonjava.indy.content.ContentDigester)2 ContentManager (org.commonjava.indy.content.ContentManager)2 IndyLocationExpander (org.commonjava.indy.content.IndyLocationExpander)2 DefaultContentManager (org.commonjava.indy.core.content.DefaultContentManager)2 StoreDataManager (org.commonjava.indy.data.StoreDataManager)2 DataFileManager (org.commonjava.indy.subsys.datafile.DataFileManager)2 DataFileEventManager (org.commonjava.indy.subsys.datafile.change.DataFileEventManager)2 TemplatingEngine (org.commonjava.indy.subsys.template.TemplatingEngine)2 MimeTyper (org.commonjava.indy.util.MimeTyper)2 SpecialPathManagerImpl (org.commonjava.maven.galley.io.SpecialPathManagerImpl)2