Search in sources :

Example 1 with MemoryPasswordManager

use of org.commonjava.util.jhttpc.auth.MemoryPasswordManager in project indy by Commonjava.

the class AbstractKojiIT method setupKojiBase.

@Before
public void setupKojiBase() {
    System.out.println("\n\n #### SETUP: " + name.getMethodName() + " #### \n\n");
    passwordManager = new MemoryPasswordManager();
    factory = new HttpFactory(passwordManager);
    System.out.println("\n\n #### START: " + name.getMethodName() + " #### \n\n");
    String buildDir = System.getProperty("project.build.directory", "target");
    downloadDir = Paths.get(buildDir, "downloads", name.getMethodName()).toFile();
    downloadDir.mkdirs();
}
Also used : HttpFactory(org.commonjava.util.jhttpc.HttpFactory) MemoryPasswordManager(org.commonjava.util.jhttpc.auth.MemoryPasswordManager) Before(org.junit.Before)

Example 2 with MemoryPasswordManager

use of org.commonjava.util.jhttpc.auth.MemoryPasswordManager in project indy by Commonjava.

the class DownloadDiagBundleTest method createIndyClient.

protected Indy createIndyClient() throws IndyClientException {
    SiteConfig config = new SiteConfigBuilder("indy", fixture.getUrl()).withRequestTimeoutSeconds(120).build();
    Collection<IndyClientModule> modules = getAdditionalClientModules();
    return new Indy(config, new MemoryPasswordManager(), new IndyObjectMapper(getAdditionalMapperModules()), modules.toArray(new IndyClientModule[modules.size()]));
}
Also used : IndyObjectMapper(org.commonjava.indy.model.core.io.IndyObjectMapper) SiteConfigBuilder(org.commonjava.util.jhttpc.model.SiteConfigBuilder) Indy(org.commonjava.indy.client.core.Indy) SiteConfig(org.commonjava.util.jhttpc.model.SiteConfig) MemoryPasswordManager(org.commonjava.util.jhttpc.auth.MemoryPasswordManager) IndyClientModule(org.commonjava.indy.client.core.IndyClientModule)

Example 3 with MemoryPasswordManager

use of org.commonjava.util.jhttpc.auth.MemoryPasswordManager in project indy by Commonjava.

the class AbstractIndyFunctionalTest method createIndyClient.

protected Indy createIndyClient() throws IndyClientException {
    SiteConfig config = new SiteConfigBuilder("indy", fixture.getUrl()).withRequestTimeoutSeconds(60).build();
    Collection<IndyClientModule> modules = getAdditionalClientModules();
    return new Indy(config, new MemoryPasswordManager(), new IndyObjectMapper(getAdditionalMapperModules()), modules.toArray(new IndyClientModule[modules.size()]));
}
Also used : IndyObjectMapper(org.commonjava.indy.model.core.io.IndyObjectMapper) SiteConfigBuilder(org.commonjava.util.jhttpc.model.SiteConfigBuilder) Indy(org.commonjava.indy.client.core.Indy) SiteConfig(org.commonjava.util.jhttpc.model.SiteConfig) MemoryPasswordManager(org.commonjava.util.jhttpc.auth.MemoryPasswordManager) IndyClientModule(org.commonjava.indy.client.core.IndyClientModule)

Example 4 with MemoryPasswordManager

use of org.commonjava.util.jhttpc.auth.MemoryPasswordManager in project indy by Commonjava.

the class KojiMavenMetadataProviderTest method initKojiClient.

