Search in sources :

Example 1 with HttpInputSourceConfig

use of org.apache.druid.data.input.impl.HttpInputSourceConfig in project druid by druid-io.

the class HttpFirehoseFactoryTest method testConstructorAllowsOnlyDefaultProtocols.

@Test
public void testConstructorAllowsOnlyDefaultProtocols() {
    new HttpFirehoseFactory(ImmutableList.of(URI.create("http:///")), null, null, null, null, null, null, null, new HttpInputSourceConfig(null));
    new HttpFirehoseFactory(ImmutableList.of(URI.create("https:///")), null, null, null, null, null, null, null, new HttpInputSourceConfig(null));
    expectedException.expect(IllegalArgumentException.class);
    expectedException.expectMessage("Only [http, https] protocols are allowed");
    new HttpFirehoseFactory(ImmutableList.of(URI.create("my-protocol:///")), null, null, null, null, null, null, null, new HttpInputSourceConfig(null));
}
Also used : HttpInputSourceConfig(org.apache.druid.data.input.impl.HttpInputSourceConfig) Test(org.junit.Test)

Example 2 with HttpInputSourceConfig

use of org.apache.druid.data.input.impl.HttpInputSourceConfig in project druid by druid-io.

the class InputSourceModuleTest method testHttpInputSourceDefaultConfig.

@Test
public void testHttpInputSourceDefaultConfig() {
    Properties props = new Properties();
    Injector injector = makeInjectorWithProperties(props);
    HttpInputSourceConfig instance = injector.getInstance(HttpInputSourceConfig.class);
    Assert.assertEquals(new HttpInputSourceConfig(null), instance);
    Assert.assertEquals(HttpInputSourceConfig.DEFAULT_ALLOWED_PROTOCOLS, instance.getAllowedProtocols());
}
Also used : Injector(com.google.inject.Injector) HttpInputSourceConfig(org.apache.druid.data.input.impl.HttpInputSourceConfig) Properties(java.util.Properties) Test(org.junit.Test)

Example 3 with HttpInputSourceConfig

use of org.apache.druid.data.input.impl.HttpInputSourceConfig in project druid by druid-io.

the class HttpFirehoseFactoryTest method testConstructorAllowsOnlyCustomProtocols.

@Test
public void testConstructorAllowsOnlyCustomProtocols() {
    final HttpInputSourceConfig customConfig = new HttpInputSourceConfig(ImmutableSet.of("druid"));
    new HttpFirehoseFactory(ImmutableList.of(URI.create("druid:///")), null, null, null, null, null, null, null, customConfig);
    expectedException.expect(IllegalArgumentException.class);
    expectedException.expectMessage("Only [druid] protocols are allowed");
    new HttpFirehoseFactory(ImmutableList.of(URI.create("https:///")), null, null, null, null, null, null, null, customConfig);
}
Also used : HttpInputSourceConfig(org.apache.druid.data.input.impl.HttpInputSourceConfig) Test(org.junit.Test)

Example 4 with HttpInputSourceConfig

use of org.apache.druid.data.input.impl.HttpInputSourceConfig in project druid by druid-io.

the class HttpFirehoseFactoryTest method testSerde.

@Test
public void testSerde() throws IOException {
    final HttpInputSourceConfig inputSourceConfig = new HttpInputSourceConfig(null);
    final ObjectMapper mapper = new DefaultObjectMapper();
    mapper.setInjectableValues(new Std().addValue(HttpInputSourceConfig.class, inputSourceConfig));
    final DefaultPasswordProvider pwProvider = new DefaultPasswordProvider("testPassword");
    final HttpFirehoseFactory factory = new HttpFirehoseFactory(ImmutableList.of(URI.create("http://foo/bar"), URI.create("http://foo/bar2")), 2048L, 1024L, 512L, 100L, 5, "testUser", pwProvider, inputSourceConfig);
    final HttpFirehoseFactory outputFact = mapper.readValue(mapper.writeValueAsString(factory), HttpFirehoseFactory.class);
    Assert.assertEquals(factory, outputFact);
}
Also used : Std(com.fasterxml.jackson.databind.InjectableValues.Std) DefaultPasswordProvider(org.apache.druid.metadata.DefaultPasswordProvider) HttpInputSourceConfig(org.apache.druid.data.input.impl.HttpInputSourceConfig) DefaultObjectMapper(org.apache.druid.jackson.DefaultObjectMapper) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) DefaultObjectMapper(org.apache.druid.jackson.DefaultObjectMapper) Test(org.junit.Test)

Aggregations

HttpInputSourceConfig (org.apache.druid.data.input.impl.HttpInputSourceConfig)4 Test (org.junit.Test)4 Std (com.fasterxml.jackson.databind.InjectableValues.Std)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Injector (com.google.inject.Injector)1 Properties (java.util.Properties)1 DefaultObjectMapper (org.apache.druid.jackson.DefaultObjectMapper)1 DefaultPasswordProvider (org.apache.druid.metadata.DefaultPasswordProvider)1