Search in sources :

Example 1 with ProviderConfig

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));
}
Also used : HttpProvider(com.yahoo.vespa.model.container.search.searchchain.HttpProvider) ChainedComponent(com.yahoo.vespa.model.container.component.chain.ChainedComponent) ProviderConfig(com.yahoo.search.federation.ProviderConfig) ComponentsBuilder(com.yahoo.vespa.model.builder.xml.dom.chains.ComponentsBuilder) HttpProviderSearcher(com.yahoo.vespa.model.container.search.searchchain.HttpProviderSearcher) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Example 2 with ProviderConfig

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);
}
Also used : ProviderConfig(com.yahoo.search.federation.ProviderConfig) ChainsConfig(com.yahoo.container.core.ChainsConfig) ClusterConfig(com.yahoo.search.config.ClusterConfig) Before(org.junit.Before)

Example 3 with ProviderConfig

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));
}
Also used : HttpProvider(com.yahoo.vespa.model.container.search.searchchain.HttpProvider) ProviderConfig(com.yahoo.search.federation.ProviderConfig) ComponentsBuilder(com.yahoo.vespa.model.builder.xml.dom.chains.ComponentsBuilder) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Example 4 with ProviderConfig

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));
}
Also used : HttpProvider(com.yahoo.vespa.model.container.search.searchchain.HttpProvider) ProviderConfig(com.yahoo.search.federation.ProviderConfig) ComponentsBuilder(com.yahoo.vespa.model.builder.xml.dom.chains.ComponentsBuilder) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Example 5 with ProviderConfig

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));
}
Also used : ProviderConfig(com.yahoo.search.federation.ProviderConfig) Test(org.junit.Test)

Aggregations

ProviderConfig (com.yahoo.search.federation.ProviderConfig)5 Test (org.junit.Test)4 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)3 ComponentsBuilder (com.yahoo.vespa.model.builder.xml.dom.chains.ComponentsBuilder)3 HttpProvider (com.yahoo.vespa.model.container.search.searchchain.HttpProvider)3 ChainsConfig (com.yahoo.container.core.ChainsConfig)1 ClusterConfig (com.yahoo.search.config.ClusterConfig)1 ChainedComponent (com.yahoo.vespa.model.container.component.chain.ChainedComponent)1 HttpProviderSearcher (com.yahoo.vespa.model.container.search.searchchain.HttpProviderSearcher)1 Before (org.junit.Before)1