Search in sources :

Example 6 with StubUserManager

use of io.crate.user.StubUserManager in project crate by crate.

the class PostgresNettyPublishPortTest method testGeneralBindAndPublishAddressOverrideSetting.

@Test
public void testGeneralBindAndPublishAddressOverrideSetting() {
    // Check override for network.host
    Settings settingsWithCustomHost = Settings.builder().put("network.host", "cantbindtothis").build();
    NetworkService networkService = new NetworkService(Collections.emptyList());
    StubUserManager userManager = new StubUserManager();
    PostgresNetty psql = new PostgresNetty(settingsWithCustomHost, mock(SQLOperations.class), userManager, networkService, new AlwaysOKAuthentication(userManager), new NettyBootstrap(), mock(SslContextProvider.class));
    try {
        psql.doStart();
        fail("Should have failed due to custom hostname");
    } catch (BindPostgresException e) {
        // that's what we want
        assertThat(e.getCause(), instanceOf(UnknownHostException.class));
    } finally {
        psql.doStop();
        psql.close();
    }
}
Also used : AlwaysOKAuthentication(io.crate.auth.AlwaysOKAuthentication) NetworkService(org.elasticsearch.common.network.NetworkService) SslContextProvider(io.crate.protocols.ssl.SslContextProvider) SQLOperations(io.crate.action.sql.SQLOperations) Settings(org.elasticsearch.common.settings.Settings) StubUserManager(io.crate.user.StubUserManager) NettyBootstrap(io.crate.netty.NettyBootstrap) Test(org.junit.Test)

Aggregations

StubUserManager (io.crate.user.StubUserManager)6 Test (org.junit.Test)6 SQLOperations (io.crate.action.sql.SQLOperations)4 AlwaysOKAuthentication (io.crate.auth.AlwaysOKAuthentication)4 NettyBootstrap (io.crate.netty.NettyBootstrap)4 SslContextProvider (io.crate.protocols.ssl.SslContextProvider)4 NetworkService (org.elasticsearch.common.network.NetworkService)4 Settings (org.elasticsearch.common.settings.Settings)3 CrateDummyClusterServiceUnitTest (io.crate.test.integration.CrateDummyClusterServiceUnitTest)2 BaseResultReceiver (io.crate.action.sql.BaseResultReceiver)1 Session (io.crate.action.sql.Session)1 AnalyzedStatement (io.crate.analyze.AnalyzedStatement)1 Row (io.crate.data.Row)1 RowConsumer (io.crate.data.RowConsumer)1 JobsLogs (io.crate.execution.engine.collect.stats.JobsLogs)1 SessionSettingRegistry (io.crate.metadata.settings.session.SessionSettingRegistry)1 DependencyCarrier (io.crate.planner.DependencyCarrier)1 Plan (io.crate.planner.Plan)1 Planner (io.crate.planner.Planner)1 PlannerContext (io.crate.planner.PlannerContext)1