use of com.yahoo.search.federation.ProviderConfig in project vespa by vespa-engine.
the class DomProviderBuilderTest method testCertificateConfig_noProxy.
@Test
public void testCertificateConfig_noProxy() {
provider = new DomProviderBuilder(new HashMap<String, ComponentsBuilder.ComponentType>()).doBuild(root, noProxy);
ChainedComponent providerSearcher = provider.getInnerComponents().iterator().next();
assertThat(providerSearcher, instanceOf(HttpProviderSearcher.class));
ProviderConfig.Builder providerBuilder = new ProviderConfig.Builder();
((HttpProvider) provider).getConfig(providerBuilder);
ProviderConfig providerConfig = new ProviderConfig(providerBuilder);
assertThat(providerConfig.yca().applicationId(), is("my-app"));
assertThat(providerConfig.yca().useProxy(), is(false));
}
use of com.yahoo.search.federation.ProviderConfig in project vespa by vespa-engine.
the class SearchChainsTest method subscribe.
@Before
public void subscribe() {
ChainsConfig.Builder chainsBuilder = new ChainsConfig.Builder();
chainsBuilder = (ChainsConfig.Builder) root.getConfig(chainsBuilder, "searchchains");
chainsConfig = new ChainsConfig(chainsBuilder);
ProviderConfig.Builder providerBuilder = new ProviderConfig.Builder();
providerBuilder = (ProviderConfig.Builder) root.getConfig(providerBuilder, "searchchains/chain/provider:1/component/com.yahoo.search.federation.vespa.VespaSearcher");
providerConfig = new ProviderConfig(providerBuilder);
ClusterConfig.Builder clusterBuilder = new ClusterConfig.Builder();
clusterBuilder = (ClusterConfig.Builder) root.getConfig(clusterBuilder, "searchchains/chain/cluster2/component/" + ClusterSearcher.class.getName());
clusterConfig = new ClusterConfig(clusterBuilder);
}
use of com.yahoo.search.federation.ProviderConfig in project vespa by vespa-engine.
the class DomProviderBuilderTest method testCertificateConfig_proprietaryProxy.
@Test
public void testCertificateConfig_proprietaryProxy() {
provider = new DomProviderBuilder(new HashMap<String, ComponentsBuilder.ComponentType>()).doBuild(root, proprietaryProxy);
ProviderConfig.Builder providerBuilder = new ProviderConfig.Builder();
((HttpProvider) provider).getConfig(providerBuilder);
ProviderConfig providerConfig = new ProviderConfig(providerBuilder);
assertThat(providerConfig.yca().applicationId(), is("my-app"));
assertThat(providerConfig.yca().useProxy(), is(true));
assertThat(providerConfig.yca().host(), is("my-host"));
assertThat(providerConfig.yca().port(), is(80));
}
use of com.yahoo.search.federation.ProviderConfig in project vespa by vespa-engine.
the class DomProviderBuilderTest method testCertificatewConfig_defaultProxy.
@Test
public void testCertificatewConfig_defaultProxy() {
provider = new DomProviderBuilder(new HashMap<String, ComponentsBuilder.ComponentType>()).doBuild(root, defaultProxy);
ProviderConfig.Builder providerBuilder = new ProviderConfig.Builder();
((HttpProvider) provider).getConfig(providerBuilder);
ProviderConfig providerConfig = new ProviderConfig(providerBuilder);
assertThat(providerConfig.yca().applicationId(), is("my-app"));
assertThat(providerConfig.yca().useProxy(), is(true));
// default from def-file
assertThat(providerConfig.yca().host(), is("yca.host must be set explicitly"));
// default from def-file
assertThat(providerConfig.yca().port(), is(3128));
}
use of com.yahoo.search.federation.ProviderConfig in project vespa by vespa-engine.
the class HttpParametersTest method create_from_config.
@Test
public void create_from_config() throws Exception {
ProviderConfig config = new ProviderConfig(new ProviderConfig.Builder().connectionTimeout(1.0).maxConnectionPerRoute(2).maxConnections(3).path("myPath").readTimeout(4).socketBufferBytes(5).yca(new Yca.Builder().applicationId("myId").host("myYcaHost").port(7).retry(8).ttl(9).useProxy(true)));
HTTPParameters httpParameters = new HTTPParameters(config);
// Written to configuredConnectionTimeout, but it is not accessible!?
// assertThat(httpParameters.getConnectionTimeout(), is(1000));
// This value is not set from config by the constructor!?
// assertThat(httpParameters.getMaxConnectionsPerRoute(), is(2));
// This value is not set from config by the constructor!?
// assertThat(httpParameters.getMaxTotalConnections(), is(3));
assertThat(httpParameters.getPath(), is("/myPath"));
// This value is not set from config by the constructor!?
// assertThat(httpParameters.getReadTimeout(), is(4));
// This value is not set from config by the constructor!?
// assertThat(httpParameters.getSocketBufferSizeBytes(), is(5));
assertThat(httpParameters.getYcaUseProxy(), is(true));
assertThat(httpParameters.getYcaApplicationId(), is("myId"));
assertThat(httpParameters.getYcaProxy(), is("myYcaHost"));
assertThat(httpParameters.getYcaPort(), is(7));
assertThat(httpParameters.getYcaRetry(), is(8000L));
assertThat(httpParameters.getYcaTtl(), is(9000L));
}
Aggregations