private void initKojiClient(String exchangeName, boolean verifyArtifacts) throws IOException, GalleyInitException, IndyDataException, KojiClientException {
    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(), null, null)).build();
    WeftExecutorService rescanService = new PoolWeftExecutorService("test-rescan-executor", (ThreadPoolExecutor) Executors.newCachedThreadPool(), 2, 10f, false, null, null);
    DownloadManager downloadManager = new DefaultDownloadManager(storeDataManager, galley.getTransferManager(), new IndyLocationExpander(storeDataManager), rescanService);
    WeftExecutorService contentAccessService = new PoolWeftExecutorService("test-content-access-executor", (ThreadPoolExecutor) Executors.newCachedThreadPool(), 2, 10f, false, null, null);
    DirectContentAccess directContentAccess = new DefaultDirectContentAccess(downloadManager, contentAccessService);
    DirectContentAccess dca = new DefaultDirectContentAccess(downloadManager, contentAccessService);
    ContentDigester contentDigester = new DefaultContentDigester(dca, new CacheHandle<String, TransferMetadata>("content-metadata", contentMetadata));
    KojiBuildAuthority buildAuthority = new KojiBuildAuthority(kojiConfig, new StandardTypeMapper(), kojiClient, storeDataManager, contentDigester, directContentAccess, cacheManager);
    WeftExecutorService kojiMDService = new PoolWeftExecutorService("test-koji-metadata-executor", (ThreadPoolExecutor) Executors.newCachedThreadPool(), 2, 10f, false, null, null);
    provider = new KojiMavenMetadataProvider(this.cache, kojiClient, buildAuthority, kojiConfig, kojiMDService, cacheManager);
}
Also used : PoolWeftExecutorService(org.commonjava.cdi.util.weft.PoolWeftExecutorService) 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) WeftExecutorService(org.commonjava.cdi.util.weft.WeftExecutorService) PoolWeftExecutorService(org.commonjava.cdi.util.weft.PoolWeftExecutorService) 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 5 with MemoryPasswordManager

use of org.commonjava.util.jhttpc.auth.MemoryPasswordManager in project indy by Commonjava.

the class KojijiProvider method start.

@Override
public void start() throws IndyLifecycleException {
    if (!config.isEnabled()) {
        return;
    }
    kojiPasswordManager = new MemoryPasswordManager();
    if (config.getProxyPassword() != null) {
        kojiPasswordManager.bind(config.getProxyPassword(), config.getKojiSiteId(), PasswordType.PROXY);
    }
    if (config.getKeyPassword() != null) {
        kojiPasswordManager.bind(config.getKeyPassword(), config.getKojiSiteId(), PasswordType.KEY);
    }
    try {
        if (indyMetricsConfig.isKojiMetricEnabled()) {
            kojiClient = new KojiClient(config, kojiPasswordManager, kojiExecutor, metricRegistry);
        } else {
            kojiClient = new KojiClient(config, kojiPasswordManager, kojiExecutor);
        }
    } catch (KojiClientException e) {
        throw new IndyLifecycleException("Failed to initialize Koji client.", e);
    }
    versionMetadataLocks = new Locker<>();
}
Also used : KojiClientException(com.redhat.red.build.koji.KojiClientException) MemoryPasswordManager(org.commonjava.util.jhttpc.auth.MemoryPasswordManager) IndyLifecycleException(org.commonjava.indy.action.IndyLifecycleException) KojiClient(com.redhat.red.build.koji.KojiClient)

Aggregations

MemoryPasswordManager (org.commonjava.util.jhttpc.auth.MemoryPasswordManager)5 IndyObjectMapper (org.commonjava.indy.model.core.io.IndyObjectMapper)3 KojiClient (com.redhat.red.build.koji.KojiClient)2 Indy (org.commonjava.indy.client.core.Indy)2 IndyClientModule (org.commonjava.indy.client.core.IndyClientModule)2 SiteConfig (org.commonjava.util.jhttpc.model.SiteConfig)2 SiteConfigBuilder (org.commonjava.util.jhttpc.model.SiteConfigBuilder)2 KojiClientException (com.redhat.red.build.koji.KojiClientException)1 PoolWeftExecutorService (org.commonjava.cdi.util.weft.PoolWeftExecutorService)1 WeftExecutorService (org.commonjava.cdi.util.weft.WeftExecutorService)1 IndyLifecycleException (org.commonjava.indy.action.IndyLifecycleException)1 ChangeSummary (org.commonjava.indy.audit.ChangeSummary)1 ContentDigester (org.commonjava.indy.content.ContentDigester)1 DirectContentAccess (org.commonjava.indy.content.DirectContentAccess)1 DownloadManager (org.commonjava.indy.content.DownloadManager)1 IndyLocationExpander (org.commonjava.indy.content.IndyLocationExpander)1 DefaultContentDigester (org.commonjava.indy.core.content.DefaultContentDigester)1 DefaultDirectContentAccess (org.commonjava.indy.core.content.DefaultDirectContentAccess)1 DefaultDownloadManager (org.commonjava.indy.core.content.DefaultDownloadManager)1 StoreDataManager (org.commonjava.indy.data.StoreDataManager)1