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));
}
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());
}
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);
}
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);
}
Aggregations