Search in sources :

Example 1 with HttpProvider

use of com.yahoo.vespa.model.container.search.searchchain.HttpProvider 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 HttpProvider

use of com.yahoo.vespa.model.container.search.searchchain.HttpProvider in project vespa by vespa-engine.

the class DomProviderBuilder method buildHttpProvider.

private Provider buildHttpProvider(ChainSpecification specWithoutInnerSearchers, ProviderReader providerReader, FederationOptions federationOptions) {
    ensureEmpty(specWithoutInnerSearchers.componentId, providerReader.clusterName);
    Provider httpProvider = buildEmptyHttpProvider(specWithoutInnerSearchers, providerReader, federationOptions);
    httpProvider.addInnerComponent(new HttpProviderSearcher(new ChainedComponentModel(HttpProviderSpec.toBundleInstantiationSpecification(HttpProviderSpec.Type.valueOf(providerReader.type)), Dependencies.emptyDependencies())));
    return httpProvider;
}
Also used : ChainedComponentModel(com.yahoo.component.chain.model.ChainedComponentModel) HttpProviderSearcher(com.yahoo.vespa.model.container.search.searchchain.HttpProviderSearcher) LocalProvider(com.yahoo.vespa.model.container.search.searchchain.LocalProvider) HttpProvider(com.yahoo.vespa.model.container.search.searchchain.HttpProvider) Provider(com.yahoo.vespa.model.container.search.searchchain.Provider)

Example 3 with HttpProvider

use of com.yahoo.vespa.model.container.search.searchchain.HttpProvider 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 HttpProvider

use of com.yahoo.vespa.model.container.search.searchchain.HttpProvider 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)

Aggregations

HttpProvider (com.yahoo.vespa.model.container.search.searchchain.HttpProvider)4 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)3 ProviderConfig (com.yahoo.search.federation.ProviderConfig)3 ComponentsBuilder (com.yahoo.vespa.model.builder.xml.dom.chains.ComponentsBuilder)3 Test (org.junit.Test)3 HttpProviderSearcher (com.yahoo.vespa.model.container.search.searchchain.HttpProviderSearcher)2 ChainedComponentModel (com.yahoo.component.chain.model.ChainedComponentModel)1 ChainedComponent (com.yahoo.vespa.model.container.component.chain.ChainedComponent)1 LocalProvider (com.yahoo.vespa.model.container.search.searchchain.LocalProvider)1 Provider (com.yahoo.vespa.model.container.search.searchchain.Provider)1