diff --git a/addons/koji/common/src/test/java/org/commonjava/indy/koji/content/KojiMavenMetadataProviderTest.java b/addons/koji/common/src/test/java/org/commonjava/indy/koji/content/KojiMavenMetadataProviderTest.java index 963d524cb5..b1d6f29051 100644 --- a/addons/koji/common/src/test/java/org/commonjava/indy/koji/content/KojiMavenMetadataProviderTest.java +++ b/addons/koji/common/src/test/java/org/commonjava/indy/koji/content/KojiMavenMetadataProviderTest.java @@ -333,7 +333,7 @@ private void initKojiClient( String exchangeName, boolean verifyArtifacts ) 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(); + new IndyObjectMapper( true ), new GlobalHttpConfiguration().getGlobalProxyConfig(), null, null ) ).build(); WeftExecutorService rescanService = new PoolWeftExecutorService( "test-rescan-executor", (ThreadPoolExecutor) Executors.newCachedThreadPool(), 2, 10f, false,null, null ); diff --git a/ftests/common/src/main/java/org/commonjava/indy/ftest/core/AbstractIndyFunctionalTest.java b/ftests/common/src/main/java/org/commonjava/indy/ftest/core/AbstractIndyFunctionalTest.java index 33844067b0..31f6aa56b9 100644 --- a/ftests/common/src/main/java/org/commonjava/indy/ftest/core/AbstractIndyFunctionalTest.java +++ b/ftests/common/src/main/java/org/commonjava/indy/ftest/core/AbstractIndyFunctionalTest.java @@ -315,6 +315,7 @@ protected void initBaseTestConfig( CoreServerFixture fixture ) writeConfigFile( "conf.d/folo.conf", "[folo]\nfolo.cassandra=true" + "\nfolo.cassandra.keyspace=folo" + "\ntrack.group.content=True" ); + writeConfigFile( "conf.d/http.conf", "[http]\nproxy.host=proxy.com" + "\nproxy.port=3128" ); if ( isSchedulerEnabled() ) { diff --git a/subsys/groovy/src/test/java/org/commonjava/indy/subsys/template/fixture/TestProvider.java b/subsys/groovy/src/test/java/org/commonjava/indy/subsys/template/fixture/TestProvider.java index c931eeb7ea..94f5b823d0 100644 --- a/subsys/groovy/src/test/java/org/commonjava/indy/subsys/template/fixture/TestProvider.java +++ b/subsys/groovy/src/test/java/org/commonjava/indy/subsys/template/fixture/TestProvider.java @@ -38,6 +38,7 @@ import org.commonjava.maven.galley.spi.event.FileEventManager; import org.commonjava.maven.galley.spi.nfc.NotFoundCache; import org.commonjava.maven.galley.transport.htcli.conf.GlobalHttpConfiguration; +import org.commonjava.maven.galley.transport.htcli.conf.GlobalProxyConfig; import org.junit.rules.TemporaryFolder; import javax.annotation.PostConstruct; @@ -48,6 +49,8 @@ import javax.enterprise.inject.Produces; import javax.inject.Inject; import java.io.IOException; +import java.util.ArrayList; +import java.util.List; import static org.junit.Assert.fail; @@ -187,7 +190,6 @@ public WeftConfig getWeftConfig() } @Produces - @Alternative public GlobalHttpConfiguration getGlobalHttpConfiguration() { return globalHttpConfiguration; diff --git a/subsys/http/src/main/conf/http.conf b/subsys/http/src/main/conf/http.conf index 2ae23ce0eb..34bfa9fe6b 100644 --- a/subsys/http/src/main/conf/http.conf +++ b/subsys/http/src/main/conf/http.conf @@ -1,4 +1,5 @@ [http] +enabled=true ## ## Below are for default site config ## @@ -10,8 +11,9 @@ #user= ## Proxy settings -#proxy.host=http://myproxy.com -#proxy.port=8001 +#proxy.host=myproxy.com +#proxy.port=3128 +#proxy.allow.http.job.types=download,existence,listing #proxy.user=proxy-user ## Trust type. Value could be either default or self-signed diff --git a/subsys/http/src/main/java/org/commonjava/indy/subsys/http/IndyGlobalHttpConfigurationProducer.java b/subsys/http/src/main/java/org/commonjava/indy/subsys/http/IndyGlobalProxyConfigProducer.java similarity index 71% rename from subsys/http/src/main/java/org/commonjava/indy/subsys/http/IndyGlobalHttpConfigurationProducer.java rename to subsys/http/src/main/java/org/commonjava/indy/subsys/http/IndyGlobalProxyConfigProducer.java index fea030654d..5ca775bd9c 100644 --- a/subsys/http/src/main/java/org/commonjava/indy/subsys/http/IndyGlobalHttpConfigurationProducer.java +++ b/subsys/http/src/main/java/org/commonjava/indy/subsys/http/IndyGlobalProxyConfigProducer.java @@ -1,15 +1,12 @@ package org.commonjava.indy.subsys.http; -import org.commonjava.indy.subsys.http.conf.IndyHttpConfig; import org.commonjava.indy.subsys.http.util.IndySiteConfigLookup; -import org.commonjava.maven.galley.transport.htcli.conf.GlobalHttpConfiguration; -import org.commonjava.maven.galley.transport.htcli.conf.ProxyConfig; +import org.commonjava.maven.galley.transport.htcli.conf.GlobalProxyConfig; import org.commonjava.util.jhttpc.model.SiteConfig; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.enterprise.context.ApplicationScoped; -import javax.enterprise.inject.Default; import javax.enterprise.inject.Produces; import javax.inject.Inject; import java.util.ArrayList; @@ -19,35 +16,31 @@ import static org.commonjava.indy.subsys.http.conf.IndyHttpConfig.DEFAULT_SITE; @ApplicationScoped -public class IndyGlobalHttpConfigurationProducer +public class IndyGlobalProxyConfigProducer { private final Logger logger = LoggerFactory.getLogger( getClass() ); - @Inject - private IndyHttpConfig config; - @Inject private IndySiteConfigLookup siteConfigLookup; - private GlobalHttpConfiguration globalHttpConfiguration; + private GlobalProxyConfig globalProxyConfig; private SiteConfig defaultSiteConfig; @Produces - @Default - public GlobalHttpConfiguration getGlobalHttpConfiguration() + public GlobalProxyConfig getGlobalProxyConfig() { defaultSiteConfig = siteConfigLookup.lookup( DEFAULT_SITE ); if ( defaultSiteConfig != null && defaultSiteConfig.getProxyHost() != null ) { - setUpGlobalHttpConfiguration(); + setupGlobalProxyConfig(); } - return globalHttpConfiguration; + return globalProxyConfig; } - private void setUpGlobalHttpConfiguration() + private void setupGlobalProxyConfig() { - logger.info( "Setup global http configuration" ); + logger.debug( "Setup global proxy config, host: {}", defaultSiteConfig.getProxyHost() ); final String allowTypes = defaultSiteConfig.getProxyAllowHttpJobTypes(); final List list = new ArrayList<>(); if ( isNotBlank( allowTypes ) ) @@ -62,7 +55,7 @@ private void setUpGlobalHttpConfiguration() } } } - ProxyConfig proxyConfig = new ProxyConfig() + globalProxyConfig = new GlobalProxyConfig() { @Override public String getHost() @@ -88,6 +81,5 @@ public List getAllowHttpJobTypes() return list; } }; - globalHttpConfiguration = new GlobalHttpConfiguration( proxyConfig ); } } diff --git a/subsys/http/src/main/resources/default-http.conf b/subsys/http/src/main/resources/default-http.conf index 4bb0981387..b0487dc486 100644 --- a/subsys/http/src/main/resources/default-http.conf +++ b/subsys/http/src/main/resources/default-http.conf @@ -10,7 +10,7 @@ #user= ## Proxy settings -#proxy.host=http://myproxy.com +#proxy.host=myproxy.com #proxy.port=3128 #proxy.allow.http.job.types=download,existence,listing #proxy.user=proxy-user